TESTTRAZE: added protocol support for 'owned' counter

master
Martin Gerhardy 2019-03-25 22:07:29 +01:00
parent e696ed7aae
commit bc3839b805
3 changed files with 3 additions and 1 deletions

View File

@ -264,7 +264,7 @@ void TestTraze::doRender() {
yOffset += _voxelFontRender.lineHeight(); yOffset += _voxelFontRender.lineHeight();
for (const traze::Player& p : _players) { for (const traze::Player& p : _players) {
_voxelFontRender.text(glm::ivec3(0, yOffset, 0), p.color, "* %s", p.name.c_str()); _voxelFontRender.text(glm::ivec3(0, yOffset, 0), p.color, "* %s", p.name.c_str());
_voxelFontRender.text(glm::ivec3(_maxLength, yOffset, 0), p.color, "%i", p.frags); _voxelFontRender.text(glm::ivec3(_maxLength, yOffset, 0), p.color, "%i/%i", p.frags, p.owned);
yOffset += _voxelFontRender.lineHeight(); yOffset += _voxelFontRender.lineHeight();
} }
} }

View File

@ -205,6 +205,7 @@ void Protocol::parsePlayers(const std::string& json) {
p.color = materialColors[index]; p.color = materialColors[index];
p.id = player["id"].get<int>(); p.id = player["id"].get<int>();
p.frags = player["frags"].get<int>(); p.frags = player["frags"].get<int>();
p.owned = player["owned"].get<int>();
players.push_back(p); players.push_back(p);
Log::debug("Player %s with id %i", p.name.c_str(), p.id); Log::debug("Player %s with id %i", p.name.c_str(), p.id);
} }

View File

@ -38,6 +38,7 @@ struct Player {
std::string name; std::string name;
PlayerId id = 0u; PlayerId id = 0u;
uint32_t frags = 0u; uint32_t frags = 0u;
uint32_t owned = 0u;
uint8_t colorIndex = 0u; uint8_t colorIndex = 0u;
glm::vec4 color {0.0f}; glm::vec4 color {0.0f};
}; };