diff options
author | Paweł Redman <pawel.redman@gmail.com> | 2017-12-21 18:01:23 +0100 |
---|---|---|
committer | Paweł Redman <pawel.redman@gmail.com> | 2017-12-21 18:01:23 +0100 |
commit | 680ce5519c24dd0fa87ae85dd824000e915974b0 (patch) | |
tree | be42a1b9915c28944829a94f54c3296722b71170 /src/game/game.cpp | |
parent | 6eed8de736ff18a2aed65cd9ba62c6a7b5d18c59 (diff) |
Add move markers.
Diffstat (limited to 'src/game/game.cpp')
-rw-r--r-- | src/game/game.cpp | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/src/game/game.cpp b/src/game/game.cpp index ddf9a75..f76b478 100644 --- a/src/game/game.cpp +++ b/src/game/game.cpp @@ -140,16 +140,27 @@ void state_t::command(v2f_t x) group_say(text::get(text::SAY_MOVING_GROUP)); for (unit_t *unit : selected_units) { - if (unit->dead) + unit_soldier_t *soldier; + + if (unit->type != unit_t::UNIT_SOLDIER) continue; - if (!unit->controllable) + soldier = dynamic_cast<unit_soldier_t*>(unit); + + if (soldier->dead) continue; - if (!unit->start_moving(snap)) - unit->say(text::get(text::SAY_NO_PATH)); - else if (selected_units.size() == 1) - unit->say(text::get(text::SAY_MOVING)); + if (!soldier->controllable) + continue; + + if (!soldier->start_moving(snap)) + soldier->say(text::get(text::SAY_NO_PATH)); + else { + soldier->move_marker = std::make_unique<fx_move_marker_t>(this, soldier->move.path.back()); + + if (selected_units.size() == 1) + soldier->say(text::get(text::SAY_MOVING)); + } } } |