(svn r3111) -Fix: [autoreplace] [ 1341783 ] Assertion failure in vehicle.c line 378

running MaybeReplaceVehicle() is now delayed until after the loop in CallVehicleTicks()
	This avoids selling the vehicle the loop currently works with (and continues to work with afterwards)
This commit is contained in:
bjarni
2005-10-31 12:59:47 +00:00
parent 229535750b
commit fa5ca040e9
7 changed files with 54 additions and 17 deletions

View File

@@ -153,6 +153,7 @@ struct Vehicle {
Vehicle *next; // next
Vehicle *first; // NOSAVE: pointer to the first vehicle in the chain
Vehicle *depot_list; //NOSAVE: linked list to tell what vehicles entered a depot during the last tick. Used by autoreplace
StringID string_id; // Displayed string
@@ -164,6 +165,7 @@ struct Vehicle {
int32 x_pos; // coordinates
int32 y_pos;
byte z_pos;
byte direction; // facing
@@ -240,6 +242,8 @@ struct Vehicle {
int32 profit_last_year;
uint32 value;
union {
VehicleRail rail;
VehicleAir air;
@@ -309,7 +313,7 @@ Vehicle *CheckClickOnVehicle(const ViewPort *vp, int x, int y);
void DecreaseVehicleValue(Vehicle *v);
void CheckVehicleBreakdown(Vehicle *v);
void AgeVehicle(Vehicle *v);
Vehicle * MaybeReplaceVehicle(Vehicle *v);
void VehicleEnteredDepotThisTick(Vehicle *v);
void BeginVehicleMove(Vehicle *v);
void EndVehicleMove(Vehicle *v);