summaryrefslogtreecommitdiff
path: root/src/game
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
parentab725d9770c648bda8cc76425a5b3fcd98dce5f7 (diff)
Group command feedback says.
Diffstat (limited to 'src/game')
-rw-r--r--src/game/game.cpp20
-rw-r--r--src/game/game.hpp3
-rw-r--r--src/game/text.cpp14
3 files changed, 31 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));
}
}
diff --git a/src/game/game.hpp b/src/game/game.hpp
index de41fc5..456a8ea 100644
--- a/src/game/game.hpp
+++ b/src/game/game.hpp
@@ -77,10 +77,13 @@ namespace game {
UNPAUSED,
FOLLOWING_ON,
FOLLOWING_OFF,
+ SAY_GROUP,
SAY_NO_PATH,
SAY_BLOCKED,
SAY_READY,
+ SAY_READY_GROUP,
SAY_MOVING,
+ SAY_MOVING_GROUP,
SAY_PANIC,
UNIT_NAME_SPIDER,
UNIT_NAME_SOLDIER,
diff --git a/src/game/text.cpp b/src/game/text.cpp
index f8c3f71..7addbfa 100644
--- a/src/game/text.cpp
+++ b/src/game/text.cpp
@@ -23,6 +23,9 @@ static std::string get_english(index_t index)
case FOLLOWING_OFF:
return "Following: off.";
+ case SAY_GROUP:
+ return "Group";
+
case SAY_BLOCKED:
return "Something is in my way.";
@@ -30,11 +33,15 @@ static std::string get_english(index_t index)
return "I can't get there.";
case SAY_READY:
+ case SAY_READY_GROUP:
return "Ready for orders.";
case SAY_MOVING:
return "On my way.";
+ case SAY_MOVING_GROUP:
+ return "On our way.";
+
case SAY_PANIC:
return "I'm not getting paid enough for this.";
@@ -94,6 +101,9 @@ static std::string get_polish(index_t index)
case FOLLOWING_OFF:
return "Podążanie: wyłączone.";
+ case SAY_GROUP:
+ return "Oddział";
+
case SAY_BLOCKED:
return "Coś jest na mojej drodze.";
@@ -101,11 +111,15 @@ static std::string get_polish(index_t index)
return "Nie mogę się tam dostać.";
case SAY_READY:
+ case SAY_READY_GROUP:
return "Gotowy na rozkaz.";
case SAY_MOVING:
return "Jestem w drodze.";
+ case SAY_MOVING_GROUP:
+ return "W drodze.";
+
case SAY_PANIC:
return "Za mało mi za to płacą.";