summaryrefslogtreecommitdiff
path: root/src/game/game.cpp
diff options
context:
space:
mode:
authorPaweł Redman <pawel.redman@gmail.com>2017-12-19 20:04:07 +0100
committerPaweł Redman <pawel.redman@gmail.com>2017-12-19 20:04:07 +0100
commita284014075b0abac2b65e3064eac152e8a62bc15 (patch)
tree200813b04a7c6098c98d069b6bf9d0af237adfa2 /src/game/game.cpp
parentab725d9770c648bda8cc76425a5b3fcd98dce5f7 (diff)
Group command feedback says.
Diffstat (limited to 'src/game/game.cpp')
-rw-r--r--src/game/game.cpp20
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));
}
}