fileContents+='\n';//HACK ALERT! Our parser does not deal with data until a '\n' character occurs. If the file has no \n on the last line, we won't process it. This hack fixes that.
std::stringcolumn="";
std::vector<std::string>data;
//HACK ALERT! If the number of recipes for any of these exceeds 300, a reallocation occurs and all pointers move...
@ -315,118 +313,119 @@ public:
ScrollProdRecipes.reserve(300);
CompRecipes.reserve(300);
DecompRecipes.reserve(300);
for(inti=0;i<fileContents.size();i++){
if(fileContents[i]=='\t'){
data.push_back(column);
column="";
}else
if(fileContents[i]=='\n'){
data.push_back(column);
column="";
if(data.size()!=25){
std::cout<<"Data size was "<<data.size()<<"! Expected 25 columns..."<<std::endl;
fileContents+='\n';//HACK ALERT! Our parser does not deal with data until a '\n' character occurs. If the file has no \n on the last line, we won't process it. This hack fixes that.
file.close();
file=std::ifstream("assets/ItemViewInfo.txt");
column="";
data.clear();
for(inti=0;i<fileContents.size();i++){
if(fileContents[i]=='\t'){
data.push_back(column);
column="";
}else
if(fileContents[i]=='\n'){
data.push_back(column);
column="";
if(data.size()!=27){
std::cout<<"Data size was "<<data.size()<<"! Expected 27 columns..."<<std::endl;
fileContents+='\n';//HACK ALERT! Our parser does not deal with data until a '\n' character occurs. If the file has no \n on the last line, we won't process it. This hack fixes that.
column="";
data.clear();
for(inti=0;i<fileContents.size();i++){
if(fileContents[i]=='\t'){
data.push_back(column);
column="";
}else
if(fileContents[i]=='\n'){
data.push_back(column);
column="";
if(data.size()!=57){
std::cout<<"Data size was "<<data.size()<<"! Expected 57 columns..."<<std::endl;
for(inti=0;i<data.size();i++){
std::cout<<"Col "<<i+1<<":"<<data[i]<<std::endl;
}
returnfalse;
while(file.good()){
std::stringline;
std::getline(file,line);
for(inti=0;i<line.size();i++){
if(line[i]=='\t'){
data.push_back(column);
column="";
}else{
//Recipe r(data);
std::stringproduct=data[1];
if(IDToName.find(product)!=IDToName.end()){
IDToName[product].name=data[2];
}
column+=line[i];
}
}
data.push_back(column);
column="";
if(data.size()!=57){
std::cout<<"Data size was "<<data.size()<<"! Expected 57 columns..."<<std::endl;