mirror of
https://github.com/zoriya/Bomberman.git
synced 2026-06-01 17:55:48 +00:00
fixing splitStr and position parsing
This commit is contained in:
@@ -281,8 +281,12 @@ namespace BBM {
|
||||
std::string subStr;
|
||||
|
||||
try {
|
||||
auto start = line.find('[', 0) + 1;
|
||||
subStr = line.substr(start, line.find(']', 0) - 1 - start);
|
||||
auto start = line.find('[') + 1;
|
||||
auto end = line.find(']');
|
||||
if (start == std::string::npos || end == std::string::npos || line.back() != ']') {
|
||||
throw ParserError("Error parsing position.");
|
||||
}
|
||||
subStr = line.substr(start, end - start);
|
||||
auto pos = Utils::splitStr(subStr, ',');
|
||||
if (pos.size() != 3)
|
||||
throw (ParserError("Error parsing position."));
|
||||
|
||||
@@ -85,6 +85,9 @@ namespace BBM
|
||||
while (std::getline(f, buffer, delim)) {;
|
||||
strings.push_back(buffer);
|
||||
}
|
||||
if (str.back() == delim) {
|
||||
strings.emplace_back("");
|
||||
}
|
||||
return strings;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user