(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')

This commit is contained in:
peter1138
2007-06-12 11:22:32 +00:00
parent 105c7455ae
commit 78d797a6b7
4 changed files with 119 additions and 32 deletions

View File

@@ -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);