mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-16 00:12:51 +00:00
(svn r16523) -Fix (rNewPool): Segfault when small ufos were heading for deleted vehicles.
This commit is contained in:
parent
59ae226ab1
commit
0b8ceb3007
@ -314,7 +314,7 @@ static bool DisasterTick_Ufo(DisasterVehicle *v)
|
|||||||
} else {
|
} else {
|
||||||
/* Target a vehicle */
|
/* Target a vehicle */
|
||||||
Vehicle *u_tmp = Vehicle::Get(v->dest_tile);
|
Vehicle *u_tmp = Vehicle::Get(v->dest_tile);
|
||||||
if (u_tmp->type != VEH_ROAD || !IsRoadVehFront(u_tmp)) {
|
if (u_tmp == NULL || u_tmp->type != VEH_ROAD || !IsRoadVehFront(u_tmp)) {
|
||||||
delete v;
|
delete v;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -402,7 +402,7 @@ static bool DisasterTick_Aircraft(DisasterVehicle *v, uint16 image_override, boo
|
|||||||
|
|
||||||
if (v->current_order.GetDestination() == 2) {
|
if (v->current_order.GetDestination() == 2) {
|
||||||
if (GB(v->tick_counter, 0, 2) == 0) {
|
if (GB(v->tick_counter, 0, 2) == 0) {
|
||||||
Industry *i = Industry::Get(v->dest_tile);
|
Industry *i = Industry::Get(v->dest_tile); // Industry destructor calls ReleaseDisastersTargetingIndustry, so this is valid
|
||||||
int x = TileX(i->xy) * TILE_SIZE;
|
int x = TileX(i->xy) * TILE_SIZE;
|
||||||
int y = TileY(i->xy) * TILE_SIZE;
|
int y = TileY(i->xy) * TILE_SIZE;
|
||||||
uint32 r = Random();
|
uint32 r = Random();
|
||||||
@ -420,7 +420,7 @@ static bool DisasterTick_Aircraft(DisasterVehicle *v, uint16 image_override, boo
|
|||||||
v->current_order.SetDestination(2);
|
v->current_order.SetDestination(2);
|
||||||
v->age = 0;
|
v->age = 0;
|
||||||
|
|
||||||
Industry *i = Industry::Get(v->dest_tile);
|
Industry *i = Industry::Get(v->dest_tile); // Industry destructor calls ReleaseDisastersTargetingIndustry, so this is valid
|
||||||
DestructIndustry(i);
|
DestructIndustry(i);
|
||||||
|
|
||||||
SetDParam(0, i->town->index);
|
SetDParam(0, i->town->index);
|
||||||
|
Loading…
Reference in New Issue
Block a user