diff options
author | Paweł Redman <pawel.redman@gmail.com> | 2018-04-14 16:41:55 +0200 |
---|---|---|
committer | Paweł Redman <pawel.redman@gmail.com> | 2018-04-14 16:41:55 +0200 |
commit | aea9498a593321a3cb34fa93d3d4734ebd8370c1 (patch) | |
tree | e4e4f1bb38cb8d4cb427a78e77df62d4da024f7d /src/game | |
parent | e132c6a9f75918978051e8eb23092f5d05c7c3fc (diff) |
Improve path finding slightly.
Diffstat (limited to 'src/game')
-rw-r--r-- | src/game/game.cpp | 11 | ||||
-rw-r--r-- | src/game/units.cpp | 2 |
2 files changed, 12 insertions, 1 deletions
diff --git a/src/game/game.cpp b/src/game/game.cpp index 185e2d1..f71b9d2 100644 --- a/src/game/game.cpp +++ b/src/game/game.cpp @@ -270,9 +270,16 @@ static void command_repl(unit_repl_t *repl, v2f_t x, int number) void state_t::command(v2f_t x, int number) { + bool unlink; + if (!selected_units.size()) return; + unlink = (number == COMMAND_MOVE); + if (unlink) + for (unit_t *unit : selected_units) + unit->cmodel.ignore = true; + for (unit_t *unit : selected_units) { if (unit->dead || !unit->controllable) continue; @@ -291,6 +298,10 @@ void state_t::command(v2f_t x, int number) default:; } } + + if (unlink) + for (unit_t *unit : selected_units) + unit->cmodel.ignore = false; } void state_t::pause(void) diff --git a/src/game/units.cpp b/src/game/units.cpp index 43e6878..11379cb 100644 --- a/src/game/units.cpp +++ b/src/game/units.cpp @@ -177,7 +177,7 @@ bool unit_t::start_moving(v2f_t dst) move.path.clear(); move.last_step = x; - rep.cflags = move.cflags & ~(cmodel.cflags); + rep.cflags = move.cflags; rep.bounds = cmodel.bounds; if (!world->find_path(x, move.dst, &rep, this, &move.path)) { |