summaryrefslogtreecommitdiff
path: root/src/game/game.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/game.cpp')
-rw-r--r--src/game/game.cpp23
1 files changed, 17 insertions, 6 deletions
diff --git a/src/game/game.cpp b/src/game/game.cpp
index 70bd040..a74a906 100644
--- a/src/game/game.cpp
+++ b/src/game/game.cpp
@@ -178,12 +178,14 @@ enum {
COMMAND_STOP,
COMMAND_REPL_SOLDIER,
- COMMAND_REPL_SCIENTIST
+ COMMAND_REPL_SCIENTIST,
+
+ COMMAND_GATHER
};
bool state_t::populate_pie_menu(std::vector<interface::pie_item_t> &items)
{
- bool can_move = false, soldiers = false, repls = false, rockets = false;
+ bool soldiers = false, repls = false, rockets = false, scientists = false;
items.clear();
@@ -196,14 +198,13 @@ bool state_t::populate_pie_menu(std::vector<interface::pie_item_t> &items)
switch (unit->type) {
case unit_t::UNIT_SOLDIER:
- can_move = true;
soldiers = true;
if (!dynamic_cast<unit_soldier_t*>(unit)->rocket_fired)
rockets = true;
break;
case unit_t::UNIT_SCIENTIST:
- can_move = true;
+ scientists = true;
break;
case unit_t::UNIT_REPL:
@@ -214,7 +215,7 @@ bool state_t::populate_pie_menu(std::vector<interface::pie_item_t> &items)
}
}
- if (can_move) {
+ if (soldiers || scientists) {
items.push_back((interface::pie_item_t){"Move", COMMAND_MOVE});
items.push_back((interface::pie_item_t){"Stop", COMMAND_STOP});
}
@@ -225,6 +226,9 @@ bool state_t::populate_pie_menu(std::vector<interface::pie_item_t> &items)
items.push_back((interface::pie_item_t){"Fire a rocket", COMMAND_FIRE_ROCKET});
}
+ if (scientists)
+ items.push_back((interface::pie_item_t){"Gather", COMMAND_GATHER});
+
if (repls) {
items.push_back((interface::pie_item_t){"Spawn a soldier", COMMAND_REPL_SOLDIER});
items.push_back((interface::pie_item_t){"Spawn a scientist", COMMAND_REPL_SCIENTIST});
@@ -292,7 +296,14 @@ static void command_scientist(unit_scientist_t *scientist, v2f_t x, int number)
case COMMAND_STOP:
scientist->stop_moving();
scientist->say("Стоп.", false);
- scientist->aim_marker.reset();
+ scientist->gather_marker.reset();
+ break;
+
+ case COMMAND_GATHER:
+ scientist->gathering = true;
+ scientist->gathering_at = x;
+ scientist->gather_marker = std::make_unique<fx_aim_marker_t>(scientist->game, x);
+ scientist->say("Я собираю.", false);
break;
}
}