mirror of
https://github.com/zoriya/Bomberman.git
synced 2026-06-03 10:26:29 +00:00
modif load player to be less cancerous & for lobby loading we should use lobby functions
This commit is contained in:
@@ -161,19 +161,21 @@ namespace BBM {
|
||||
{"green", GREEN}
|
||||
};
|
||||
|
||||
playerName.push_back(node.getName());
|
||||
playerAssets.push_back(node.getProperty("texture_path"));
|
||||
playerBombCount.push_back(_parseMaxBomb(node.getProperty("max_bomb")));
|
||||
playerExplosionRange.push_back(_parseExplosionRadius(node.getProperty("explosion_radius")));
|
||||
playerSpeed.push_back(_parseSpeed(node.getProperty("speed")));
|
||||
playerPosition.push_back(_parsePosition(node.getProperty("position")));
|
||||
playersInfos.emplace_back(PlayerInfos{
|
||||
node.getName(),
|
||||
_parsePosition(node.getProperty("position")),
|
||||
_parseMaxBomb(node.getProperty("max_bomb")),
|
||||
_parseExplosionRadius(node.getProperty("explosion_radius")),
|
||||
_parseSpeed(node.getProperty("speed")),
|
||||
node.getProperty("texture_path")
|
||||
});
|
||||
|
||||
if ((tmpAssets.find("red.png") == std::string::npos && tmpAssets.find("blue.png") == std::string::npos &&
|
||||
tmpAssets.find("green.png") == std::string::npos && tmpAssets.find("yellow.png") == std::string::npos &&
|
||||
tmpAssets.find("ai.png") == std::string::npos) || !std::filesystem::exists(tmpAssets)) {
|
||||
throw (ParserError("Error with saved map: One asset is invalid.\n Loading default maps..."));
|
||||
}
|
||||
auto start = tmpAssets.find_last_of("/") + 1;
|
||||
auto start = tmpAssets.find_last_of('/') + 1;
|
||||
auto color = map.at(tmpAssets.substr(start, tmpAssets.length() - start - 4));
|
||||
auto resumeScene = Runner::gameState._loadedScenes[GameState::SceneID::ResumeLobbyScene];
|
||||
auto &playerTile = resumeScene->addEntity("player tile")
|
||||
@@ -396,11 +398,6 @@ namespace BBM {
|
||||
{
|
||||
std::string line;
|
||||
Node node(nodeName);
|
||||
#ifdef __linux__
|
||||
int endlNbChars = 1;
|
||||
#elif _WIN32
|
||||
int endlNbChars = 2;
|
||||
#endif
|
||||
|
||||
while(std::getline(file, line)) {
|
||||
if (line.empty())
|
||||
|
||||
@@ -14,6 +14,13 @@ namespace BBM {
|
||||
class ParserYAML {
|
||||
private:
|
||||
|
||||
//! @brief The number of chars for endl
|
||||
#ifdef __linux__
|
||||
static constexpr int endlNbChars = 1;
|
||||
#elif _WIN32
|
||||
static constexpr int endlNbChars = 2;
|
||||
#endif
|
||||
|
||||
//!@brief file block of the parser
|
||||
static std::stringstream _block;
|
||||
//!@brief file bonus of the parser
|
||||
@@ -99,18 +106,22 @@ namespace BBM {
|
||||
|
||||
static Node parseFile(const std::string &path);
|
||||
|
||||
//! @brief All name that was into the file
|
||||
static std::vector<std::string> playerName;
|
||||
//! @brief Player position
|
||||
static std::vector<Vector3f> playerPosition;
|
||||
//! @brief The amount of bomb a player had
|
||||
static std::vector<int> playerBombCount;
|
||||
//! @brief The explosion range of a player
|
||||
static std::vector<float> playerExplosionRange;
|
||||
//! @brief The speed of a player
|
||||
static std::vector<float> playerSpeed;
|
||||
//! @brief The assets of the player
|
||||
static std::vector<std::string> playerAssets;
|
||||
|
||||
struct PlayerInfos {
|
||||
std::string playerName;
|
||||
//! @brief Player position
|
||||
Vector3f playerPosition;
|
||||
//! @brief The amount of bomb a player had
|
||||
int playerBombCount;
|
||||
//! @brief The explosion range of a player
|
||||
int playerExplosionRange;
|
||||
//! @brief The speed of a player
|
||||
float playerSpeed;
|
||||
//! @brief The assets of the player
|
||||
std::string playerAssets;
|
||||
};
|
||||
|
||||
static std::vector<PlayerInfos> playersInfos;
|
||||
|
||||
//!@param scene Scene to update
|
||||
//!@brief save yaml
|
||||
@@ -121,6 +132,5 @@ namespace BBM {
|
||||
|
||||
//! @brief save file name
|
||||
static const std::string fileName;
|
||||
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user