Skip to content
Snippets Groups Projects
Commit c10c0cc1 authored by Max Cherris's avatar Max Cherris
Browse files

Handle selecting city without showing "train"

parent 512e95d0
Branches
No related tags found
2 merge requests!34Building features,!29Merge main into box2d to implement physics
......@@ -109,4 +109,8 @@ std::vector<UnitId> Building::recruitableUnits()
return {};
}
BuildingId Building::getBuildingId() {
return this->m_id;
}
} // namespace advanced_wars
\ No newline at end of file
......@@ -56,6 +56,8 @@ class Building
*
*/
std::vector<UnitId> recruitableUnits();
BuildingId getBuildingId();
};
} // namespace advanced_wars
\ No newline at end of file
......@@ -600,8 +600,12 @@ void Level::handleSelectingEvents(Engine& engine, SDL_Event& event)
}
else
{
if(m_buildings.at(m_selectedBuilding).getBuildingId() == BuildingId::CITY) {
m_contextMenu.setOptions({"Info", "Wait"});
} else {
m_contextMenu.setOptions({"Train", "Info", "Wait"});
}
}
m_state = LevelState::MENUACTIVE_STATE;
}
}
......@@ -694,11 +698,7 @@ void Level::handleMenuActiveEvents(Engine& engine, SDL_Event& event)
m_recruitingMenu.update(
(tilePos.first * 16 + 15) * RENDERING_SCALE,
(tilePos.second * 16 + 15) * RENDERING_SCALE);
m_recruitingMenu.setOptions(
{UnitId::INFANTERY, UnitId::MECHANIZED_INFANTERY, UnitId::RECON, UnitId::APC,
UnitId::ARTILLERY, UnitId::ANTI_AIR_TANK, UnitId::ANTI_AIR_MISSILE_LAUNCHER,
UnitId::ROCKET_ARTILLERY, UnitId::MEDIUM_TANK, UnitId::NEO_TANK,
UnitId::HEAVY_TANK});
m_recruitingMenu.setOptions(m_buildings.at(m_selectedBuilding).recruitableUnits());
std::cout << "no training here" << std::endl;
}
}
......
......@@ -32,7 +32,8 @@ namespace advanced_wars
std::vector<std::pair<std::string, int>> options;
for (UnitId id : recruitableUnits) {
for (UnitId id : recruitableUnits)
{
options.push_back(unitNames.at(id));
cost2UnitId.insert(std::make_pair(unitNames.at(id).second, id));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment