From a284014075b0abac2b65e3064eac152e8a62bc15 Mon Sep 17 00:00:00 2001 From: Paweł Redman Date: Tue, 19 Dec 2017 20:04:07 +0100 Subject: Group command feedback says. --- src/game/game.cpp | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'src/game/game.cpp') 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)); } } -- cgit