summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaweł Redman <pawel.redman@gmail.com>2017-12-14 14:45:24 +0100
committerPaweł Redman <pawel.redman@gmail.com>2017-12-14 14:45:24 +0100
commitd376eb30b8363f712e3a0bbc04ea584547c09e65 (patch)
tree971ed135c4df8a265eee1d676ad22672a6a114c8
parenteddac97f8365e2739e06f040f3d6b6ee0079139a (diff)
Command feedback.
-rw-r--r--src/common.hpp2
-rw-r--r--src/game/game.cpp7
-rw-r--r--src/text.cpp6
3 files changed, 15 insertions, 0 deletions
diff --git a/src/common.hpp b/src/common.hpp
index 49166d3..8478e91 100644
--- a/src/common.hpp
+++ b/src/common.hpp
@@ -324,6 +324,8 @@ namespace text {
typedef enum {
SAY_NO_PATH,
SAY_BLOCKED,
+ SAY_READY,
+ SAY_MOVING,
UNIT_ALIEN,
UNIT_HUMAN,
UNIT_DEATH,
diff --git a/src/game/game.cpp b/src/game/game.cpp
index f5f57bf..836b304 100644
--- a/src/game/game.cpp
+++ b/src/game/game.cpp
@@ -40,6 +40,8 @@ void state_t::stop(void)
void state_t::select(rectf_t x)
{
+ size_t old_cookie = selection_cookie;
+
selection_cookie++;
selected_units.clear();
@@ -54,6 +56,9 @@ void state_t::select(rectf_t x)
if (unit->type != unit_t::UNIT_HUMAN)
continue;
+ if (unit->selected != old_cookie)
+ unit->say(text::get(text::SAY_READY));
+
unit->selected = selection_cookie;
selected_units.insert(unit);
}
@@ -72,6 +77,8 @@ void state_t::command(v2f_t x)
if (!unit->start_moving(snap))
unit->say(text::get(text::SAY_NO_PATH));
+ else
+ unit->say(text::get(text::SAY_MOVING));
}
}
diff --git a/src/text.cpp b/src/text.cpp
index ad6af83..3c89610 100644
--- a/src/text.cpp
+++ b/src/text.cpp
@@ -20,6 +20,12 @@ static std::string get_english(index_t index)
case SAY_NO_PATH:
return "I can't get there.";
+ case SAY_READY:
+ return "Ready for orders.";
+
+ case SAY_MOVING:
+ return "On my way.";
+
case UNIT_ALIEN:
return "Alien";