summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaweł Redman <pawel.redman@gmail.com>2018-04-20 18:45:28 +0200
committerPaweł Redman <pawel.redman@gmail.com>2018-04-20 18:45:28 +0200
commit0f1afafbb6d6f175c3ced248923a77b1c6071651 (patch)
tree91d4cb908b376dcfb4bd2aad7884b7fd4699f4ed /src
parent3c15992a4f856d33bf521624740b969ae07f0b85 (diff)
Remove the unit message spam.
Diffstat (limited to 'src')
-rw-r--r--src/game/game.cpp10
-rw-r--r--src/game/game.hpp2
-rw-r--r--src/game/units.cpp6
3 files changed, 10 insertions, 8 deletions
diff --git a/src/game/game.cpp b/src/game/game.cpp
index 6ffb629..72aabf2 100644
--- a/src/game/game.cpp
+++ b/src/game/game.cpp
@@ -153,7 +153,7 @@ void state_t::select(rectf_t rect, int type)
if (select_unit(unit, type)) {
if (unit->type == unit_t::UNIT_SOLDIER)
- unit->say(text::get(text::SAY_READY));
+ unit->say(text::get(text::SAY_READY), false);
}
if (select_one)
@@ -217,24 +217,24 @@ static void command_soldier(unit_soldier_t *soldier, v2f_t x, int number)
switch (number) {
case COMMAND_MOVE:
if (!soldier->start_moving(x))
- soldier->say(text::get(text::SAY_NO_PATH));
+ soldier->say(text::get(text::SAY_NO_PATH), false);
else {
soldier->move_marker = std::make_unique<fx_move_marker_t>(soldier->game, soldier->move.path.back());
- soldier->say(text::get(text::SAY_MOVING));
+ soldier->say(text::get(text::SAY_MOVING), false);
}
break;
case COMMAND_STOP:
soldier->stop_moving();
soldier->manual_firing = false;
- soldier->say(text::get(text::SAY_STOPPING));
+ soldier->say(text::get(text::SAY_STOPPING), false);
soldier->aim_marker.reset();
break;
case COMMAND_FIRE:
soldier->manual_firing = true;
soldier->manual_firing_target = x;
- soldier->say(text::get(text::SAY_FIRING));
+ soldier->say(text::get(text::SAY_FIRING), false);
break;
case COMMAND_FIRE_ROCKET:
diff --git a/src/game/game.hpp b/src/game/game.hpp
index 27fc69b..145fc7e 100644
--- a/src/game/game.hpp
+++ b/src/game/game.hpp
@@ -229,7 +229,7 @@ namespace game {
std::string say_text;
double say_time = -INFINITY;
- void say(std::string str);
+ void say(std::string str, bool on_interface=true);
void render_to(render::state_t *render);
};
diff --git a/src/game/units.cpp b/src/game/units.cpp
index 5ee626b..735ed89 100644
--- a/src/game/units.cpp
+++ b/src/game/units.cpp
@@ -95,11 +95,13 @@ void unit_t::render_to(render::state_t *render)
}
}
-void unit_t::say(std::string str)
+void unit_t::say(std::string str, bool on_interface)
{
say_text = str;
say_time = game->now;
- game->interface->print(name + ": " + str);
+
+ if (on_interface)
+ game->interface->print(name + ": " + str);
}
bool unit_t::keep_moving(double speed)