~ubuntu-branches/debian/squeeze/openttd/squeeze

« back to all changes in this revision

Viewing changes to src/disaster_cmd.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jordi Mallach, Matthijs Kooijman
  • Date: 2009-06-09 21:46:28 UTC
  • mfrom: (1.1.7 upstream) (2.1.4 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090609214628-6z5uodi6178z050l
[ Matthijs Kooijman ]
* New upstream release.
* Link against libicu to enable right-to-left language support. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* $Id: disaster_cmd.cpp 15764 2009-03-18 19:47:05Z rubidium $ */
 
1
/* $Id: disaster_cmd.cpp 16539 2009-06-08 22:53:39Z rubidium $ */
2
2
 
3
3
/** @file disaster_cmd.cpp
4
4
 * All disaster/easter egg vehicles are handled here.
323
323
        } else {
324
324
                /* Target a vehicle */
325
325
                u = GetVehicle(v->dest_tile);
326
 
                if (u->type != VEH_ROAD || !IsRoadVehFront(u)) {
327
 
                        delete v;
328
 
                        return;
329
 
                }
 
326
                assert(u->type == VEH_ROAD && IsRoadVehFront(u));
330
327
 
331
328
                dist = Delta(v->x_pos, u->x_pos) + Delta(v->y_pos, u->y_pos);
332
329
 
1029
1026
        }
1030
1027
}
1031
1028
 
 
1029
/** Notify disasters that we are about to delete a vehicle. So make them head elsewhere.
 
1030
 * @param vehicle deleted vehicle
 
1031
 */
 
1032
void ReleaseDisastersTargetingVehicle(VehicleID vehicle)
 
1033
{
 
1034
        Vehicle *v;
 
1035
        FOR_ALL_VEHICLES(v) {
 
1036
                /* primary disaster vehicles that have chosen target */
 
1037
                if (v->type == VEH_DISASTER && v->subtype == ST_SMALL_UFO) {
 
1038
                        if (v->current_order.GetDestination() != 0 && v->dest_tile == vehicle) {
 
1039
                                /* Revert to target-searching */
 
1040
                                v->current_order.SetDestination(0);
 
1041
                                v->dest_tile = RandomTile();
 
1042
                                v->z_pos = 135;
 
1043
                                v->age = 0;
 
1044
                        }
 
1045
                }
 
1046
        }
 
1047
}
 
1048
 
1032
1049
void DisasterVehicle::UpdateDeltaXY(Direction direction)
1033
1050
{
1034
1051
        this->x_offs        = -1;