1
0
Fork 0

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

- Fix: When marking trains stuck do not reset the unload/stuck counter when the vehicle is unloading. It will be automatically reset once the vehicle wants to leave the station [FS#3046] (r16901)
- Fix: [NoAI]: Small errors in the API documentation [FS#3037] (r16865)
- Fix: Savegames from before 0.4 would get their waypoint 'index' messed up (r16854)
- Fix: Cargo payments were not destroyed when a vehicle was destructed. This only happened when you crashed a vehicle while it was unloading [FS#3032, FS#3046] (r16801)
release/0.7
rubidium 2009-07-21 17:17:20 +00:00
parent 969d538026
commit d567f99ecf
12 changed files with 27 additions and 20 deletions

Binary file not shown.

View File

@ -129,7 +129,7 @@ public:
* @exception AIError::ERR_FLAT_LAND_REQUIRED
* @exception AIError::ERR_LOCAL_AUTHORITY_REFUSES
* @exception AIStation::ERR_STATION_TOO_LARGE
* @exception AIStation::ERR_STATION_TOO_CLOSE_TO_OTHER_STATION
* @exception AIStation::ERR_STATION_TOO_CLOSE_TO_ANOTHER_STATION
* @return Whether the airport has been/can be build or not.
*/
static bool BuildAirport(TileIndex tile, AirportType type, StationID station_id);

View File

@ -328,7 +328,7 @@ public:
* @pre AIVehicle::IsValidVehicle(vehicle_id).
* @pre AreOrderFlagsValid(destination, order_flags).
* @exception AIError::ERR_OWNED_BY_ANOTHER_COMPANY
* @exception AIOrder::ERR_ORDER_NO_MORE_SPACE
* @exception AIOrder::ERR_ORDER_TOO_MANY
* @exception AIOrder::ERR_ORDER_TOO_FAR_AWAY_FROM_PREVIOUS_DESTINATION
* @return True if and only if the order was appended.
*/
@ -341,7 +341,7 @@ public:
* @pre AIVehicle::IsValidVehicle(vehicle_id).
* @pre IsValidVehicleOrder(vehicle_id, jump_to).
* @exception AIError::ERR_OWNED_BY_ANOTHER_COMPANY
* @exception AIOrder::ERR_ORDER_NO_MORE_SPACE
* @exception AIOrder::ERR_ORDER_TOO_MANY
* @return True if and only if the order was appended.
*/
static bool AppendConditionalOrder(VehicleID vehicle_id, OrderPosition jump_to);
@ -355,7 +355,7 @@ public:
* @pre IsValidVehicleOrder(vehicle_id, order_position).
* @pre AreOrderFlagsValid(destination, order_flags).
* @exception AIError::ERR_OWNED_BY_ANOTHER_COMPANY
* @exception AIOrder::ERR_ORDER_NO_MORE_SPACE
* @exception AIOrder::ERR_ORDER_TOO_MANY
* @exception AIOrder::ERR_ORDER_TOO_FAR_AWAY_FROM_PREVIOUS_DESTINATION
* @return True if and only if the order was inserted.
*/
@ -369,7 +369,7 @@ public:
* @pre IsValidVehicleOrder(vehicle_id, order_position).
* @pre IsValidVehicleOrder(vehicle_id, jump_to).
* @exception AIError::ERR_OWNED_BY_ANOTHER_COMPANY
* @exception AIOrder::ERR_ORDER_NO_MORE_SPACE
* @exception AIOrder::ERR_ORDER_TOO_MANY
* @return True if and only if the order was inserted.
*/
static bool InsertConditionalOrder(VehicleID vehicle_id, OrderPosition order_position, OrderPosition jump_to);
@ -442,7 +442,7 @@ public:
* @pre AIVehicle::IsValidVehicle(vehicle_id).
* @pre AIVehicle::IsValidVehicle(main_vehicle_id).
* @exception AIError::ERR_OWNED_BY_ANOTHER_COMPANY
* @exception AIOrder::ERR_ORDER_NO_MORE_SPACE
* @exception AIOrder::ERR_ORDER_TOO_MANY
* @return True if and only if the copying succeeded.
*/
static bool CopyOrders(VehicleID vehicle_id, VehicleID main_vehicle_id);

View File

@ -349,7 +349,7 @@ public:
* @exception AIError::ERR_FLAT_LAND_REQUIRED
* @exception AIRoad::ERR_ROAD_DRIVE_THROUGH_WRONG_DIRECTION
* @exception AIRoad::ERR_ROAD_CANNOT_BUILD_ON_TOWN_ROAD
* @exception AIError:ERR_VEHICLE_IN_THE_WAY
* @exception AIError::ERR_VEHICLE_IN_THE_WAY
* @exception AIStation::ERR_STATION_TOO_CLOSE_TO_ANOTHER_STATION
* @exception AIStation::ERR_STATION_TOO_MANY_STATIONS
* @exception AIStation::ERR_STATION_TOO_MANY_STATIONS_IN_TOWN
@ -372,7 +372,7 @@ public:
* @exception AIError::ERR_FLAT_LAND_REQUIRED
* @exception AIRoad::ERR_ROAD_DRIVE_THROUGH_WRONG_DIRECTION
* @exception AIRoad::ERR_ROAD_CANNOT_BUILD_ON_TOWN_ROAD
* @exception AIError:ERR_VEHICLE_IN_THE_WAY
* @exception AIError::ERR_VEHICLE_IN_THE_WAY
* @exception AIStation::ERR_STATION_TOO_CLOSE_TO_ANOTHER_STATION
* @exception AIStation::ERR_STATION_TOO_MANY_STATIONS
* @exception AIStation::ERR_STATION_TOO_MANY_STATIONS_IN_TOWN

View File

@ -58,7 +58,7 @@ public:
ERR_VEHICLE_IN_FLIGHT, // [STR_A017_AIRCRAFT_IS_IN_FLIGHT]
/** Vehicle is without power */
ERR_VEHCILE_NO_POWER, // [STR_TRAIN_START_NO_CATENARY]
ERR_VEHICLE_NO_POWER, // [STR_TRAIN_START_NO_CATENARY]
};

View File

@ -37,7 +37,7 @@ void SQAIVehicle_Register(Squirrel *engine) {
SQAIVehicle.DefSQConst(engine, AIVehicle::ERR_VEHICLE_IS_DESTROYED, "ERR_VEHICLE_IS_DESTROYED");
SQAIVehicle.DefSQConst(engine, AIVehicle::ERR_VEHICLE_NOT_IN_DEPOT, "ERR_VEHICLE_NOT_IN_DEPOT");
SQAIVehicle.DefSQConst(engine, AIVehicle::ERR_VEHICLE_IN_FLIGHT, "ERR_VEHICLE_IN_FLIGHT");
SQAIVehicle.DefSQConst(engine, AIVehicle::ERR_VEHCILE_NO_POWER, "ERR_VEHCILE_NO_POWER");
SQAIVehicle.DefSQConst(engine, AIVehicle::ERR_VEHICLE_NO_POWER, "ERR_VEHICLE_NO_POWER");
SQAIVehicle.DefSQConst(engine, AIVehicle::VT_RAIL, "VT_RAIL");
SQAIVehicle.DefSQConst(engine, AIVehicle::VT_ROAD, "VT_ROAD");
SQAIVehicle.DefSQConst(engine, AIVehicle::VT_WATER, "VT_WATER");
@ -85,7 +85,7 @@ void SQAIVehicle_Register(Squirrel *engine) {
AIError::RegisterErrorMap(STR_TRAIN_MUST_BE_STOPPED, AIVehicle::ERR_VEHICLE_NOT_IN_DEPOT);
AIError::RegisterErrorMap(STR_980B_SHIP_MUST_BE_STOPPED_IN, AIVehicle::ERR_VEHICLE_NOT_IN_DEPOT);
AIError::RegisterErrorMap(STR_A017_AIRCRAFT_IS_IN_FLIGHT, AIVehicle::ERR_VEHICLE_IN_FLIGHT);
AIError::RegisterErrorMap(STR_TRAIN_START_NO_CATENARY, AIVehicle::ERR_VEHCILE_NO_POWER);
AIError::RegisterErrorMap(STR_TRAIN_START_NO_CATENARY, AIVehicle::ERR_VEHICLE_NO_POWER);
AIError::RegisterErrorMapString(AIVehicle::ERR_VEHICLE_TOO_MANY, "ERR_VEHICLE_TOO_MANY");
AIError::RegisterErrorMapString(AIVehicle::ERR_VEHICLE_NOT_AVAILABLE, "ERR_VEHICLE_NOT_AVAILABLE");
@ -98,7 +98,7 @@ void SQAIVehicle_Register(Squirrel *engine) {
AIError::RegisterErrorMapString(AIVehicle::ERR_VEHICLE_IS_DESTROYED, "ERR_VEHICLE_IS_DESTROYED");
AIError::RegisterErrorMapString(AIVehicle::ERR_VEHICLE_NOT_IN_DEPOT, "ERR_VEHICLE_NOT_IN_DEPOT");
AIError::RegisterErrorMapString(AIVehicle::ERR_VEHICLE_IN_FLIGHT, "ERR_VEHICLE_IN_FLIGHT");
AIError::RegisterErrorMapString(AIVehicle::ERR_VEHCILE_NO_POWER, "ERR_VEHCILE_NO_POWER");
AIError::RegisterErrorMapString(AIVehicle::ERR_VEHICLE_NO_POWER, "ERR_VEHICLE_NO_POWER");
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::IsValidVehicle, "IsValidVehicle", 2, ".i");
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetNumWagons, "GetNumWagons", 2, ".i");

View File

@ -1552,6 +1552,7 @@ void PrepareUnload(Vehicle *front_v)
static void LoadUnloadVehicle(Vehicle *v, int *cargo_left)
{
assert(v->current_order.IsType(OT_LOADING));
assert(v->load_unload_time_rem != 0);
/* We have not waited enough time till the next round of loading/unloading */
if (--v->load_unload_time_rem != 0) {

View File

@ -416,6 +416,9 @@ bool AfterLoadGame()
}
}
/* Update all waypoints */
if (CheckSavegameVersion(12)) FixOldWaypoints();
if (CheckSavegameVersion(84)) {
FOR_ALL_COMPANIES(c) {
c->name = CopyFromOldName(c->name_1);
@ -440,7 +443,7 @@ bool AfterLoadGame()
Waypoint *wp;
FOR_ALL_WAYPOINTS(wp) {
wp->name = CopyFromOldName(wp->string);
wp->string = STR_EMPTY;
wp->string = STR_NULL;
}
}
@ -518,9 +521,6 @@ bool AfterLoadGame()
}
}
/* Update all waypoints */
if (CheckSavegameVersion(12)) FixOldWaypoints();
/* make sure there is a town in the game */
if (_game_mode == GM_NORMAL && !ClosestTownFromTile(0, UINT_MAX)) {
SetSaveLoadError(STR_NO_TOWN_IN_SCENARIO);

View File

@ -45,8 +45,8 @@ void FixOldWaypoints()
FOR_ALL_WAYPOINTS(wp) {
wp->town_index = ClosestTownFromTile(wp->xy, UINT_MAX)->index;
wp->town_cn = 0;
if (wp->string & 0xC000) {
wp->town_cn = wp->string & 0x3F;
if ((wp->string & 0xC000) == 0xC000) {
wp->town_cn = (wp->string >> 8) & 0x3F;
wp->string = STR_NULL;
}
}

View File

@ -1557,6 +1557,10 @@ static void MarkTrainAsStuck(Vehicle *v)
if (!HasBit(v->u.rail.flags, VRF_TRAIN_STUCK)) {
/* It is the first time the problem occured, set the "train stuck" flag. */
SetBit(v->u.rail.flags, VRF_TRAIN_STUCK);
/* When loading the vehicle is already stopped. No need to change that. */
if (v->current_order.IsType(OT_LOADING)) return;
v->load_unload_time_rem = 0;
/* Stop train */

View File

@ -535,6 +535,8 @@ void Vehicle::PreDestructor()
GetStation(this->last_station_visited)->loading_vehicles.remove(this);
HideFillingPercent(&this->fill_percent_te_id);
delete this->cargo_payment;
}
if (IsEngineCountable(this)) {

View File

@ -407,7 +407,7 @@ struct RefitWindow : public Window {
static const Widget _vehicle_refit_widgets[] = {
{ WWT_CLOSEBOX, RESIZE_NONE, COLOUR_GREY, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
{ WWT_CAPTION, RESIZE_NONE, COLOUR_GREY, 11, 239, 0, 13, STR_983B_REFIT, STR_018C_WINDOW_TITLE_DRAG_THIS},
{ WWT_TEXTBTN, RESIZE_NONE, COLOUR_GREY, 0, 239, 14, 27, STR_983F_SELECT_CARGO_TYPE_TO_CARRY, NULL},
{ WWT_TEXTBTN, RESIZE_NONE, COLOUR_GREY, 0, 239, 14, 27, STR_983F_SELECT_CARGO_TYPE_TO_CARRY, STR_NULL},
{ WWT_MATRIX, RESIZE_BOTTOM, COLOUR_GREY, 0, 227, 28, 139, 0x801, STR_EMPTY},
{ WWT_SCROLLBAR, RESIZE_BOTTOM, COLOUR_GREY, 228, 239, 28, 139, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST},
@ -1882,7 +1882,7 @@ struct VehicleViewWindow : Window {
} else { // no train
str = STR_8861_STOPPED;
}
} else if (v->type == VEH_TRAIN && HasBit(v->u.rail.flags, VRF_TRAIN_STUCK)) {
} else if (v->type == VEH_TRAIN && HasBit(v->u.rail.flags, VRF_TRAIN_STUCK) && !v->current_order.IsType(OT_LOADING)) {
str = STR_TRAIN_STUCK;
} else { // vehicle is in a "normal" state, show current order
switch (v->current_order.GetType()) {