- Ja llig correctament el mapa en format text

This commit is contained in:
2023-10-18 17:25:24 +02:00
parent fdc604be3c
commit c6b994cc37
3 changed files with 20 additions and 7 deletions

View File

@@ -9,9 +9,20 @@ namespace textfile
int fsize = 0;
int p = 0;
const int toInt(std::string token)
{
int value = 0;
for (std::size_t i=0; i<token.length(); ++i)
{
if (token[i]<48 || token[i]>57) return 0;
value = (value*10) + (token[i]-48);
}
return value;
}
const bool open(std::string filename)
{
buffer = file::getFileBuffer(filename.c_str());
buffer = file::getFileBuffer(filename.c_str(), &fsize);
p = 0;
return true;
@@ -52,6 +63,6 @@ namespace textfile
const int getIntValue(std::string token)
{
return std::stoi(getStringValue(token));
return toInt(getStringValue(token));
}
}