diff options
author | Paweł Redman <pawel.redman@gmail.com> | 2018-03-26 19:27:17 +0200 |
---|---|---|
committer | Paweł Redman <pawel.redman@gmail.com> | 2018-03-26 19:27:17 +0200 |
commit | c9a0aff5a9333cf5e0ee55ba5c8551457a3ae13c (patch) | |
tree | af5175e56edcb50062555933eb9779a9e7c231a6 /src/game | |
parent | 2f978ea5085678e98e391317cc50ac991cd726a8 (diff) |
Diffstat (limited to 'src/game')
-rw-r--r-- | src/game/interface.cpp | 6 | ||||
-rw-r--r-- | src/game/units.cpp | 14 |
2 files changed, 14 insertions, 6 deletions
diff --git a/src/game/interface.cpp b/src/game/interface.cpp index 262c3ae..bd70dbb 100644 --- a/src/game/interface.cpp +++ b/src/game/interface.cpp @@ -277,7 +277,11 @@ void state_t::render_to(render::state_t *render) x[1] += em; ss.str(std::string()); ss << std::fixed << std::setprecision(3); - ss << "Game t/F/B: " << game->time * 1.0e-9 << "/" << game->frames << "/" << game->frames_behind; + ss << "Game t/F/B/PFT: "; + ss << game->time * 1.0e-9 << "/"; + ss << game->frames << "/"; + ss << game->frames_behind << "/"; + ss << game->pathfinder_time * 1.0e-9 << " (" << ((float)game->pathfinder_time / game->time * 100.0f) << "%)"; render->render_text(x, em, ss.str(), render::ALIGN_LEFT_TOP, sf::Color::White); } diff --git a/src/game/units.cpp b/src/game/units.cpp index edb41ec..5f722aa 100644 --- a/src/game/units.cpp +++ b/src/game/units.cpp @@ -163,6 +163,8 @@ bool unit_t::keep_moving(double speed) bool unit_t::start_moving(v2f_t dst) { world::cmodel_t rep; + ntime_t t0; + bool rv; if (!world) { printf("unit_t::start_moving: entity is not linked\n"); @@ -175,7 +177,10 @@ bool unit_t::start_moving(v2f_t dst) rep.cflags = move.cflags & ~(cmodel.cflags); rep.bounds = cmodel.bounds; - if (!world->find_path(x, move.dst, &rep, this, &move.path)) { + t0 = nclock(); + rv = world->find_path(x, move.dst, &rep, this, &move.path); + game->pathfinder_time += nclock() - t0; + if (!rv) { move.moving = false; return false; } @@ -531,8 +536,8 @@ void unit_soldier_t::render_late_to(render::state_t *render) unit_spider_t::unit_spider_t(game::state_t *game) : unit_t(game, UNIT_SPIDER) { - size[0] = v2f_t(-0.2f, +0.0f); - size[1] = v2f_t(+0.2f, +0.3f); + size[0] = v2f_t(-0.3f, +0.0f); + size[1] = v2f_t(+0.3f, +0.3f); render_size[0] = v2f_t(-0.3f, -0.3f); render_size[1] = v2f_t(+0.3f, +0.3f); cmodel.cflags = CF_BODY_SMALL; @@ -560,7 +565,7 @@ void unit_spider_t::target_and_attack(void) return; start_moving(target->x); - next_targetting = game->now + 0.2; + next_targetting = game->now + 500.0; if (last_attack + 0.5 > game->now) return; @@ -588,7 +593,6 @@ void unit_spider_t::on_think(void) void unit_spider_t::on_wake(void) { - next_targetting = game->now; } void unit_spider_t::on_death(void) |