From 78d797a6b7cbafb79d128550d95867482cf3e931 Mon Sep 17 00:00:00 2001 From: peter1138 Date: Tue, 12 Jun 2007 11:22:32 +0000 Subject: (svn r10111) -Codechange: Add new vehicle hash table for collision detection and finding vehicles on a tile. The hash area scanned is far smaller than the old hash table, which is now used for viewport updates only. This should give a significant performance improvement for games with many vehicles. (Based on work by 'B. N. SmatZ!' and 'madman2003') --- src/vehicle.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/vehicle.h') diff --git a/src/vehicle.h b/src/vehicle.h index 8d734bf22..2d808c0b9 100644 --- a/src/vehicle.h +++ b/src/vehicle.h @@ -290,6 +290,8 @@ struct Vehicle { int32 right_coord; int32 bottom_coord; Vehicle *next_hash; + Vehicle *next_new_hash; + Vehicle **old_new_hash; /* Related to age and service time */ Date age; // Age in days @@ -497,6 +499,7 @@ uint CountVehiclesInChain(const Vehicle* v); bool IsEngineCountable(const Vehicle *v); void DeleteVehicleChain(Vehicle *v); void *VehicleFromPos(TileIndex tile, void *data, VehicleFromPosProc *proc); +void *VehicleFromPosXY(int x, int y, void *data, VehicleFromPosProc *proc); void CallVehicleTicks(); Vehicle *FindVehicleOnTileZ(TileIndex tile, byte z); -- cgit v1.2.3-54-g00ecf