LOWERCASE I AAHHHHHHH

master
sigonasr2 1 year ago
parent ee01343c4e
commit 5f66b590b2
  1. 185
      FiestaCraftingCalculator/FiestaCraftingCalculator.cpp
  2. 14962
      FiestaCraftingCalculator/assets/ItemInfo.txt
  3. 15162
      FiestaCraftingCalculator/assets/ItemViewInfo.csv
  4. 14962
      FiestaCraftingCalculator/assets/ItemViewInfo.txt
  5. 3
      FiestaCraftingCalculator/emscripten_build.ps1
  6. BIN
      FiestaCraftingCalculator/pge.data
  7. 2
      FiestaCraftingCalculator/pge.js
  8. BIN
      FiestaCraftingCalculator/pge.wasm

@ -304,8 +304,6 @@ public:
{
// Called once at the start, so create things here
std::ifstream file=std::ifstream("assets/Produce.txt");
std::string fileContents=slurp(file);
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::string column="";
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(int i=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;
for(int i=0;i<data.size();i++){
std::cout<<"Col "<<i+1<<":"<<data[i]<<std::endl;
}
return false;
while(file.good()){
std::string line;
std::getline(file,line);
for(int i=0;i<line.size();i++){
if(line[i]=='\t'){
data.push_back(column);
column="";
} else {
Recipe r(data);
switch(stoi(data[21])){
case 0:{
StoneProdRecipes.push_back(r);
StoneProdRecipeLink[stoi(data[0])]=&(*std::prev(StoneProdRecipes.end()));
}break;
case 1:{
PotionProdRecipes.push_back(r);
PotionProdRecipeLink[stoi(data[0])]=&(*std::prev(PotionProdRecipes.end()));
}break;
case 2:{
ScrollProdRecipes.push_back(r);
ScrollProdRecipeLink[stoi(data[0])]=&(*std::prev(ScrollProdRecipes.end()));
}break;
//For some reason 3 is skipped in the game's data.
case 4:{
CompRecipes.push_back(r);
CompRecipeLink[stoi(data[0])]=&(*std::prev(CompRecipes.end()));
}break;
case 5:{
DecompRecipes.push_back(r);
DecompRecipeLink[stoi(data[0])]=&(*std::prev(DecompRecipes.end()));
}break;
}
column+=line[i];
}
data.clear();
}
data.push_back(column);
column="";
if(data.size()!=25){
std::cout<<"Data size was "<<data.size()<<"! Expected 25 columns..."<<std::endl;
for(int i=0;i<data.size();i++){
std::cout<<"Col "<<i+1<<":"<<data[i]<<std::endl;
}
return false;
} else {
column+=fileContents[i];
Recipe r(data);
switch(stoi(data[21])){
case 0:{
StoneProdRecipes.push_back(r);
StoneProdRecipeLink[stoi(data[0])]=&(*std::prev(StoneProdRecipes.end()));
}break;
case 1:{
PotionProdRecipes.push_back(r);
PotionProdRecipeLink[stoi(data[0])]=&(*std::prev(PotionProdRecipes.end()));
}break;
case 2:{
ScrollProdRecipes.push_back(r);
ScrollProdRecipeLink[stoi(data[0])]=&(*std::prev(ScrollProdRecipes.end()));
}break;
//For some reason 3 is skipped in the game's data.
case 4:{
CompRecipes.push_back(r);
CompRecipeLink[stoi(data[0])]=&(*std::prev(CompRecipes.end()));
}break;
case 5:{
DecompRecipes.push_back(r);
DecompRecipeLink[stoi(data[0])]=&(*std::prev(DecompRecipes.end()));
}break;
}
}
data.clear();
}
file=std::ifstream("assets/ItemViewinfo.txt");
fileContents=slurp(file);
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(int i=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;
for(int i=0;i<data.size();i++){
std::cout<<"Col "<<i+1<<":"<<data[i]<<std::endl;
}
return false;
while(file.good()){
std::string line;
std::getline(file,line);
for(int i=0;i<line.size();i++){
if(line[i]=='\t'){
data.push_back(column);
column="";
} else {
//Recipe r(data);
std::string product=data[1];
if(IDToName.find(product)!=IDToName.end()){
IDToName[product]=ItemData{product,{uint8_t(stoi(data[8])),uint8_t(stoi(data[9])),uint8_t(stoi(data[10]))},{data[3],stoi(data[2])},{data[5],stoi(data[4])}};
goto quitLoop;
}
column+=line[i];
}
quitLoop:
data.clear();
}
data.push_back(column);
column="";
if(data.size()!=27){
std::cout<<"Data size was "<<data.size()<<"! Expected 27 columns..."<<std::endl;
for(int i=0;i<data.size();i++){
std::cout<<"Col "<<i+1<<":"<<data[i]<<std::endl;
}
return false;
} else {
column+=fileContents[i];
//Recipe r(data);
std::string product=data[1];
if(IDToName.find(product)!=IDToName.end()){
IDToName[product]=ItemData{product,{uint8_t(stoi(data[8])),uint8_t(stoi(data[9])),uint8_t(stoi(data[10]))},{data[3],stoi(data[2])},{data[5],stoi(data[4])}};
}
}
data.clear();
}
file.close();
file=std::ifstream("assets/ItemInfo.txt");
fileContents=slurp(file);
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(int i=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(int i=0;i<data.size();i++){
std::cout<<"Col "<<i+1<<":"<<data[i]<<std::endl;
}
return false;
while(file.good()){
std::string line;
std::getline(file,line);
for(int i=0;i<line.size();i++){
if(line[i]=='\t'){
data.push_back(column);
column="";
} else {
//Recipe r(data);
std::string product=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;
for(int i=0;i<data.size();i++){
std::cout<<"Col "<<i+1<<":"<<data[i]<<std::endl;
}
data.clear();
return false;
} else {
column+=fileContents[i];
//Recipe r(data);
std::string product=data[1];
if(IDToName.find(product)!=IDToName.end()){
IDToName[product].name=data[2];
}
}
data.clear();
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -1,2 +1,3 @@
~\Documents\emsdk\emsdk_env.ps1 activate latest
em++ -std=c++17 -O2 -s ALLOW_MEMORY_GROWTH=1 -s MAX_WEBGL_VERSION=2 -s MIN_WEBGL_VERSION=2 -s USE_LIBPNG=1 $(Get-ChildItem *.cpp) -o pge.html --preload-file assets
em++ -std=c++17 -O2 -s ALLOW_MEMORY_GROWTH=1 -s MAX_WEBGL_VERSION=2 -s MIN_WEBGL_VERSION=2 -s USE_LIBPNG=1 $(Get-ChildItem *.cpp) -o pge.html --preload-file assets
emrun pge.html

Binary file not shown.

Before

Width:  |  Height:  |  Size: 602 KiB

After

Width:  |  Height:  |  Size: 676 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.
Loading…
Cancel
Save