Skip to content

Commit 6f8d1b6

Browse files
committed
Optimise Track::get_friction a bit
Minimap updates were at 14% on a profile
1 parent ad3b6df commit 6f8d1b6

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

track.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,9 @@ float Track::get_friction(blit::Vec2 pos) {
216216
if(tile_coord.x < 0 || tile_coord.y < 0 || tile_coord.x >= map->bounds.w || tile_coord.y >= map->bounds.h)
217217
return 0.0f;
218218

219-
auto tile_id = map->tile_at(tile_coord);
219+
// we know that the coord is in bounds so skip the offset calcs
220+
//auto tile_id = map->tile_at(tile_coord);
221+
auto tile_id = map->tiles[tile_coord.x + tile_coord.y * map->bounds.w];
220222

221223
// default
222224
if(tile_id >= info.tile_friction_len)

0 commit comments

Comments
 (0)