mirror of
https://github.com/zoriya/Bomberman.git
synced 2026-05-30 01:05:24 +00:00
fixed one segf
This commit is contained in:
@@ -144,9 +144,9 @@ namespace BBM {
|
|||||||
blockFile << _block.str() << std::endl;
|
blockFile << _block.str() << std::endl;
|
||||||
playerFile << _player.str() << std::endl;
|
playerFile << _player.str() << std::endl;
|
||||||
bonusFile << _bonus.str() << std::endl;
|
bonusFile << _bonus.str() << std::endl;
|
||||||
_block.clear();
|
_block = std::stringstream();
|
||||||
_player.clear();
|
_player = std::stringstream();
|
||||||
_bonus.clear();
|
_bonus = std::stringstream();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ParserYAML::_loadPlayer(std::shared_ptr<WAL::Scene> scene, std::vector<std::string> lines, int &index)
|
void ParserYAML::_loadPlayer(std::shared_ptr<WAL::Scene> scene, std::vector<std::string> lines, int &index)
|
||||||
@@ -202,7 +202,7 @@ namespace BBM {
|
|||||||
if (!file.good())
|
if (!file.good())
|
||||||
throw (ParserError("File error"));
|
throw (ParserError("File error"));
|
||||||
while (std::getline(file, line)) {
|
while (std::getline(file, line)) {
|
||||||
if (line.empty() || !line.compare("players:"))
|
if (line.empty() || line.find("players:") != std::string::npos)
|
||||||
continue;
|
continue;
|
||||||
lines.push_back(line);
|
lines.push_back(line);
|
||||||
}
|
}
|
||||||
@@ -287,6 +287,10 @@ namespace BBM {
|
|||||||
_parseEntityName(lines[index], entity);
|
_parseEntityName(lines[index], entity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (bonusType == Bonus::NOTHING) {
|
||||||
|
entity.scheduleDeletion();
|
||||||
|
return;
|
||||||
|
}
|
||||||
MapGenerator::createBonus(entity, pos, bonusType);
|
MapGenerator::createBonus(entity, pos, bonusType);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -299,7 +303,7 @@ namespace BBM {
|
|||||||
if (!file.good())
|
if (!file.good())
|
||||||
throw (ParserError("File error"));
|
throw (ParserError("File error"));
|
||||||
while (std::getline(file, line)) {
|
while (std::getline(file, line)) {
|
||||||
if (line.empty() || !line.compare("bonuses:"))
|
if (line.empty() || line.find("bonuses:") != std::string::npos)
|
||||||
continue;
|
continue;
|
||||||
lines.push_back(line);
|
lines.push_back(line);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user