1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-17 17:32:45 +01:00

(svn r16539) [0.7] -Backport from trunk:

- Fix: When finding duplicate graphics sets favour the more complete one (r16538)
- Fix: [Squirrel] Crash that occured when an AI was halted while one or more generators were still in a 'running' state [FS#2942] (r16534)
- Fix: [Squirrel] Do not copy an object when we just checked that the pointer to it is NULL (r16532)
- Fix: Notify small UFOs on deletion of road vehicles, so they can head for somewhere else instead of stumbling over a ghost (r16525)
- Update: a few languages.
This commit is contained in:
rubidium
2009-06-08 22:53:39 +00:00
parent b1d2a8876b
commit a00a4b5ad8
18 changed files with 361 additions and 194 deletions

View File

@@ -323,10 +323,7 @@ static void DisasterTick_Ufo(Vehicle *v)
} else {
/* Target a vehicle */
u = GetVehicle(v->dest_tile);
if (u->type != VEH_ROAD || !IsRoadVehFront(u)) {
delete v;
return;
}
assert(u->type == VEH_ROAD && IsRoadVehFront(u));
dist = Delta(v->x_pos, u->x_pos) + Delta(v->y_pos, u->y_pos);
@@ -1029,6 +1026,26 @@ void ReleaseDisastersTargetingIndustry(IndustryID i)
}
}
/** Notify disasters that we are about to delete a vehicle. So make them head elsewhere.
* @param vehicle deleted vehicle
*/
void ReleaseDisastersTargetingVehicle(VehicleID vehicle)
{
Vehicle *v;
FOR_ALL_VEHICLES(v) {
/* primary disaster vehicles that have chosen target */
if (v->type == VEH_DISASTER && v->subtype == ST_SMALL_UFO) {
if (v->current_order.GetDestination() != 0 && v->dest_tile == vehicle) {
/* Revert to target-searching */
v->current_order.SetDestination(0);
v->dest_tile = RandomTile();
v->z_pos = 135;
v->age = 0;
}
}
}
}
void DisasterVehicle::UpdateDeltaXY(Direction direction)
{
this->x_offs = -1;