#include "aux_textfile.h" #include "jgame.h" #include namespace textfile { char *buffer = nullptr; int fsize = 0; int p = 0; const int toInt(std::string token) { int value = 0; for (std::size_t i=0; i57) return 0; value = (value*10) + (token[i]-48); } return value; } const bool open(std::string filename) { buffer = file_getfilebuffer(filename.c_str(), fsize); p = 0; return true; } void close() { free(buffer); } std::string getNextToken() { char token[255]; int tpos = 0; // Ignore whitespace while (p32 ) token[tpos++]=buffer[p++]; token[tpos]=0; return std::string(token); } const bool searchToken(std::string token) { while (p