diff options
author | Paweł Redman <pawel.redman@gmail.com> | 2018-04-13 17:37:02 +0200 |
---|---|---|
committer | Paweł Redman <pawel.redman@gmail.com> | 2018-04-13 17:37:02 +0200 |
commit | 794f6119ffcec7b8cab77cf48876b4ba50aa11c9 (patch) | |
tree | 825f97ba17a35bb8a172d4602a291752188841d1 /src/game | |
parent | 93ab25508f68481f307ec19f3f7459b2ea54f8b4 (diff) |
Don't show 'Fire a rocket' if no one has any rockets.
Diffstat (limited to 'src/game')
-rw-r--r-- | src/game/game.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/game/game.cpp b/src/game/game.cpp index 547d890..cf8fa1a 100644 --- a/src/game/game.cpp +++ b/src/game/game.cpp @@ -172,7 +172,7 @@ enum { bool state_t::populate_pie_menu(std::vector<interface::pie_item_t> &items) { - bool soldiers = false, repls = false; + bool soldiers = false, repls = false, rockets = false; items.clear(); @@ -186,6 +186,8 @@ bool state_t::populate_pie_menu(std::vector<interface::pie_item_t> &items) switch (unit->type) { case unit_t::UNIT_SOLDIER: soldiers = true; + if (!dynamic_cast<unit_soldier_t*>(unit)->rocket_fired) + rockets = true; break; case unit_t::UNIT_REPL: repls = true; @@ -198,7 +200,8 @@ bool state_t::populate_pie_menu(std::vector<interface::pie_item_t> &items) if (soldiers) { items.push_back((interface::pie_item_t){"Move", COMMAND_MOVE}); items.push_back((interface::pie_item_t){"Fire", COMMAND_FIRE}); - items.push_back((interface::pie_item_t){"Fire a rocket", COMMAND_FIRE_ROCKET}); + if (rockets) + items.push_back((interface::pie_item_t){"Fire a rocket", COMMAND_FIRE_ROCKET}); items.push_back((interface::pie_item_t){"Stop", COMMAND_STOP}); } |