diff options
Diffstat (limited to 'src/game/game.cpp')
-rw-r--r-- | src/game/game.cpp | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/src/game/game.cpp b/src/game/game.cpp index 22b883e..d086cb6 100644 --- a/src/game/game.cpp +++ b/src/game/game.cpp @@ -81,10 +81,13 @@ void state_t::stop(void) { } -void state_t::select(rectf_t x) +void state_t::group_say(std::string text) { - size_t old_cookie = selection_cookie; + interface->print(text::get(text::SAY_GROUP) + ": " + text); +} +void state_t::select(rectf_t x) +{ selection_cookie++; selected_units.clear(); @@ -99,12 +102,14 @@ void state_t::select(rectf_t x) if (!unit->controllable) continue; - if (!unit->dead && unit->selected != old_cookie) - unit->say(text::get(text::SAY_READY)); - unit->selected = selection_cookie; selected_units.insert(unit); } + + if (selected_units.size() == 1) + (*selected_units.begin())->say(text::get(text::SAY_READY)); + else if (selected_units.size() > 1) + group_say(text::get(text::SAY_READY_GROUP)); } void state_t::command(v2f_t x) @@ -114,6 +119,9 @@ void state_t::command(v2f_t x) snap[0] = std::round(x[0] - 0.5f) + 0.5f; snap[1] = std::round(x[1] - 0.5f) + 0.5f; + if (selected_units.size() > 1) + group_say(text::get(text::SAY_MOVING_GROUP)); + for (unit_t *unit : selected_units) { if (unit->dead) continue; @@ -123,7 +131,7 @@ void state_t::command(v2f_t x) if (!unit->start_moving(snap)) unit->say(text::get(text::SAY_NO_PATH)); - else + else if (selected_units.size() == 1) unit->say(text::get(text::SAY_MOVING)); } } |