(svn r12597) [NoAI] -Sync: with trunk r12501:12596.
--- a/Makefile.in Sun Apr 06 14:12:19 2008 +0000
+++ b/Makefile.in Sun Apr 06 23:07:42 2008 +0000
@@ -22,7 +22,6 @@
INSTALL_BINARY_DIR = "$(INSTALL_DIR)/"!!BINARY_DIR!!
INSTALL_ICON_DIR = "$(INSTALL_DIR)/"!!ICON_DIR!!
INSTALL_DATA_DIR = "$(INSTALL_DIR)/"!!DATA_DIR!!
-INSTALL_PERSONAL_DIR = !!PERSONAL_DIR!!
TTD = !!TTD!!
TTDS = $(SRC_DIRS:%=%/$(TTD))
OS = !!OS!!
@@ -280,10 +279,5 @@
$(Q)install -m 644 "$(BUNDLE_DIR)/data/"* "$(INSTALL_DATA_DIR)/data"
$(Q)install -m 644 "$(BUNDLE_DIR)/docs/"* "$(INSTALL_DATA_DIR)/docs"
$(Q)install -m 644 "$(BUNDLE_DIR)/media/"* "$(INSTALL_ICON_DIR)"
-ifdef INSTALL_PERSONAL_DIR
- $(Q)mkdir -p ~/"$(INSTALL_PERSONAL_DIR)"
- $(Q)cp -R "$(BUNDLE_DIR)/scenario" ~/"$(INSTALL_PERSONAL_DIR)"
-else
$(Q)cp -R "$(BUNDLE_DIR)/scenario" "$(INSTALL_DATA_DIR)"
-endif # INSTALL_PERSONAL_DIR
endif # OSXAPP
--- a/bin/ai/regression/regression.txt Sun Apr 06 14:12:19 2008 +0000
+++ b/bin/ai/regression/regression.txt Sun Apr 06 23:07:42 2008 +0000
@@ -6311,9 +6311,25 @@
GetEventType: 3
EventName: SubsidiaryOffer
CargoID: 0
- GetFromTownID: 0
+ GetFromTownID: 24
GetToTownID: 65535
GetFromIndustryID: 65535
- GetToIndustryID: 21
+ GetToIndustryID: 16
+ GetNextEvent: instance
+ GetEventType: 3
+ EventName: SubsidiaryOffer
+ CargoID: 0
+ GetFromTownID: 20
+ GetToTownID: 65535
+ GetFromIndustryID: 65535
+ GetToIndustryID: 6
+ GetNextEvent: instance
+ GetEventType: 3
+ EventName: SubsidiaryOffer
+ CargoID: 0
+ GetFromTownID: 21
+ GetToTownID: 65535
+ GetFromIndustryID: 65535
+ GetToIndustryID: 24
IsEventWaiting: false
ERROR: We've got a suicidal AI for player 1
Binary file media/palette.act has changed
--- a/src/ai/api/ai_order.cpp Sun Apr 06 14:12:19 2008 +0000
+++ b/src/ai/api/ai_order.cpp Sun Apr 06 23:07:42 2008 +0000
@@ -68,10 +68,10 @@
Order *order = ::GetVehicle(vehicle_id)->orders;
for (uint i = 0; i < order_id; i++) order = order->next;
- switch (order->type) {
- case OT_GOTO_DEPOT: return ::GetDepot(order->dest)->xy;
- case OT_GOTO_STATION: return ::GetStation(order->dest)->xy;
- case OT_GOTO_WAYPOINT: return ::GetWaypoint(order->dest)->xy;
+ switch (order->GetType()) {
+ case OT_GOTO_DEPOT: return ::GetDepot(order->GetDestination())->xy;
+ case OT_GOTO_STATION: return ::GetStation(order->GetDestination())->xy;
+ case OT_GOTO_WAYPOINT: return ::GetWaypoint(order->GetDestination())->xy;
default: return INVALID_TILE;
}
}
@@ -83,7 +83,23 @@
Order *order = ::GetVehicle(vehicle_id)->orders;
for (uint i = 0; i < order_id; i++) order = order->next;
- return (AIOrder::AIOrderFlags)order->flags;
+ AIOrderFlags order_flags= AIOF_NONE;
+ if (order->GetNonStopType() != OFB_NO_NON_STOP) order_flags |= AIOF_NON_STOP;
+ switch (order->GetType()) {
+ case OT_GOTO_DEPOT:
+ if (order->GetDepotOrderType() & OFB_SERVICE_IF_NEEDED) order_flags |= AIOF_SERVICE_IF_NEEDED;
+ break;
+
+ case OT_GOTO_STATION:
+ if (order->GetLoadType() & OFB_FULL_LOAD) order_flags |= AIOF_FULL_LOAD;
+ if (order->GetUnloadType() & OFB_UNLOAD) order_flags |= AIOF_UNLOAD;
+ if (order->GetUnloadType() & OFB_TRANSFER) order_flags |= AIOF_TRANSFER;
+ break;
+
+ default: break;
+ }
+
+ return order_flags;
}
/* static */ bool AIOrder::AppendOrder(VehicleID vehicle_id, TileIndex destination, AIOrderFlags order_flags)
@@ -99,16 +115,29 @@
!AreOrderFlagsValid(destination, order_flags)) return false;
Order order;
- order.type = ::GetOrderTypeByTile(destination);
- order.flags = order_flags;
- switch (order.type) {
- case OT_GOTO_DEPOT: order.dest = ::GetDepotByTile(destination)->index; break;
- case OT_GOTO_STATION: order.dest = ::GetStationIndex(destination); break;
- case OT_GOTO_WAYPOINT: order.dest = ::GetWaypointIndex(destination); break;
- default: NOT_REACHED(); return false;
+ switch (::GetOrderTypeByTile(destination)) {
+ case OT_GOTO_DEPOT:
+ order.MakeGoToDepot(::GetDepotByTile(destination)->index, true);
+ if (order_flags & AIOF_SERVICE_IF_NEEDED) order.SetDepotOrderType(OFB_SERVICE_IF_NEEDED);
+ break;
+
+ case OT_GOTO_STATION:
+ order.MakeGoToStation(::GetStationIndex(destination));
+ if (order_flags & AIOF_FULL_LOAD) order.SetLoadType(OFB_FULL_LOAD);
+ order.SetUnloadType(((order_flags & AIOF_TRANSFER) ? OFB_TRANSFER : 0) | ((order_flags & AIOF_UNLOAD) ? OFB_UNLOAD : 0));
+ break;
+
+ case OT_GOTO_WAYPOINT:
+ order.MakeGoToWaypoint(::GetWaypointIndex(destination));
+ break;
+
+ default:
+ return false;
}
- return AIObject::DoCommand(0, vehicle_id | (order_id << 16), PackOrder(&order), CMD_INSERT_ORDER);
+ if (order_flags & AIOF_NON_STOP) order.SetNonStopType(OFB_NON_STOP);
+
+ return AIObject::DoCommand(0, vehicle_id | (order_id << 16), order.Pack(), CMD_INSERT_ORDER);
}
/* static */ bool AIOrder::RemoveOrder(VehicleID vehicle_id, uint32 order_id)
--- a/src/ai/api/ai_stationlist.cpp Sun Apr 06 14:12:19 2008 +0000
+++ b/src/ai/api/ai_stationlist.cpp Sun Apr 06 23:07:42 2008 +0000
@@ -23,6 +23,6 @@
Vehicle *v = ::GetVehicle(vehicle_id);
for (Order *o = v->orders; o != NULL; o = o->next) {
- if (o->type == OT_GOTO_STATION) this->AddItem(o->dest);
+ if (o->IsType(OT_GOTO_STATION)) this->AddItem(o->GetDestination());
}
}
--- a/src/ai/api/ai_vehiclelist.cpp Sun Apr 06 14:12:19 2008 +0000
+++ b/src/ai/api/ai_vehiclelist.cpp Sun Apr 06 23:07:42 2008 +0000
@@ -26,7 +26,7 @@
const Order *order;
FOR_VEHICLE_ORDERS(v, order) {
- if (order->type == OT_GOTO_STATION && order->dest == station_id) {
+ if (order->IsType(OT_GOTO_STATION) && order->GetDestination() == station_id) {
this->AddItem(v->index);
break;
}
--- a/src/aircraft.h Sun Apr 06 14:12:19 2008 +0000
+++ b/src/aircraft.h Sun Apr 06 23:07:42 2008 +0000
@@ -126,6 +126,7 @@
bool IsInDepot() const { return (this->vehstatus & VS_HIDDEN) != 0 && IsHangarTile(this->tile); }
void Tick();
void OnNewDay();
+ TileIndex GetOrderStationLocation(StationID station);
};
#endif /* AIRCRAFT_H */
--- a/src/aircraft_cmd.cpp Sun Apr 06 14:12:19 2008 +0000
+++ b/src/aircraft_cmd.cpp Sun Apr 06 23:07:42 2008 +0000
@@ -55,17 +55,17 @@
case FLYING: x = MKIT(24, 24, -1, -1); break;
default: x = MKIT( 2, 2, -1, -1); break;
}
- this->z_height = 5;
+ this->z_extent = 5;
break;
- case AIR_SHADOW: this->z_height = 1; x = MKIT(2, 2, 0, 0); break;
- case AIR_ROTOR: this->z_height = 1; x = MKIT(2, 2, -1, -1); break;
+ case AIR_SHADOW: this->z_extent = 1; x = MKIT(2, 2, 0, 0); break;
+ case AIR_ROTOR: this->z_extent = 1; x = MKIT(2, 2, -1, -1); break;
}
#undef MKIT
this->x_offs = GB(x, 0, 8);
this->y_offs = GB(x, 8, 8);
- this->sprite_width = GB(x, 16, 8);
- this->sprite_height = GB(x, 24, 8);
+ this->x_extent = GB(x, 16, 8);
+ this->y_extent = GB(x, 24, 8);
}
@@ -570,14 +570,15 @@
if (v->type != VEH_AIRCRAFT || !CheckOwnership(v->owner) || v->IsInDepot()) return CMD_ERROR;
- if (v->current_order.type == OT_GOTO_DEPOT && !(p2 & DEPOT_LOCATE_HANGAR)) {
- if (!!(p2 & DEPOT_SERVICE) == HasBit(v->current_order.flags, OF_HALT_IN_DEPOT)) {
+ if (v->current_order.IsType(OT_GOTO_DEPOT) && !(p2 & DEPOT_LOCATE_HANGAR)) {
+ bool halt_in_depot = HasBit(v->current_order.GetDepotActionType(), OF_HALT_IN_DEPOT);
+ if (!!(p2 & DEPOT_SERVICE) == halt_in_depot) {
/* We called with a different DEPOT_SERVICE setting.
* Now we change the setting to apply the new one and let the vehicle head for the same hangar.
* Note: the if is (true for requesting service == true for ordered to stop in hangar) */
if (flags & DC_EXEC) {
- ClrBit(v->current_order.flags, OF_PART_OF_ORDERS);
- ToggleBit(v->current_order.flags, OF_HALT_IN_DEPOT);
+ v->current_order.SetDepotOrderType(OFB_MANUAL_ORDER);
+ v->current_order.SetDepotActionType(halt_in_depot ? OFB_NORMAL_ACTION : OFB_HALT_IN_DEPOT);
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
}
return CommandCost();
@@ -585,9 +586,11 @@
if (p2 & DEPOT_DONT_CANCEL) return CMD_ERROR; // Requested no cancelation of hangar orders
if (flags & DC_EXEC) {
- if (v->current_order.flags & OFB_UNLOAD) v->cur_order_index++;
- v->current_order.type = OT_DUMMY;
- v->current_order.flags = 0;
+ /* If the orders to 'goto depot' are in the orders list (forced servicing),
+ * then skip to the next order; effectively cancelling this forced service */
+ if (v->current_order.GetDepotOrderType() & OFB_PART_OF_ORDERS) v->cur_order_index++;
+
+ v->current_order.MakeDummy();
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
}
} else {
@@ -605,13 +608,10 @@
}
if (flags & DC_EXEC) {
- if (v->current_order.type == OT_LOADING) v->LeaveStation();
+ if (v->current_order.IsType(OT_LOADING)) v->LeaveStation();
- v->current_order.type = OT_GOTO_DEPOT;
- v->current_order.flags = OFB_NON_STOP;
- if (!(p2 & DEPOT_SERVICE)) SetBit(v->current_order.flags, OF_HALT_IN_DEPOT);
- v->current_order.refit_cargo = CT_INVALID;
- v->current_order.dest = next_airport_index;
+ v->current_order.MakeGoToDepot(next_airport_index, false);
+ if (!(p2 & DEPOT_SERVICE)) v->current_order.SetDepotActionType(OFB_HALT_IN_DEPOT);
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
if (v->u.air.state == FLYING && !next_airport_has_hangar) {
/* The aircraft is now heading for a different hangar than the next in the orders */
@@ -710,17 +710,15 @@
return;
}
- const Station *st = GetStation(v->current_order.dest);
+ const Station *st = GetStation(v->current_order.GetDestination());
/* only goto depot if the target airport has terminals (eg. it is airport) */
if (st->IsValid() && st->airport_tile != 0 && st->Airport()->terminals != NULL) {
// printf("targetairport = %d, st->index = %d\n", v->u.air.targetairport, st->index);
// v->u.air.targetairport = st->index;
- v->current_order.type = OT_GOTO_DEPOT;
- v->current_order.flags = OFB_NON_STOP;
+ v->current_order.MakeGoToDepot(0, false);
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
- } else if (v->current_order.type == OT_GOTO_DEPOT) {
- v->current_order.type = OT_DUMMY;
- v->current_order.flags = 0;
+ } else if (v->current_order.IsType(OT_GOTO_DEPOT)) {
+ v->current_order.MakeDummy();
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
}
}
@@ -781,7 +779,7 @@
/* if true, helicopter rotors do not rotate. This should only be the case if a helicopter is
* loading/unloading at a terminal or stopped */
- if (v->current_order.type == OT_LOADING || (v->vehstatus & VS_STOPPED)) {
+ if (v->current_order.IsType(OT_LOADING) || (v->vehstatus & VS_STOPPED)) {
if (u->cur_speed != 0) {
u->cur_speed++;
if (u->cur_speed >= 0x80 && u->u.air.state == HRS_ROTOR_MOVING_3) {
@@ -1061,7 +1059,7 @@
/* Jump into our "holding pattern" state machine if possible */
if (v->u.air.pos >= afc->nofelements) {
v->u.air.pos = v->u.air.previous_pos = AircraftGetEntryPoint(v, afc);
- } else if (v->u.air.targetairport != v->current_order.dest) {
+ } else if (v->u.air.targetairport != v->current_order.GetDestination()) {
/* If not possible, just get out of here fast */
v->u.air.state = FLYING;
UpdateAircraftCache(v);
@@ -1362,74 +1360,48 @@
}
}
-static void ProcessAircraftOrder(Vehicle *v)
+void HandleMissingAircraftOrders(Vehicle *v)
{
- switch (v->current_order.type) {
- case OT_GOTO_DEPOT:
- if (!(v->current_order.flags & OFB_PART_OF_ORDERS)) return;
- if (v->current_order.flags & OFB_SERVICE_IF_NEEDED &&
- !VehicleNeedsService(v)) {
- UpdateVehicleTimetable(v, true);
- v->cur_order_index++;
- }
- break;
+ /*
+ * We do not have an order. This can be divided into two cases:
+ * 1) we are heading to an invalid station. In this case we must
+ * find another airport to go to. If there is nowhere to go,
+ * we will destroy the aircraft as it otherwise will enter
+ * the holding pattern for the first airport, which can cause
+ * the plane to go into an undefined state when building an
+ * airport with the same StationID.
+ * 2) we are (still) heading to a (still) valid airport, then we
+ * can continue going there. This can happen when you are
+ * changing the aircraft's orders while in-flight or in for
+ * example a depot. However, when we have a current order to
+ * go to a depot, we have to keep that order so the aircraft
+ * actually stops.
+ */
+ const Station *st = GetStation(v->u.air.targetairport);
+ if (!st->IsValid() || st->airport_tile == 0) {
+ CommandCost ret;
+ PlayerID old_player = _current_player;
- case OT_LOADING: return;
+ _current_player = v->owner;
+ ret = DoCommand(v->tile, v->index, 0, DC_EXEC, CMD_SEND_AIRCRAFT_TO_HANGAR);
+ _current_player = old_player;
- default: break;
+ if (CmdFailed(ret)) CrashAirplane(v);
+ } else if (!v->current_order.IsType(OT_GOTO_DEPOT)) {
+ v->current_order.Free();
+ }
+}
+
+
+TileIndex Aircraft::GetOrderStationLocation(StationID station)
+{
+ /* Orders are changed in flight, ensure going to the right station. */
+ if (this->u.air.state == FLYING) {
+ AircraftNextAirportPos_and_Order(this);
}
- if (v->cur_order_index >= v->num_orders) v->cur_order_index = 0;
-
- const Order *order = GetVehicleOrder(v, v->cur_order_index);
-
- if (order == NULL|| (order->type == OT_DUMMY && !CheckForValidOrders(v))) {
- /*
- * We do not have an order. This can be divided into two cases:
- * 1) we are heading to an invalid station. In this case we must
- * find another airport to go to. If there is nowhere to go,
- * we will destroy the aircraft as it otherwise will enter
- * the holding pattern for the first airport, which can cause
- * the plane to go into an undefined state when building an
- * airport with the same StationID.
- * 2) we are (still) heading to a (still) valid airport, then we
- * can continue going there. This can happen when you are
- * changing the aircraft's orders while in-flight or in for
- * example a depot. However, when we have a current order to
- * go to a depot, we have to keep that order so the aircraft
- * actually stops.
- */
- const Station *st = GetStation(v->u.air.targetairport);
- if (!st->IsValid() || st->airport_tile == 0) {
- CommandCost ret;
- PlayerID old_player = _current_player;
-
- _current_player = v->owner;
- ret = DoCommand(v->tile, v->index, 0, DC_EXEC, CMD_SEND_AIRCRAFT_TO_HANGAR);
- _current_player = old_player;
-
- if (CmdFailed(ret)) CrashAirplane(v);
- } else if (v->current_order.type != OT_GOTO_DEPOT) {
- v->current_order.Free();
- }
- return;
- }
-
- if (order->type == v->current_order.type &&
- order->flags == v->current_order.flags &&
- order->dest == v->current_order.dest)
- return;
-
- v->current_order = *order;
-
- /* orders are changed in flight, ensure going to the right station */
- if (order->type == OT_GOTO_STATION && v->u.air.state == FLYING) {
- AircraftNextAirportPos_and_Order(v);
- }
-
- InvalidateVehicleOrder(v);
-
- InvalidateWindowClasses(WC_AIRCRAFT_LIST);
+ /* Aircraft do not use dest-tile */
+ return 0;
}
void Aircraft::MarkDirty()
@@ -1500,7 +1472,7 @@
/** we've landed and just arrived at a terminal */
static void AircraftEntersTerminal(Vehicle *v)
{
- if (v->current_order.type == OT_GOTO_DEPOT) return;
+ if (v->current_order.IsType(OT_GOTO_DEPOT)) return;
Station *st = GetStation(v->u.air.targetairport);
v->last_station_visited = v->u.air.targetairport;
@@ -1534,9 +1506,9 @@
/** set the right pos when heading to other airports after takeoff */
static void AircraftNextAirportPos_and_Order(Vehicle *v)
{
- if (v->current_order.type == OT_GOTO_STATION ||
- v->current_order.type == OT_GOTO_DEPOT)
- v->u.air.targetairport = v->current_order.dest;
+ if (v->current_order.IsType(OT_GOTO_STATION) ||
+ v->current_order.IsType(OT_GOTO_DEPOT))
+ v->u.air.targetairport = v->current_order.GetDestination();
const AirportFTAClass *apc = GetStation(v->u.air.targetairport)->Airport();
v->u.air.pos = v->u.air.previous_pos = AircraftGetEntryPoint(v, apc);
@@ -1632,20 +1604,20 @@
}
/* if we were sent to the depot, stay there */
- if (v->current_order.type == OT_GOTO_DEPOT && (v->vehstatus & VS_STOPPED)) {
+ if (v->current_order.IsType(OT_GOTO_DEPOT) && (v->vehstatus & VS_STOPPED)) {
v->current_order.Free();
return;
}
- if (v->current_order.type != OT_GOTO_STATION &&
- v->current_order.type != OT_GOTO_DEPOT)
+ if (!v->current_order.IsType(OT_GOTO_STATION) &&
+ !v->current_order.IsType(OT_GOTO_DEPOT))
return;
/* if the block of the next position is busy, stay put */
if (AirportHasBlock(v, &apc->layout[v->u.air.pos], apc)) return;
/* We are already at the target airport, we need to find a terminal */
- if (v->current_order.dest == v->u.air.targetairport) {
+ if (v->current_order.GetDestination() == v->u.air.targetairport) {
/* FindFreeTerminal:
* 1. Find a free terminal, 2. Occupy it, 3. Set the vehicle's state to that terminal */
if (v->subtype == AIR_HELICOPTER) {
@@ -1689,13 +1661,13 @@
/* airport-road is free. We either have to go to another airport, or to the hangar
* ---> start moving */
- switch (v->current_order.type) {
+ switch (v->current_order.GetType()) {
case OT_GOTO_STATION: // ready to fly to another airport
/* airplane goto state takeoff, helicopter to helitakeoff */
v->u.air.state = (v->subtype == AIR_HELICOPTER) ? HELITAKEOFF : TAKEOFF;
break;
case OT_GOTO_DEPOT: // visit hangar for serivicing, sale, etc.
- if (v->current_order.dest == v->u.air.targetairport) {
+ if (v->current_order.GetDestination() == v->u.air.targetairport) {
v->u.air.state = HANGAR;
} else {
v->u.air.state = (v->subtype == AIR_HELICOPTER) ? HELITAKEOFF : TAKEOFF;
@@ -1815,7 +1787,7 @@
* 1. in case all terminals are busy AirportFindFreeTerminal() returns false or
* 2. not going for terminal (but depot, no order),
* --> get out of the way to the hangar. */
- if (v->current_order.type == OT_GOTO_STATION) {
+ if (v->current_order.IsType(OT_GOTO_STATION)) {
if (AirportFindFreeTerminal(v, apc)) return;
}
v->u.air.state = HANGAR;
@@ -1834,7 +1806,7 @@
* --> else TAKEOFF
* the reason behind this is that if an airport has a terminal, it also has a hangar. Airplanes
* must go to a hangar. */
- if (v->current_order.type == OT_GOTO_STATION) {
+ if (v->current_order.IsType(OT_GOTO_STATION)) {
if (AirportFindFreeHelipad(v, apc)) return;
}
v->u.air.state = (apc->nof_depots != 0) ? HANGAR : HELITAKEOFF;
@@ -2152,10 +2124,10 @@
}
HandleAircraftSmoke(v);
- ProcessAircraftOrder(v);
+ ProcessOrders(v);
v->HandleLoading(loop != 0);
- if (v->current_order.type >= OT_LOADING) return;
+ if (v->current_order.IsType(OT_LOADING) || v->current_order.IsType(OT_LEAVESTATION)) return;
AirportGoToNextPosition(v);
}
--- a/src/airport_gui.cpp Sun Apr 06 14:12:19 2008 +0000
+++ b/src/airport_gui.cpp Sun Apr 06 23:07:42 2008 +0000
@@ -186,8 +186,9 @@
DrawWindowWidgets(w);
// strings such as 'Size' and 'Coverage Area'
// 'Coverage Area'
- int text_end = DrawStationCoverageAreaText(2, 206, SCT_ALL, rad) + 4;
- if (text_end > w->widget[6].bottom) {
+ int text_end = DrawStationCoverageAreaText(2, 206, SCT_ALL, rad, false);
+ text_end = DrawStationCoverageAreaText(2, text_end + 4, SCT_ALL, rad, true) + 4;
+ if (text_end != w->widget[6].bottom) {
SetWindowDirty(w);
ResizeWindowForWidget(w, 6, 0, text_end - w->widget[6].bottom);
SetWindowDirty(w);
--- a/src/autoreplace_cmd.cpp Sun Apr 06 14:12:19 2008 +0000
+++ b/src/autoreplace_cmd.cpp Sun Apr 06 23:07:42 2008 +0000
@@ -71,9 +71,9 @@
}
FOR_VEHICLE_ORDERS(u, o) {
- if (!(o->refit_cargo < NUM_CARGO)) continue;
- if (!CanRefitTo(v->engine_type, o->refit_cargo)) continue;
- if (!CanRefitTo(engine_type, o->refit_cargo)) return false;
+ if (!o->IsRefit()) continue;
+ if (!CanRefitTo(v->engine_type, o->GetRefitCargo())) continue;
+ if (!CanRefitTo(engine_type, o->GetRefitCargo())) return false;
}
return true;
--- a/src/command.cpp Sun Apr 06 14:12:19 2008 +0000
+++ b/src/command.cpp Sun Apr 06 23:07:42 2008 +0000
@@ -668,52 +668,3 @@
ClearStorageChanges(false);
return false;
}
-
-
-CommandCost CommandCost::AddCost(CommandCost ret)
-{
- this->AddCost(ret.cost);
- if (this->success && !ret.success) {
- this->message = ret.message;
- this->success = false;
- }
- return *this;
-}
-
-CommandCost CommandCost::AddCost(Money cost)
-{
- this->cost += cost;
- return *this;
-}
-
-CommandCost CommandCost::MultiplyCost(int factor)
-{
- this->cost *= factor;
- return *this;
-}
-
-Money CommandCost::GetCost() const
-{
- return this->cost;
-}
-
-ExpensesType CommandCost::GetExpensesType() const
-{
- return this->expense_type;
-}
-
-void CommandCost::SetGlobalErrorMessage() const
-{
- extern StringID _error_message;
- if (this->message != INVALID_STRING_ID) _error_message = this->message;
-}
-
-bool CommandCost::Succeeded() const
-{
- return this->success;
-}
-
-bool CommandCost::Failed() const
-{
- return !this->success;
-}
--- a/src/command_type.h Sun Apr 06 14:12:19 2008 +0000
+++ b/src/command_type.h Sun Apr 06 23:07:42 2008 +0000
@@ -49,50 +49,82 @@
* @param ret the command to add the cost of.
* @return this class.
*/
- CommandCost AddCost(CommandCost ret);
+ CommandCost AddCost(CommandCost ret)
+ {
+ this->AddCost(ret.cost);
+ if (this->success && !ret.success) {
+ this->message = ret.message;
+ this->success = false;
+ }
+ return *this;
+ }
/**
* Adds the given cost to the cost of the command.
* @param cost the cost to add
* @return this class.
*/
- CommandCost AddCost(Money cost);
+ CommandCost AddCost(Money cost)
+ {
+ this->cost += cost;
+ return *this;
+ }
/**
* Multiplies the cost of the command by the given factor.
* @param cost factor to multiply the costs with
* @return this class
*/
- CommandCost MultiplyCost(int factor);
+ CommandCost MultiplyCost(int factor)
+ {
+ this->cost *= factor;
+ return *this;
+ }
/**
* The costs as made up to this moment
* @return the costs
*/
- Money GetCost() const;
+ Money GetCost() const
+ {
+ return this->cost;
+ }
/**
* The expense type of the cost
* @return the expense type
*/
- ExpensesType GetExpensesType() const;
+ ExpensesType GetExpensesType() const
+ {
+ return this->expense_type;
+ }
/**
* Sets the global error message *if* this class has one.
*/
- void SetGlobalErrorMessage() const;
+ void SetGlobalErrorMessage() const
+ {
+ extern StringID _error_message;
+ if (this->message != INVALID_STRING_ID) _error_message = this->message;
+ }
/**
* Did this command succeed?
* @return true if and only if it succeeded
*/
- bool Succeeded() const;
+ bool Succeeded() const
+ {
+ return this->success;
+ }
/**
* Did this command fail?
* @return true if and only if it failed
*/
- bool Failed() const;
+ bool Failed() const
+ {
+ return !this->success;
+ }
};
/**
--- a/src/core/alloc_func.hpp Sun Apr 06 14:12:19 2008 +0000
+++ b/src/core/alloc_func.hpp Sun Apr 06 23:07:42 2008 +0000
@@ -107,9 +107,11 @@
#else
/** Storing it on the heap */
T *data;
+ /** The length (in elements) of data in this allocator. */
+ size_t len;
/** Allocating the memory */
- SmallStackSafeStackAlloc() : data(MallocT<T>(length)) {}
+ SmallStackSafeStackAlloc() : data(MallocT<T>(length)), len(length) {}
/** And freeing when it goes out of scope */
~SmallStackSafeStackAlloc() { free(data); }
#endif
@@ -118,7 +120,26 @@
* Gets a pointer to the data stored in this wrapper.
* @return the pointer.
*/
- operator T* () { return data; }
+ inline operator T* () { return data; }
+
+ /**
+ * Gets a pointer to the data stored in this wrapper.
+ * @return the pointer.
+ */
+ inline T* operator -> () { return data; }
+
+ /**
+ * Gets a pointer to the last data element stored in this wrapper.
+ * @note needed because endof does not work properly for pointers.
+ * @return the 'endof' pointer.
+ */
+ inline T* EndOf() {
+#if !defined(__NDS__)
+ return endof(data);
+#else
+ return &data[len];
+#endif
+ }
};
#endif /* ALLOC_FUNC_HPP */
--- a/src/core/math_func.hpp Sun Apr 06 14:12:19 2008 +0000
+++ b/src/core/math_func.hpp Sun Apr 06 23:07:42 2008 +0000
@@ -163,8 +163,8 @@
*/
static inline int32 ClampToI32(const int64 a)
{
- if (a <= (int32)0x80000000) return 0x80000000;
- if (a >= (int32)0x7FFFFFFF) return 0x7FFFFFFF;
+ if (a <= INT32_MIN) return INT32_MIN;
+ if (a >= INT32_MAX) return INT32_MAX;
return (int32)a;
}
@@ -177,7 +177,7 @@
*/
static inline uint16 ClampToU16(const uint64 a)
{
- return min(a, 0xFFFF);
+ return (uint16)(a <= UINT16_MAX ? a : UINT16_MAX);
}
/**
--- a/src/core/random_func.cpp Sun Apr 06 14:12:19 2008 +0000
+++ b/src/core/random_func.cpp Sun Apr 06 23:07:42 2008 +0000
@@ -28,101 +28,6 @@
this->state[1] = seed;
}
-#ifdef MERSENNE_TWISTER
-// Source code for Mersenne Twister.
-// A Random number generator with much higher quality random numbers.
-
-#define N (624) // length of _mt_state vector
-#define M (397) // a period parameter
-#define K (0x9908B0DFU) // a magic constant
-#define hiBit(u) ((u) & 0x80000000U) // mask all but highest bit of u
-#define loBit(u) ((u) & 0x00000001U) // mask all but lowest bit of u
-#define loBits(u) ((u) & 0x7FFFFFFFU) // mask the highest bit of u
-#define mixBits(u, v) (hiBit(u)|loBits(v)) // move hi bit of u to hi bit of v
-
-static uint32 _mt_state[N+1]; // _mt_state vector + 1 extra to not violate ANSI C
-static uint32 *_mt_next; // _mt_next random value is computed from here
-static int _mt_left = -1; // can *_mt_next++ this many times before reloading
-
-void SetRandomSeed(register uint32 seed)
-{
- register uint32 *s = _mt_state;
- _mt_left = 0;
-
- seed |= 1U;
- seed &= 0xFFFFFFFFU;
-
- *s = seed;
-
- for (register uint i = N; i != 0; i--) {
- seed *= 69069U;
- *s++;
- *s = seed & 0xFFFFFFFFU;
- }
-}
-
-static uint32 ReloadRandom()
-{
- if (_mt_left < -1) SetRandomSeed(4357U);
-
- _mt_left = N - 1;
- _mt_next = _mt_state + 1;
-
- register uint32 *p0 = _mt_state;
- register uint32 *p2 = _mt_state + 2;
- register uint32 *pM = _mt_state + M;
-
- register uint32 s0 = _mt_state[0];
- register uint32 s1 = _mt_state[1];
-
- register uint i = 0;
-
- for (i = (N - M + 1); i != 0; i--) {
- s0 = s1;
- s1 = *p2;
- *p0 = *pM ^ (mixBits(s0, s1) >> 1) ^ (loBit(s1) ? K : 0U);
- *p0++;
- *p2++;
- *pM++;
- }
-
- pM = _mt_state;
-
- for (i = M; i != 0; i--) {
- s0 = s1;
- s1 = *p2;
- *p0 = *pM ^ (mixBits(s0, s1) >> 1) ^ (loBit(s1) ? K : 0U);
- *p0++;
- *p2++;
- *pM++;
- }
-
- s1 = _mt_state[0];
- *p0 = *pM ^ (mixBits(s0, s1) >> 1) ^ (loBit(s1) ? K : 0U);
-
- s1 ^= (s1 >> 11);
- s1 ^= (s1 << 7) & 0x9D2C5680U;
- s1 ^= (s1 << 15) & 0xEFC60000U;
- s1 ^= (s1 >> 18);
- return s1;
-}
-
-uint32 Random()
-{
- _mt_left--;
- if (_mt_left < 0) return ReloadRandom();
-
- uint32 y = *_mt_next;
- *_mt_next++;
-
- y ^= (y >> 11);
- y ^= (y << 7) & 0x9D2C5680U;
- y ^= (y << 15) & 0xEFC60000U;
- y ^= (y >> 18);
- return y;
-}
-
-#else /* MERSENNE_TWISTER */
void SetRandomSeed(uint32 seed)
{
_random.SetSeed(seed);
@@ -142,12 +47,9 @@
return _random.Next();
}
-#endif /* RANDOM_DEBUG */
-#endif /* MERSENNE_TWISTER */
-#if defined(RANDOM_DEBUG) && !defined(MERSENNE_TWISTER)
uint DoRandomRange(uint max, int line, const char *file)
{
return GB(DoRandom(line, file), 0, 16) * max >> 16;
}
-#endif /* RANDOM_DEBUG & !MERSENNE_TWISTER */
+#endif /* RANDOM_DEBUG */
--- a/src/core/random_func.hpp Sun Apr 06 14:12:19 2008 +0000
+++ b/src/core/random_func.hpp Sun Apr 06 23:07:42 2008 +0000
@@ -23,10 +23,6 @@
//#define RANDOM_DEBUG
-// Enable this to produce higher quality random numbers.
-// Doesn't work with network yet.
-// #define MERSENNE_TWISTER
-
/**
* Structure to encapsulate the pseudo random number generators.
*/
--- a/src/date.cpp Sun Apr 06 14:12:19 2008 +0000
+++ b/src/date.cpp Sun Apr 06 23:07:42 2008 +0000
@@ -15,6 +15,7 @@
#include "date_func.h"
#include "vehicle_base.h"
#include "debug.h"
+#include "rail_gui.h"
#ifdef DEBUG_DUMP_COMMANDS
#include "saveload.h"
#endif
@@ -282,6 +283,8 @@
ShipsYearlyLoop();
if (_network_server) NetworkServerYearlyLoop();
+ if (_cur_year == _patches.semaphore_build_before) ResetSignalVariant();
+
/* check if we reached end of the game */
if (_cur_year == _patches.ending_year) {
ShowEndGameChart();
--- a/src/depot_gui.cpp Sun Apr 06 14:12:19 2008 +0000
+++ b/src/depot_gui.cpp Sun Apr 06 23:07:42 2008 +0000
@@ -441,6 +441,7 @@
WP(w, depot_d).sel = v->index;
SetWindowDirty(w);
SetObjectToPlaceWnd(image, GetVehiclePalette(v), VHM_DRAG, w);
+ _cursor.vehchain = _ctrl_pressed;
}
}
break;
@@ -957,6 +958,7 @@
WP(w, depot_d).sel = INVALID_VEHICLE;
SetWindowDirty(w);
}
+ _cursor.vehchain = false;
break;
case WE_RESIZE:
@@ -965,6 +967,13 @@
w->widget[DEPOT_WIDGET_MATRIX].data = (w->vscroll.cap << 8) + (WP(w, depot_d).type == VEH_TRAIN ? 1 : w->hscroll.cap);
ResizeDepotButtons(w);
break;
+
+ case WE_CTRL_CHANGED:
+ if (WP(w, depot_d).sel != INVALID_VEHICLE) {
+ _cursor.vehchain = _ctrl_pressed;
+ w->InvalidateWidget(DEPOT_WIDGET_MATRIX);
+ }
+ break;
}
}
--- a/src/disaster_cmd.cpp Sun Apr 06 14:12:19 2008 +0000
+++ b/src/disaster_cmd.cpp Sun Apr 06 23:07:42 2008 +0000
@@ -206,29 +206,29 @@
v->tick_counter++;
- if (v->current_order.dest < 2) {
+ if (v->current_order.GetDestination() < 2) {
if (HasBit(v->tick_counter, 0)) return;
GetNewVehiclePosResult gp = GetNewVehiclePos(v);
SetDisasterVehiclePos(v, gp.x, gp.y, v->z_pos);
- if (v->current_order.dest == 1) {
+ if (v->current_order.GetDestination() == 1) {
if (++v->age == 38) {
- v->current_order.dest = 2;
+ v->current_order.SetDestination(2);
v->age = 0;
}
if (GB(v->tick_counter, 0, 3) == 0) CreateEffectVehicleRel(v, 0, -17, 2, EV_SMOKE);
- } else if (v->current_order.dest == 0) {
+ } else if (v->current_order.GetDestination() == 0) {
tile = v->tile;
if (IsValidTile(tile) &&
IsTileType(tile, MP_STATION) &&
IsAirport(tile) &&
IsHumanPlayer(GetTileOwner(tile))) {
- v->current_order.dest = 1;
+ v->current_order.SetDestination(1);
v->age = 0;
SetDParam(0, GetStationIndex(tile));
@@ -243,7 +243,7 @@
return;
}
- if (v->current_order.dest > 2) {
+ if (v->current_order.GetDestination() > 2) {
if (++v->age <= 13320) return;
tile = v->tile;
@@ -284,7 +284,7 @@
EV_EXPLOSION_SMALL);
}
} else if (v->age == 350) {
- v->current_order.dest = 3;
+ v->current_order.SetDestination(3);
v->age = 0;
}
@@ -312,7 +312,7 @@
v->u.disaster.image_override = (HasBit(++v->tick_counter, 3)) ? SPR_UFO_SMALL_SCOUT_DARKER : SPR_UFO_SMALL_SCOUT;
- if (v->current_order.dest == 0) {
+ if (v->current_order.GetDestination() == 0) {
/* Fly around randomly */
int x = TileX(v->dest_tile) * TILE_SIZE;
int y = TileY(v->dest_tile) * TILE_SIZE;
@@ -326,7 +326,7 @@
v->dest_tile = RandomTile();
return;
}
- v->current_order.dest = 1;
+ v->current_order.SetDestination(1);
FOR_ALL_VEHICLES(u) {
if (u->type == VEH_ROAD && IsHumanPlayer(u->owner)) {
@@ -405,7 +405,7 @@
{
v->tick_counter++;
v->u.disaster.image_override =
- (v->current_order.dest == 1 && HasBit(v->tick_counter, 2)) ? SPR_F_15_FIRING : 0;
+ (v->current_order.GetDestination() == 1 && HasBit(v->tick_counter, 2)) ? SPR_F_15_FIRING : 0;
GetNewVehiclePosResult gp = GetNewVehiclePos(v);
SetDisasterVehiclePos(v, gp.x, gp.y, v->z_pos);
@@ -415,7 +415,7 @@
return;
}
- if (v->current_order.dest == 2) {
+ if (v->current_order.GetDestination() == 2) {
if (GB(v->tick_counter, 0, 2) == 0) {
Industry *i = GetIndustry(v->dest_tile);
int x = TileX(i->xy) * TILE_SIZE;
@@ -428,13 +428,13 @@
GB(r, 12, 4),
EV_EXPLOSION_SMALL);
- if (++v->age >= 55) v->current_order.dest = 3;
+ if (++v->age >= 55) v->current_order.SetDestination(3);
}
- } else if (v->current_order.dest == 1) {
+ } else if (v->current_order.GetDestination() == 1) {
if (++v->age == 112) {
Industry *i;
- v->current_order.dest = 2;
+ v->current_order.SetDestination(2);
v->age = 0;
i = GetIndustry(v->dest_tile);
@@ -444,7 +444,7 @@
AddNewsItem(STR_B002_OIL_REFINERY_EXPLOSION, NM_THIN, NF_VIEWPORT | NF_TILE, NT_ACCIDENT, DNC_NONE, i->xy, 0);
SndPlayTileFx(SND_12_EXPLOSION, i->xy);
}
- } else if (v->current_order.dest == 0) {
+ } else if (v->current_order.GetDestination() == 0) {
int x, y;
TileIndex tile;
uint ind;
@@ -461,7 +461,7 @@
v->dest_tile = ind;
if (GetIndustrySpec(GetIndustry(ind)->type)->behaviour & INDUSTRYBEH_AIRPLANE_ATTACKS) {
- v->current_order.dest = 1;
+ v->current_order.SetDestination(1);
v->age = 0;
}
}
@@ -478,7 +478,7 @@
{
v->tick_counter++;
v->u.disaster.image_override =
- (v->current_order.dest == 1 && HasBit(v->tick_counter, 2)) ? SPR_AH_64A_FIRING : 0;
+ (v->current_order.GetDestination() == 1 && HasBit(v->tick_counter, 2)) ? SPR_AH_64A_FIRING : 0;
GetNewVehiclePosResult gp = GetNewVehiclePos(v);
SetDisasterVehiclePos(v, gp.x, gp.y, v->z_pos);
@@ -488,7 +488,7 @@
return;
}
- if (v->current_order.dest == 2) {
+ if (v->current_order.GetDestination() == 2) {
if (GB(v->tick_counter, 0, 2) == 0) {
Industry *i = GetIndustry(v->dest_tile);
int x = TileX(i->xy) * TILE_SIZE;
@@ -501,13 +501,13 @@
GB(r, 12, 4),
EV_EXPLOSION_SMALL);
- if (++v->age >= 55) v->current_order.dest = 3;
+ if (++v->age >= 55) v->current_order.SetDestination(3);
}
- } else if (v->current_order.dest == 1) {
+ } else if (v->current_order.GetDestination() == 1) {
if (++v->age == 112) {
Industry *i;
- v->current_order.dest = 2;
+ v->current_order.SetDestination(2);
v->age = 0;
i = GetIndustry(v->dest_tile);
@@ -517,7 +517,7 @@
AddNewsItem(STR_B003_FACTORY_DESTROYED_IN_SUSPICIOUS, NM_THIN, NF_VIEWPORT | NF_TILE, NT_ACCIDENT, DNC_NONE, i->xy, 0);
SndPlayTileFx(SND_12_EXPLOSION, i->xy);
}
- } else if (v->current_order.dest == 0) {
+ } else if (v->current_order.GetDestination() == 0) {
int x, y;
TileIndex tile;
uint ind;
@@ -534,7 +534,7 @@
v->dest_tile = ind;
if (GetIndustrySpec(GetIndustry(ind)->type)->behaviour & INDUSTRYBEH_CHOPPER_ATTACKS) {
- v->current_order.dest = 1;
+ v->current_order.SetDestination(1);
v->age = 0;
}
}
@@ -568,7 +568,7 @@
v->tick_counter++;
- if (v->current_order.dest == 1) {
+ if (v->current_order.GetDestination() == 1) {
int x = TileX(v->dest_tile) * TILE_SIZE + TILE_SIZE / 2;
int y = TileY(v->dest_tile) * TILE_SIZE + TILE_SIZE / 2;
if (Delta(v->x_pos, x) + Delta(v->y_pos, y) >= 8) {
@@ -585,7 +585,7 @@
return;
}
- v->current_order.dest = 2;
+ v->current_order.SetDestination(2);
FOR_ALL_VEHICLES(u) {
if (u->type == VEH_TRAIN || u->type == VEH_ROAD) {
@@ -618,7 +618,7 @@
u->SetNext(w);
InitializeDisasterVehicle(w, -6 * TILE_SIZE, v->y_pos, 0, DIR_SW, ST_Big_Ufo_Destroyer_Shadow);
w->vehstatus |= VS_SHADOW;
- } else if (v->current_order.dest == 0) {
+ } else if (v->current_order.GetDestination() == 0) {
int x = TileX(v->dest_tile) * TILE_SIZE;
int y = TileY(v->dest_tile) * TILE_SIZE;
if (Delta(x, v->x_pos) + Delta(y, v->y_pos) >= TILE_SIZE) {
@@ -632,7 +632,7 @@
v->dest_tile = RandomTile();
return;
}
- v->current_order.dest = 1;
+ v->current_order.SetDestination(1);
tile_org = tile = RandomTile();
do {
@@ -669,10 +669,10 @@
return;
}
- if (v->current_order.dest == 0) {
+ if (v->current_order.GetDestination() == 0) {
u = GetVehicle(v->u.disaster.big_ufo_destroyer_target);
if (Delta(v->x_pos, u->x_pos) > TILE_SIZE) return;
- v->current_order.dest = 1;
+ v->current_order.SetDestination(1);
CreateEffectVehicleRel(u, 0, 7, 8, EV_EXPLOSION_LARGE);
SndPlayVehicleFx(SND_12_EXPLOSION, u);
@@ -1061,7 +1061,7 @@
{
this->x_offs = -1;
this->y_offs = -1;
- this->sprite_width = 2;
- this->sprite_height = 2;
- this->z_height = 5;
+ this->x_extent = 2;
+ this->y_extent = 2;
+ this->z_extent = 5;
}
--- a/src/dock_gui.cpp Sun Apr 06 14:12:19 2008 +0000
+++ b/src/dock_gui.cpp Sun Apr 06 23:07:42 2008 +0000
@@ -254,8 +254,9 @@
SetTileSelectSize(1, 1);
}
- int text_end = DrawStationCoverageAreaText(4, 50, SCT_ALL, rad) + 4;
- if (text_end > w->widget[2].bottom) {
+ int text_end = DrawStationCoverageAreaText(4, 50, SCT_ALL, rad, false);
+ text_end = DrawStationCoverageAreaText(4, text_end + 4, SCT_ALL, rad, true) + 4;
+ if (text_end != w->widget[2].bottom) {
SetWindowDirty(w);
ResizeWindowForWidget(w, 2, 0, text_end - w->widget[2].bottom);
SetWindowDirty(w);
--- a/src/driver.cpp Sun Apr 06 14:12:19 2008 +0000
+++ b/src/driver.cpp Sun Apr 06 23:07:42 2008 +0000
@@ -53,3 +53,137 @@
const char* p = GetDriverParam(parm, name);
return p != NULL ? atoi(p) : def;
}
+
+/**
+ * Find the requested driver and return its class.
+ * @param name the driver to select.
+ * @post Sets the driver so GetCurrentDriver() returns it too.
+ */
+const Driver *DriverFactoryBase::SelectDriver(const char *name, Driver::Type type)
+{
+ if (GetDrivers().size() == 0) return NULL;
+
+ if (*name == '\0') {
+ /* Probe for this driver */
+ for (int priority = 10; priority >= 0; priority--) {
+ Drivers::iterator it = GetDrivers().begin();
+ for (; it != GetDrivers().end(); ++it) {
+ DriverFactoryBase *d = (*it).second;
+
+ /* Check driver type */
+ if (d->type != type) continue;
+ if (d->priority != priority) continue;
+
+ Driver *newd = d->CreateInstance();
+ const char *err = newd->Start(NULL);
+ if (err == NULL) {
+ DEBUG(driver, 1, "Successfully probed %s driver '%s'", GetDriverTypeName(type), d->name);
+ delete *GetActiveDriver(type);
+ *GetActiveDriver(type) = newd;
+ return newd;
+ }
+
+ DEBUG(driver, 1, "Probing %s driver '%s' failed with error: %s", GetDriverTypeName(type), d->name, err);
+ delete newd;
+ }
+ }
+ error("Couldn't find any suitable %s driver", GetDriverTypeName(type));
+ } else {
+ char *parm;
+ char buffer[256];
+ const char *parms[32];
+
+ /* Extract the driver name and put parameter list in parm */
+ strecpy(buffer, name, lastof(buffer));
+ parm = strchr(buffer, ':');
+ parms[0] = NULL;
+ if (parm != NULL) {
+ uint np = 0;
+ /* Tokenize the parm. */
+ do {
+ *parm++ = '\0';
+ if (np < lengthof(parms) - 1) parms[np++] = parm;
+ while (*parm != '\0' && *parm != ',') parm++;
+ } while (*parm == ',');
+ parms[np] = NULL;
+ }
+
+ /* Find this driver */
+ Drivers::iterator it = GetDrivers().begin();
+ for (; it != GetDrivers().end(); ++it) {
+ DriverFactoryBase *d = (*it).second;
+
+ /* Check driver type */
+ if (d->type != type) continue;
+
+ /* Check driver name */
+ if (strcasecmp(buffer, d->name) != 0) continue;
+
+ /* Found our driver, let's try it */
+ Driver *newd = d->CreateInstance();
+
+ const char *err = newd->Start(parms);
+ if (err != NULL) {
+ delete newd;
+ error("Unable to load driver '%s'. The error was: %s", d->name, err);
+ }
+
+ DEBUG(driver, 1, "Successfully loaded %s driver '%s'", GetDriverTypeName(type), d->name);
+ delete *GetActiveDriver(type);
+ *GetActiveDriver(type) = newd;
+ return newd;
+ }
+ error("No such %s driver: %s\n", GetDriverTypeName(type), buffer);
+ }
+}
+
+/**
+ * Register a driver internally, based on its name.
+ * @param name the name of the driver.
+ * @note an assert() will be trigger if 2 driver with the same name try to register.
+ */
+void DriverFactoryBase::RegisterDriver(const char *name, Driver::Type type, int priority)
+{
+ /* Don't register nameless Drivers */
+ if (name == NULL) return;
+
+ this->name = strdup(name);
+ this->type = type;
+ this->priority = priority;
+
+ /* Prefix the name with driver type to make it unique */
+ char buf[32];
+ strecpy(buf, GetDriverTypeName(type), lastof(buf));
+ strecpy(buf + 5, name, lastof(buf));
+
+#if !defined(NDEBUG) || defined(WITH_ASSERT)
+ /* NDEBUG disables asserts and gives a warning: unused variable 'P' */
+ std::pair<Drivers::iterator, bool> P =
+#endif /* !NDEBUG */
+ GetDrivers().insert(Drivers::value_type(buf, this));
+ assert(P.second);
+}
+
+/**
+ * Build a human readable list of available drivers, grouped by type.
+ */
+char *DriverFactoryBase::GetDriversInfo(char *p, const char *last)
+{
+ for (Driver::Type type = Driver::DT_BEGIN; type != Driver::DT_END; type++) {
+ p += snprintf(p, last - p, "List of %s drivers:\n", GetDriverTypeName(type));
+
+ for (int priority = 10; priority >= 0; priority--) {
+ Drivers::iterator it = GetDrivers().begin();
+ for (; it != GetDrivers().end(); it++) {
+ DriverFactoryBase *d = (*it).second;
+ if (d->type != type) continue;
+ if (d->priority != priority) continue;
+ p += snprintf(p, last - p, "%18s: %s\n", d->name, d->GetDescription());
+ }
+ }
+
+ p += snprintf(p, last - p, "\n");
+ }
+
+ return p;
+}
--- a/src/driver.h Sun Apr 06 14:12:19 2008 +0000
+++ b/src/driver.h Sun Apr 06 23:07:42 2008 +0000
@@ -60,32 +60,7 @@
}
protected:
- /**
- * Register a driver internally, based on its name.
- * @param name the name of the driver.
- * @note an assert() will be trigger if 2 driver with the same name try to register.
- */
- void RegisterDriver(const char *name, Driver::Type type, int priority)
- {
- /* Don't register nameless Drivers */
- if (name == NULL) return;
-
- this->name = strdup(name);
- this->type = type;
- this->priority = priority;
-
- /* Prefix the name with driver type to make it unique */
- char buf[32];
- strecpy(buf, GetDriverTypeName(type), lastof(buf));
- strecpy(buf + 5, name, lastof(buf));
-
-#if !defined(NDEBUG) || defined(WITH_ASSERT)
- /* NDEBUG disables asserts and gives a warning: unused variable 'P' */
- std::pair<Drivers::iterator, bool> P =
-#endif /* !NDEBUG */
- GetDrivers().insert(Drivers::value_type(buf, this));
- assert(P.second);
- }
+ void RegisterDriver(const char *name, Driver::Type type, int priority);
public:
DriverFactoryBase() :
@@ -94,114 +69,8 @@
virtual ~DriverFactoryBase() { if (this->name != NULL) GetDrivers().erase(this->name); free(this->name); }
- /**
- * Find the requested driver and return its class.
- * @param name the driver to select.
- * @post Sets the driver so GetCurrentDriver() returns it too.
- */
- static Driver *SelectDriver(const char *name, Driver::Type type)
- {
- if (GetDrivers().size() == 0) return NULL;
-
- if (*name == '\0') {
- /* Probe for this driver */
- for (int priority = 10; priority >= 0; priority--) {
- Drivers::iterator it = GetDrivers().begin();
- for (; it != GetDrivers().end(); ++it) {
- DriverFactoryBase *d = (*it).second;
-
- /* Check driver type */
- if (d->type != type) continue;
- if (d->priority != priority) continue;
-
- Driver *newd = d->CreateInstance();
- const char *err = newd->Start(NULL);
- if (err == NULL) {
- DEBUG(driver, 1, "Successfully probed %s driver '%s'", GetDriverTypeName(type), d->name);
- delete *GetActiveDriver(type);
- *GetActiveDriver(type) = newd;
- return newd;
- }
-
- DEBUG(driver, 1, "Probing %s driver '%s' failed with error: %s", GetDriverTypeName(type), d->name, err);
- delete newd;
- }
- }
- error("Couldn't find any suitable %s driver", GetDriverTypeName(type));
- } else {
- char *parm;
- char buffer[256];
- const char *parms[32];
-
- /* Extract the driver name and put parameter list in parm */
- strecpy(buffer, name, lastof(buffer));
- parm = strchr(buffer, ':');
- parms[0] = NULL;
- if (parm != NULL) {
- uint np = 0;
- /* Tokenize the parm. */
- do {
- *parm++ = '\0';
- if (np < lengthof(parms) - 1)
- parms[np++] = parm;
- while (*parm != '\0' && *parm != ',')
- parm++;
- } while (*parm == ',');
- parms[np] = NULL;
- }
-
- /* Find this driver */
- Drivers::iterator it = GetDrivers().begin();
- for (; it != GetDrivers().end(); ++it) {
- DriverFactoryBase *d = (*it).second;
-
- /* Check driver type */
- if (d->type != type) continue;
-
- /* Check driver name */
- if (strcasecmp(buffer, d->name) != 0) continue;
-
- /* Found our driver, let's try it */
- Driver *newd = d->CreateInstance();
-
- const char *err = newd->Start(parms);
- if (err != NULL) {
- delete newd;
- error("Unable to load driver '%s'. The error was: %s", d->name, err);
- }
-
- DEBUG(driver, 1, "Successfully loaded %s driver '%s'", GetDriverTypeName(type), d->name);
- delete *GetActiveDriver(type);
- *GetActiveDriver(type) = newd;
- return newd;
- }
- error("No such %s driver: %s\n", GetDriverTypeName(type), buffer);
- }
- }
-
- /**
- * Build a human readable list of available drivers, grouped by type.
- */
- static char *GetDriversInfo(char *p, const char *last)
- {
- for (Driver::Type type = Driver::DT_BEGIN; type != Driver::DT_END; type++) {
- p += snprintf(p, last - p, "List of %s drivers:\n", GetDriverTypeName(type));
-
- for (int priority = 10; priority >= 0; priority--) {
- Drivers::iterator it = GetDrivers().begin();
- for (; it != GetDrivers().end(); it++) {
- DriverFactoryBase *d = (*it).second;
- if (d->type != type) continue;
- if (d->priority != priority) continue;
- p += snprintf(p, last - p, "%18s: %s\n", d->name, d->GetDescription());
- }
- }
-
- p += snprintf(p, last - p, "\n");
- }
-
- return p;
- }
+ static const Driver *SelectDriver(const char *name, Driver::Type type);
+ static char *GetDriversInfo(char *p, const char *last);
/**
* Get a nice description of the driver-class.
--- a/src/economy.cpp Sun Apr 06 14:12:19 2008 +0000
+++ b/src/economy.cpp Sun Apr 06 23:07:42 2008 +0000
@@ -352,7 +352,7 @@
}
/* Reset the ratings for the old player */
- t->ratings[old_player] = 500;
+ t->ratings[old_player] = RATING_INITIAL;
ClrBit(t->have_ratings, old_player);
}
@@ -1492,7 +1492,7 @@
if (!cp->paid_for &&
cp->source != last_visited &&
HasBit(ge->acceptance_pickup, GoodsEntry::ACCEPTANCE) &&
- (front_v->current_order.flags & OFB_TRANSFER) == 0) {
+ (front_v->current_order.GetUnloadType() & OFB_TRANSFER) == 0) {
/* Deliver goods to the station */
st->time_since_unload = 0;
@@ -1505,8 +1505,8 @@
result |= 1;
SetBit(v->vehicle_flags, VF_CARGO_UNLOADING);
- } else if (front_v->current_order.flags & (OFB_UNLOAD | OFB_TRANSFER)) {
- if (!cp->paid_for && (front_v->current_order.flags & OFB_TRANSFER) != 0) {
+ } else if (front_v->current_order.GetUnloadType() & (OFB_UNLOAD | OFB_TRANSFER)) {
+ if (!cp->paid_for && (front_v->current_order.GetUnloadType() & OFB_TRANSFER) != 0) {
Money profit = GetTransportedGoodsIncome(
cp->count,
/* pay transfer vehicle for only the part of transfer it has done: ie. cargo_loaded_at_xy to here */
@@ -1555,11 +1555,11 @@
*/
static void LoadUnloadVehicle(Vehicle *v, int *cargo_left)
{
- assert(v->current_order.type == OT_LOADING);
+ assert(v->current_order.IsType(OT_LOADING));
/* We have not waited enough time till the next round of loading/unloading */
if (--v->load_unload_time_rem != 0) {
- if (_patches.improved_load && HasBit(v->current_order.flags, OF_FULL_LOAD)) {
+ if (_patches.improved_load && HasBit(v->current_order.GetLoadType(), OF_FULL_LOAD)) {
/* 'Reserve' this cargo for this vehicle, because we were first. */
for (; v != NULL; v = v->Next()) {
if (v->cargo_cap != 0) cargo_left[v->cargo_type] -= v->cargo_cap - v->cargo.Count();
@@ -1607,12 +1607,12 @@
uint amount_unloaded = _patches.gradual_loading ? min(cargo_count, load_amount) : cargo_count;
bool remaining; // Are there cargo entities in this vehicle that can still be unloaded here?
- if (HasBit(ge->acceptance_pickup, GoodsEntry::ACCEPTANCE) && !(u->current_order.flags & OFB_TRANSFER)) {
+ if (HasBit(ge->acceptance_pickup, GoodsEntry::ACCEPTANCE) && !(u->current_order.GetUnloadType() & OFB_TRANSFER)) {
/* The cargo has reached it's final destination, the packets may now be destroyed */
remaining = v->cargo.MoveTo(NULL, amount_unloaded, CargoList::MTA_FINAL_DELIVERY, last_visited);
result |= 1;
- } else if (u->current_order.flags & (OFB_UNLOAD | OFB_TRANSFER)) {
+ } else if (u->current_order.GetUnloadType() & (OFB_UNLOAD | OFB_TRANSFER)) {
remaining = v->cargo.MoveTo(&ge->cargo, amount_unloaded);
SetBit(ge->acceptance_pickup, GoodsEntry::PICKUP);
@@ -1641,7 +1641,7 @@
}
/* Do not pick up goods that we unloaded */
- if (u->current_order.flags & OFB_UNLOAD) continue;
+ if (u->current_order.GetUnloadType() & OFB_UNLOAD) continue;
/* update stats */
int t;
@@ -1713,7 +1713,7 @@
* all wagons at the same time instead of using the same 'improved'
* loading algorithm for the wagons (only fill wagon when there is
* enough to fill the previous wagons) */
- if (_patches.improved_load && HasBit(u->current_order.flags, OF_FULL_LOAD)) {
+ if (_patches.improved_load && HasBit(u->current_order.GetLoadType(), OF_FULL_LOAD)) {
/* Update left cargo */
for (v = u; v != NULL; v = v->Next()) {
if (v->cargo_cap != 0) cargo_left[v->cargo_type] -= v->cargo_cap - v->cargo.Count();
@@ -1732,7 +1732,7 @@
}
} else {
bool finished_loading = true;
- if (HasBit(v->current_order.flags, OF_FULL_LOAD)) {
+ if (HasBit(v->current_order.GetLoadType(), OF_FULL_LOAD)) {
if (_patches.full_load_any) {
/* if the aircraft carries passengers and is NOT full, then
* continue loading, no matter how much mail is in */
--- a/src/elrail.cpp Sun Apr 06 14:12:19 2008 +0000
+++ b/src/elrail.cpp Sun Apr 06 23:07:42 2008 +0000
@@ -434,6 +434,9 @@
{
if (_patches.disable_elrails) return;
+ /* Do not draw catenary if it is invisible */
+ if (IsInvisibilitySet(TO_CATENARY)) return;
+
if (MayHaveBridgeAbove(ti->tile) && IsBridgeAbove(ti->tile)) {
TileIndex head = GetNorthernBridgeEnd(ti->tile);
--- a/src/gfx_type.h Sun Apr 06 14:12:19 2008 +0000
+++ b/src/gfx_type.h Sun Apr 06 23:07:42 2008 +0000
@@ -130,6 +130,8 @@
bool dirty; ///< the rect occupied by the mouse is dirty (redraw)
bool fix_at; ///< mouse is moving, but cursor is not (used for scrolling)
bool in_window; ///< mouse inside this window, determines drawing logic
+
+ bool vehchain; ///< vehicle chain is dragged
};
struct DrawPixelInfo {
--- a/src/group_gui.cpp Sun Apr 06 14:12:19 2008 +0000
+++ b/src/group_gui.cpp Sun Apr 06 23:07:42 2008 +0000
@@ -575,6 +575,7 @@
if (v->IsValid()) {
SetObjectToPlaceWnd(v->GetImage(DIR_W), GetVehiclePalette(v), VHM_DRAG, w);
+ _cursor.vehchain = true;
}
SetWindowDirty(w);
@@ -687,6 +688,7 @@
break;
}
}
+ _cursor.vehchain = false;
break;
}
--- a/src/industry_cmd.cpp Sun Apr 06 14:12:19 2008 +0000
+++ b/src/industry_cmd.cpp Sun Apr 06 23:07:42 2008 +0000
@@ -303,6 +303,9 @@
DrawGroundSprite(image, pal);
+ /* If industries are transparent and invisible, do not draw the upper part */
+ if (IsInvisibilitySet(TO_INDUSTRIES)) return;
+
/* Add industry on top of the ground? */
image = dits->building.sprite;
if (image != 0) {
@@ -1964,13 +1967,13 @@
*/
const Order *o;
FOR_VEHICLE_ORDERS(v, o) {
- if (o->type == OT_GOTO_STATION && !HasBit(o->flags, OF_TRANSFER)) {
+ if (o->IsType(OT_GOTO_STATION) && !HasBit(o->GetUnloadType(), OF_TRANSFER)) {
/* Vehicle visits a station to load or unload */
- Station *st = GetStation(o->dest);
+ Station *st = GetStation(o->GetDestination());
if (!st->IsValid()) continue;
/* Same cargo produced by industry is dropped here => not serviced by vehicle v */
- if (HasBit(o->flags, OF_UNLOAD) && !c_accepts) break;
+ if (HasBit(o->GetUnloadType(), OF_UNLOAD) && !c_accepts) break;
if (stations.find(st) != stations.end()) {
if (v->owner == _local_player) return 2; // Player services industry
--- a/src/landscape.cpp Sun Apr 06 14:12:19 2008 +0000
+++ b/src/landscape.cpp Sun Apr 06 23:07:42 2008 +0000
@@ -72,7 +72,6 @@
*/
uint ApplyFoundationToSlope(Foundation f, Slope *s)
{
-
if (!IsFoundation(f)) return 0;
if (IsLeveledFoundation(f)) {
@@ -116,6 +115,13 @@
}
+/**
+ * Determines height at given coordinate of a slope
+ * @param x x coordinate
+ * @param y y coordinate
+ * @param corners slope to examine
+ * @return height of given point of given slope
+ */
uint GetPartialZ(int x, int y, Slope corners)
{
if (IsHalftileSlope(corners)) {
@@ -143,91 +149,99 @@
int z = 0;
switch (RemoveHalftileSlope(corners)) {
- case SLOPE_W:
- if (x - y >= 0)
- z = (x - y) >> 1;
- break;
-
- case SLOPE_S:
- y ^= 0xF;
- if ( (x - y) >= 0)
- z = (x - y) >> 1;
- break;
-
- case SLOPE_SW:
- z = (x >> 1) + 1;
- break;
-
- case SLOPE_E:
- if (y - x >= 0)
- z = (y - x) >> 1;
- break;
-
- case SLOPE_EW:
- case SLOPE_NS:
- case SLOPE_ELEVATED:
- z = 4;
- break;
-
- case SLOPE_SE:
- z = (y >> 1) + 1;
- break;
-
- case SLOPE_WSE:
- z = 8;
- y ^= 0xF;
- if (x - y < 0)
- z += (x - y) >> 1;
- break;
+ case SLOPE_W:
+ if (x - y >= 0) {
+ z = (x - y) >> 1;
+ }
+ break;
- case SLOPE_N:
- y ^= 0xF;
- if (y - x >= 0)
- z = (y - x) >> 1;
- break;
-
- case SLOPE_NW:
- z = (y ^ 0xF) >> 1;
- break;
-
- case SLOPE_NWS:
- z = 8;
- if (x - y < 0)
- z += (x - y) >> 1;
- break;
-
- case SLOPE_NE:
- z = (x ^ 0xF) >> 1;
- break;
+ case SLOPE_S:
+ y ^= 0xF;
+ if ((x - y) >= 0) {
+ z = (x - y) >> 1;
+ }
+ break;
- case SLOPE_ENW:
- z = 8;
- y ^= 0xF;
- if (y - x < 0)
- z += (y - x) >> 1;
- break;
-
- case SLOPE_SEN:
- z = 8;
- if (y - x < 0)
- z += (y - x) >> 1;
- break;
+ case SLOPE_SW:
+ z = (x >> 1) + 1;
+ break;
- case SLOPE_STEEP_S:
- z = 1 + ((x + y) >> 1);
- break;
+ case SLOPE_E:
+ if (y - x >= 0) {
+ z = (y - x) >> 1;
+ }
+ break;
- case SLOPE_STEEP_W:
- z = 1 + ((x + (y ^ 0xF)) >> 1);
- break;
+ case SLOPE_EW:
+ case SLOPE_NS:
+ case SLOPE_ELEVATED:
+ z = 4;
+ break;
- case SLOPE_STEEP_N:
- z = 1 + (((x ^ 0xF) + (y ^ 0xF)) >> 1);
- break;
+ case SLOPE_SE:
+ z = (y >> 1) + 1;
+ break;
- case SLOPE_STEEP_E:
- z = 1 + (((x ^ 0xF) + y) >> 1);
- break;
+ case SLOPE_WSE:
+ z = 8;
+ y ^= 0xF;
+ if (x - y < 0) {
+ z += (x - y) >> 1;
+ }
+ break;
+
+ case SLOPE_N:
+ y ^= 0xF;
+ if (y - x >= 0) {
+ z = (y - x) >> 1;
+ }
+ break;
+
+ case SLOPE_NW:
+ z = (y ^ 0xF) >> 1;
+ break;
+
+ case SLOPE_NWS:
+ z = 8;
+ if (x - y < 0) {
+ z += (x - y) >> 1;
+ }
+ break;
+
+ case SLOPE_NE:
+ z = (x ^ 0xF) >> 1;
+ break;
+
+ case SLOPE_ENW:
+ z = 8;
+ y ^= 0xF;
+ if (y - x < 0) {
+ z += (y - x) >> 1;
+ }
+ break;
+
+ case SLOPE_SEN:
+ z = 8;
+ if (y - x < 0) {
+ z += (y - x) >> 1;
+ }
+ break;
+
+ case SLOPE_STEEP_S:
+ z = 1 + ((x + y) >> 1);
+ break;
+
+ case SLOPE_STEEP_W:
+ z = 1 + ((x + (y ^ 0xF)) >> 1);
+ break;
+
+ case SLOPE_STEEP_N:
+ z = 1 + (((x ^ 0xF) + (y ^ 0xF)) >> 1);
+ break;
+
+ case SLOPE_STEEP_E:
+ z = 1 + (((x ^ 0xF) + y) >> 1);
+ break;
default: break;
}
@@ -552,35 +566,29 @@
*/
CommandCost CmdClearArea(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
{
- CommandCost ret, money;
- CommandCost cost(EXPENSES_CONSTRUCTION);
- int ex;
- int ey;
- int sx, sy;
- int x, y;
- bool success = false;
-
if (p1 >= MapSize()) return CMD_ERROR;
/* make sure sx,sy are smaller than ex,ey */
- ex = TileX(tile);
- ey = TileY(tile);
- sx = TileX(p1);
- sy = TileY(p1);
+ int ex = TileX(tile);
+ int ey = TileY(tile);
+ int sx = TileX(p1);
+ int sy = TileY(p1);
if (ex < sx) Swap(ex, sx);
if (ey < sy) Swap(ey, sy);
- money.AddCost(GetAvailableMoneyForCommand());
+ Money money = GetAvailableMoneyForCommand();
+ CommandCost cost(EXPENSES_CONSTRUCTION);
+ bool success = false;
- for (x = sx; x <= ex; ++x) {
- for (y = sy; y <= ey; ++y) {
- ret = DoCommand(TileXY(x, y), 0, 0, flags & ~DC_EXEC, CMD_LANDSCAPE_CLEAR);
+ for (int x = sx; x <= ex; ++x) {
+ for (int y = sy; y <= ey; ++y) {
+ CommandCost ret = DoCommand(TileXY(x, y), 0, 0, flags & ~DC_EXEC, CMD_LANDSCAPE_CLEAR);
if (CmdFailed(ret)) continue;
success = true;
if (flags & DC_EXEC) {
- money.AddCost(-ret.GetCost());
- if (ret.GetCost() > 0 && money.GetCost() < 0) {
+ money -= ret.GetCost();
+ if (ret.GetCost() > 0 && money < 0) {
_additional_cash_required = ret.GetCost();
return cost;
}
@@ -609,13 +617,10 @@
void RunTileLoop()
{
- TileIndex tile;
- uint count;
+ TileIndex tile = _cur_tileloop_tile;
- tile = _cur_tileloop_tile;
-
- assert( (tile & ~TILELOOP_ASSERTMASK) == 0);
- count = (MapSizeX() / TILELOOP_SIZE) * (MapSizeY() / TILELOOP_SIZE);
+ assert((tile & ~TILELOOP_ASSERTMASK) == 0);
+ uint count = (MapSizeX() / TILELOOP_SIZE) * (MapSizeY() / TILELOOP_SIZE);
do {
_tile_type_procs[GetTileType(tile)]->tile_loop_proc(tile);
@@ -624,12 +629,13 @@
} else {
tile = TILE_MASK(tile - TILELOOP_SIZE * (MapSizeX() / TILELOOP_SIZE - 1) + TileDiffXY(0, TILELOOP_SIZE)); /* x would overflow, also increase y */
}
- } while (--count);
- assert( (tile & ~TILELOOP_ASSERTMASK) == 0);
+ } while (--count != 0);
+ assert((tile & ~TILELOOP_ASSERTMASK) == 0);
tile += 9;
- if (tile & TILELOOP_CHKMASK)
+ if (tile & TILELOOP_CHKMASK) {
tile = (tile + MapSizeX()) & TILELOOP_ASSERTMASK;
+ }
_cur_tileloop_tile = tile;
}
@@ -638,10 +644,10 @@
uint maxx = MapMaxX();
uint maxy = MapMaxY();
uint sizex = MapSizeX();
- uint x;
+
uint y;
-
for (y = 0; y < maxy; y++) {
+ uint x;
for (x = 0; x < maxx; x++) {
MakeClear(sizex * y + x, CLEAR_GRASS, 3);
SetTileHeight(sizex * y + x, 0);
@@ -650,49 +656,38 @@
}
MakeVoid(sizex * y + x);
}
- for (x = 0; x < sizex; x++) MakeVoid(sizex * y + x);
+ for (uint x = 0; x < sizex; x++) MakeVoid(sizex * y + x);
}
static const byte _genterrain_tbl_1[5] = { 10, 22, 33, 37, 4 };
static const byte _genterrain_tbl_2[5] = { 0, 0, 0, 0, 33 };
-static void GenerateTerrain(int type, int flag)
+static void GenerateTerrain(int type, uint flag)
{
- uint32 r;
- uint x;
- uint y;
- uint w;
- uint h;
- const Sprite* templ;
- const byte *p;
- Tile* tile;
- byte direction;
+ uint32 r = Random();
- r = Random();
- templ = GetSprite((((r >> 24) * _genterrain_tbl_1[type]) >> 8) + _genterrain_tbl_2[type] + 4845);
+ const Sprite *templ = GetSprite((((r >> 24) * _genterrain_tbl_1[type]) >> 8) + _genterrain_tbl_2[type] + 4845);
- x = r & MapMaxX();
- y = (r >> MapLogX()) & MapMaxY();
-
+ uint x = r & MapMaxX();
+ uint y = (r >> MapLogX()) & MapMaxY();
if (x < 2 || y < 2) return;
- direction = GB(r, 22, 2);
- if (direction & 1) {
- w = templ->height;
- h = templ->width;
- } else {
- w = templ->width;
- h = templ->height;
- }
- p = templ->data;
+ DiagDirection direction = (DiagDirection)GB(r, 22, 2);
+ uint w = templ->width;
+ uint h = templ->height;
- if (flag & 4) {
+ if (DiagDirToAxis(direction) == AXIS_Y) Swap(w, h);
+
+ const byte *p = templ->data;
+
+ if ((flag & 4) != 0) {
uint xw = x * MapSizeY();
uint yw = y * MapSizeX();
uint bias = (MapSizeX() + MapSizeY()) * 16;
switch (flag & 3) {
+ default: NOT_REACHED();
case 0:
if (xw + yw > MapSize() - bias) return;
break;
@@ -714,15 +709,15 @@
if (x + w >= MapMaxX() - 1) return;
if (y + h >= MapMaxY() - 1) return;
- tile = &_m[TileXY(x, y)];
+ Tile *tile = &_m[TileXY(x, y)];
switch (direction) {
- case 0:
+ default: NOT_REACHED();
+ case DIAGDIR_NE:
do {
- Tile* tile_cur = tile;
- uint w_cur;
+ Tile *tile_cur = tile;
- for (w_cur = w; w_cur != 0; --w_cur) {
+ for (uint w_cur = w; w_cur != 0; --w_cur) {
if (*p >= tile_cur->type_height) tile_cur->type_height = *p;
p++;
tile_cur++;
@@ -731,27 +726,25 @@
} while (--h != 0);
break;
- case 1:
+ case DIAGDIR_SE:
do {
- Tile* tile_cur = tile;
- uint h_cur;
+ Tile *tile_cur = tile;
- for (h_cur = h; h_cur != 0; --h_cur) {
+ for (uint h_cur = h; h_cur != 0; --h_cur) {
if (*p >= tile_cur->type_height) tile_cur->type_height = *p;
p++;
tile_cur += TileDiffXY(0, 1);
}
- tile++;
+ tile += TileDiffXY(1, 0);
} while (--w != 0);
break;
- case 2:
+ case DIAGDIR_SW:
tile += TileDiffXY(w - 1, 0);
do {
- Tile* tile_cur = tile;
- uint w_cur;
+ Tile *tile_cur = tile;
- for (w_cur = w; w_cur != 0; --w_cur) {
+ for (uint w_cur = w; w_cur != 0; --w_cur) {
if (*p >= tile_cur->type_height) tile_cur->type_height = *p;
p++;
tile_cur--;
@@ -760,18 +753,17 @@
} while (--h != 0);
break;
- case 3:
+ case DIAGDIR_NW:
tile += TileDiffXY(0, h - 1);
do {
- Tile* tile_cur = tile;
- uint h_cur;
+ Tile *tile_cur = tile;
- for (h_cur = h; h_cur != 0; --h_cur) {
+ for (uint h_cur = h; h_cur != 0; --h_cur) {
if (*p >= tile_cur->type_height) tile_cur->type_height = *p;
p++;
tile_cur -= TileDiffXY(0, 1);
}
- tile++;
+ tile += TileDiffXY(1, 0);
} while (--w != 0);
break;
}
@@ -782,12 +774,10 @@
static void CreateDesertOrRainForest()
{
- TileIndex tile;
TileIndex update_freq = MapSize() / 4;
const TileIndexDiffC *data;
- uint i;
- for (tile = 0; tile != MapSize(); ++tile) {
+ for (TileIndex tile = 0; tile != MapSize(); ++tile) {
if ((tile % update_freq) == 0) IncreaseGeneratingWorldProgress(GWP_LANDSCAPE);
for (data = _make_desert_or_rainforest_data;
@@ -799,13 +789,13 @@
SetTropicZone(tile, TROPICZONE_DESERT);
}
- for (i = 0; i != 256; i++) {
+ for (uint i = 0; i != 256; i++) {
if ((i % 64) == 0) IncreaseGeneratingWorldProgress(GWP_LANDSCAPE);
RunTileLoop();
}
- for (tile = 0; tile != MapSize(); ++tile) {
+ for (TileIndex tile = 0; tile != MapSize(); ++tile) {
if ((tile % update_freq) == 0) IncreaseGeneratingWorldProgress(GWP_LANDSCAPE);
for (data = _make_desert_or_rainforest_data;
@@ -820,10 +810,7 @@
void GenerateLandscape(byte mode)
{
- const int gwp_desert_amount = 4 + 8;
- uint i;
- uint flag;
- uint32 r;
+ static const int gwp_desert_amount = 4 + 8;
if (mode == GW_HEIGHTMAP) {
SetGeneratingWorldProgress(GWP_LANDSCAPE, (_opt.landscape == LT_TROPIC) ? 1 + gwp_desert_amount : 1);
@@ -834,54 +821,58 @@
GenerateTerrainPerlin();
} else {
switch (_opt.landscape) {
- case LT_ARCTIC:
+ case LT_ARCTIC: {
SetGeneratingWorldProgress(GWP_LANDSCAPE, 2);
- for (i = ScaleByMapSize((Random() & 0x7F) + 950); i != 0; --i) {
+ uint32 r = Random();
+
+ for (uint i = ScaleByMapSize(GB(r, 0, 7) + 950); i != 0; --i) {
GenerateTerrain(2, 0);
}
IncreaseGeneratingWorldProgress(GWP_LANDSCAPE);
- r = Random();
- flag = GB(r, 0, 2) | 4;
- for (i = ScaleByMapSize(GB(r, 16, 7) + 450); i != 0; --i) {
+ uint flag = GB(r, 7, 2) | 4;
+ for (uint i = ScaleByMapSize(GB(r, 9, 7) + 450); i != 0; --i) {
GenerateTerrain(4, flag);
}
IncreaseGeneratingWorldProgress(GWP_LANDSCAPE);
- break;
+ } break;
- case LT_TROPIC:
+ case LT_TROPIC: {
SetGeneratingWorldProgress(GWP_LANDSCAPE, 3 + gwp_desert_amount);
- for (i = ScaleByMapSize((Random() & 0x7F) + 170); i != 0; --i) {
+ uint32 r = Random();
+
+ for (uint i = ScaleByMapSize(GB(r, 0, 7) + 170); i != 0; --i) {
GenerateTerrain(0, 0);
}
IncreaseGeneratingWorldProgress(GWP_LANDSCAPE);
- r = Random();
- flag = GB(r, 0, 2) | 4;
- for (i = ScaleByMapSize(GB(r, 16, 8) + 1700); i != 0; --i) {
+ uint flag = GB(r, 7, 2) | 4;
+ for (uint i = ScaleByMapSize(GB(r, 9, 8) + 1700); i != 0; --i) {
GenerateTerrain(0, flag);
}
IncreaseGeneratingWorldProgress(GWP_LANDSCAPE);
flag ^= 2;
- for (i = ScaleByMapSize((Random() & 0x7F) + 410); i != 0; --i) {
+ for (uint i = ScaleByMapSize(GB(r, 17, 7) + 410); i != 0; --i) {
GenerateTerrain(3, flag);
}
IncreaseGeneratingWorldProgress(GWP_LANDSCAPE);
- break;
+ } break;
- default:
+ default: {
SetGeneratingWorldProgress(GWP_LANDSCAPE, 1);
- i = ScaleByMapSize((Random() & 0x7F) + (3 - _opt.diff.quantity_sea_lakes) * 256 + 100);
+ uint32 r = Random();
+
+ uint i = ScaleByMapSize(GB(r, 0, 7) + (3 - _opt.diff.quantity_sea_lakes) * 256 + 100);
for (; i != 0; --i) {
GenerateTerrain(_opt.diff.terrain_type, 0);
}
IncreaseGeneratingWorldProgress(GWP_LANDSCAPE);
- break;
+ } break;
}
}
--- a/src/lang/afrikaans.txt Sun Apr 06 14:12:19 2008 +0000
+++ b/src/lang/afrikaans.txt Sun Apr 06 23:07:42 2008 +0000
@@ -1061,7 +1061,6 @@
STR_CONFIG_PATCHES_AUTORENEW_MONEY :{LTBLUE}Outohernuwe minimum vereisde geld vir hernuwe: {ORANGE}{STRING}
STR_CONFIG_PATCHES_ERRMSG_DURATION :{LTBLUE}Duur van fout boodskap: {ORANGE}{STRING}
STR_CONFIG_PATCHES_POPULATION_IN_LABEL :{LTBLUE}Toon dorp populasie in die dorp naam etiket: {ORANGE}{STRING}
-STR_CONFIG_PATCHES_INVISIBLE_TREES :{LTBLUE}Onsigbaar boome (met deurskynend geboue): {ORANGE}{STRING}
STR_CONFIG_PATCHES_LAND_GENERATOR :{LTBLUE}Land genereerder: {ORANGE}{STRING}
STR_CONFIG_PATCHES_LAND_GENERATOR_ORIGINAL :Oorspronklik
--- a/src/lang/brazilian_portuguese.txt Sun Apr 06 14:12:19 2008 +0000
+++ b/src/lang/brazilian_portuguese.txt Sun Apr 06 23:07:42 2008 +0000
@@ -2,7 +2,6 @@
##ownname Português (BR)
##isocode pt_BR
##plural 2
-##case m f
##gender m f
#
@@ -1070,7 +1069,6 @@
STR_CONFIG_PATCHES_AUTORENEW_MONEY :{LTBLUE}Dinheiro mínimo para fazer auto-renovação: {ORANGE}{STRING}
STR_CONFIG_PATCHES_ERRMSG_DURATION :{LTBLUE}Duração das mensagens de erro: {ORANGE}{STRING}
STR_CONFIG_PATCHES_POPULATION_IN_LABEL :{LTBLUE}Exibir população da cidade na janela da cidade: {ORANGE}{STRING}
-STR_CONFIG_PATCHES_INVISIBLE_TREES :{LTBLUE}Árvores invisíveis (com edifícios transparentes): {ORANGE}{STRING}
STR_CONFIG_PATCHES_LAND_GENERATOR :{LTBLUE}Gerador de Terreno: {ORANGE}{STRING}
STR_CONFIG_PATCHES_LAND_GENERATOR_ORIGINAL :Original
@@ -1175,6 +1173,7 @@
STR_CONFIG_PATCHES_TOWN_LAYOUT_BETTER_ROADS :melhores estradas
STR_CONFIG_PATCHES_TOWN_LAYOUT_2X2_GRID :grade 2x2
STR_CONFIG_PATCHES_TOWN_LAYOUT_3X3_GRID :grade 3x3
+STR_CONFIG_PATCHES_TOWN_LAYOUT_RANDOM :random
STR_CONFIG_PATCHES_TOOLBAR_POS :{LTBLUE}Posição da barra de ferramentas principal: {ORANGE}{STRING}
STR_CONFIG_PATCHES_TOOLBAR_POS_LEFT :Esquerda
@@ -1354,6 +1353,7 @@
STR_NETWORK_PLAYER_NAME :{BLACK}Nome:
STR_NETWORK_ENTER_NAME_TIP :{BLACK}Este é o nome pelo qual os outros jogadores irão te identificar
+STR_NETWORK_PLAYER_NAME_OSKTITLE :{BLACK}Coloque seu nome
STR_NETWORK_CONNECTION :{BLACK}Conexão:
STR_NETWORK_CONNECTION_TIP :{BLACK}Escolha entre um jogo pela Internet ou pela rede local
@@ -1397,6 +1397,7 @@
STR_NETWORK_NEW_GAME_NAME :{BLACK}Nome do jogo:
STR_NETWORK_NEW_GAME_NAME_TIP :{BLACK}O nome do jogo será exibido aos outros jogadores no menu de seleção de jogos multi-jogador
+STR_NETWORK_NEW_GAME_NAME_OSKTITLE :{BLACK}Coloque o nome para o jogo em rede
STR_NETWORK_SET_PASSWORD :{BLACK}Definir senha
STR_NETWORK_PASSWORD_TIP :{BLACK}Proteja o jogo com uma senha se não desejar que seja publicamente acessível
STR_NETWORK_SELECT_MAP :{BLACK}Selecionar um mapa:
@@ -1453,6 +1454,13 @@
STR_NETWORK_LANG_SWEDISH :Sueco
STR_NETWORK_LANG_TURKISH :Turco
STR_NETWORK_LANG_UKRAINIAN :Ucraniano
+STR_NETWORK_LANG_AFRIKAANS :Africano
+STR_NETWORK_LANG_CROATIAN :Croata
+STR_NETWORK_LANG_CATALAN :Catalão
+STR_NETWORK_LANG_ESTONIAN :Estoniano
+STR_NETWORK_LANG_GALICIAN :Galego
+STR_NETWORK_LANG_GREEK :Grego
+STR_NETWORK_LANG_LATVIAN :Letão
############ End of leave-in-this-order
STR_NETWORK_GAME_LOBBY :{WHITE}Sala de espera do jogo
@@ -1551,6 +1559,7 @@
STR_NETWORK_CHAT_TO_CLIENT :[Privado] Para {STRING}: {GRAY}{STRING}
STR_NETWORK_CHAT_ALL_CAPTION :[Todos] :
STR_NETWORK_CHAT_ALL :[Todos] {STRING}: {GRAY}{STRING}
+STR_NETWORK_CHAT_OSKTITLE :{BLACK}Coloque o texto para o jogo em rede
STR_NETWORK_NAME_CHANGE :mudou o nome dele/dela para
STR_NETWORK_SERVER_SHUTDOWN :{WHITE} O servidor fechou a sessão
STR_NETWORK_SERVER_REBOOT :{WHITE} O servidor está reiniciando...{}Aguarde...
@@ -1809,8 +1818,6 @@
STR_INDUSTRY :{INDUSTRY}
STR_TOWN :{TOWN}
STR_INDUSTRY_FORMAT :{1:STRING} de {0:TOWN}
-STR_INDUSTRY_FORMAT.f :{G=f}{1:STRING} de {0:TOWN}
-STR_INDUSTRY_FORMAT.m :{G=m}{1:STRING} de {0:TOWN}
STR_STATION :{STATION}
##id 0x2800
@@ -1956,6 +1963,7 @@
STR_400F_SELECT_SCENARIO_GREEN_PRE :{BLACK}Selecionar cenário (verde), jogo pré-programado (azul), ou novo jogo aleatório
STR_4010_GENERATE_RANDOM_NEW_GAME :Gerar novo jogo aleatório
STR_LOAD_HEIGHTMAP :{WHITE}Carregar Relevo
+STR_SAVE_OSKTITLE :{BLACK}Coloque o nome para o jogo salvo
##id 0x4800
STR_4800_IN_THE_WAY :{WHITE}{STRING} no caminho
@@ -2714,6 +2722,8 @@
STR_REFIT_ORDER :(Adaptar para {STRING})
STR_TIMETABLE_VIEW :{BLACK}Plano de horário
STR_TIMETABLE_VIEW_TOOLTIP :{BLACK}Exibe o plano de horário
+STR_ORDER_VIEW :{BLACK}Ordens
+STR_ORDER_VIEW_TOOLTIP :{BLACK}Alternar para ver as ordens
STR_8829_ORDERS :{WHITE}{VEHICLE} (Ordens)
STR_882A_END_OF_ORDERS :{SETX 10}- - Fim de Ordens - -
STR_FULLLOAD_OR_SERVICE :{SKIP}{SKIP}{STRING}
@@ -3270,6 +3280,7 @@
STR_WORLD_GENERATION_CAPTION :{WHITE}Geração de mundo
STR_RANDOM_SEED :{BLACK}Semente:
STR_RANDOM_SEED_HELP :{BLACK}Clique para digitar uma semente
+STR_RANDOM_SEED_OSKTITLE :{BLACK}Coloque uma semente randomica
STR_LAND_GENERATOR :{BLACK}Gerador de terra
STR_TREE_PLACER :{BLACK}Algorítimo de árvores
STR_HEIGHTMAP_ROTATION :{BLACK}Rotação do mapa em relevo:
@@ -3417,6 +3428,7 @@
#### Improved sign GUI
STR_NEXT_SIGN_TOOLTIP :{BLACK}Próxima Placa
STR_PREVIOUS_SIGN_TOOLTIP :{BLACK}Placa anterior
+STR_SIGN_OSKTITLE :{BLACK}Coloque um nome para a placa
########
@@ -3489,3 +3501,8 @@
STR_DRAG_SIGNALS_DENSITY_DECREASE_TIP :{BLACK}Diminuir a densidade dos sinais
STR_DRAG_SIGNALS_DENSITY_INCREASE_TIP :{BLACK}Aumentar a densidade dos sinais
########
+
+############ on screen keyboard
+STR_OSK_KEYBOARD_LAYOUT :`1234567890-=\qwertyuiop[]asdfghjkl;' zxcvbnm,./ .
+STR_OSK_KEYBOARD_LAYOUT_CAPS :~!@#$%^&*()_+|QWERTYUIOP{{}}ASDFGHJKL:" ZXCVBNM<>? .
+########
--- a/src/lang/bulgarian.txt Sun Apr 06 14:12:19 2008 +0000
+++ b/src/lang/bulgarian.txt Sun Apr 06 23:07:42 2008 +0000
@@ -1070,7 +1070,6 @@
STR_CONFIG_PATCHES_AUTORENEW_MONEY :{LTBLUE}Автоматично възстановяване на минималната сума пари необходима за започване отначало: {ORANGE}{STRING}
STR_CONFIG_PATCHES_ERRMSG_DURATION :{LTBLUE}Продължителност на съобщенията за грешки: {ORANGE}{STRING}
STR_CONFIG_PATCHES_POPULATION_IN_LABEL :{LTBLUE}Населението на града в етикета с името на града: {ORANGE}{STRING}
-STR_CONFIG_PATCHES_INVISIBLE_TREES :{LTBLUE}Невидими дървета (с невидими сгради): {ORANGE}{STRING}
STR_CONFIG_PATCHES_LAND_GENERATOR :{LTBLUE}Генератор на земя: {ORANGE}{STRING}
STR_CONFIG_PATCHES_LAND_GENERATOR_ORIGINAL :Оригинал
@@ -1354,6 +1353,7 @@
STR_NETWORK_PLAYER_NAME :{BLACK}Име на играч:
STR_NETWORK_ENTER_NAME_TIP :{BLACK}Чрез това име другите играчи ще ви идентифицират
+STR_NETWORK_PLAYER_NAME_OSKTITLE :{BLACK}Въведете името си
STR_NETWORK_CONNECTION :{BLACK}Връзка:
STR_NETWORK_CONNECTION_TIP :{BLACK}Избор между игра в интернет или локална мрежа (LAN)
@@ -1397,6 +1397,7 @@
STR_NETWORK_NEW_GAME_NAME :{BLACK}Име на игра:
STR_NETWORK_NEW_GAME_NAME_TIP :{BLACK}Името на играта ще се вижда от другите играчи при избор на игра
+STR_NETWORK_NEW_GAME_NAME_OSKTITLE :{BLACK}Въведете име за мрежовата игра
STR_NETWORK_SET_PASSWORD :{BLACK}Поставяне на парола
STR_NETWORK_PASSWORD_TIP :{BLACK}Защитаване на вашата игра с парола за да не е публично достъпна
STR_NETWORK_SELECT_MAP :{BLACK}Избор на карта:
@@ -1453,6 +1454,13 @@
STR_NETWORK_LANG_SWEDISH :Шведски
STR_NETWORK_LANG_TURKISH :Турски
STR_NETWORK_LANG_UKRAINIAN :Украински
+STR_NETWORK_LANG_AFRIKAANS :Африкаанс
+STR_NETWORK_LANG_CROATIAN :Хърватски
+STR_NETWORK_LANG_CATALAN :Каталонски
+STR_NETWORK_LANG_ESTONIAN :Естонски
+STR_NETWORK_LANG_GALICIAN :Галиматия
+STR_NETWORK_LANG_GREEK :Гръцки
+STR_NETWORK_LANG_LATVIAN :Латвийски
############ End of leave-in-this-order
STR_NETWORK_GAME_LOBBY :{WHITE}Преддверие
@@ -1551,6 +1559,7 @@
STR_NETWORK_CHAT_TO_CLIENT :[Private] До {STRING}: {GRAY}{STRING}
STR_NETWORK_CHAT_ALL_CAPTION :[All] :
STR_NETWORK_CHAT_ALL :[All] {STRING}: {GRAY}{STRING}
+STR_NETWORK_CHAT_OSKTITLE :{BLACK}Въведи текст за мрежов разговор
STR_NETWORK_NAME_CHANGE :смени името си на
STR_NETWORK_SERVER_SHUTDOWN :{WHITE} Сървъра прекъсна сесията
STR_NETWORK_SERVER_REBOOT :{WHITE} Сървъра се рестартира...{}Моля изчакайте...
@@ -1954,6 +1963,7 @@
STR_400F_SELECT_SCENARIO_GREEN_PRE :{BLACK}Избери на сценарии (зелено), предварително настроена игра (синьо), или произволна нова игра
STR_4010_GENERATE_RANDOM_NEW_GAME :Генерирай произволна нова игра
STR_LOAD_HEIGHTMAP :{WHITE}Зареди височинна карта
+STR_SAVE_OSKTITLE :{BLACK}Въведете име за запазената игра
##id 0x4800
STR_4800_IN_THE_WAY :{WHITE}{STRING} пречи
@@ -2712,6 +2722,8 @@
STR_REFIT_ORDER :(Преустройство към {STRING})
STR_TIMETABLE_VIEW :{BLACK}Разписание
STR_TIMETABLE_VIEW_TOOLTIP :{BLACK}Виж разписанието
+STR_ORDER_VIEW :{BLACK}Сортиране
+STR_ORDER_VIEW_TOOLTIP :{BLACK}Промени сортацията
STR_8829_ORDERS :{WHITE}{VEHICLE} (Заповеди)
STR_882A_END_OF_ORDERS :{SETX 10}- - Край на Заповедите - -
STR_FULLLOAD_OR_SERVICE :{SKIP}{SKIP}{STRING}
@@ -3268,6 +3280,7 @@
STR_WORLD_GENERATION_CAPTION :{WHITE}Световна генерация
STR_RANDOM_SEED :{BLACK}Семе на случайност:
STR_RANDOM_SEED_HELP :{BLACK}Натиснете за въвеждане семе на случайност
+STR_RANDOM_SEED_OSKTITLE :{BLACK}Въведи случаено семе
STR_LAND_GENERATOR :{BLACK}Генератор на земя:
STR_TREE_PLACER :{BLACK}Алгоритъм за дървета:
STR_HEIGHTMAP_ROTATION :{BLACK}Завъртане на височинна карта:
@@ -3415,6 +3428,7 @@
#### Improved sign GUI
STR_NEXT_SIGN_TOOLTIP :{BLACK}Отиди до следващиат знак
STR_PREVIOUS_SIGN_TOOLTIP :{BLACK}Отиди до предишниат знак
+STR_SIGN_OSKTITLE :{BLACK}Въведете име за знакът
########
@@ -3487,3 +3501,8 @@
STR_DRAG_SIGNALS_DENSITY_DECREASE_TIP :{BLACK}Намалява плътноста на сигналите при влачене
STR_DRAG_SIGNALS_DENSITY_INCREASE_TIP :{BLACK}Увеличава плътноста на сигналите при влачене
########
+
+############ on screen keyboard
+STR_OSK_KEYBOARD_LAYOUT :`1234567890-.,уеишщксдзц;(ьяаожгтнвмчюйъэфхпрлб
+STR_OSK_KEYBOARD_LAYOUT_CAPS :~!?+"%=:/_№ІVыУЕИШЩКСДЗЦ§)ЬЯАОЖГТНВМЧЮЙЪЭФХПРЛБ
+########
--- a/src/lang/catalan.txt Sun Apr 06 14:12:19 2008 +0000
+++ b/src/lang/catalan.txt Sun Apr 06 23:07:42 2008 +0000
@@ -1068,7 +1068,6 @@
STR_CONFIG_PATCHES_AUTORENEW_MONEY :{LTBLUE}Autorenovació: mínim de diners per renovar: {ORANGE}{STRING}
STR_CONFIG_PATCHES_ERRMSG_DURATION :{LTBLUE}Duració del missatge d'error: {ORANGE}{STRING}
STR_CONFIG_PATCHES_POPULATION_IN_LABEL :{LTBLUE}Mostra els habitants a la etiqueta del nom de població: {ORANGE}{STRING}
-STR_CONFIG_PATCHES_INVISIBLE_TREES :{LTBLUE}Arbres invisibles (amb edificis transparents): {ORANGE}{STRING}
STR_CONFIG_PATCHES_LAND_GENERATOR :{LTBLUE}Generador de terrenys: {ORANGE}{STRING}
STR_CONFIG_PATCHES_LAND_GENERATOR_ORIGINAL :Original
@@ -1173,6 +1172,7 @@
STR_CONFIG_PATCHES_TOWN_LAYOUT_BETTER_ROADS :millors carreteres
STR_CONFIG_PATCHES_TOWN_LAYOUT_2X2_GRID :graella 2x2
STR_CONFIG_PATCHES_TOWN_LAYOUT_3X3_GRID :graella 3x3
+STR_CONFIG_PATCHES_TOWN_LAYOUT_RANDOM :aleatori
STR_CONFIG_PATCHES_TOOLBAR_POS :{LTBLUE}Posició de la barra d'eines principal: {ORANGE}{STRING}
STR_CONFIG_PATCHES_TOOLBAR_POS_LEFT :Esquerra
@@ -1352,6 +1352,7 @@
STR_NETWORK_PLAYER_NAME :{BLACK}Nom del jugador:
STR_NETWORK_ENTER_NAME_TIP :{BLACK}Aquest és el nom amb el que els altres jugadors t'identificaran
+STR_NETWORK_PLAYER_NAME_OSKTITLE :{BLACK}Posa el teu nom
STR_NETWORK_CONNECTION :{BLACK}Connexió:
STR_NETWORK_CONNECTION_TIP :{BLACK}Tria entre jugar per internet o jugar en xarxa local
@@ -1395,6 +1396,7 @@
STR_NETWORK_NEW_GAME_NAME :{BLACK}Nom del joc:
STR_NETWORK_NEW_GAME_NAME_TIP :{BLACK}El nom del joc es mostrarà a altres jugadors en el menú de selecció de joc multijugador
+STR_NETWORK_NEW_GAME_NAME_OSKTITLE :{BLACK}Posa el nom del joc per xarxa
STR_NETWORK_SET_PASSWORD :{BLACK}Posa una contrasenya
STR_NETWORK_PASSWORD_TIP :{BLACK}Protegeix el teu joc amb una contrasenya si no vols que d'altre gent el pugui utilitzar
STR_NETWORK_SELECT_MAP :{BLACK}Selecciona un mapa:
@@ -1556,6 +1558,7 @@
STR_NETWORK_CHAT_TO_CLIENT :[Private] a {STRING}: {GRAY}{STRING}
STR_NETWORK_CHAT_ALL_CAPTION :[All] :
STR_NETWORK_CHAT_ALL :[All] {STRING}: {GRAY}{STRING}
+STR_NETWORK_CHAT_OSKTITLE :{BLACK}Posa el text pel xat de xarxa
STR_NETWORK_NAME_CHANGE :ha canviat el seu nom a
STR_NETWORK_SERVER_SHUTDOWN :{WHITE} El servidor ha tancat la sesió
STR_NETWORK_SERVER_REBOOT :{WHITE} El servidor està reiniciant...{}Espera un moment...
@@ -1959,6 +1962,7 @@
STR_400F_SELECT_SCENARIO_GREEN_PRE :{BLACK}Selecciona l'escenari (verd), joc pre-programat (blau), o el nou joc aleatori
STR_4010_GENERATE_RANDOM_NEW_GAME :Genera un nou joc aleatori
STR_LOAD_HEIGHTMAP :{WHITE}Carrega un Mapa d'alçades
+STR_SAVE_OSKTITLE :{BLACK}Posa el nom pel joc desat
##id 0x4800
STR_4800_IN_THE_WAY :{WHITE}{STRING} en el camí
@@ -2717,6 +2721,8 @@
STR_REFIT_ORDER :(Remodela a {STRING})
STR_TIMETABLE_VIEW :{BLACK}Horari
STR_TIMETABLE_VIEW_TOOLTIP :{BLACK}Canvia cap a la vista d'horari
+STR_ORDER_VIEW :{BLACK}Ordres
+STR_ORDER_VIEW_TOOLTIP :{BLACK}Commuta l'ordre de la vista
STR_8829_ORDERS :{WHITE}{VEHICLE} (Ordres)
STR_882A_END_OF_ORDERS :{SETX 10}- - Fí d'Ordres - -
STR_FULLLOAD_OR_SERVICE :{SKIP}{SKIP}{STRING}
@@ -3273,6 +3279,7 @@
STR_WORLD_GENERATION_CAPTION :{WHITE}Generació del món
STR_RANDOM_SEED :{BLACK}Nombre aleatori:
STR_RANDOM_SEED_HELP :{BLACK}Click per introduïr un nombre aleatori
+STR_RANDOM_SEED_OSKTITLE :{BLACK}Posa un valor aleatori
STR_LAND_GENERATOR :{BLACK}Gen. de terrenys:
STR_TREE_PLACER :{BLACK}Algoritme d'arbres:
STR_HEIGHTMAP_ROTATION :{BLACK}Rotació del mapa d'alçades:
@@ -3420,6 +3427,7 @@
#### Improved sign GUI
STR_NEXT_SIGN_TOOLTIP :{BLACK}Ves a la propera senyal
STR_PREVIOUS_SIGN_TOOLTIP :{BLACK}Ves a la senyal anterior
+STR_SIGN_OSKTITLE :{BLACK}Posa el nom del signe
########
@@ -3492,3 +3500,8 @@
STR_DRAG_SIGNALS_DENSITY_DECREASE_TIP :{BLACK}Disminueix la densitat de senyals en arrossegar
STR_DRAG_SIGNALS_DENSITY_INCREASE_TIP :{BLACK}Incrementa la densitat de senyals en arrossegar
########
+
+############ on screen keyboard
+STR_OSK_KEYBOARD_LAYOUT :`1234567890-=\qwertyuiop[]asdfghjkl;' zxcvbnm,./ .
+STR_OSK_KEYBOARD_LAYOUT_CAPS :~!@#$%^&*()_+|QWERTYUIOP{{}}ASDFGHJKL:" ZXCVBNM<>? .
+########
--- a/src/lang/croatian.txt Sun Apr 06 14:12:19 2008 +0000
+++ b/src/lang/croatian.txt Sun Apr 06 23:07:42 2008 +0000
@@ -1067,7 +1067,6 @@
STR_CONFIG_PATCHES_AUTORENEW_MONEY :{LTBLUE}Minimum novca potrebnih za automatsko obnavljanje: {ORANGE}{STRING}
STR_CONFIG_PATCHES_ERRMSG_DURATION :{LTBLUE}Trajanje poruke s greškom: {ORANGE}{STRING}
STR_CONFIG_PATCHES_POPULATION_IN_LABEL :{LTBLUE}Pokaži broj stanovnika u oznaci imena grada: {ORANGE}{STRING}
-STR_CONFIG_PATCHES_INVISIBLE_TREES :{LTBLUE}Nevidljivo drveće (s prozirnim građevinama): {ORANGE}{STRING}
STR_CONFIG_PATCHES_LAND_GENERATOR :{LTBLUE}Generator zemlje: {ORANGE}{STRING}
STR_CONFIG_PATCHES_LAND_GENERATOR_ORIGINAL :Izvorni
--- a/src/lang/czech.txt Sun Apr 06 14:12:19 2008 +0000
+++ b/src/lang/czech.txt Sun Apr 06 23:07:42 2008 +0000
@@ -1126,7 +1126,6 @@
STR_CONFIG_PATCHES_AUTORENEW_MONEY :{LTBLUE}Minimální částka pro automatické obnovení: {ORANGE}{STRING}
STR_CONFIG_PATCHES_ERRMSG_DURATION :{LTBLUE}Doba zobrazení chybové zprávy: {ORANGE}{STRING}
STR_CONFIG_PATCHES_POPULATION_IN_LABEL :{LTBLUE}Zobrazovat populaci města v jeho popisku: {ORANGE}{STRING}
-STR_CONFIG_PATCHES_INVISIBLE_TREES :{LTBLUE}Neviditelné stromy (společně s průhlednými budovami): {ORANGE}{STRING}
STR_CONFIG_PATCHES_LAND_GENERATOR :{LTBLUE}Tvůrce krajiny: {ORANGE}{STRING}
STR_CONFIG_PATCHES_LAND_GENERATOR_ORIGINAL :původní
--- a/src/lang/danish.txt Sun Apr 06 14:12:19 2008 +0000
+++ b/src/lang/danish.txt Sun Apr 06 23:07:42 2008 +0000
@@ -1068,7 +1068,6 @@
STR_CONFIG_PATCHES_AUTORENEW_MONEY :{LTBLUE}Min. kontanter før automatisk køretøjsfornyelse: {ORANGE}{STRING}
STR_CONFIG_PATCHES_ERRMSG_DURATION :{LTBLUE}Levetid for fejlmeddelser: {ORANGE}{STRING}
STR_CONFIG_PATCHES_POPULATION_IN_LABEL :{LTBLUE}Vis byens indbyggertal i bynavnet: {ORANGE}{STRING}
-STR_CONFIG_PATCHES_INVISIBLE_TREES :{LTBLUE}Usynlige træer (med gennemsigtige bygninger): {ORANGE}{STRING}
STR_CONFIG_PATCHES_LAND_GENERATOR :{LTBLUE}Landskabs generator: {ORANGE}{STRING}
STR_CONFIG_PATCHES_LAND_GENERATOR_ORIGINAL :Original
--- a/src/lang/dutch.txt Sun Apr 06 14:12:19 2008 +0000
+++ b/src/lang/dutch.txt Sun Apr 06 23:07:42 2008 +0000
@@ -1068,7 +1068,6 @@
STR_CONFIG_PATCHES_AUTORENEW_MONEY :{LTBLUE}Minimum benodigd geld voor automatisch vernieuwen: {ORANGE}{STRING}
STR_CONFIG_PATCHES_ERRMSG_DURATION :{LTBLUE}Duur van foutmeldingen: {ORANGE}{STRING}
STR_CONFIG_PATCHES_POPULATION_IN_LABEL :{LTBLUE}Geef het inwoneraantal bij een stad weer: {ORANGE}{STRING}
-STR_CONFIG_PATCHES_INVISIBLE_TREES :{LTBLUE}Onzichtbare bomen (met transparante gebouwen): {ORANGE}{STRING}
STR_CONFIG_PATCHES_LAND_GENERATOR :{LTBLUE}Land generator: {ORANGE}{STRING}
STR_CONFIG_PATCHES_LAND_GENERATOR_ORIGINAL :Origineel
@@ -1173,6 +1172,7 @@
STR_CONFIG_PATCHES_TOWN_LAYOUT_BETTER_ROADS :betere wegen
STR_CONFIG_PATCHES_TOWN_LAYOUT_2X2_GRID :2x2 raster
STR_CONFIG_PATCHES_TOWN_LAYOUT_3X3_GRID :3x3 raster
+STR_CONFIG_PATCHES_TOWN_LAYOUT_RANDOM :willekeurig
STR_CONFIG_PATCHES_TOOLBAR_POS :{LTBLUE}Positie van algemene toolbar: {ORANGE}{STRING}
STR_CONFIG_PATCHES_TOOLBAR_POS_LEFT :Links
@@ -1352,6 +1352,7 @@
STR_NETWORK_PLAYER_NAME :{BLACK}Spelernaam:
STR_NETWORK_ENTER_NAME_TIP :{BLACK}Dit is de naam waarmee andere spelers je herkennen
+STR_NETWORK_PLAYER_NAME_OSKTITLE :{BLACK}Was is je naam
STR_NETWORK_CONNECTION :{BLACK}Verbinding:
STR_NETWORK_CONNECTION_TIP :{BLACK}Kies tussen een internet spel of een lokaal netwerk spel
@@ -1395,6 +1396,7 @@
STR_NETWORK_NEW_GAME_NAME :{BLACK}Spelnaam:
STR_NETWORK_NEW_GAME_NAME_TIP :{BLACK}De spelnaam wordt weergegeven aan andere spelers in het multiplayer spelselectie menu
+STR_NETWORK_NEW_GAME_NAME_OSKTITLE :{BLACK}Geef de naam van het netwerk spel
STR_NETWORK_SET_PASSWORD :{BLACK}Zet wachtwoord
STR_NETWORK_PASSWORD_TIP :{BLACK}Bescherm je spel met een wachtwoord als je niet wil dat andere mensen meespelen
STR_NETWORK_SELECT_MAP :{BLACK}Selecteer een kaart:
@@ -1451,6 +1453,13 @@
STR_NETWORK_LANG_SWEDISH :Zweeds
STR_NETWORK_LANG_TURKISH :Turks
STR_NETWORK_LANG_UKRAINIAN :Oekraïne
+STR_NETWORK_LANG_AFRIKAANS :Afrikaans
+STR_NETWORK_LANG_CROATIAN :Kroatisch
+STR_NETWORK_LANG_CATALAN :Catalaans
+STR_NETWORK_LANG_ESTONIAN :Ests
+STR_NETWORK_LANG_GALICIAN :Galiciaans
+STR_NETWORK_LANG_GREEK :Grieks
+STR_NETWORK_LANG_LATVIAN :Lets
############ End of leave-in-this-order
STR_NETWORK_GAME_LOBBY :{WHITE}Multiplayer lobby
@@ -1549,6 +1558,7 @@
STR_NETWORK_CHAT_TO_CLIENT :[Prive] Aan {STRING}: {GRAY}{STRING}
STR_NETWORK_CHAT_ALL_CAPTION :[Iedereen] :
STR_NETWORK_CHAT_ALL :[Iedereen] {STRING}: {GRAY}{STRING}
+STR_NETWORK_CHAT_OSKTITLE :{BLACK}Heef de tekst voor de netwerk-chat
STR_NETWORK_NAME_CHANGE :heeft zijn naam veranderd in
STR_NETWORK_SERVER_SHUTDOWN :{WHITE} De server heeft de sessie gestopt.
STR_NETWORK_SERVER_REBOOT :{WHITE} De server wordt opnieuw gestart...{}Wacht aub...
@@ -1715,6 +1725,7 @@
STR_2002_WHITE :{TINYFONT}{WHITE}{SIGN}
STR_2004_BUILDING_MUST_BE_DEMOLISHED :{WHITE}Gebouw moet eerst gesloopt worden
STR_2005 :{WHITE}{TOWN}
+STR_CITY :{WHITE}{TOWN} (Stad)
STR_2006_POPULATION :{BLACK}Bevolking: {ORANGE}{COMMA}{BLACK} Huizen: {ORANGE}{COMMA}
STR_2007_RENAME_TOWN :Hernoem stad
STR_2008_CAN_T_RENAME_TOWN :{WHITE}Kan stad niet hernoemen...
@@ -1951,6 +1962,7 @@
STR_400F_SELECT_SCENARIO_GREEN_PRE :{BLACK}Selecteer scenario (groen), vooraf ingesteld spel (blauw), or willekeurig nieuw spel
STR_4010_GENERATE_RANDOM_NEW_GAME :Genereer willekeurig nieuw spel
STR_LOAD_HEIGHTMAP :{WHITE}Laad Hoogtekaart
+STR_SAVE_OSKTITLE :{BLACK}Typ een naam voor het op te slaan spel
##id 0x4800
STR_4800_IN_THE_WAY :{WHITE}{STRING} in de weg
@@ -2709,6 +2721,8 @@
STR_REFIT_ORDER :(Ombouwen naar {STRING})
STR_TIMETABLE_VIEW :{BLACK}Dienstregeling
STR_TIMETABLE_VIEW_TOOLTIP :{BLACK}Schakel naar de dienstregeling
+STR_ORDER_VIEW :{BLACK}Orders
+STR_ORDER_VIEW_TOOLTIP :{BLACK}Ga naar het order scherm
STR_8829_ORDERS :{WHITE}{VEHICLE} (Orders)
STR_882A_END_OF_ORDERS :{SETX 10}- - Einde van orders - -
STR_FULLLOAD_OR_SERVICE :{SKIP}{SKIP}{STRING}
@@ -3265,6 +3279,7 @@
STR_WORLD_GENERATION_CAPTION :{WHITE}Wereld maken
STR_RANDOM_SEED :{BLACK}Willekeurig getal
STR_RANDOM_SEED_HELP :{BLACK}Klik voor een willekeurig getal
+STR_RANDOM_SEED_OSKTITLE :{BLACK}Geef een willekeurige seed op
STR_LAND_GENERATOR :{BLACK}Land generator:
STR_TREE_PLACER :{BLACK}Bos algoritme:
STR_HEIGHTMAP_ROTATION :{BLACK}Aantal graden hoogtekaart:
@@ -3412,6 +3427,7 @@
#### Improved sign GUI
STR_NEXT_SIGN_TOOLTIP :{BLACK}Ga naar volgende bord
STR_PREVIOUS_SIGN_TOOLTIP :{BLACK}Ga naar vorige bord
+STR_SIGN_OSKTITLE :{BLACK}Heef een naam voor dit bord
########
@@ -3484,3 +3500,8 @@
STR_DRAG_SIGNALS_DENSITY_DECREASE_TIP :{BLACK}Verklein gesleepte sein dichtheid
STR_DRAG_SIGNALS_DENSITY_INCREASE_TIP :{BLACK}Vergroot gesleepte sein dichtheid
########
+
+############ on screen keyboard
+STR_OSK_KEYBOARD_LAYOUT :`1234567890-=\qwertyuiop[]asdfghjkl;' zxcvbnm,./ .
+STR_OSK_KEYBOARD_LAYOUT_CAPS :~!@#$%^&*()_+|QWERTYUIOP{{}}ASDFGHJKL:" ZXCVBNM<>? .
+########
--- a/src/lang/english.txt Sun Apr 06 14:12:19 2008 +0000
+++ b/src/lang/english.txt Sun Apr 06 23:07:42 2008 +0000
@@ -18,6 +18,7 @@
STR_EN_ROUTE_FROM :{YELLOW}({SHORTCARGO} en-route from {STATION})
STR_000C_ACCEPTS :{BLACK}Accepts: {WHITE}
STR_000D_ACCEPTS :{BLACK}Accepts: {GOLD}
+STR_SUPPLIES :{BLACK}Supplies: {GOLD}
STR_000E :
STR_000F_PASSENGERS :Passengers
STR_0010_COAL :Coal
@@ -1069,7 +1070,6 @@
STR_CONFIG_PATCHES_AUTORENEW_MONEY :{LTBLUE}Autorenew minimum needed money for renew: {ORANGE}{STRING1}
STR_CONFIG_PATCHES_ERRMSG_DURATION :{LTBLUE}Duration of error message: {ORANGE}{STRING1}
STR_CONFIG_PATCHES_POPULATION_IN_LABEL :{LTBLUE}Show town population in the town name label: {ORANGE}{STRING1}
-STR_CONFIG_PATCHES_INVISIBLE_TREES :{LTBLUE}Invisible trees: {ORANGE}{STRING1}
STR_CONFIG_PATCHES_LAND_GENERATOR :{LTBLUE}Land generator: {ORANGE}{STRING1}
STR_CONFIG_PATCHES_LAND_GENERATOR_ORIGINAL :Original
@@ -1174,6 +1174,7 @@
STR_CONFIG_PATCHES_TOWN_LAYOUT_BETTER_ROADS :better roads
STR_CONFIG_PATCHES_TOWN_LAYOUT_2X2_GRID :2x2 grid
STR_CONFIG_PATCHES_TOWN_LAYOUT_3X3_GRID :3x3 grid
+STR_CONFIG_PATCHES_TOWN_LAYOUT_RANDOM :random
STR_CONFIG_PATCHES_TOOLBAR_POS :{LTBLUE}Position of main toolbar: {ORANGE}{STRING1}
STR_CONFIG_PATCHES_TOOLBAR_POS_LEFT :Left
@@ -3373,6 +3374,7 @@
STR_TRANSPARENT_STRUCTURES_DESC :{BLACK}Toggle transparency for structures like lighthouses and antennas. CTRL+click to lock.
STR_TRANSPARENT_CATENARY_DESC :{BLACK}Toggle transparency for catenary. CTRL+click to lock.
STR_TRANSPARENT_LOADING_DESC :{BLACK}Toggle transparency for loading indicators. CTRL+click to lock.
+STR_TRANSPARENT_INVISIBLE_DESC :{BLACK}Set objects invisible instead of transparent
STR_PERCENT_UP_SMALL :{TINYFONT}{WHITE}{NUM}%{UPARROW}
STR_PERCENT_UP :{WHITE}{NUM}%{UPARROW}
--- a/src/lang/english_US.txt Sun Apr 06 14:12:19 2008 +0000
+++ b/src/lang/english_US.txt Sun Apr 06 23:07:42 2008 +0000
@@ -1064,7 +1064,6 @@
STR_CONFIG_PATCHES_AUTORENEW_MONEY :{LTBLUE}Autorenew minimum needed money for renew: {ORANGE}{STRING}
STR_CONFIG_PATCHES_ERRMSG_DURATION :{LTBLUE}Duration of error message: {ORANGE}{STRING}
STR_CONFIG_PATCHES_POPULATION_IN_LABEL :{LTBLUE}Show town population in the town name label: {ORANGE}{STRING}
-STR_CONFIG_PATCHES_INVISIBLE_TREES :{LTBLUE}Invisible trees (with transparent buildings): {ORANGE}{STRING}
STR_CONFIG_PATCHES_LAND_GENERATOR :{LTBLUE}Land generator: {ORANGE}{STRING}
STR_CONFIG_PATCHES_LAND_GENERATOR_ORIGINAL :Original
--- a/src/lang/esperanto.txt Sun Apr 06 14:12:19 2008 +0000
+++ b/src/lang/esperanto.txt Sun Apr 06 23:07:42 2008 +0000
@@ -1054,7 +1054,6 @@
STR_CONFIG_PATCHES_AUTORENEW_MONEY :{LTBLUE}Minimuma mono por anstataŭado: {ORANGE}{STRING}
STR_CONFIG_PATCHES_ERRMSG_DURATION :{LTBLUE}Daŭro de erar-mesaĝo: {ORANGE}{STRING}
STR_CONFIG_PATCHES_POPULATION_IN_LABEL :{LTBLUE}Montru enloĝantaron en urbnomindikilo: {ORANGE}{STRING}
-STR_CONFIG_PATCHES_INVISIBLE_TREES :{LTBLUE}Nevideblaj arboj (ĉe travideblaj konstruaĵoj): {ORANGE}{STRING}
STR_CONFIG_PATCHES_LAND_GENERATOR :{LTBLUE}Landgenerilo: {ORANGE}{STRING}
STR_CONFIG_PATCHES_LAND_GENERATOR_ORIGINAL :Origina
--- a/src/lang/estonian.txt Sun Apr 06 14:12:19 2008 +0000
+++ b/src/lang/estonian.txt Sun Apr 06 23:07:42 2008 +0000
@@ -1168,7 +1168,6 @@
STR_CONFIG_PATCHES_AUTORENEW_MONEY :{LTBLUE}Iseuuendusele kuluv väikseim summa: {ORANGE}{STRING}
STR_CONFIG_PATCHES_ERRMSG_DURATION :{LTBLUE}Veateate kuvamise kestus: {ORANGE}{STRING}
STR_CONFIG_PATCHES_POPULATION_IN_LABEL :{LTBLUE}Linna nimesildil näidatakse rahvaarvu: {ORANGE}{STRING}
-STR_CONFIG_PATCHES_INVISIBLE_TREES :{LTBLUE}Nähtamatud puud (läbipaistvate ehitistega): {ORANGE}{STRING}
STR_CONFIG_PATCHES_LAND_GENERATOR :{LTBLUE}Maaala Generaator: {ORANGE}{STRING}
STR_CONFIG_PATCHES_LAND_GENERATOR_ORIGINAL :Algupärane
--- a/src/lang/finnish.txt Sun Apr 06 14:12:19 2008 +0000
+++ b/src/lang/finnish.txt Sun Apr 06 23:07:42 2008 +0000
@@ -1057,7 +1057,6 @@
STR_CONFIG_PATCHES_AUTORENEW_MONEY :{LTBLUE}Pienin tarvittava rahamäärä itseuudistukseen: {ORANGE}{STRING}
STR_CONFIG_PATCHES_ERRMSG_DURATION :{LTBLUE}Virheilmoituksen kesto: {ORANGE}{STRING}
STR_CONFIG_PATCHES_POPULATION_IN_LABEL :{LTBLUE}Näytä kaupungin asukasluku kaupungin nimessä: {ORANGE}{STRING}
-STR_CONFIG_PATCHES_INVISIBLE_TREES :{LTBLUE}Näkymättömät puut (läpinäkyvillä rakennuksilla): {ORANGE}{STRING}
STR_CONFIG_PATCHES_LAND_GENERATOR :{LTBLUE}Maa generaattori: {ORANGE}{STRING}
STR_CONFIG_PATCHES_LAND_GENERATOR_ORIGINAL :Alkuperäinen
--- a/src/lang/french.txt Sun Apr 06 14:12:19 2008 +0000
+++ b/src/lang/french.txt Sun Apr 06 23:07:42 2008 +0000
@@ -1069,7 +1069,6 @@
STR_CONFIG_PATCHES_AUTORENEW_MONEY :{LTBLUE}Argent nécessaire pour l'auto-renouvelement : {ORANGE}{STRING}
STR_CONFIG_PATCHES_ERRMSG_DURATION :{LTBLUE}Temps d'affichage des messages d'erreur: {ORANGE}{STRING}
STR_CONFIG_PATCHES_POPULATION_IN_LABEL :{LTBLUE}Afficher la population d'une ville dans son label : {ORANGE}{STRING}
-STR_CONFIG_PATCHES_INVISIBLE_TREES :{LTBLUE}Arbres invisibles: {ORANGE}{STRING}
STR_CONFIG_PATCHES_LAND_GENERATOR :{LTBLUE}Générateur de terrain : {ORANGE}{STRING}
STR_CONFIG_PATCHES_LAND_GENERATOR_ORIGINAL :Original
@@ -1174,6 +1173,7 @@
STR_CONFIG_PATCHES_TOWN_LAYOUT_BETTER_ROADS :meilleures routes
STR_CONFIG_PATCHES_TOWN_LAYOUT_2X2_GRID :grille 2x2
STR_CONFIG_PATCHES_TOWN_LAYOUT_3X3_GRID :grille 3x3
+STR_CONFIG_PATCHES_TOWN_LAYOUT_RANDOM :aléatoire
STR_CONFIG_PATCHES_TOOLBAR_POS :{LTBLUE}Position de la barre d'outils principale: {ORANGE}{STRING}
STR_CONFIG_PATCHES_TOOLBAR_POS_LEFT :À gauche
@@ -1353,6 +1353,7 @@
STR_NETWORK_PLAYER_NAME :{BLACK}Nom du joueur:
STR_NETWORK_ENTER_NAME_TIP :{BLACK}Ceci est le nom avec lequel les autres joueurs pourront vous identifier
+STR_NETWORK_PLAYER_NAME_OSKTITLE :{BLACK}Entrer votre nom
STR_NETWORK_CONNECTION :{BLACK}Connexion :
STR_NETWORK_CONNECTION_TIP :{BLACK}Choisir entre un jeu sur Internet ou sur réseau local
@@ -1396,6 +1397,7 @@
STR_NETWORK_NEW_GAME_NAME :{BLACK}Nom de la partie:
STR_NETWORK_NEW_GAME_NAME_TIP :{BLACK}Le nom de la partie sera affiché aux autres joueurs dans le menu de sélection de partie multijoueur
+STR_NETWORK_NEW_GAME_NAME_OSKTITLE :{BLACK}Entrer un nom pour la partie en réseau
STR_NETWORK_SET_PASSWORD :{BLACK}Choisir le mot de passe
STR_NETWORK_PASSWORD_TIP :{BLACK}Protéger votre partie avec un mot de passe si vous ne souhaitez pas que d'autres l'utilisent
STR_NETWORK_SELECT_MAP :{BLACK}Choisir une carte:
@@ -1557,6 +1559,7 @@
STR_NETWORK_CHAT_TO_CLIENT :[Privé] A {STRING}: {GRAY}{STRING}
STR_NETWORK_CHAT_ALL_CAPTION :[Tous] :
STR_NETWORK_CHAT_ALL :[Tous] {STRING}: {GRAY}{STRING}
+STR_NETWORK_CHAT_OSKTITLE :{BLACK}Entrer le texte pour le chat
STR_NETWORK_NAME_CHANGE :a changé son nom pour
STR_NETWORK_SERVER_SHUTDOWN :{WHITE} Le serveur a fermé la session
STR_NETWORK_SERVER_REBOOT :{WHITE} Le serveur redémarre...{}Veuillez patienter...
@@ -1960,6 +1963,7 @@
STR_400F_SELECT_SCENARIO_GREEN_PRE :{BLACK}Choisir un scénario (vert), une partie préparée (bleu), ou une partie aléatoire
STR_4010_GENERATE_RANDOM_NEW_GAME :Créer une partie aléatoirement
STR_LOAD_HEIGHTMAP :{WHITE}Charger une carte d'altitude
+STR_SAVE_OSKTITLE :{BLACK}Entrer un nom pour la sauvegarde
##id 0x4800
STR_4800_IN_THE_WAY :{WHITE}{STRING} présente
@@ -2718,6 +2722,8 @@
STR_REFIT_ORDER :(Réaménager pour {STRING})
STR_TIMETABLE_VIEW :{BLACK}Horaire
STR_TIMETABLE_VIEW_TOOLTIP :{BLACK}Basculer vers la vue horaire
+STR_ORDER_VIEW :{BLACK}Ordres
+STR_ORDER_VIEW_TOOLTIP :{BLACK}Basculer vers la vue ordres
STR_8829_ORDERS :{WHITE}{VEHICLE} (Ordres)
STR_882A_END_OF_ORDERS :{SETX 10}- - Fin des ordres - -
STR_FULLLOAD_OR_SERVICE :{SKIP}{SKIP}{STRING}
@@ -3274,6 +3280,7 @@
STR_WORLD_GENERATION_CAPTION :{WHITE}Création du monde
STR_RANDOM_SEED :{BLACK}Amorce :
STR_RANDOM_SEED_HELP :{BLACK}Cliquer pour saisir une amorce
+STR_RANDOM_SEED_OSKTITLE :{BLACK}Entrer une amorce
STR_LAND_GENERATOR :{BLACK}Générateur :
STR_TREE_PLACER :{BLACK}Ajout des arbres :
STR_HEIGHTMAP_ROTATION :{BLACK}Rotation de la carte d'altitude :
@@ -3421,6 +3428,7 @@
#### Improved sign GUI
STR_NEXT_SIGN_TOOLTIP :{BLACK}Aller au panneau suivant
STR_PREVIOUS_SIGN_TOOLTIP :{BLACK}Aller au panneau précédent
+STR_SIGN_OSKTITLE :{BLACK}Entrer un nom pour le panneau
########
@@ -3493,3 +3501,8 @@
STR_DRAG_SIGNALS_DENSITY_DECREASE_TIP :{BLACK}Réduire la densité de signal
STR_DRAG_SIGNALS_DENSITY_INCREASE_TIP :{BLACK}Augmenter la densité de signal
########
+
+############ on screen keyboard
+STR_OSK_KEYBOARD_LAYOUT :²&é"'(-è_çà)=azertyuiop^$qsdfghjklmù*wxcvbn,;:!
+STR_OSK_KEYBOARD_LAYOUT_CAPS :²1234567890°+AZERTYUIOP¨£QSDFGHJKLM%µWXCVBN?./§
+########
--- a/src/lang/galician.txt Sun Apr 06 14:12:19 2008 +0000
+++ b/src/lang/galician.txt Sun Apr 06 23:07:42 2008 +0000
@@ -1024,7 +1024,6 @@
STR_CONFIG_PATCHES_AUTORENEW_MONEY :{LTBLUE}Diñeiro mínimo necesario para a autorenovación: {ORANGE}{STRING}
STR_CONFIG_PATCHES_ERRMSG_DURATION :{LTBLUE}Duración das mensaxes de error: {ORANGE}{STRING}
STR_CONFIG_PATCHES_POPULATION_IN_LABEL :{LTBLUE}Mostra-la poboación da cidade na etiqueta: {ORANGE}{STRING}
-STR_CONFIG_PATCHES_INVISIBLE_TREES :{LTBLUE}Árbores invisibles (con edificios transparentes): {ORANGE}{STRING}
STR_CONFIG_PATCHES_LAND_GENERATOR :{LTBLUE}Xerador de mapas: {ORANGE}{STRING}
STR_CONFIG_PATCHES_LAND_GENERATOR_ORIGINAL :Orixinal
--- a/src/lang/german.txt Sun Apr 06 14:12:19 2008 +0000
+++ b/src/lang/german.txt Sun Apr 06 23:07:42 2008 +0000
@@ -1069,7 +1069,6 @@
STR_CONFIG_PATCHES_AUTORENEW_MONEY :{LTBLUE}Minimaler Kontostand für automatisches Erneuern: {ORANGE}{STRING}
STR_CONFIG_PATCHES_ERRMSG_DURATION :{LTBLUE}Dauer der Fehlermeldungen: {ORANGE}{STRING}
STR_CONFIG_PATCHES_POPULATION_IN_LABEL :{LTBLUE}Zeige die Einwohnerzahl der Stadt im Label: {ORANGE}{STRING}
-STR_CONFIG_PATCHES_INVISIBLE_TREES :{LTBLUE}Unsichtbare Bäume (bei transparenten Gebäuden): {ORANGE}{STRING}
STR_CONFIG_PATCHES_LAND_GENERATOR :{LTBLUE}Land Generator: {ORANGE}{STRING}
STR_CONFIG_PATCHES_LAND_GENERATOR_ORIGINAL :Original
--- a/src/lang/hungarian.txt Sun Apr 06 14:12:19 2008 +0000
+++ b/src/lang/hungarian.txt Sun Apr 06 23:07:42 2008 +0000
@@ -1133,7 +1133,6 @@
STR_CONFIG_PATCHES_AUTORENEW_MONEY :{LTBLUE}Automata megújításhoz szükséges minimális pénz: {ORANGE}{STRING}
STR_CONFIG_PATCHES_ERRMSG_DURATION :{LTBLUE}Hibaüzenetek megjelenítési ideje: {ORANGE}{STRING}
STR_CONFIG_PATCHES_POPULATION_IN_LABEL :{LTBLUE}Mutassa a lakosságot a feliratban: {ORANGE}{STRING}
-STR_CONFIG_PATCHES_INVISIBLE_TREES :{LTBLUE}Láthatatlan fák (átlátszó épületekkel): {ORANGE}{STRING}
STR_CONFIG_PATCHES_LAND_GENERATOR :{LTBLUE}Térkép generálás: {ORANGE}{STRING}
STR_CONFIG_PATCHES_LAND_GENERATOR_ORIGINAL :Eredeti
@@ -1238,6 +1237,7 @@
STR_CONFIG_PATCHES_TOWN_LAYOUT_BETTER_ROADS :jobb utak
STR_CONFIG_PATCHES_TOWN_LAYOUT_2X2_GRID :2x2-es háló
STR_CONFIG_PATCHES_TOWN_LAYOUT_3X3_GRID :3x3-as háló
+STR_CONFIG_PATCHES_TOWN_LAYOUT_RANDOM :véletlenszerű
STR_CONFIG_PATCHES_TOOLBAR_POS :{LTBLUE}A fő eszközsor helye: {ORANGE}{STRING}
STR_CONFIG_PATCHES_TOOLBAR_POS_LEFT :Balra
@@ -1417,6 +1417,7 @@
STR_NETWORK_PLAYER_NAME :{BLACK}Játékos neve:
STR_NETWORK_ENTER_NAME_TIP :{BLACK}A többi játékos ilyen nével fog ismerni Téged.
+STR_NETWORK_PLAYER_NAME_OSKTITLE :{BLACK}Add meg a neved
STR_NETWORK_CONNECTION :{BLACK}Kapcsolat:
STR_NETWORK_CONNECTION_TIP :{BLACK}Válassz az internetes vagy helyi hálózati játék közül
@@ -1460,6 +1461,7 @@
STR_NETWORK_NEW_GAME_NAME :{BLACK}Játék neve:
STR_NETWORK_NEW_GAME_NAME_TIP :{BLACK}A játék neve fog megjelenni a többi játékosnak a többjátékos menüben
+STR_NETWORK_NEW_GAME_NAME_OSKTITLE :{BLACK}Add meg a hálózati játékhoz a neved
STR_NETWORK_SET_PASSWORD :{BLACK}Jelszó beállítása
STR_NETWORK_PASSWORD_TIP :{BLACK}Védd le a játékodat jelszóval ha nem akarod hogy mások csatlakozzanak
STR_NETWORK_SELECT_MAP :{BLACK}Válassz egy térképet:
@@ -1621,6 +1623,7 @@
STR_NETWORK_CHAT_TO_CLIENT :[Privát] {STRING} számára: {GRAY}{STRING}
STR_NETWORK_CHAT_ALL_CAPTION :[Mindenkinek] :
STR_NETWORK_CHAT_ALL :[Mindenkinek] {STRING}: {GRAY}{STRING}
+STR_NETWORK_CHAT_OSKTITLE :{BLACK}Add meg a hálózati beszélgetéshez a neved
STR_NETWORK_NAME_CHANGE :megváltoztatta a nevét erre:
STR_NETWORK_SERVER_SHUTDOWN :{WHITE} A szerver leállította a játékot
STR_NETWORK_SERVER_REBOOT :{WHITE} A szerver újraindul...{}Türelem...
@@ -2024,6 +2027,7 @@
STR_400F_SELECT_SCENARIO_GREEN_PRE :{BLACK}Válassz egy pályát (zöld), előre beállított játékot (kék) vagy véletlenszerű új játékot
STR_4010_GENERATE_RANDOM_NEW_GAME :Véletlenszerű új játék
STR_LOAD_HEIGHTMAP :{WHITE}Magasságtérkép betöltése
+STR_SAVE_OSKTITLE :{BLACK}Add meg a játékmentés nevét
##id 0x4800
STR_4800_IN_THE_WAY :{WHITE}...{STRING} van az útban
@@ -3594,3 +3598,6 @@
STR_DRAG_SIGNALS_DENSITY_DECREASE_TIP :{BLACK}Automata szignáltávolság csökkentése
STR_DRAG_SIGNALS_DENSITY_INCREASE_TIP :{BLACK}Automata szignáltávolság növelése
########
+
+############ on screen keyboard
+########
--- a/src/lang/icelandic.txt Sun Apr 06 14:12:19 2008 +0000
+++ b/src/lang/icelandic.txt Sun Apr 06 23:07:42 2008 +0000
@@ -1,7 +1,7 @@
##name Icelandic
##ownname Íslenska
##isocode is_IS
-##plural 9
+##plural 0
##gender karlkyn kvenkyn hvorugkyn
#
@@ -1036,6 +1036,8 @@
STR_CONFIG_PATCHES_GOTODEPOT :{LTBLUE}Skýli má vera á áætlun lesta: {ORANGE}{STRING}
STR_CONFIG_PATCHES_RAW_INDUSTRY_CONSTRUCTION_METHOD :{LTBLUE}Fjármögnun nýrra hráefnisiðnaða: {ORANGE}{STRING}
STR_CONFIG_PATCHES_RAW_INDUSTRY_CONSTRUCTION_METHOD_NONE :engin
+STR_CONFIG_PATCHES_RAW_INDUSTRY_CONSTRUCTION_METHOD_NORMAL :eins og annarra iðnaða
+STR_CONFIG_PATCHES_RAW_INDUSTRY_CONSTRUCTION_METHOD_PROSPECTING :með jarðefnisleit
STR_CONFIG_PATCHES_MULTIPINDTOWN :{LTBLUE}Leyfa marga svipaða iðnaði í sama bæ: {ORANGE}{STRING}
STR_CONFIG_PATCHES_SAMEINDCLOSE :{LTBLUE}Má byggja iðnaði af sömu gerð nálægt hvor öðrum: {ORANGE}{STRING}
STR_CONFIG_PATCHES_LONGDATE :{LTBLUE}Sýna alltaf fulla dagsetningu á upplýsingaslá: {ORANGE}{STRING}
@@ -1049,6 +1051,7 @@
STR_CONFIG_PATCHES_ALLOW_GIVE_MONEY :{LTBLUE}Heimila peningagreiðslur til annarra fyrirtækja: {ORANGE}{STRING}
STR_CONFIG_PATCHES_NONUNIFORM_STATIONS :{LTBLUE}Órétthyrndar lestarstöðvar leyfðar: {ORANGE}{STRING}
STR_CONFIG_PATCHES_FREIGHT_TRAINS :{LTBLUE}Margfalda þyngd farms til að líkja eftir þyngri lestum: {ORANGE}{STRING}
+STR_CONFIG_PATCHES_PLANE_SPEED :{LTBLUE}Hraðastuðull flugvéla: {ORANGE}1 / {STRING}
STR_CONFIG_PATCHES_STOP_ON_TOWN_ROAD :{LTBLUE}Leyfa strætóstöðvar á gangstéttum bæja: {ORANGE}{STRING}
STR_CONFIG_PATCHES_ADJACENT_STATIONS :{LTBLUE}Heimila sambyggingu stöðva: {ORANGE}{STRING}
@@ -1066,7 +1069,6 @@
STR_CONFIG_PATCHES_AUTORENEW_MONEY :{LTBLUE}Lágmarks bankainnistæða fyrir sjálfvirka uppfæringu: {ORANGE}{STRING}
STR_CONFIG_PATCHES_ERRMSG_DURATION :{LTBLUE}Birtingartími villuskilaboða: {ORANGE}{STRING}
STR_CONFIG_PATCHES_POPULATION_IN_LABEL :{LTBLUE}Sýna íbúafjölda í bæjarmerki: {ORANGE}{STRING}
-STR_CONFIG_PATCHES_INVISIBLE_TREES :{LTBLUE}Ósýnileg tré (með gagnsæjum byggingum): {ORANGE}{STRING}
STR_CONFIG_PATCHES_LAND_GENERATOR :{LTBLUE}Landslagsmótun: {ORANGE}{STRING}
STR_CONFIG_PATCHES_LAND_GENERATOR_ORIGINAL :Upphafleg
@@ -1104,6 +1106,9 @@
STR_CONFIG_PATCHES_SCROLLWHEEL_OFF :Engin
STR_CONFIG_PATCHES_SCROLLWHEEL_MULTIPLIER :{LTBLUE}Hraði skrunhjóls á korti: {ORANGE}{STRING}
+STR_CONFIG_PATCHES_RIGHT_MOUSE_BTN_EMU :{LTBLUE}Hægrismellshermun: {ORANGE}{STRING}
+STR_CONFIG_PATCHES_RIGHT_MOUSE_BTN_EMU_COMMAND :Command-smella
+STR_CONFIG_PATCHES_RIGHT_MOUSE_BTN_EMU_CONTROL :Control-smella
STR_CONFIG_PATCHES_RIGHT_MOUSE_BTN_EMU_OFF :Af
STR_CONFIG_PATCHES_PAUSE_ON_NEW_GAME :{LTBLUE}Setja leik á bið þegar nýr leikur er hafinn: {ORANGE}{STRING}
@@ -1126,6 +1131,7 @@
STR_CONFIG_PATCHES_DEFAULT_RAIL_TYPE_LAST :Síðasta mögulega
STR_CONFIG_PATCHES_DEFAULT_RAIL_TYPE_MOST_USED :Mest notuð
+STR_CONFIG_PATCHES_ALWAYS_BUILD_INFRASTRUCTURE :{LTBLUE}Sýna byggingarvalmynd þegar engin viðeigandi farartæki eru fáanleg: {ORANGE}{STRING}
STR_CONFIG_PATCHES_MAX_TRAINS :{LTBLUE}Lestir á leikmann mest: {ORANGE}{STRING}
STR_CONFIG_PATCHES_MAX_ROADVEH :{LTBLUE}Bifreiðir á leikmann mest: {ORANGE}{STRING}
STR_CONFIG_PATCHES_MAX_AIRCRAFT :{LTBLUE}Flugvélar á leikmann mest: {ORANGE}{STRING}
@@ -1298,8 +1304,8 @@
STR_FAST_FORWARD :{BLACK}Spóla leikinn áfram
STR_MESSAGE_HISTORY :{WHITE}Saga skilaboða
STR_MESSAGE_HISTORY_TIP :{BLACK}Listi yfir nýlegar fréttir
-STR_MESSAGES_DISABLE_ALL :{BLACK}Óvirkja allt
-STR_MESSAGES_ENABLE_ALL :{BLACK}Virkja allt
+STR_MESSAGES_DISABLE_ALL :{BLACK}Fela allt
+STR_MESSAGES_ENABLE_ALL :{BLACK}Sýna allt
STR_CONSTRUCT_COAL_MINE_TIP :{BLACK}Grafa Kolanámu
STR_CONSTRUCT_FOREST_TIP :{BLACK}Gróðursetja Skóg
@@ -1346,6 +1352,7 @@
STR_NETWORK_PLAYER_NAME :{BLACK}Nafn leikmanns:
STR_NETWORK_ENTER_NAME_TIP :{BLACK}Þetta er nafnið sem aðrir leikmenn munu þekkja þig undir
+STR_NETWORK_PLAYER_NAME_OSKTITLE :{BLACK}Sláðu inn nafn þitt
STR_NETWORK_CONNECTION :{BLACK}Tenging:
STR_NETWORK_CONNECTION_TIP :{BLACK}Veldu milli internetleiks eða staðarnetleiks
@@ -1389,6 +1396,7 @@
STR_NETWORK_NEW_GAME_NAME :{BLACK}Nafn leiks:
STR_NETWORK_NEW_GAME_NAME_TIP :{BLACK}Nafn leiksins mun vera sýnilegt öðrum leikmönnum í fjölspilunarvalmyndinni
+STR_NETWORK_NEW_GAME_NAME_OSKTITLE :{BLACK}Sláðu inn nafn netleiksins
STR_NETWORK_SET_PASSWORD :{BLACK}Veldu lykilorð
STR_NETWORK_PASSWORD_TIP :{BLACK}Verndaðu leikinn þinn með lykilorði ef þú vilt ekki að óboðnir tengist honum
STR_NETWORK_SELECT_MAP :{BLACK}Veldu kort:
@@ -1445,6 +1453,13 @@
STR_NETWORK_LANG_SWEDISH :Sænska
STR_NETWORK_LANG_TURKISH :Tyrkneska
STR_NETWORK_LANG_UKRAINIAN :Úkraínska
+STR_NETWORK_LANG_AFRIKAANS :Afríkanska
+STR_NETWORK_LANG_CROATIAN :Króatíska
+STR_NETWORK_LANG_CATALAN :Katalónska
+STR_NETWORK_LANG_ESTONIAN :Eistneska
+STR_NETWORK_LANG_GALICIAN :Gelíska
+STR_NETWORK_LANG_GREEK :Gríska
+STR_NETWORK_LANG_LATVIAN :Lettneska
############ End of leave-in-this-order
STR_NETWORK_GAME_LOBBY :{WHITE}Anddyri fjölspilunarleiks
@@ -1543,6 +1558,7 @@
STR_NETWORK_CHAT_TO_CLIENT :[Private] Til {STRING}: {GRAY}{STRING}
STR_NETWORK_CHAT_ALL_CAPTION :[All] :
STR_NETWORK_CHAT_ALL :[All] {STRING}: {GRAY}{STRING}
+STR_NETWORK_CHAT_OSKTITLE :{BLACK}Sláðu inn texta fyrir netpsjall
STR_NETWORK_NAME_CHANGE :hefur breytt nafni sínu í
STR_NETWORK_SERVER_SHUTDOWN :{WHITE} Þjónninn sleit tengingunni
STR_NETWORK_SERVER_REBOOT :{WHITE} Verið er að endurræsa þjóninn...{}Vinsamlega bíðið...
@@ -1709,6 +1725,7 @@
STR_2002_WHITE :{TINYFONT}{WHITE}{SIGN}
STR_2004_BUILDING_MUST_BE_DEMOLISHED :{WHITE}Verður að eyða byggingu fyrst
STR_2005 :{WHITE}{TOWN}
+STR_CITY :{WHITE}{TOWN} (Borg)
STR_2006_POPULATION :{BLACK}Íbúafjöldi: {ORANGE}{COMMA}{BLACK} Hús: {ORANGE}{COMMA}
STR_2007_RENAME_TOWN :Endurskíra bæ
STR_2008_CAN_T_RENAME_TOWN :{WHITE}Get ekki endurskírt bæ...
@@ -1945,6 +1962,7 @@
STR_400F_SELECT_SCENARIO_GREEN_PRE :{BLACK}Velja landslag (grænt), forstilltan leik (blátt) eða handahófskenndan leik
STR_4010_GENERATE_RANDOM_NEW_GAME :Búa til nýjan leik
STR_LOAD_HEIGHTMAP :{WHITE}Hlaða hæðakorti
+STR_SAVE_OSKTITLE :{BLACK}Sláðu inn nafn fyrir vistun leiksins
##id 0x4800
STR_4800_IN_THE_WAY :{WHITE}{STRING} er fyrir
@@ -2703,6 +2721,8 @@
STR_REFIT_ORDER :(Breyta í {STRING})
STR_TIMETABLE_VIEW :{BLACK}Áætlun
STR_TIMETABLE_VIEW_TOOLTIP :{BLACK}Skipta yfir í áætlanasýn
+STR_ORDER_VIEW :{BLACK}Skipanir
+STR_ORDER_VIEW_TOOLTIP :{BLACK}Skipta yfir í skipanasýn
STR_8829_ORDERS :{WHITE}{VEHICLE} (Skipanir)
STR_882A_END_OF_ORDERS :{SETX 10}- - Endi skipana - -
STR_FULLLOAD_OR_SERVICE :{SKIP}{SKIP}{STRING}
@@ -3259,6 +3279,7 @@
STR_WORLD_GENERATION_CAPTION :{WHITE}Sköpun heims
STR_RANDOM_SEED :{BLACK}Raðnúmer lands:
STR_RANDOM_SEED_HELP :{BLACK}Smelltu til að skrifa inn raðnúmer
+STR_RANDOM_SEED_OSKTITLE :{BLACK}Sláðu inn slembistofn
STR_LAND_GENERATOR :{BLACK}Landmyndun:
STR_TREE_PLACER :{BLACK}Planta trjám:
STR_HEIGHTMAP_ROTATION :{BLACK}Snúningur hæðarkorts:
@@ -3337,6 +3358,7 @@
########
+STR_FEEDER_CARGO_VALUE :{BLACK}Millifæra gjaldeyri: {LTBLUE}{CURRENCY}
STR_DRIVE_THROUGH_ERROR_ON_TOWN_ROAD :{WHITE}...vegurinn er í eigu bæjar
STR_DRIVE_THROUGH_ERROR_DIRECTION :{WHITE}...vegurinn snýr í ranga átt
@@ -3405,6 +3427,7 @@
#### Improved sign GUI
STR_NEXT_SIGN_TOOLTIP :{BLACK}Fara að næsta skilti
STR_PREVIOUS_SIGN_TOOLTIP :{BLACK}Fara að fyrra skilti
+STR_SIGN_OSKTITLE :{BLACK}Sláðu inn nafn fyrir skiltið
########
@@ -3477,3 +3500,6 @@
STR_DRAG_SIGNALS_DENSITY_DECREASE_TIP :{BLACK}Minnka þéttleika dreginna ljósa
STR_DRAG_SIGNALS_DENSITY_INCREASE_TIP :{BLACK}Auka þéttleika dreginna ljósa
########
+
+############ on screen keyboard
+########
--- a/src/lang/italian.txt Sun Apr 06 14:12:19 2008 +0000
+++ b/src/lang/italian.txt Sun Apr 06 23:07:42 2008 +0000
@@ -1070,7 +1070,6 @@
STR_CONFIG_PATCHES_AUTORENEW_MONEY :{LTBLUE}Rinnova solo se disponibile il fondo minimo di {ORANGE}{STRING}
STR_CONFIG_PATCHES_ERRMSG_DURATION :{LTBLUE}Durata dei messaggi d'errore: {ORANGE}{STRING}
STR_CONFIG_PATCHES_POPULATION_IN_LABEL :{LTBLUE}Mostra la popolazione di una città nell'etichetta del nome: {ORANGE}{STRING}
-STR_CONFIG_PATCHES_INVISIBLE_TREES :{LTBLUE}Alberi invisibili: {ORANGE}{STRING}
STR_CONFIG_PATCHES_LAND_GENERATOR :{LTBLUE}Generatore terreno: {ORANGE}{STRING}
STR_CONFIG_PATCHES_LAND_GENERATOR_ORIGINAL :Originale
@@ -1175,6 +1174,7 @@
STR_CONFIG_PATCHES_TOWN_LAYOUT_BETTER_ROADS :Pianta migliorata
STR_CONFIG_PATCHES_TOWN_LAYOUT_2X2_GRID :Griglia 2x2
STR_CONFIG_PATCHES_TOWN_LAYOUT_3X3_GRID :Griglia 3x3
+STR_CONFIG_PATCHES_TOWN_LAYOUT_RANDOM :Casuale
STR_CONFIG_PATCHES_TOOLBAR_POS :{LTBLUE}Posizione barra degli strumenti principale: {ORANGE}{STRING}
STR_CONFIG_PATCHES_TOOLBAR_POS_LEFT :Sinistra
@@ -1354,6 +1354,7 @@
STR_NETWORK_PLAYER_NAME :{BLACK}Nome giocatore:
STR_NETWORK_ENTER_NAME_TIP :{BLACK}Questo è il nome con cui si verrà identificati dagli altri giocatori
+STR_NETWORK_PLAYER_NAME_OSKTITLE :{BLACK}Inserire il nome del giocatore
STR_NETWORK_CONNECTION :{BLACK}Connessione:
STR_NETWORK_CONNECTION_TIP :{BLACK}Sceglie fra una partita in Internet o in rete locale (LAN)
@@ -1397,6 +1398,7 @@
STR_NETWORK_NEW_GAME_NAME :{BLACK}Nome partita:
STR_NETWORK_NEW_GAME_NAME_TIP :{BLACK}Il nome della partita sarà mostrato dagli altri giocatori nel menu di selezione delle partite multigiocatore
+STR_NETWORK_NEW_GAME_NAME_OSKTITLE :{BLACK}Inserire il nome della partita
STR_NETWORK_SET_PASSWORD :{BLACK}Imposta password
STR_NETWORK_PASSWORD_TIP :{BLACK}Protegge la partita con una password in modo che non sia accessibile pubblicamente
STR_NETWORK_SELECT_MAP :{BLACK}Seleziona mappa:
@@ -1456,7 +1458,7 @@
STR_NETWORK_LANG_AFRIKAANS :Afrikaans
STR_NETWORK_LANG_CROATIAN :Croato
STR_NETWORK_LANG_CATALAN :Catalano
-STR_NETWORK_LANG_ESTONIAN :Èstone
+STR_NETWORK_LANG_ESTONIAN :Estone
STR_NETWORK_LANG_GALICIAN :Galiziano
STR_NETWORK_LANG_GREEK :Greco
STR_NETWORK_LANG_LATVIAN :Lèttone
@@ -1558,6 +1560,7 @@
STR_NETWORK_CHAT_TO_CLIENT :[Privato] A {STRING}: {GRAY}{STRING}
STR_NETWORK_CHAT_ALL_CAPTION :[Tutti] :
STR_NETWORK_CHAT_ALL :[Tutti] {STRING}: {GRAY}{STRING}
+STR_NETWORK_CHAT_OSKTITLE :{BLACK}Inserire il messaggio
STR_NETWORK_NAME_CHANGE :ha cambiato il suo nome in
STR_NETWORK_SERVER_SHUTDOWN :{WHITE} Il server ha chiuso la sessione
STR_NETWORK_SERVER_REBOOT :{WHITE} Il server si sta riavviando...{}Attendere prego...
@@ -1961,6 +1964,7 @@
STR_400F_SELECT_SCENARIO_GREEN_PRE :{BLACK}Seleziona uno scenario (verde), una partita pre-impostata (blu), o una nuova partita casuale
STR_4010_GENERATE_RANDOM_NEW_GAME :Crea partita casuale
STR_LOAD_HEIGHTMAP :{WHITE}Carica heightmap
+STR_SAVE_OSKTITLE :{BLACK}Inserire un nome per il salvataggio
##id 0x4800
STR_4800_IN_THE_WAY :{WHITE}{STRING} di mezzo
@@ -2719,6 +2723,8 @@
STR_REFIT_ORDER :(Riadatta per {STRING})
STR_TIMETABLE_VIEW :{BLACK}Orario
STR_TIMETABLE_VIEW_TOOLTIP :{BLACK}Passa alla visualizzazione della tabella oraria
+STR_ORDER_VIEW :{BLACK}Ordini
+STR_ORDER_VIEW_TOOLTIP :{BLACK}Passa alla visualizzazione degli ordini
STR_8829_ORDERS :{WHITE}{VEHICLE} (Ordini)
STR_882A_END_OF_ORDERS :{SETX 10}- - Fine degli ordini - -
STR_FULLLOAD_OR_SERVICE :{SKIP}{SKIP}{STRING}
@@ -3275,6 +3281,7 @@
STR_WORLD_GENERATION_CAPTION :{WHITE}Generazione mondo
STR_RANDOM_SEED :{BLACK}Seme casuale:
STR_RANDOM_SEED_HELP :{BLACK}Fare clic per introdurre un seme casuale
+STR_RANDOM_SEED_OSKTITLE :{BLACK}Inserire un seme casuale
STR_LAND_GENERATOR :{BLACK}Generatore:
STR_TREE_PLACER :{BLACK}Algoritmo alberi:
STR_HEIGHTMAP_ROTATION :{BLACK}Rotazione heightmap:
@@ -3422,6 +3429,7 @@
#### Improved sign GUI
STR_NEXT_SIGN_TOOLTIP :{BLACK}Va al cartello successivo
STR_PREVIOUS_SIGN_TOOLTIP :{BLACK}Va al cartello precedente
+STR_SIGN_OSKTITLE :{BLACK}Inserire il nome del cartello
########
@@ -3494,3 +3502,8 @@
STR_DRAG_SIGNALS_DENSITY_DECREASE_TIP :{BLACK}Riduce la distanza fra i segnali costruiti
STR_DRAG_SIGNALS_DENSITY_INCREASE_TIP :{BLACK}Aumenta la distanza fra i segnali costruiti
########
+
+############ on screen keyboard
+STR_OSK_KEYBOARD_LAYOUT :\1234567890'ìùqwertyuiopè+asdfghjklòà zxcvbnm,.- .
+STR_OSK_KEYBOARD_LAYOUT_CAPS :|!"£$%&/()=?^QWERTYUIOPé*§ASDFGHJKLç° ZXCVBNM;:_ .
+########
--- a/src/lang/japanese.txt Sun Apr 06 14:12:19 2008 +0000
+++ b/src/lang/japanese.txt Sun Apr 06 23:07:42 2008 +0000
@@ -1067,7 +1067,6 @@
STR_CONFIG_PATCHES_AUTORENEW_MONEY :{LTBLUE}自動交換するための最小資金:{ORANGE}{STRING}
STR_CONFIG_PATCHES_ERRMSG_DURATION :{LTBLUE}エラーメッセージの表示時間:{ORANGE}{STRING}
STR_CONFIG_PATCHES_POPULATION_IN_LABEL :{LTBLUE}町名に人口を含む:{ORANGE}{STRING}
-STR_CONFIG_PATCHES_INVISIBLE_TREES :{LTBLUE}木を不可視にする(建物が透明):{ORANGE}{STRING}
STR_CONFIG_PATCHES_LAND_GENERATOR :{LTBLUE}地形作成:{ORANGE}{STRING}
STR_CONFIG_PATCHES_LAND_GENERATOR_ORIGINAL :旧式
--- a/src/lang/korean.txt Sun Apr 06 14:12:19 2008 +0000
+++ b/src/lang/korean.txt Sun Apr 06 23:07:42 2008 +0000
@@ -1069,7 +1069,6 @@
STR_CONFIG_PATCHES_AUTORENEW_MONEY :{LTBLUE}교체를 위한 자동 교체 최소 요구 자금 : {ORANGE}{STRING}
STR_CONFIG_PATCHES_ERRMSG_DURATION :{LTBLUE}오류 메시지 표시 : {ORANGE}{STRING}초 동안
STR_CONFIG_PATCHES_POPULATION_IN_LABEL :{LTBLUE}도시명 옆에 인구를 표시함 : {ORANGE}{STRING}
-STR_CONFIG_PATCHES_INVISIBLE_TREES :{LTBLUE}나무 안보이게 하기 (건물 투명하게 하면서) : {ORANGE}{STRING}
STR_CONFIG_PATCHES_LAND_GENERATOR :{LTBLUE}지형 생성: {ORANGE}{STRING}
STR_CONFIG_PATCHES_LAND_GENERATOR_ORIGINAL :오리지널
@@ -1302,7 +1301,7 @@
STR_SELECT_STATION_CLASS_TIP :{BLACK}표시할 역의 종류를 선택합니다
STR_SELECT_STATION_TYPE_TIP :{BLACK}건설할 역의 종류를 선택합니다
-STR_FAST_FORWARD :{BLACK}게임 빨리감기
+STR_FAST_FORWARD :{BLACK}게임 고속 진행
STR_MESSAGE_HISTORY :{WHITE}메시지 기록
STR_MESSAGE_HISTORY_TIP :{BLACK}최근 뉴스 메시지의 기록입니다
STR_MESSAGES_DISABLE_ALL :{BLACK}모두 사용 안함
@@ -1353,6 +1352,7 @@
STR_NETWORK_PLAYER_NAME :{BLACK}플레이어 이름:
STR_NETWORK_ENTER_NAME_TIP :{BLACK}다른 사람이 당신을 확인할 이름입니다
+STR_NETWORK_PLAYER_NAME_OSKTITLE :{BLACK}이름을 입력하세요
STR_NETWORK_CONNECTION :{BLACK}접속방법:
STR_NETWORK_CONNECTION_TIP :{BLACK}인터넷/네트워크 게임중에 하나를 선택하세요.
@@ -1396,6 +1396,7 @@
STR_NETWORK_NEW_GAME_NAME :{BLACK}게임 제목:
STR_NETWORK_NEW_GAME_NAME_TIP :{BLACK}멀티플레이 게임 선택 메뉴에서 보여질 게임 제목입니다.
+STR_NETWORK_NEW_GAME_NAME_OSKTITLE :{BLACK}네트워크 게임에서 사용할 이름을 입력하세요
STR_NETWORK_SET_PASSWORD :{BLACK}암호 설정
STR_NETWORK_PASSWORD_TIP :{BLACK}자유로운 접근을 막고 싶을 때 게임 접근시 암호를 설정할 수 있습니다
STR_NETWORK_SELECT_MAP :{BLACK}맵 선택:
@@ -1452,6 +1453,13 @@
STR_NETWORK_LANG_SWEDISH :스웨덴어
STR_NETWORK_LANG_TURKISH :터키어
STR_NETWORK_LANG_UKRAINIAN :우크라이나어
+STR_NETWORK_LANG_AFRIKAANS :아프리카
+STR_NETWORK_LANG_CROATIAN :크로아티아
+STR_NETWORK_LANG_CATALAN :카탈로니아
+STR_NETWORK_LANG_ESTONIAN :에스토니아
+STR_NETWORK_LANG_GALICIAN :갈리시아
+STR_NETWORK_LANG_GREEK :그리스
+STR_NETWORK_LANG_LATVIAN :라트비아
############ End of leave-in-this-order
STR_NETWORK_GAME_LOBBY :{WHITE}멀티플레이 준비
@@ -1550,6 +1558,7 @@
STR_NETWORK_CHAT_TO_CLIENT :[귓속말] {STRING}에게: {GRAY}{STRING}
STR_NETWORK_CHAT_ALL_CAPTION :[모두] :
STR_NETWORK_CHAT_ALL :[모두] {STRING}: {GRAY}{STRING}
+STR_NETWORK_CHAT_OSKTITLE :{BLACK}네트워크 채팅을 위한 텍스트를 입력하세요
STR_NETWORK_NAME_CHANGE :님의 이름이 바뀌었습니다 :
STR_NETWORK_SERVER_SHUTDOWN :{WHITE} 서버가 세션을 종료하였습니다
STR_NETWORK_SERVER_REBOOT :{WHITE} 서버 재가동중...{}기다려주세요...
@@ -1953,6 +1962,7 @@
STR_400F_SELECT_SCENARIO_GREEN_PRE :{BLACK}시나리오(녹색), 프리셋 게임(파랑), 무작위 게임 선택
STR_4010_GENERATE_RANDOM_NEW_GAME :신규 무작위 게임 생성
STR_LOAD_HEIGHTMAP :{WHITE}DEM지형 로드
+STR_SAVE_OSKTITLE :{BLACK}게임을 저장할 파일명을 입력하세요
##id 0x4800
STR_4800_IN_THE_WAY :{WHITE}중간에 {STRING}이/가 있습니다
@@ -2711,6 +2721,8 @@
STR_REFIT_ORDER :({STRING}(으)로 개조)
STR_TIMETABLE_VIEW :{BLACK}시간표
STR_TIMETABLE_VIEW_TOOLTIP :{BLACK}시간표 보기 전환
+STR_ORDER_VIEW :{BLACK}순서
+STR_ORDER_VIEW_TOOLTIP :{BLACK}순서 보기로 변경
STR_8829_ORDERS :{WHITE}{VEHICLE} (경로)
STR_882A_END_OF_ORDERS :{SETX 10}- - 경로의 끝 - -
STR_FULLLOAD_OR_SERVICE :{SKIP}{SKIP}{STRING}
@@ -2941,7 +2953,7 @@
STR_9831_NAME_SHIP :{WHITE}선박 이름 지정
STR_9832_CAN_T_NAME_SHIP :{WHITE}선박의 이름을 바꿀 수 없습니다...
STR_9833_CITIZENS_CELEBRATE_FIRST :{BLACK}{BIGFONT}첫 선박이 {STATION}에 도착했습니다!{}시민들이 환호하고 있습니다!
-STR_9834_POSITION_BUOY_WHICH_CAN :{BLACK}웨이포인트로 사용할 부이를 which can be used as a waypoint
+STR_9834_POSITION_BUOY_WHICH_CAN :{BLACK}웨이포인트로 사용할 부이를 설치합니다.
STR_9835_CAN_T_POSITION_BUOY_HERE :{WHITE}여기에 부이를 설치할 수 없습니다...
STR_9836_RENAME :{BLACK}이름 지정
STR_9837_RENAME_SHIP_TYPE :{BLACK}선박 타입의 이름 지정
@@ -3267,6 +3279,7 @@
STR_WORLD_GENERATION_CAPTION :{WHITE}세계 창조
STR_RANDOM_SEED :{BLACK}무작위수치:
STR_RANDOM_SEED_HELP :{BLACK}무작위수치를 입력하세요
+STR_RANDOM_SEED_OSKTITLE :{BLACK}임의 설정값 입력
STR_LAND_GENERATOR :{BLACK}지형 생성:
STR_TREE_PLACER :{BLACK}나무 알고리즘:
STR_HEIGHTMAP_ROTATION :{BLACK}DEM지형 방향:
@@ -3396,7 +3409,7 @@
STR_GROUP_CAN_T_ADD_VEHICLE :{WHITE}이 그룹에 차량을 추가할 수 없습니다.
STR_GROUP_CAN_T_ADD_SHARED_VEHICLE :{WHITE}이 구릅에 공유된 차량을 추가할 수 없습니다.
-STR_GROUPS_CLICK_ON_GROUP_FOR_TIP :{BLACK}그룹 - 땅을 클릭하면 이 그룹의 모든 차량을 나열
+STR_GROUPS_CLICK_ON_GROUP_FOR_TIP :{BLACK}그룹 - 클릭하신 그룹에 속한 차량을 모두 나열합니다
STR_GROUP_CREATE_TIP :{BLACK}그룹 만들기
STR_GROUP_DELETE_TIP :{BLACK}선택한 그룹 삭제
STR_GROUP_RENAME_TIP :{BLACK}선택한 그룹 이름 바꾸기
@@ -3414,6 +3427,7 @@
#### Improved sign GUI
STR_NEXT_SIGN_TOOLTIP :{BLACK}다음 팻말로 가기
STR_PREVIOUS_SIGN_TOOLTIP :{BLACK}이전 팻말로 가기
+STR_SIGN_OSKTITLE :{BLACK}팻말 이름을 입력하세요
########
@@ -3486,3 +3500,8 @@
STR_DRAG_SIGNALS_DENSITY_DECREASE_TIP :{BLACK}드래그시 신호기 간격 감소
STR_DRAG_SIGNALS_DENSITY_INCREASE_TIP :{BLACK}드래그시 신호기 증가
########
+
+############ on screen keyboard
+STR_OSK_KEYBOARD_LAYOUT :`1234567890-=\qwertyuiop[]asdfghjkl;' zxcvbnm,./ .
+STR_OSK_KEYBOARD_LAYOUT_CAPS :~!@#$%^&*()_+|QWERTYUIOP{{}}ASDFGHJKL:" ZXCVBNM<>? .
+########
--- a/src/lang/lithuanian.txt Sun Apr 06 14:12:19 2008 +0000
+++ b/src/lang/lithuanian.txt Sun Apr 06 23:07:42 2008 +0000
@@ -1084,7 +1084,6 @@
STR_CONFIG_PATCHES_AUTORENEW_MONEY :{LTBLUE}Minimali suma reikalinga automatiniam atnaujinimui: {ORANGE}{STRING}
STR_CONFIG_PATCHES_ERRMSG_DURATION :{LTBLUE}Klaidos pranešimų rodymo trukmė: {ORANGE}{STRING}
STR_CONFIG_PATCHES_POPULATION_IN_LABEL :{LTBLUE}Rodyti miestu gyventoju skaiciu salia pavadinimo: {ORANGE}{STRING}
-STR_CONFIG_PATCHES_INVISIBLE_TREES :{LTBLUE}Nematomi medziai (kai ijungti permatomi pastatai): {ORANGE}{STRING}
STR_CONFIG_PATCHES_LAND_GENERATOR :{LTBLUE}Sausumos kūrimas: {ORANGE}{STRING}
STR_CONFIG_PATCHES_LAND_GENERATOR_ORIGINAL :Standartinis
--- a/src/lang/norwegian_bokmal.txt Sun Apr 06 14:12:19 2008 +0000
+++ b/src/lang/norwegian_bokmal.txt Sun Apr 06 23:07:42 2008 +0000
@@ -1066,7 +1066,6 @@
STR_CONFIG_PATCHES_AUTORENEW_MONEY :{LTBLUE}Autoforny minimum penger trengst for fornying: {ORANGE}{STRING}
STR_CONFIG_PATCHES_ERRMSG_DURATION :{LTBLUE}Varighet til feilmelding: {ORANGE}{STRING}
STR_CONFIG_PATCHES_POPULATION_IN_LABEL :{LTBLUE}Vis byers folketall i tittel: {ORANGE}{STRING}
-STR_CONFIG_PATCHES_INVISIBLE_TREES :{LTBLUE}Usynlige trær (med gjennomsiktige bygninger): {ORANGE}{STRING}
STR_CONFIG_PATCHES_LAND_GENERATOR :{LTBLUE}Landskapsgenerator: {ORANGE}{STRING}
STR_CONFIG_PATCHES_LAND_GENERATOR_ORIGINAL :Orginal
--- a/src/lang/norwegian_nynorsk.txt Sun Apr 06 14:12:19 2008 +0000
+++ b/src/lang/norwegian_nynorsk.txt Sun Apr 06 23:07:42 2008 +0000
@@ -1065,7 +1065,6 @@
STR_CONFIG_PATCHES_AUTORENEW_MONEY :{LTBLUE}Minimum pengar som trengst for automatisk fornying: {ORANGE}{STRING}
STR_CONFIG_PATCHES_ERRMSG_DURATION :{LTBLUE}Varigskap for feilmelding: {ORANGE}{STRING}
STR_CONFIG_PATCHES_POPULATION_IN_LABEL :{LTBLUE}Vis innbyggjartalet til byane i tittel: {ORANGE}{STRING}
-STR_CONFIG_PATCHES_INVISIBLE_TREES :{LTBLUE}Usynlige tre (med gjennomsiktige bygningar): {ORANGE}{STRING}
STR_CONFIG_PATCHES_LAND_GENERATOR :{LTBLUE}Landskapsgenerator: {ORANGE}{STRING}
STR_CONFIG_PATCHES_LAND_GENERATOR_ORIGINAL :Original
--- a/src/lang/piglatin.txt Sun Apr 06 14:12:19 2008 +0000
+++ b/src/lang/piglatin.txt Sun Apr 06 23:07:42 2008 +0000
@@ -1057,7 +1057,6 @@
STR_CONFIG_PATCHES_AUTORENEW_MONEY :{LTBLUE}Autorenewway inimummay eedednay oneymay orfay enewray: {ORANGE}{STRING}
STR_CONFIG_PATCHES_ERRMSG_DURATION :{LTBLUE}Urationday ofway errorway essagemay: {ORANGE}{STRING}
STR_CONFIG_PATCHES_POPULATION_IN_LABEL :{LTBLUE}Owshay owntay opulationpay inway ethay owntay amenay abellay: {ORANGE}{STRING}
-STR_CONFIG_PATCHES_INVISIBLE_TREES :{LTBLUE}Invisibleway eestray (ithway ansparenttray uildingsbay): {ORANGE}{STRING}
STR_CONFIG_PATCHES_LAND_GENERATOR :{LTBLUE}Andlay eneratorgay: {ORANGE}{STRING}
STR_CONFIG_PATCHES_LAND_GENERATOR_ORIGINAL :Originalway
--- a/src/lang/polish.txt Sun Apr 06 14:12:19 2008 +0000
+++ b/src/lang/polish.txt Sun Apr 06 23:07:42 2008 +0000
@@ -1151,7 +1151,6 @@
STR_CONFIG_PATCHES_AUTORENEW_MONEY :{LTBLUE}Min. ilość pieniędzy potrzebna do autoodnowienia: {ORANGE}{STRING}
STR_CONFIG_PATCHES_ERRMSG_DURATION :{LTBLUE}Czas trwania komunikatu o błędzie: {ORANGE}{STRING} sekund{P a y ""}
STR_CONFIG_PATCHES_POPULATION_IN_LABEL :{LTBLUE}Pokaż populację miasta w jego nazwie: {ORANGE}{STRING}
-STR_CONFIG_PATCHES_INVISIBLE_TREES :{LTBLUE}Niewidoczne drzewa (w trybie przezroczystych budynków): {ORANGE}{STRING}
STR_CONFIG_PATCHES_LAND_GENERATOR :{LTBLUE}Generator krajobrazu: {ORANGE}{STRING}
STR_CONFIG_PATCHES_LAND_GENERATOR_ORIGINAL :Oryginalny
--- a/src/lang/portuguese.txt Sun Apr 06 14:12:19 2008 +0000
+++ b/src/lang/portuguese.txt Sun Apr 06 23:07:42 2008 +0000
@@ -1068,7 +1068,6 @@
STR_CONFIG_PATCHES_AUTORENEW_MONEY :{LTBLUE}Dinheiro mínimo para fazer auto-renovação: {ORANGE}{STRING}
STR_CONFIG_PATCHES_ERRMSG_DURATION :{LTBLUE}Duração das mensagens de erro: {ORANGE}{STRING}
STR_CONFIG_PATCHES_POPULATION_IN_LABEL :{LTBLUE}Mostra população da cidade na janela da cidade: {ORANGE}{STRING}
-STR_CONFIG_PATCHES_INVISIBLE_TREES :{LTBLUE}Árvores invisíveis (com edifícios transparentes): {ORANGE}{STRING}
STR_CONFIG_PATCHES_LAND_GENERATOR :{LTBLUE}Gerador de terra: {ORANGE}{STRING}
STR_CONFIG_PATCHES_LAND_GENERATOR_ORIGINAL :Original
--- a/src/lang/romanian.txt Sun Apr 06 14:12:19 2008 +0000
+++ b/src/lang/romanian.txt Sun Apr 06 23:07:42 2008 +0000
@@ -1065,7 +1065,6 @@
STR_CONFIG_PATCHES_AUTORENEW_MONEY :{LTBLUE}Fonduri minime pentru înnoire automatã: {ORANGE}{STRING}
STR_CONFIG_PATCHES_ERRMSG_DURATION :{LTBLUE}Durata mesajelor de eroare: {ORANGE}{STRING}
STR_CONFIG_PATCHES_POPULATION_IN_LABEL :{LTBLUE}Afiseaza populatia unui oras langa nume: {ORANGE}{STRING}
-STR_CONFIG_PATCHES_INVISIBLE_TREES :{LTBLUE}Ascunde arborii la alegerea optiunii 'clãdiri transparente': {ORANGE}{STRING}
STR_CONFIG_PATCHES_LAND_GENERATOR :{LTBLUE}Generator teren: {ORANGE}{STRING}
STR_CONFIG_PATCHES_LAND_GENERATOR_ORIGINAL :Original
--- a/src/lang/russian.txt Sun Apr 06 14:12:19 2008 +0000
+++ b/src/lang/russian.txt Sun Apr 06 23:07:42 2008 +0000
@@ -1070,7 +1070,6 @@
STR_CONFIG_PATCHES_AUTORENEW_MONEY :{LTBLUE}Сумма, необходимая для автозамены: {ORANGE}{STRING}
STR_CONFIG_PATCHES_ERRMSG_DURATION :{LTBLUE}Макс. длительность сообщений об ошибке (сек.): {ORANGE}{STRING}
STR_CONFIG_PATCHES_POPULATION_IN_LABEL :{LTBLUE}Показывать количество жителей города после названия: {ORANGE}{STRING}
-STR_CONFIG_PATCHES_INVISIBLE_TREES :{LTBLUE}Убирать деревья при включении прозрачности зданий: {ORANGE}{STRING}
STR_CONFIG_PATCHES_LAND_GENERATOR :{LTBLUE}Генератор земли: {ORANGE}{STRING}
STR_CONFIG_PATCHES_LAND_GENERATOR_ORIGINAL :Оригинальный
--- a/src/lang/simplified_chinese.txt Sun Apr 06 14:12:19 2008 +0000
+++ b/src/lang/simplified_chinese.txt Sun Apr 06 23:07:42 2008 +0000
@@ -1052,7 +1052,6 @@
STR_CONFIG_PATCHES_AUTORENEW_MONEY :{LTBLUE}启动自动更新需要的最少现金:{ORANGE}{STRING}
STR_CONFIG_PATCHES_ERRMSG_DURATION :{LTBLUE}错误信息显示时间:{ORANGE}{STRING}
STR_CONFIG_PATCHES_POPULATION_IN_LABEL :{LTBLUE}在城镇名称的标签中同时显示人口:{ORANGE}{STRING}
-STR_CONFIG_PATCHES_INVISIBLE_TREES :{LTBLUE}在建筑物透明模式中隐藏树木:{ORANGE}{STRING}
STR_CONFIG_PATCHES_LAND_GENERATOR :{LTBLUE}生成地形:{ORANGE}{STRING}
STR_CONFIG_PATCHES_LAND_GENERATOR_ORIGINAL :原始
--- a/src/lang/slovak.txt Sun Apr 06 14:12:19 2008 +0000
+++ b/src/lang/slovak.txt Sun Apr 06 23:07:42 2008 +0000
@@ -1132,7 +1132,6 @@
STR_CONFIG_PATCHES_AUTORENEW_MONEY :{LTBLUE}Min. mnozstvo penazi pre aut. obnovovanie vozidiel: {ORANGE}{STRING}
STR_CONFIG_PATCHES_ERRMSG_DURATION :{LTBLUE}Dlžka zobrazenia chybovej správy: {ORANGE}{STRING}
STR_CONFIG_PATCHES_POPULATION_IN_LABEL :{LTBLUE}Zobrazit pocet obyvatelov mesta v jeho nazve: {ORANGE}{STRING}
-STR_CONFIG_PATCHES_INVISIBLE_TREES :{LTBLUE}Neviditelne stromy (pri priesvitnych budovach): {ORANGE}{STRING}
STR_CONFIG_PATCHES_LAND_GENERATOR :{LTBLUE}Generátor uzemia: {ORANGE}{STRING}
STR_CONFIG_PATCHES_LAND_GENERATOR_ORIGINAL :Povodny
@@ -1416,6 +1415,7 @@
STR_NETWORK_PLAYER_NAME :{BLACK}Meno hraca:
STR_NETWORK_ENTER_NAME_TIP :{BLACK}Toto je meno podla ktoreho vas ostatny identifikuju
+STR_NETWORK_PLAYER_NAME_OSKTITLE :{BLACK}Zadajte vaše meno
STR_NETWORK_CONNECTION :{BLACK}Pripojenie:
STR_NETWORK_CONNECTION_TIP :{BLACK}Vyber si medzi hrou na internete alebo na lokalnej sieti
@@ -1459,6 +1459,7 @@
STR_NETWORK_NEW_GAME_NAME :{BLACK}Nazov hry:
STR_NETWORK_NEW_GAME_NAME_TIP :{BLACK}Nazov hry, ktory uvidia ostatni v zozname sietovych hier
+STR_NETWORK_NEW_GAME_NAME_OSKTITLE :{BLACK}Zadajte názov sietovej hry
STR_NETWORK_SET_PASSWORD :{BLACK}Nastavit heslo
STR_NETWORK_PASSWORD_TIP :{BLACK}Ochran hru heslom, ak nechcec aby sa pripajali ostatni ludia
STR_NETWORK_SELECT_MAP :{BLACK}Vyber mapu:
@@ -1515,6 +1516,13 @@
STR_NETWORK_LANG_SWEDISH :Svédsky
STR_NETWORK_LANG_TURKISH :Turecky
STR_NETWORK_LANG_UKRAINIAN :Ukrajinsky
+STR_NETWORK_LANG_AFRIKAANS :Africky
+STR_NETWORK_LANG_CROATIAN :Chorvátsky
+STR_NETWORK_LANG_CATALAN :Katalánsky
+STR_NETWORK_LANG_ESTONIAN :Estónsky
+STR_NETWORK_LANG_GALICIAN :Gálsky
+STR_NETWORK_LANG_GREEK :Grécky
+STR_NETWORK_LANG_LATVIAN :Litovsky
############ End of leave-in-this-order
STR_NETWORK_GAME_LOBBY :{WHITE}Sietova hra - lobby
@@ -1613,6 +1621,7 @@
STR_NETWORK_CHAT_TO_CLIENT :[Privatny] pre {STRING}: {GRAY}{STRING}
STR_NETWORK_CHAT_ALL_CAPTION :[Všetkým] :
STR_NETWORK_CHAT_ALL :[Všetkým] {STRING}: {GRAY}{STRING}
+STR_NETWORK_CHAT_OSKTITLE :{BLACK}Zadajte text pre sietový chat
STR_NETWORK_NAME_CHANGE :si zmenil meno na
STR_NETWORK_SERVER_SHUTDOWN :{WHITE} Server ukoncil relaciu
STR_NETWORK_SERVER_REBOOT :{WHITE} Server sa restartuje ...{}Cakajte prosim ...
@@ -1779,6 +1788,7 @@
STR_2002_WHITE :{TINYFONT}{WHITE}{SIGN}
STR_2004_BUILDING_MUST_BE_DEMOLISHED :{WHITE}Budova sa musi zburat
STR_2005 :{WHITE}{TOWN}
+STR_CITY :{WHITE}{TOWN} (Mesto)
STR_2006_POPULATION :{BLACK}Obyvatelstvo: {ORANGE}{COMMA}{BLACK} Domov: {ORANGE}{COMMA}
STR_2007_RENAME_TOWN :Premenovat mesto
STR_2008_CAN_T_RENAME_TOWN :{WHITE}Mesto nemoze byt odstranene ...
@@ -2015,6 +2025,7 @@
STR_400F_SELECT_SCENARIO_GREEN_PRE :{BLACK}Vyber scenar (zeleny), prednastavenu hra (modra), alebo nahodnu hru
STR_4010_GENERATE_RANDOM_NEW_GAME :Vygenerovat nahodnu novu hru
STR_LOAD_HEIGHTMAP :{WHITE}Nahrat výškovú mapu
+STR_SAVE_OSKTITLE :{BLACK}Zadajte názov pre uloženie hry
##id 0x4800
STR_4800_IN_THE_WAY :{WHITE}{STRING} v ceste
@@ -2773,6 +2784,8 @@
STR_REFIT_ORDER :(Prestavba na {STRING})
STR_TIMETABLE_VIEW :{BLACK}CP
STR_TIMETABLE_VIEW_TOOLTIP :{BLACK}Prepnút na zobrazenie cestovného poriadku
+STR_ORDER_VIEW :{BLACK}Príkazy
+STR_ORDER_VIEW_TOOLTIP :{BLACK}Prepnút na zobrazenie príkazov
STR_8829_ORDERS :{WHITE}{VEHICLE} (Prikazy)
STR_882A_END_OF_ORDERS :{SETX 10}- - Koniec prikazov - -
STR_FULLLOAD_OR_SERVICE :{SKIP}{SKIP}{STRING}
@@ -3329,6 +3342,7 @@
STR_WORLD_GENERATION_CAPTION :{WHITE}Vytvorenie krajiny
STR_RANDOM_SEED :{BLACK}Náhodný kód:
STR_RANDOM_SEED_HELP :{BLACK}Kliknite pre zadanie nahodneho kodu
+STR_RANDOM_SEED_OSKTITLE :{BLACK}Zadajte náhodný kód
STR_LAND_GENERATOR :{BLACK}Generátor krajiny:
STR_TREE_PLACER :{BLACK}Generátor stromov:
STR_HEIGHTMAP_ROTATION :{BLACK}Orientacia vyskovej mapy:
@@ -3476,6 +3490,7 @@
#### Improved sign GUI
STR_NEXT_SIGN_TOOLTIP :{BLACK}Prejst na dalsiu znacku
STR_PREVIOUS_SIGN_TOOLTIP :{BLACK}Prejst na predchádzajúcu znacku
+STR_SIGN_OSKTITLE :{BLACK}Zadajte názov pre popis
########
@@ -3548,3 +3563,8 @@
STR_DRAG_SIGNALS_DENSITY_DECREASE_TIP :{BLACK}Znižit hustotu signálov
STR_DRAG_SIGNALS_DENSITY_INCREASE_TIP :{BLACK}Zvýšit hustotu signálov
########
+
+############ on screen keyboard
+STR_OSK_KEYBOARD_LAYOUT :`1234567890-=\qwertyuiop[]asdfghjkl;' zxcvbnm,./ .
+STR_OSK_KEYBOARD_LAYOUT_CAPS :~!@#$%^&*()_+|QWERTYUIOP{{}}ASDFGHJKL:" ZXCVBNM<>? .
+########
--- a/src/lang/slovenian.txt Sun Apr 06 14:12:19 2008 +0000
+++ b/src/lang/slovenian.txt Sun Apr 06 23:07:42 2008 +0000
@@ -1110,7 +1110,6 @@
STR_CONFIG_PATCHES_AUTORENEW_MONEY :{LTBLUE}Samoobnovi najmanj potrebnega denarja za obnovo: {ORANGE}{STRING}
STR_CONFIG_PATCHES_ERRMSG_DURATION :{LTBLUE}Trajanje sporočila o napaki: {ORANGE}{STRING}
STR_CONFIG_PATCHES_POPULATION_IN_LABEL :{LTBLUE}Prikaz števila prebivalcev ob imenu mesta: {ORANGE}{STRING}
-STR_CONFIG_PATCHES_INVISIBLE_TREES :{LTBLUE}Prozorna drevesa (ob prozornih zgradbah): {ORANGE}{STRING}
STR_CONFIG_PATCHES_LAND_GENERATOR :{LTBLUE}Urejevalnik terena: {ORANGE}{STRING}
STR_CONFIG_PATCHES_LAND_GENERATOR_ORIGINAL :Original
@@ -1215,6 +1214,7 @@
STR_CONFIG_PATCHES_TOWN_LAYOUT_BETTER_ROADS :boljše ceste
STR_CONFIG_PATCHES_TOWN_LAYOUT_2X2_GRID :2x2 mreža
STR_CONFIG_PATCHES_TOWN_LAYOUT_3X3_GRID :3x3 mreža
+STR_CONFIG_PATCHES_TOWN_LAYOUT_RANDOM :naključno
STR_CONFIG_PATCHES_TOOLBAR_POS :{LTBLUE}Pozicija glavne orodne vrstice: {ORANGE}{STRING}
STR_CONFIG_PATCHES_TOOLBAR_POS_LEFT :Levo
@@ -1394,6 +1394,7 @@
STR_NETWORK_PLAYER_NAME :{BLACK}Ime igralca:
STR_NETWORK_ENTER_NAME_TIP :{BLACK}To je ime, po katerem te prepoznajo drugi igralci
+STR_NETWORK_PLAYER_NAME_OSKTITLE :{BLACK}Vpiši tvoje ime
STR_NETWORK_CONNECTION :{BLACK}Povezava:
STR_NETWORK_CONNECTION_TIP :{BLACK}Izberi med internetom ali lokalno mrezo (LAN)
@@ -1437,6 +1438,7 @@
STR_NETWORK_NEW_GAME_NAME :{BLACK}Ime igre:
STR_NETWORK_NEW_GAME_NAME_TIP :{BLACK}Ime bo prikazano drugim igralcem na večigralskem seznamu
+STR_NETWORK_NEW_GAME_NAME_OSKTITLE :{BLACK}Vpiši ime za mrežno igro
STR_NETWORK_SET_PASSWORD :{BLACK}Nastavi geslo
STR_NETWORK_PASSWORD_TIP :{BLACK}Zaščiti igro z geslom, če želiš preprečiti dostop nepovabljenim
STR_NETWORK_SELECT_MAP :{BLACK}Izberi ozemlje:
@@ -1493,6 +1495,13 @@
STR_NETWORK_LANG_SWEDISH :Švedski
STR_NETWORK_LANG_TURKISH :Turški
STR_NETWORK_LANG_UKRAINIAN :Ukrajinski
+STR_NETWORK_LANG_AFRIKAANS :Afriški
+STR_NETWORK_LANG_CROATIAN :Hrvaški
+STR_NETWORK_LANG_CATALAN :Katalonski
+STR_NETWORK_LANG_ESTONIAN :Estonski
+STR_NETWORK_LANG_GALICIAN :Galijski
+STR_NETWORK_LANG_GREEK :Grški
+STR_NETWORK_LANG_LATVIAN :Latvijski
############ End of leave-in-this-order
STR_NETWORK_GAME_LOBBY :{WHITE}Seje večigralskih iger
@@ -1591,6 +1600,7 @@
STR_NETWORK_CHAT_TO_CLIENT :[Privatno] Za {STRING}: {GRAY}{STRING}
STR_NETWORK_CHAT_ALL_CAPTION :[Vsi] :
STR_NETWORK_CHAT_ALL :[Vsi] {STRING}: {GRAY}{STRING}
+STR_NETWORK_CHAT_OSKTITLE :{BLACK}Vpiši tekst za mrežni pogovor
STR_NETWORK_NAME_CHANGE :je spremenil/a svoje ime v
STR_NETWORK_SERVER_SHUTDOWN :{WHITE} Strežnik je zaprl sejo
STR_NETWORK_SERVER_REBOOT :{WHITE} Strežnik se zaganja...{}Prosim počakaj...
@@ -1757,6 +1767,7 @@
STR_2002_WHITE :{TINYFONT}{WHITE}{SIGN}
STR_2004_BUILDING_MUST_BE_DEMOLISHED :{WHITE}Najprej mora biti stavba porušena
STR_2005 :{WHITE}{TOWN}
+STR_CITY :{WHITE}{TOWN} (Mesto)
STR_2006_POPULATION :{BLACK}Prebivalstvo: {ORANGE}{COMMA}{BLACK} Število stavb: {ORANGE}{COMMA}
STR_2007_RENAME_TOWN :Preimenuj mesto
STR_2008_CAN_T_RENAME_TOWN :{WHITE}Ne moreš preimenovati mesta ...
@@ -1994,6 +2005,7 @@
STR_400F_SELECT_SCENARIO_GREEN_PRE :{BLACK}Izberi scenarij (zeleno), prednastavljeno igro (modro) ali naključno novo igro
STR_4010_GENERATE_RANDOM_NEW_GAME :Ustvari naključno novo igro
STR_LOAD_HEIGHTMAP :{WHITE}Naloži višinsko karto
+STR_SAVE_OSKTITLE :{BLACK}Vpiši ime za shranjeno igro
##id 0x4800
STR_4800_IN_THE_WAY :{WHITE}{STRING} na poti
@@ -2789,6 +2801,8 @@
STR_REFIT_ORDER :(Predelaj za {STRING})
STR_TIMETABLE_VIEW :{BLACK}Časovna tabela
STR_TIMETABLE_VIEW_TOOLTIP :{BLACK}Preklop na pogled časovnih tabel
+STR_ORDER_VIEW :{BLACK}Ukazi
+STR_ORDER_VIEW_TOOLTIP :{BLACK}Preklop na pogled ukazov
STR_8829_ORDERS :{WHITE}{VEHICLE} (Ukazi)
STR_882A_END_OF_ORDERS :{SETX 10}- - Konec ukazov - -
STR_FULLLOAD_OR_SERVICE :{SKIP}{SKIP}{STRING}
@@ -3345,6 +3359,7 @@
STR_WORLD_GENERATION_CAPTION :{WHITE}Ustvarjanje sveta
STR_RANDOM_SEED :{BLACK}Naključno seme:
STR_RANDOM_SEED_HELP :{BLACK}Klikni za vnos naključnega semena
+STR_RANDOM_SEED_OSKTITLE :{BLACK}Vpiši naključno seme
STR_LAND_GENERATOR :{BLACK}Ustvarjalec terena:
STR_TREE_PLACER :{BLACK}Algoritem dreves:
STR_HEIGHTMAP_ROTATION :{BLACK}Zasuk višinskega zemljevida:
@@ -3492,6 +3507,7 @@
#### Improved sign GUI
STR_NEXT_SIGN_TOOLTIP :{BLACK}Pojdi na naslednjo oznako
STR_PREVIOUS_SIGN_TOOLTIP :{BLACK}Pojdi na predhodno oznako
+STR_SIGN_OSKTITLE :{BLACK}Vpiši ime za znak
########
@@ -3564,3 +3580,8 @@
STR_DRAG_SIGNALS_DENSITY_DECREASE_TIP :{BLACK}Zmanjšaj gostoto signala za vlečenje
STR_DRAG_SIGNALS_DENSITY_INCREASE_TIP :{BLACK}Povečaj gostoto signala za vlečenjeIncrease dragging signal density
########
+
+############ on screen keyboard
+STR_OSK_KEYBOARD_LAYOUT :`1234567890-=\qwertyuiop[]asdfghjkl;' zxcvbnm,./ .
+STR_OSK_KEYBOARD_LAYOUT_CAPS :~!@#$%^&*()_+|QWERTYUIOP{{}}ASDFGHJKL:" ZXCVBNM<>? .
+########
--- a/src/lang/spanish.txt Sun Apr 06 14:12:19 2008 +0000
+++ b/src/lang/spanish.txt Sun Apr 06 23:07:42 2008 +0000
@@ -1069,7 +1069,6 @@
STR_CONFIG_PATCHES_AUTORENEW_MONEY :{LTBLUE}Renovar auto. usando la menor cantidad de dinero: {ORANGE}{STRING}
STR_CONFIG_PATCHES_ERRMSG_DURATION :{LTBLUE}Duración del mensaje de error: {ORANGE}{STRING}
STR_CONFIG_PATCHES_POPULATION_IN_LABEL :{LTBLUE}Muestra la población de esta población en esta etiqueta: {ORANGE}{STRING}
-STR_CONFIG_PATCHES_INVISIBLE_TREES :{LTBLUE}Árboles invisibles (con edificios transparentes): {ORANGE}{STRING}
STR_CONFIG_PATCHES_LAND_GENERATOR :{LTBLUE}Generador terreno: {ORANGE}{STRING}
STR_CONFIG_PATCHES_LAND_GENERATOR_ORIGINAL :Original
--- a/src/lang/swedish.txt Sun Apr 06 14:12:19 2008 +0000
+++ b/src/lang/swedish.txt Sun Apr 06 23:07:42 2008 +0000
@@ -1050,6 +1050,7 @@
STR_CONFIG_PATCHES_ALLOW_GIVE_MONEY :{LTBLUE}Tillåt skicka pengar till andra företag: {ORANGE}{STRING}
STR_CONFIG_PATCHES_NONUNIFORM_STATIONS :{LTBLUE}Icke-rektangulära stationer: {ORANGE}{STRING}
STR_CONFIG_PATCHES_FREIGHT_TRAINS :{LTBLUE}Godsfaktor för att simulera tunga tåg: {ORANGE}{STRING}
+STR_CONFIG_PATCHES_PLANE_SPEED :{LTBLUE}Hastighetsfaktor för flygplan: {ORANGE}1 / {STRING}
STR_CONFIG_PATCHES_STOP_ON_TOWN_ROAD :{LTBLUE}Tillåt genomfarts-stop på stadsägda vägar: {ORANGE}{STRING}
STR_CONFIG_PATCHES_ADJACENT_STATIONS :{LTBLUE}Tillåt byggande av närliggande stationer: {ORANGE}{STRING}
@@ -1067,7 +1068,6 @@
STR_CONFIG_PATCHES_AUTORENEW_MONEY :{LTBLUE}Minst mängd pengar för auto-förnyelse av fordon: {ORANGE}{STRING}
STR_CONFIG_PATCHES_ERRMSG_DURATION :{LTBLUE}Hur länge felmeddelanden visas: {ORANGE}{STRING}
STR_CONFIG_PATCHES_POPULATION_IN_LABEL :{LTBLUE}Visa befolkningsmängd i stadsnamnet: {ORANGE}{STRING}
-STR_CONFIG_PATCHES_INVISIBLE_TREES :{LTBLUE}Osynliga träd (när genomskinliga byggnader är valt): {ORANGE}{STRING}
STR_CONFIG_PATCHES_LAND_GENERATOR :{LTBLUE}Land generator: {ORANGE}{STRING}
STR_CONFIG_PATCHES_LAND_GENERATOR_ORIGINAL :Original
@@ -1204,6 +1204,18 @@
STR_CONFIG_PATCHES_QUERY_CAPT :{WHITE}Ändra inställningsvärde
STR_CONFIG_PATCHES_SERVICE_INTERVAL_INCOMPATIBLE :{WHITE}Några eller alla av standard serviceintervalls-inställningarna är felaktiga! (5-90% och 30-800 dagar är giltiga inställningar)
+STR_CONFIG_PATCHES_PATHFINDER_FOR_TRAINS :{LTBLUE}Vägfinnare för tåg: {ORANGE}{STRING}
+STR_CONFIG_PATCHES_PATHFINDER_FOR_TRAINS_NTP :NTP {RED}(Ej rekommenderad)
+STR_CONFIG_PATCHES_PATHFINDER_FOR_TRAINS_NPF :NPF
+STR_CONFIG_PATCHES_PATHFINDER_FOR_TRAINS_YAPF :YAPF {BLUE}(Rekommenderad)
+STR_CONFIG_PATCHES_PATHFINDER_FOR_ROADVEH :{LTBLUE}Vägfinnare för vägfordon: {ORANGE}{STRING}
+STR_CONFIG_PATCHES_PATHFINDER_FOR_ROADVEH_OPF :Original {RED}(Ej rekommenderad)
+STR_CONFIG_PATCHES_PATHFINDER_FOR_ROADVEH_NPF :NPF
+STR_CONFIG_PATCHES_PATHFINDER_FOR_ROADVEH_YAPF :YAPF {BLUE}(Rekommenderad)
+STR_CONFIG_PATCHES_PATHFINDER_FOR_SHIPS :{LTBLUE}Vägfinnare för skepp: {ORANGE}{STRING}
+STR_CONFIG_PATCHES_PATHFINDER_FOR_SHIPS_OPF :Original {BLUE}(Rekommenderad)
+STR_CONFIG_PATCHES_PATHFINDER_FOR_SHIPS_NPF :NPF
+STR_CONFIG_PATCHES_PATHFINDER_FOR_SHIPS_YAPF :YAPF {RED}(Ej rekommenderad)
STR_TEMPERATE_LANDSCAPE :Tempererat landskap
STR_SUB_ARCTIC_LANDSCAPE :Sub-arktiskt landskap
@@ -1339,6 +1351,7 @@
STR_NETWORK_PLAYER_NAME :{BLACK}Spelarnamn:
STR_NETWORK_ENTER_NAME_TIP :{BLACK}Namnet som andra spelare kommer se dej som
+STR_NETWORK_PLAYER_NAME_OSKTITLE :{BLACK}Mata in ditt namn
STR_NETWORK_CONNECTION :{BLACK}Anslutning:
STR_NETWORK_CONNECTION_TIP :{BLACK}Välj mellan att spela över internet eller det lokala nätverket
@@ -1382,6 +1395,7 @@
STR_NETWORK_NEW_GAME_NAME :{BLACK}Namn:
STR_NETWORK_NEW_GAME_NAME_TIP :{BLACK}Namnet på nätverksspelet kommer att synas för andra spelare i multiplayer menyn
+STR_NETWORK_NEW_GAME_NAME_OSKTITLE :{BLACK}Mata in ett namn för nätverksspelet
STR_NETWORK_SET_PASSWORD :{BLACK}Bestäm lösenord
STR_NETWORK_PASSWORD_TIP :{BLACK}Skydda spelet med ett lösenord så att inte andra än dom som har lösenordet kan gå med i spelet
STR_NETWORK_SELECT_MAP :{BLACK}Välj karta:
@@ -1438,6 +1452,13 @@
STR_NETWORK_LANG_SWEDISH :Svensk
STR_NETWORK_LANG_TURKISH :Turkisk
STR_NETWORK_LANG_UKRAINIAN :Ukrainsk
+STR_NETWORK_LANG_AFRIKAANS :Afrikaans
+STR_NETWORK_LANG_CROATIAN :Kroatiska
+STR_NETWORK_LANG_CATALAN :Katalanska
+STR_NETWORK_LANG_ESTONIAN :Estniska
+STR_NETWORK_LANG_GALICIAN :Galiciska
+STR_NETWORK_LANG_GREEK :Grekiska
+STR_NETWORK_LANG_LATVIAN :Lettiska
############ End of leave-in-this-order
STR_NETWORK_GAME_LOBBY :{WHITE}Nätverksspel
@@ -1536,6 +1557,7 @@
STR_NETWORK_CHAT_TO_CLIENT :[Privat] Till {STRING}: {GRAY}{STRING}
STR_NETWORK_CHAT_ALL_CAPTION :[Alla] :
STR_NETWORK_CHAT_ALL :[Alla] {STRING}: {GRAY}{STRING}
+STR_NETWORK_CHAT_OSKTITLE :{BLACK}Mata in text för nätverkschat
STR_NETWORK_NAME_CHANGE :har ändrat sitt namn till
STR_NETWORK_SERVER_SHUTDOWN :{WHITE} Servern avslutade sessionen
STR_NETWORK_SERVER_REBOOT :{WHITE} Servern startar om...{}Var vänlig vänta...
@@ -1599,6 +1621,7 @@
STR_1005_NO_SUITABLE_RAILROAD_TRACK :{WHITE}Inget passande järnvägsspår
STR_1007_ALREADY_BUILT :{WHITE}...redan byggd
STR_1008_MUST_REMOVE_RAILROAD_TRACK :{WHITE}Måste ta bort järnväg först
+STR_ERR_CROSSING_ON_ONEWAY_ROAD :{WHITE}Vägen är enkelriktad eller blockerad
STR_100A_RAILROAD_CONSTRUCTION :{WHITE}Bygg järnväg
STR_TITLE_ELRAIL_CONSTRUCTION :{WHITE}Elektrifierad järnvägskonstruktion
STR_100B_MONORAIL_CONSTRUCTION :{WHITE}Bygg monorail
@@ -1701,6 +1724,7 @@
STR_2002_WHITE :{TINYFONT}{WHITE}{SIGN}
STR_2004_BUILDING_MUST_BE_DEMOLISHED :{WHITE}Byggnad måste rivas först
STR_2005 :{WHITE}{TOWN}
+STR_CITY :{WHITE}{TOWN} (Stad)
STR_2006_POPULATION :{BLACK}Invånare: {ORANGE}{COMMA}{BLACK} Hus: {ORANGE}{COMMA}
STR_2007_RENAME_TOWN :Byt namn på stad
STR_2008_CAN_T_RENAME_TOWN :{WHITE}Kan inte byta namn på stad...
@@ -1937,6 +1961,7 @@
STR_400F_SELECT_SCENARIO_GREEN_PRE :{BLACK}Välj scenario (grön), förbestämt spel (blå), eller slumpmässigt nytt spel
STR_4010_GENERATE_RANDOM_NEW_GAME :Skapa slumpmässigt nytt spel
STR_LOAD_HEIGHTMAP :{WHITE}Läs höjdkarta
+STR_SAVE_OSKTITLE :{BLACK}Mata in ett namn för detta sparade spel
##id 0x4800
STR_4800_IN_THE_WAY :{WHITE}{STRING} i vägen
@@ -2695,6 +2720,8 @@
STR_REFIT_ORDER :(Anpassa för {STRING})
STR_TIMETABLE_VIEW :{BLACK}Tidtabell
STR_TIMETABLE_VIEW_TOOLTIP :{BLACK}Ändra till tidtabellsvy
+STR_ORDER_VIEW :{BLACK}Order
+STR_ORDER_VIEW_TOOLTIP :{BLACK}Byt till ordervyn
STR_8829_ORDERS :{WHITE}{VEHICLE} (Order)
STR_882A_END_OF_ORDERS :{SETX 10}- - Slut på order - -
STR_FULLLOAD_OR_SERVICE :{SKIP}{SKIP}{STRING}
@@ -3251,6 +3278,7 @@
STR_WORLD_GENERATION_CAPTION :{WHITE}Generera Värld
STR_RANDOM_SEED :{BLACK}Slump-nummer:
STR_RANDOM_SEED_HELP :{BLACK}Klicka för att mata in ett slump-nummer
+STR_RANDOM_SEED_OSKTITLE :{BLACK}Mata in ett slumpmässigt frö
STR_LAND_GENERATOR :{BLACK}Landgenerator:
STR_TREE_PLACER :{BLACK}Träd Algoritm:
STR_HEIGHTMAP_ROTATION :{BLACK}Rotation på höjdkarta:
@@ -3341,6 +3369,7 @@
STR_TRANSPARENT_BUILDINGS_DESC :{BLACK}Växla genomskinlighet för byggnader såsom stationer, depåer, riktmärken eller kedjelinje
STR_TRANSPARENT_BRIDGES_DESC :{BLACK}Växla genomskinlighet för industrier
STR_TRANSPARENT_STRUCTURES_DESC :{BLACK}Växla genomskinlighet för byggnader såsom fyrar och antenner, kanske i framtiden även ögongodis
+STR_TRANSPARENT_CATENARY_DESC :{BLACK}Växla genomskinlighet för kedjebro. CTRL+klick för att låsa.
STR_TRANSPARENT_LOADING_DESC :{BLACK}Växla genomskinlighet för lastningsindikatörer
STR_PERCENT_UP_SMALL :{TINYFONT}{WHITE}{NUM}%{UPARROW}
@@ -3397,6 +3426,7 @@
#### Improved sign GUI
STR_NEXT_SIGN_TOOLTIP :{BLACK}Åk till nästa skylt
STR_PREVIOUS_SIGN_TOOLTIP :{BLACK}Åk till föregående skylt
+STR_SIGN_OSKTITLE :{BLACK}Mata in ett namn för skylten
########
@@ -3469,3 +3499,8 @@
STR_DRAG_SIGNALS_DENSITY_DECREASE_TIP :{BLACK}Minska dragen signals täthet
STR_DRAG_SIGNALS_DENSITY_INCREASE_TIP :{BLACK}Öka dragen signals täthet
########
+
+############ on screen keyboard
+STR_OSK_KEYBOARD_LAYOUT :`1234567890-=\qwertyuiop[]asdfghjkl;' zxcvbnm,./ .
+STR_OSK_KEYBOARD_LAYOUT_CAPS :~!@#$%^&*()_+|QWERTYUIOP{{}}ASDFGHJKL:" ZXCVBNM<>? .
+########
--- a/src/lang/traditional_chinese.txt Sun Apr 06 14:12:19 2008 +0000
+++ b/src/lang/traditional_chinese.txt Sun Apr 06 23:07:42 2008 +0000
@@ -1061,7 +1061,6 @@
STR_CONFIG_PATCHES_AUTORENEW_MONEY :{LTBLUE}自動翻新最低費用:{ORANGE}{STRING}
STR_CONFIG_PATCHES_ERRMSG_DURATION :{LTBLUE}錯誤訊息顯示時間:{ORANGE}{STRING}
STR_CONFIG_PATCHES_POPULATION_IN_LABEL :{LTBLUE}於標籤顯示市鎮人口:{ORANGE}{STRING}
-STR_CONFIG_PATCHES_INVISIBLE_TREES :{LTBLUE}選擇半透明建築物時將樹木隱藏:{ORANGE}{STRING}
STR_CONFIG_PATCHES_LAND_GENERATOR :{LTBLUE}地形產生器:{ORANGE}{STRING}
STR_CONFIG_PATCHES_LAND_GENERATOR_ORIGINAL :原版
--- a/src/lang/turkish.txt Sun Apr 06 14:12:19 2008 +0000
+++ b/src/lang/turkish.txt Sun Apr 06 23:07:42 2008 +0000
@@ -1035,6 +1035,7 @@
STR_CONFIG_PATCHES_RAW_INDUSTRY_CONSTRUCTION_METHOD :{LTBLUE}Üretim fabrikalarının yapım yöntemi: {ORANGE}{STRING}
STR_CONFIG_PATCHES_RAW_INDUSTRY_CONSTRUCTION_METHOD_NONE :hiçbiri
STR_CONFIG_PATCHES_RAW_INDUSTRY_CONSTRUCTION_METHOD_NORMAL :diğer fabrikalar gibi
+STR_CONFIG_PATCHES_RAW_INDUSTRY_CONSTRUCTION_METHOD_PROSPECTING :tetkik aramayla
STR_CONFIG_PATCHES_MULTIPINDTOWN :{LTBLUE}Bir şehirde birden fazla aynı fabrika olması izinli: {ORANGE}{STRING}
STR_CONFIG_PATCHES_SAMEINDCLOSE :{LTBLUE}Aynı tür fabrikalar yan yana yapılabilir: {ORANGE}{STRING}
STR_CONFIG_PATCHES_LONGDATE :{LTBLUE}Durum çubuğunda uzun tarih göster: {ORANGE}{STRING}
@@ -1048,6 +1049,7 @@
STR_CONFIG_PATCHES_ALLOW_GIVE_MONEY :{LTBLUE}Diğer şirketlere para gönderme izinli: {ORANGE}{STRING}
STR_CONFIG_PATCHES_NONUNIFORM_STATIONS :{LTBLUE}Özel istasyonlar: {ORANGE}{STRING}
STR_CONFIG_PATCHES_FREIGHT_TRAINS :{LTBLUE}Ağır yük trenleri için ağırlık çarpanı: {ORANGE}{STRING}
+STR_CONFIG_PATCHES_PLANE_SPEED :{LTBLUE}Uçak hızı çarpanı: {ORANGE}1 / {STRING}
STR_CONFIG_PATCHES_STOP_ON_TOWN_ROAD :{LTBLUE}Şehiriçi yollara durak yapmak izinli: {ORANGE}{STRING}
STR_CONFIG_PATCHES_ADJACENT_STATIONS :{LTBLUE}Bitişik istasyonlar izinli: {ORANGE}{STRING}
@@ -1065,7 +1067,6 @@
STR_CONFIG_PATCHES_AUTORENEW_MONEY :{LTBLUE}Yenileme icin gerekli en az parayı otomatik yenile: {ORANGE}{STRING}
STR_CONFIG_PATCHES_ERRMSG_DURATION :{LTBLUE}Hata mesajı görünme süresi: {ORANGE}{STRING}
STR_CONFIG_PATCHES_POPULATION_IN_LABEL :{LTBLUE}Şehir nüfusunu isminin yanına yaz: {ORANGE}{STRING}
-STR_CONFIG_PATCHES_INVISIBLE_TREES :{LTBLUE}Görünmez ağaçlar (şeffaf binalarla): {ORANGE}{STRING}
STR_CONFIG_PATCHES_LAND_GENERATOR :{LTBLUE}Arazi üretici: {ORANGE}{STRING}
STR_CONFIG_PATCHES_LAND_GENERATOR_ORIGINAL :Özgün
@@ -1349,6 +1350,7 @@
STR_NETWORK_PLAYER_NAME :{BLACK}Oyuncu adı:
STR_NETWORK_ENTER_NAME_TIP :{BLACK}Oyuncuların görecegi adınızı seçin
+STR_NETWORK_PLAYER_NAME_OSKTITLE :{BLACK}İsminizi girin
STR_NETWORK_CONNECTION :{BLACK}Bağlantı:
STR_NETWORK_CONNECTION_TIP :{BLACK}İnternet ya da yerel ağ bağlantısı (LAN) oyunundan birini seçin
@@ -1392,6 +1394,7 @@
STR_NETWORK_NEW_GAME_NAME :{BLACK}Oyun adı:
STR_NETWORK_NEW_GAME_NAME_TIP :{BLACK}Bu oyun adı diğer oyuncuların server listesinde görünecek
+STR_NETWORK_NEW_GAME_NAME_OSKTITLE :{BLACK}Ağ oyunu için bir isim girin
STR_NETWORK_SET_PASSWORD :{BLACK}Parola koy
STR_NETWORK_PASSWORD_TIP :{BLACK}Erişimi kısıtlamak için oyuna parola koy
STR_NETWORK_SELECT_MAP :{BLACK}Harita seç:
@@ -1448,6 +1451,13 @@
STR_NETWORK_LANG_SWEDISH :İsveççe
STR_NETWORK_LANG_TURKISH :Türkçe
STR_NETWORK_LANG_UKRAINIAN :Ukraynaca
+STR_NETWORK_LANG_AFRIKAANS :Afrikaanca
+STR_NETWORK_LANG_CROATIAN :Hırvatça
+STR_NETWORK_LANG_CATALAN :Katalanca
+STR_NETWORK_LANG_ESTONIAN :Estonyaca
+STR_NETWORK_LANG_GALICIAN :Galiçyaca
+STR_NETWORK_LANG_GREEK :Yunanca
+STR_NETWORK_LANG_LATVIAN :Letonca
############ End of leave-in-this-order
STR_NETWORK_GAME_LOBBY :{WHITE}Çok oyunculu oyun lobisi
@@ -1546,6 +1556,7 @@
STR_NETWORK_CHAT_TO_CLIENT :[Özel] -> {STRING}: {GRAY}{STRING}
STR_NETWORK_CHAT_ALL_CAPTION :[Herkes] :
STR_NETWORK_CHAT_ALL :[Herkes] {STRING}: {GRAY}{STRING}
+STR_NETWORK_CHAT_OSKTITLE :{BLACK}Ağ sohbeti için yazı girin
STR_NETWORK_NAME_CHANGE :ismini değiştirdi:
STR_NETWORK_SERVER_SHUTDOWN :{WHITE} Sunucu kapandı
STR_NETWORK_SERVER_REBOOT :{WHITE} Sunucu baştan başlatılıyor...{}Lütfen bekleyin...
@@ -1609,6 +1620,7 @@
STR_1005_NO_SUITABLE_RAILROAD_TRACK :{WHITE}Uygun ray yok
STR_1007_ALREADY_BUILT :{WHITE}...zaten yapıldı
STR_1008_MUST_REMOVE_RAILROAD_TRACK :{WHITE}Önce ray kaldırılmalı
+STR_ERR_CROSSING_ON_ONEWAY_ROAD :{WHITE}Yol tek yönlü veya kapalı
STR_100A_RAILROAD_CONSTRUCTION :{WHITE}Demiryolu Yapımı
STR_TITLE_ELRAIL_CONSTRUCTION :{WHITE}Elektrikli Ray Yapımı
STR_100B_MONORAIL_CONSTRUCTION :{WHITE}Monoray Yapımı
@@ -1711,6 +1723,7 @@
STR_2002_WHITE :{TINYFONT}{WHITE}{SIGN}
STR_2004_BUILDING_MUST_BE_DEMOLISHED :{WHITE}Önce bina yıkılmalı
STR_2005 :{WHITE}{TOWN}
+STR_CITY :{WHITE}{TOWN} (Şehir)
STR_2006_POPULATION :{BLACK}Nüfus: {ORANGE}{COMMA}{BLACK} Ev: {ORANGE}{COMMA}
STR_2007_RENAME_TOWN :İsim değiştir
STR_2008_CAN_T_RENAME_TOWN :{WHITE}İsim değiştirilemiyor...
@@ -1947,6 +1960,7 @@
STR_400F_SELECT_SCENARIO_GREEN_PRE :{BLACK}Senaryo (yeşil), kurulu oyun (mavi) veya yeni oyun seç
STR_4010_GENERATE_RANDOM_NEW_GAME :Rastgele haritada oyna
STR_LOAD_HEIGHTMAP :{WHITE}Yükseklik haritası yükle
+STR_SAVE_OSKTITLE :{BLACK}Kayıtlı oyun için bir isim girin
##id 0x4800
STR_4800_IN_THE_WAY :{WHITE}yolda {STRING} var
@@ -3091,6 +3105,7 @@
STR_NEWGRF_ERROR_LOAD_BEFORE :{STRING} önce, {STRING} ondan sonra yüklenmeli.
STR_NEWGRF_ERROR_LOAD_AFTER :{STRING} sonra, {STRING} ondan önce yüklenmeli.
STR_NEWGRF_ERROR_OTTD_VERSION_NUMBER :{STRING} OpenTTD {STRING} veya daha yüksek bir sürüm gerektirir.
+STR_NEWGRF_ERROR_AFTER_TRANSLATED_FILE :GRF dosyası çeviri için yapılmış
STR_NEWGRF_ERROR_TOO_MANY_NEWGRFS_LOADED :Çok fazla NewGRF yüklendi.
STR_NEWGRF_ADD :{BLACK}Ekle
@@ -3259,6 +3274,7 @@
STR_WORLD_GENERATION_CAPTION :{WHITE}Harita üretimi
STR_RANDOM_SEED :{BLACK}Rastgele Sayı:
STR_RANDOM_SEED_HELP :{BLACK}Rastgele bir sayı girmek için tıklayın
+STR_RANDOM_SEED_OSKTITLE :{BLACK}Rastgele bir tohum girin
STR_LAND_GENERATOR :{BLACK}Harita üretici:
STR_TREE_PLACER :{BLACK}Ağaç algoritmasi:
STR_HEIGHTMAP_ROTATION :{BLACK}Yükseklik haritası döndür:
@@ -3276,6 +3292,7 @@
STR_START_DATE_QUERY_CAPT :{WHITE}Başlangıç yılını değiştir
STR_HEIGHTMAP_SCALE_WARNING_CAPTION :{WHITE}Ölcek uyarısı
STR_HEIGHTMAP_SCALE_WARNING_MESSAGE :{YELLOW}Kaynak haritanin boyutunu değiştirmek önerilmez. Harita oluşturmaya devam edilsin mi?
+STR_TOWN_LAYOUT_WARNING_CAPTION :{WHITE}Şehir planlama uyarısı
STR_HEIGHTMAP_NAME :{BLACK}Yükseklik haritası adı:
STR_HEIGHTMAP_SIZE :{BLACK}Boyut: {ORANGE}{NUM} x {NUM}
STR_GENERATION_WORLD :{WHITE}Harita oluşturuluyor...
@@ -3465,3 +3482,6 @@
STR_DRAG_SIGNALS_DENSITY_DECREASE_TIP :{BLACK}Sinyal sürükleme yoğunluğunu azalt
STR_DRAG_SIGNALS_DENSITY_INCREASE_TIP :{BLACK}Sinyal sürükleme yoğunluğunu arttır
########
+
+############ on screen keyboard
+########
--- a/src/lang/ukrainian.txt Sun Apr 06 14:12:19 2008 +0000
+++ b/src/lang/ukrainian.txt Sun Apr 06 23:07:42 2008 +0000
@@ -1193,7 +1193,6 @@
STR_CONFIG_PATCHES_AUTORENEW_MONEY :{LTBLUE}Сума, необхідна для автооновлення: {ORANGE}{STRING}
STR_CONFIG_PATCHES_ERRMSG_DURATION :{LTBLUE}Тривалість повідомлення про помилку: {ORANGE}{STRING}
STR_CONFIG_PATCHES_POPULATION_IN_LABEL :{LTBLUE}Показувати населення міста поруч з назвою: {ORANGE}{STRING}
-STR_CONFIG_PATCHES_INVISIBLE_TREES :{LTBLUE}Прозорі дерева: {ORANGE}{STRING}
STR_CONFIG_PATCHES_LAND_GENERATOR :{LTBLUE}Генератор ландшафту: {ORANGE}{STRING}
STR_CONFIG_PATCHES_LAND_GENERATOR_ORIGINAL :Класичний
@@ -1477,6 +1476,7 @@
STR_NETWORK_PLAYER_NAME :{BLACK}Ім'я гравця:
STR_NETWORK_ENTER_NAME_TIP :{BLACK}Ім'я, за яким тебе розпізнаватимуть інші гравці
+STR_NETWORK_PLAYER_NAME_OSKTITLE :{BLACK}Введіть ваше ім'я
STR_NETWORK_CONNECTION :{BLACK}З'єднання:
STR_NETWORK_CONNECTION_TIP :{BLACK}Виберіть гру через інтернет або через локальну мережу(ЛОМ)
@@ -1520,6 +1520,7 @@
STR_NETWORK_NEW_GAME_NAME :{BLACK}Назва гри:
STR_NETWORK_NEW_GAME_NAME_TIP :{BLACK}Назва гри відображатиметься іншим гравцям у меню мережної гри
+STR_NETWORK_NEW_GAME_NAME_OSKTITLE :{BLACK}Введіть назву мережевої гри
STR_NETWORK_SET_PASSWORD :{BLACK}Встановити пароль
STR_NETWORK_PASSWORD_TIP :{BLACK}Захистіть вашу гру паролем, якщо не бажаєте загального доступу
STR_NETWORK_SELECT_MAP :{BLACK}Виберіть карту:
@@ -1576,6 +1577,13 @@
STR_NETWORK_LANG_SWEDISH :Шведська
STR_NETWORK_LANG_TURKISH :Турецька
STR_NETWORK_LANG_UKRAINIAN :Українська
+STR_NETWORK_LANG_AFRIKAANS :Афрікаанс
+STR_NETWORK_LANG_CROATIAN :Хорватська
+STR_NETWORK_LANG_CATALAN :Каталонська
+STR_NETWORK_LANG_ESTONIAN :Естонська
+STR_NETWORK_LANG_GALICIAN :Галісійська
+STR_NETWORK_LANG_GREEK :Грецька
+STR_NETWORK_LANG_LATVIAN :Латвійська
############ End of leave-in-this-order
STR_NETWORK_GAME_LOBBY :{WHITE}Мережева гра - кімната
@@ -1674,6 +1682,7 @@
STR_NETWORK_CHAT_TO_CLIENT :[Приватно] до {STRING}:{GRAY}{STRING}
STR_NETWORK_CHAT_ALL_CAPTION :[Всім] :
STR_NETWORK_CHAT_ALL :[Всім] {STRING}:{GRAY}{STRING}
+STR_NETWORK_CHAT_OSKTITLE :{BLACK}Введіть текст для мережевого чату
STR_NETWORK_NAME_CHANGE :змінив своє ім'я на
STR_NETWORK_SERVER_SHUTDOWN :{WHITE} Сервер закрив сеанс
STR_NETWORK_SERVER_REBOOT :{WHITE} Перезавантаження сервера...{}Зачекайте...
@@ -2077,6 +2086,7 @@
STR_400F_SELECT_SCENARIO_GREEN_PRE :{BLACK}Виберіть сценарій (зелений), встановлена гра (синій), або випадкова нова гра
STR_4010_GENERATE_RANDOM_NEW_GAME :Генерувати випадкову нову гру
STR_LOAD_HEIGHTMAP :{WHITE}Завантажити ландшафт
+STR_SAVE_OSKTITLE :{BLACK}Введіть назву файла збереженої гри
##id 0x4800
STR_4800_IN_THE_WAY :{WHITE}{STRING} на шляху
@@ -2872,6 +2882,8 @@
STR_REFIT_ORDER :(Переобладнати до {STRING})
STR_TIMETABLE_VIEW :{BLACK}Розклад
STR_TIMETABLE_VIEW_TOOLTIP :{BLACK}Переключитись на розклад
+STR_ORDER_VIEW :{BLACK}Завдання
+STR_ORDER_VIEW_TOOLTIP :{BLACK}Переключитись до вікна завдань
STR_8829_ORDERS :{WHITE}{VEHICLE} (Накази)
STR_882A_END_OF_ORDERS :{SETX 10}- - Кінець наказів - -
STR_FULLLOAD_OR_SERVICE :{SKIP}{SKIP}{STRING}
@@ -3428,6 +3440,7 @@
STR_WORLD_GENERATION_CAPTION :{WHITE}Створення світу
STR_RANDOM_SEED :{BLACK}Випадкове число:
STR_RANDOM_SEED_HELP :{BLACK}Клік для вводу значення
+STR_RANDOM_SEED_OSKTITLE :{BLACK}Введіть випадкове число
STR_LAND_GENERATOR :{BLACK}Ландшафт:
STR_TREE_PLACER :{BLACK}Насадження дерев:
STR_HEIGHTMAP_ROTATION :{BLACK}Поворот рельєфу
@@ -3575,6 +3588,7 @@
#### Improved sign GUI
STR_NEXT_SIGN_TOOLTIP :{BLACK}Наступне позначення
STR_PREVIOUS_SIGN_TOOLTIP :{BLACK}Попереднє позначення
+STR_SIGN_OSKTITLE :{BLACK}Введіть назву знака
########
@@ -3647,3 +3661,8 @@
STR_DRAG_SIGNALS_DENSITY_DECREASE_TIP :{BLACK}Зменшити частоту сигналів
STR_DRAG_SIGNALS_DENSITY_INCREASE_TIP :{BLACK}Збільшити частоту сигналів
########
+
+############ on screen keyboard
+STR_OSK_KEYBOARD_LAYOUT :`1234567890-=\йцукенгшщзхїфівапролджє ячсмитьбю. .
+STR_OSK_KEYBOARD_LAYOUT_CAPS :~!@#$%^&*()_+|ЙЦУКЕНГШЩЗХЇФІВАПРОЛДЖЄ ЯЧСМИТЬБЮ, .
+########
--- a/src/lang/unfinished/greek.txt Sun Apr 06 14:12:19 2008 +0000
+++ b/src/lang/unfinished/greek.txt Sun Apr 06 23:07:42 2008 +0000
@@ -1047,7 +1047,6 @@
STR_CONFIG_PATCHES_AUTORENEW_MONEY :{LTBLUE}Αυτόματη Ανανέωση με τα ελάχιστα απαιτούμενα χρήματα: {ORANGE}{STRING}
STR_CONFIG_PATCHES_ERRMSG_DURATION :{LTBLUE}Διάρκεια μηνύματος σφάλματος: {ORANGE}{STRING}
STR_CONFIG_PATCHES_POPULATION_IN_LABEL :{LTBLUE}Εμφάνιση πληθυσμού πόλης στο όνομα της πόλης: {ORANGE}{STRING}
-STR_CONFIG_PATCHES_INVISIBLE_TREES :{LTBLUE}Αόρατα δέντρα (με διαφανή κτίρια): {ORANGE}{STRING}
STR_CONFIG_PATCHES_LAND_GENERATOR :{LTBLUE}Γεννήτρια Γης: {ORANGE}{STRING}
STR_CONFIG_PATCHES_LAND_GENERATOR_ORIGINAL :Αυθεντικό
--- a/src/lang/unfinished/latvian.txt Sun Apr 06 14:12:19 2008 +0000
+++ b/src/lang/unfinished/latvian.txt Sun Apr 06 23:07:42 2008 +0000
@@ -1039,7 +1039,6 @@
STR_CONFIG_PATCHES_AUTORENEW_MONEY :{LTBLUE}Automa'tiski atjaunot minima'lo naudu kas nepiecies'ama atjaunos'anai: {ORANGE}{STRING}
STR_CONFIG_PATCHES_ERRMSG_DURATION :{LTBLUE}Kl'u'das zin'ojuma ilgums: {ORANGE}{STRING}
STR_CONFIG_PATCHES_POPULATION_IN_LABEL :{LTBLUE}Râdît pilsçtas iedzîvotâju skaitu pie pilsçtas nosaukuma: {ORANGE}{STRING}
-STR_CONFIG_PATCHES_INVISIBLE_TREES :{LTBLUE}Neredzami koki (ar caurspi'di'ga'm celtne'm): {ORANGE}{STRING}
STR_CONFIG_PATCHES_LAND_GENERATOR_ORIGINAL :Parasts
STR_CONFIG_PATCHES_LAND_GENERATOR_TERRA_GENESIS :TerraGenesis
--- a/src/main_gui.cpp Sun Apr 06 14:12:19 2008 +0000
+++ b/src/main_gui.cpp Sun Apr 06 23:07:42 2008 +0000
@@ -1069,6 +1069,19 @@
MarkWholeScreenDirty();
break;
+ case '1' | WKC_CTRL | WKC_SHIFT:
+ case '2' | WKC_CTRL | WKC_SHIFT:
+ case '3' | WKC_CTRL | WKC_SHIFT:
+ case '4' | WKC_CTRL | WKC_SHIFT:
+ case '5' | WKC_CTRL | WKC_SHIFT:
+ case '6' | WKC_CTRL | WKC_SHIFT:
+ case '7' | WKC_CTRL | WKC_SHIFT:
+ case '8' | WKC_CTRL | WKC_SHIFT:
+ /* Invisibility toggle hot keys */
+ ToggleInvisibilityWithTransparency((TransparencyOption)(e->we.keypress.keycode - ('1' | WKC_CTRL | WKC_SHIFT)));
+ MarkWholeScreenDirty();
+ break;
+
case 'X' | WKC_CTRL:
ShowTransparencyToolbar();
break;
--- a/src/misc.cpp Sun Apr 06 14:12:19 2008 +0000
+++ b/src/misc.cpp Sun Apr 06 23:07:42 2008 +0000
@@ -482,9 +482,8 @@
{
Cheat* cht = (Cheat*)&_cheats;
uint count = SlGetFieldLength() / 2;
- uint i;
- for (i = 0; i < count; i++) {
+ for (uint i = 0; i < count; i++) {
cht[i].been_used = (SlReadByte() != 0);
cht[i].value = (SlReadByte() != 0);
}
--- a/src/misc_cmd.cpp Sun Apr 06 14:12:19 2008 +0000
+++ b/src/misc_cmd.cpp Sun Apr 06 23:07:42 2008 +0000
@@ -54,20 +54,20 @@
*/
CommandCost CmdSetPlayerColor(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
{
- Player *p, *pp;
- byte colour;
+ if (p2 >= 16) return CMD_ERROR; // max 16 colours
+
+ byte colour = p2;
+
LiveryScheme scheme = (LiveryScheme)GB(p1, 0, 8);
byte state = GB(p1, 8, 2);
- if (p2 >= 16) return CMD_ERROR; // max 16 colours
- colour = p2;
-
if (scheme >= LS_END || state >= 3) return CMD_ERROR;
- p = GetPlayer(_current_player);
+ Player *p = GetPlayer(_current_player);
/* Ensure no two companies have the same primary colour */
if (scheme == LS_DEFAULT && state == 0) {
+ const Player *pp;
FOR_ALL_PLAYERS(pp) {
if (pp->is_active && pp != p && pp->player_color == colour) return CMD_ERROR;
}
@@ -235,14 +235,12 @@
*/
CommandCost CmdChangeCompanyName(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
{
- Player *p;
-
if (StrEmpty(_cmd_text)) return CMD_ERROR;
if (!IsUniqueCompanyName(_cmd_text)) return_cmd_error(STR_NAME_MUST_BE_UNIQUE);
if (flags & DC_EXEC) {
- p = GetPlayer(_current_player);
+ Player *p = GetPlayer(_current_player);
free(p->name);
p->name = strdup(_cmd_text);
MarkWholeScreenDirty();
@@ -274,14 +272,12 @@
*/
CommandCost CmdChangePresidentName(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
{
- Player *p;
-
if (StrEmpty(_cmd_text)) return CMD_ERROR;
if (!IsUniquePresidentName(_cmd_text)) return_cmd_error(STR_NAME_MUST_BE_UNIQUE);
if (flags & DC_EXEC) {
- p = GetPlayer(_current_player);
+ Player *p = GetPlayer(_current_player);
free(p->president_name);
p->president_name = strdup(_cmd_text);
@@ -419,8 +415,9 @@
/* If we are a network-client, update the difficult setting (if it is open).
* Use this instead of just dirtying the window because we need to load in
* the new difficulty settings */
- if (_networking && !_network_server && FindWindowById(WC_GAME_OPTIONS, 0) != NULL)
+ if (_networking && !_network_server && FindWindowById(WC_GAME_OPTIONS, 0) != NULL) {
ShowGameDifficulty();
+ }
}
return CommandCost();
}
--- a/src/misc_gui.cpp Sun Apr 06 14:12:19 2008 +0000
+++ b/src/misc_gui.cpp Sun Apr 06 23:07:42 2008 +0000
@@ -41,6 +41,7 @@
#include "player_gui.h"
#include "settings_type.h"
#include "newgrf_cargo.h"
+#include "rail_gui.h"
#include "table/sprites.h"
#include "table/strings.h"
@@ -93,9 +94,6 @@
static void Place_LandInfo(TileIndex tile)
{
- AcceptedCargo ac;
- TileDesc td;
-
DeleteWindowById(WC_LAND_INFO, 0);
Window *w = AllocateWindowDesc(&_land_info_desc);
@@ -110,6 +108,9 @@
p->player_money = old_money;
/* Because build_date is not set yet in every TileDesc, we make sure it is empty */
+ TileDesc td;
+ AcceptedCargo ac;
+
td.build_date = 0;
GetAcceptedCargo(tile, ac);
GetTileDesc(tile, &td);
@@ -336,13 +337,15 @@
static void BuildTreesWndProc(Window *w, WindowEvent *e)
{
switch (e->event) {
+ case WE_CREATE:
+ ResetObjectToPlace();
+ break;
+
case WE_PAINT: {
- int i, count;
-
DrawWindowWidgets(w);
- WP(w, tree_d).base = i = _tree_base_by_landscape[_opt.landscape];
- WP(w, tree_d).count = count = _tree_count_by_landscape[_opt.landscape];
+ int i = WP(w, tree_d).base = _tree_base_by_landscape[_opt.landscape];
+ int count = WP(w, tree_d).count = _tree_count_by_landscape[_opt.landscape];
int x = 18;
int y = 54;
@@ -360,7 +363,7 @@
int wid = e->we.click.widget;
switch (wid) {
- case 0:
+ case 0:
ResetObjectToPlace();
break;
@@ -578,10 +581,6 @@
void ShowErrorMessage(StringID msg_1, StringID msg_2, int x, int y)
{
- Window *w;
- const ViewPort *vp;
- Point pt;
-
DeleteWindowById(WC_ERRMSG, 0);
if (msg_2 == STR_NULL) msg_2 = STR_EMPTY;
@@ -592,6 +591,10 @@
_errmsg_duration = _patches.errmsg_duration;
if (!_errmsg_duration) return;
+ Point pt;
+ const ViewPort *vp;
+ Window *w;
+
if (_errmsg_message_1 != STR_013B_OWNED_BY || GetDParamX(_errmsg_decode_params,2) >= 8) {
if ((x | y) != 0) {
pt = RemapCoords2(x, y);
@@ -641,10 +644,9 @@
void ShowCostOrIncomeAnimation(int x, int y, int z, Money cost)
{
- StringID msg;
Point pt = RemapCoords(x,y,z);
+ StringID msg = STR_0801_COST;
- msg = STR_0801_COST;
if (cost < 0) {
cost = -cost;
msg = STR_0803_INCOME;
@@ -761,13 +763,12 @@
}
-static int DrawStationCoverageText(const AcceptedCargo accepts,
- int str_x, int str_y, StationCoverageType sct)
+static int DrawStationCoverageText(const AcceptedCargo cargo,
+ int str_x, int str_y, StationCoverageType sct, bool supplies)
{
- char *b = _userstring;
bool first = true;
- b = InlineString(b, STR_000D_ACCEPTS);
+ char *b = InlineString(_userstring, supplies ? STR_SUPPLIES : STR_000D_ACCEPTS);
for (CargoID i = 0; i < NUM_CARGO; i++) {
if (b >= lastof(_userstring) - (1 + 2 * 4)) break; // ',' or ' ' and two calls to Utf8Encode()
@@ -777,7 +778,7 @@
case SCT_ALL: break;
default: NOT_REACHED();
}
- if (accepts[i] >= 8) {
+ if (cargo[i] >= (supplies ? 1 : 8)) {
if (first) {
first = false;
} else {
@@ -800,13 +801,26 @@
return DrawStringMultiLine(str_x, str_y, STR_SPEC_USERSTRING, 144);
}
-int DrawStationCoverageAreaText(int sx, int sy, StationCoverageType sct, int rad)
+/**
+ * Calculates and draws the accepted or supplied cargo around the selected tile(s)
+ * @param sx x position where the string is to be drawn
+ * @param sy y position where the string is to be drawn
+ * @param sct which type of cargo is to be displayed (passengers/non-passengers)
+ * @param rad radius around selected tile(s) to be searched
+ * @param supplies if supplied cargos should be drawn, else accepted cargos
+ * @return Returns the y value below the string that was drawn
+ */
+int DrawStationCoverageAreaText(int sx, int sy, StationCoverageType sct, int rad, bool supplies)
{
TileIndex tile = TileVirtXY(_thd.pos.x, _thd.pos.y);
- AcceptedCargo accepts;
+ AcceptedCargo cargo;
if (tile < MapSize()) {
- GetAcceptanceAroundTiles(accepts, tile, _thd.size.x / TILE_SIZE, _thd.size.y / TILE_SIZE , rad);
- return sy + DrawStationCoverageText(accepts, sx, sy, sct);
+ if (supplies) {
+ GetProductionAroundTiles(cargo, tile, _thd.size.x / TILE_SIZE, _thd.size.y / TILE_SIZE , rad);
+ } else {
+ GetAcceptanceAroundTiles(cargo, tile, _thd.size.x / TILE_SIZE, _thd.size.y / TILE_SIZE , rad);
+ }
+ return sy + DrawStationCoverageText(cargo, sx, sy, sct, supplies);
}
return sy;
@@ -966,6 +980,9 @@
tb->caretpos = tb->length;
tb->caretxoffs = tb->width;
return true;
+
+ default:
+ break;
}
return false;
@@ -1068,15 +1085,15 @@
void DrawEditBox(Window *w, querystr_d *string, int wid)
{
- DrawPixelInfo dpi, *old_dpi;
- int delta;
const Widget *wi = &w->widget[wid];
- const Textbuf *tb = &string->text;
assert((wi->type & WWT_MASK) == WWT_EDITBOX);
GfxFillRect(wi->left + 1, wi->top + 1, wi->right - 1, wi->bottom - 1, 215);
+ DrawPixelInfo dpi;
+ int delta;
+
/* Limit the drawing of the string inside the widget boundaries */
if (!FillDrawPixelInfo(&dpi,
wi->left + 4,
@@ -1086,11 +1103,13 @@
return;
}
- old_dpi = _cur_dpi;
+ DrawPixelInfo *old_dpi = _cur_dpi;
_cur_dpi = &dpi;
/* We will take the current widget length as maximum width, with a small
* space reserved at the end for the caret to show */
+ const Textbuf *tb = &string->text;
+
delta = (wi->right - wi->left) - tb->width - 10;
if (delta > 0) delta = 0;
@@ -1424,14 +1443,12 @@
{
uint sort_start = 0;
uint sort_end = 0;
- uint s_amount;
- int i;
/* Directories are always above the files (FIOS_TYPE_DIR)
* Drives (A:\ (windows only) are always under the files (FIOS_TYPE_DRIVE)
* Only sort savegames/scenarios, not directories
*/
- for (i = 0; i < _fios_num; i++) {
+ for (int i = 0; i < _fios_num; i++) {
switch (_fios_list[i].type) {
case FIOS_TYPE_DIR: sort_start++; break;
case FIOS_TYPE_PARENT: sort_start++; break;
@@ -1439,9 +1456,10 @@
}
}
- s_amount = _fios_num - sort_start - sort_end;
- if (s_amount > 0)
+ uint s_amount = _fios_num - sort_start - sort_end;
+ if (s_amount > 0) {
qsort(_fios_list + sort_start, s_amount, sizeof(FiosItem), compare_FiosItems);
+ }
}
static void GenerateFileName()
@@ -1699,10 +1717,8 @@
STR_LOAD_HEIGHTMAP,
};
- Window *w;
const WindowDesc *sld = &_save_dialog_desc;
-
SetObjectToPlace(SPR_CURSOR_ZZZ, PAL_NONE, VHM_NONE, WC_MAIN_WINDOW, 0);
DeleteWindowById(WC_QUERY_STRING, 0);
DeleteWindowById(WC_SAVELOAD, 0);
@@ -1720,7 +1736,8 @@
}
assert((uint)mode < lengthof(saveload_captions));
- w = AllocateWindowDesc(sld);
+
+ Window *w = AllocateWindowDesc(sld);
w->widget[1].data = saveload_captions[mode];
w->LowerWidget(7);
@@ -1833,6 +1850,7 @@
SetDate(ConvertYMDToDate(_cur_year + p2, ymd.month, ymd.day));
EnginesMonthlyLoop();
SetWindowDirty(FindWindowById(WC_STATUS_BAR, 0));
+ ResetSignalVariant();
return _cur_year;
}
--- a/src/music.cpp Sun Apr 06 14:12:19 2008 +0000
+++ b/src/music.cpp Sun Apr 06 23:07:42 2008 +0000
@@ -2,6 +2,7 @@
/** @file music.cpp */
+#include "stdafx.h"
#include "music.h"
const SongSpecs origin_songs_specs[NUM_SONGS_AVAILABLE] = {
--- a/src/music.h Sun Apr 06 14:12:19 2008 +0000
+++ b/src/music.h Sun Apr 06 23:07:42 2008 +0000
@@ -9,7 +9,7 @@
#define NUM_SONGS_AVAILABLE 22
struct SongSpecs {
- char filename[256];
+ char filename[MAX_PATH];
char song_name[64];
};
--- a/src/network/network_udp.cpp Sun Apr 06 14:12:19 2008 +0000
+++ b/src/network/network_udp.cpp Sun Apr 06 23:07:42 2008 +0000
@@ -519,7 +519,7 @@
/* check for socket */
if (!_udp_master_socket->IsConnected()) {
- if (!_udp_master_socket->Listen(0, 0, false)) return;
+ if (!_udp_master_socket->Listen(_network_server_bind_ip, 0, false)) return;
}
DEBUG(net, 1, "[udp] removing advertise from master server");
@@ -549,7 +549,7 @@
/* check for socket */
if (!_udp_master_socket->IsConnected()) {
- if (!_udp_master_socket->Listen(0, 0, false)) return;
+ if (!_udp_master_socket->Listen(_network_server_bind_ip, 0, false)) return;
}
if (_network_need_advertise) {
--- a/src/newgrf_config.h Sun Apr 06 14:12:19 2008 +0000
+++ b/src/newgrf_config.h Sun Apr 06 23:07:42 2008 +0000
@@ -7,17 +7,19 @@
#include "strings_type.h"
-/* GRF config bit flags */
+/** GRF config bit flags */
enum GCF_Flags {
- GCF_SYSTEM, ///< GRF file is an openttd-internal system grf
- GCF_UNSAFE, ///< GRF file is unsafe for static usage
- GCF_STATIC, ///< GRF file is used statically (can be used in any MP game)
- GCF_COMPATIBLE,///< GRF file does not exactly match the requested GRF (different MD5SUM), but grfid matches)
- GCF_COPY, ///< The data is copied from a grf in _all_grfs
- GCF_INIT_ONLY, ///< GRF file is processed up to GLS_INIT
- GCF_RESERVED, ///< GRF file passed GLS_RESERVE stage
+ GCF_SYSTEM, ///< GRF file is an openttd-internal system grf
+ GCF_UNSAFE, ///< GRF file is unsafe for static usage
+ GCF_STATIC, ///< GRF file is used statically (can be used in any MP game)
+ GCF_COMPATIBLE, ///< GRF file does not exactly match the requested GRF (different MD5SUM), but grfid matches)
+ GCF_COPY, ///< The data is copied from a grf in _all_grfs
+ GCF_INIT_ONLY, ///< GRF file is processed up to GLS_INIT
+ GCF_RESERVED, ///< GRF file passed GLS_RESERVE stage
+
};
+/** Status of GRF */
enum GRFStatus {
GCS_UNKNOWN, ///< The status of this grf file is unknown
GCS_DISABLED, ///< GRF file is disabled
@@ -26,53 +28,50 @@
GCS_ACTIVATED ///< GRF file has been activated
};
+/** Status of post-gameload GRF compatibility check */
enum GRFListCompatibility{
- GLC_ALL_GOOD,
- GLC_COMPATIBLE,
- GLC_NOT_FOUND
-};
-
-struct GRFIdentifier {
- uint32 grfid;
- uint8 md5sum[16];
+ GLC_ALL_GOOD, ///< All GRF needed by game are present
+ GLC_COMPATIBLE, ///< Compatible (eg. the same ID, but different chacksum) GRF found in at least one case
+ GLC_NOT_FOUND ///< At least one GRF couldn't be found (higher priority than GLC_COMPATIBLE)
};
-struct GRFError {
- char *custom_message;
- char *data;
- StringID message;
- StringID severity;
- uint8 num_params;
- uint8 param_number[2];
+/** Basic data to distinguish a GRF. Used in the server list window */
+struct GRFIdentifier {
+ uint32 grfid; ///< GRF ID (defined by Action 0x08)
+ uint8 md5sum[16]; ///< MD5 checksum of file to distinguish files with the same GRF ID (eg. newer version of GRF)
};
-struct GRFConfig : public GRFIdentifier {
- char *filename;
- char *name;
- char *info;
- GRFError *error;
+/** Information about why GRF had problems during initialisation */
+struct GRFError {
+ char *custom_message; ///< Custom message (if present)
+ char *data; ///< Additional data for message and custom_message
+ StringID message; ///< Default message
+ StringID severity; ///< Info / Warning / Error / Fatal
+ uint8 num_params; ///< Number of additinal parameters for custom_message (0, 1 or 2)
+ uint8 param_number[2]; ///< GRF parameters to show for custom_message
+};
- uint8 flags;
- GRFStatus status;
- uint32 param[0x80];
- uint8 num_params;
+/** Information about GRF, used in the game and (part of it) in savegames */
+struct GRFConfig : public GRFIdentifier {
+ char *filename; ///< Filename - either with or without full path
+ char *name; ///< NOSAVE: GRF name (Action 0x08)
+ char *info; ///< NOSAVE: GRF info (author, copyright, ...) (Action 0x08)
+ GRFError *error; ///< NOSAVE: Error/Warning during GRF loading (Action 0x0B)
- struct GRFConfig *next;
+ uint8 flags; ///< NOSAVE: GCF_Flags, bitset
+ GRFStatus status; ///< NOSAVE: GRFStatus, enum
+ uint32 param[0x80]; ///< GRF parameters
+ uint8 num_params; ///< Number of used parameters
+
+ struct GRFConfig *next; ///< NOSAVE: Next item in the linked list
bool IsOpenTTDBaseGRF() const;
};
-/* First item in list of all scanned NewGRFs */
-extern GRFConfig *_all_grfs;
-
-/* First item in list of current GRF set up */
-extern GRFConfig *_grfconfig;
-
-/* First item in list of default GRF set up */
-extern GRFConfig *_grfconfig_newgame;
-
-/* First item in list of static GRF set up */
-extern GRFConfig *_grfconfig_static;
+extern GRFConfig *_all_grfs; ///< First item in list of all scanned NewGRFs
+extern GRFConfig *_grfconfig; ///< First item in list of current GRF set up
+extern GRFConfig *_grfconfig_newgame; ///< First item in list of default GRF set up
+extern GRFConfig *_grfconfig_static; ///< First item in list of static GRF set up
void ScanNewGRFFiles();
const GRFConfig *FindGRFConfig(uint32 grfid, const uint8 *md5sum = NULL);
--- a/src/newgrf_engine.cpp Sun Apr 06 14:12:19 2008 +0000
+++ b/src/newgrf_engine.cpp Sun Apr 06 23:07:42 2008 +0000
@@ -348,11 +348,11 @@
case TERM1:
case HELIPAD1:
- return (v->current_order.type == OT_LOADING) ? AMA_TTDP_ON_PAD1 : AMA_TTDP_LANDING_TO_PAD1;
+ return (v->current_order.IsType(OT_LOADING)) ? AMA_TTDP_ON_PAD1 : AMA_TTDP_LANDING_TO_PAD1;
case TERM2:
case HELIPAD2:
- return (v->current_order.type == OT_LOADING) ? AMA_TTDP_ON_PAD2 : AMA_TTDP_LANDING_TO_PAD2;
+ return (v->current_order.IsType(OT_LOADING)) ? AMA_TTDP_ON_PAD2 : AMA_TTDP_LANDING_TO_PAD2;
case TERM3:
case TERM4:
@@ -362,7 +362,7 @@
case TERM8:
case HELIPAD3:
case HELIPAD4:
- return (v->current_order.type == OT_LOADING) ? AMA_TTDP_ON_PAD3 : AMA_TTDP_LANDING_TO_PAD3;
+ return (v->current_order.IsType(OT_LOADING)) ? AMA_TTDP_ON_PAD3 : AMA_TTDP_LANDING_TO_PAD3;
case TAKEOFF: // Moving to takeoff position
case STARTTAKEOFF: // Accelerating down runway
@@ -379,7 +379,7 @@
case HELILANDING:
case HELIENDLANDING:
/* @todo Need to check terminal we're landing to. Is it known yet? */
- return (v->current_order.type == OT_GOTO_DEPOT) ?
+ return (v->current_order.IsType(OT_GOTO_DEPOT)) ?
AMA_TTDP_LANDING_TO_HANGAR : AMA_TTDP_LANDING_TO_PAD1;
default:
@@ -681,8 +681,8 @@
case 0x01: return MapOldSubType(v);
case 0x04: return v->index;
case 0x05: return GB(v->index, 8, 8);
- case 0x0A: return PackOrder(&v->current_order);
- case 0x0B: return GB(PackOrder(&v->current_order), 8, 8);
+ case 0x0A: return v->current_order.Pack();
+ case 0x0B: return GB(v->current_order.Pack(), 8, 8);
case 0x0C: return v->num_orders;
case 0x0D: return v->cur_order_index;
case 0x10: return v->load_unload_time_rem;
@@ -811,7 +811,7 @@
return NULL;
}
- bool in_motion = v->First()->current_order.type != OT_LOADING;
+ bool in_motion = !v->First()->current_order.IsType(OT_LOADING);
totalsets = in_motion ? group->g.real.num_loaded : group->g.real.num_loading;
--- a/src/newgrf_house.cpp Sun Apr 06 14:12:19 2008 +0000
+++ b/src/newgrf_house.cpp Sun Apr 06 23:07:42 2008 +0000
@@ -216,7 +216,7 @@
switch (variable) {
/* Construction stage. */
- case 0x40: return (IsTileType(tile, MP_HOUSE) ? GetHouseBuildingStage(tile) : 0) | OriginalTileRandomiser(TileX(tile), TileY(tile)) << 2;
+ case 0x40: return (IsTileType(tile, MP_HOUSE) ? GetHouseBuildingStage(tile) : 0) | TileHash2Bit(TileX(tile), TileY(tile)) << 2;
/* Building age. */
case 0x41: return Clamp(_cur_year - GetHouseConstructionYear(tile), 0, 0xFF);
@@ -322,6 +322,9 @@
if (GB(image, 0, SPRITE_WIDTH) != 0) DrawGroundSprite(image, pal);
+ /* End now, if houses are invisible */
+ if (IsInvisibilitySet(TO_HOUSES)) return;
+
foreach_draw_tile_seq(dtss, dts->seq) {
if (GB(dtss->image.sprite, 0, SPRITE_WIDTH) == 0) continue;
@@ -340,7 +343,7 @@
pal = HasBit(callback, 14) ? GB(callback, 0, 8) + SPR_2CCMAP_BASE : callback;
}
} else {
- pal = hs->random_colour[OriginalTileRandomiser(ti->x, ti->y)] + PALETTE_RECOLOR_START;
+ pal = hs->random_colour[TileHash2Bit(ti->x, ti->y)] + PALETTE_RECOLOR_START;
}
}
} else {
--- a/src/newgrf_industrytiles.cpp Sun Apr 06 14:12:19 2008 +0000
+++ b/src/newgrf_industrytiles.cpp Sun Apr 06 23:07:42 2008 +0000
@@ -185,6 +185,9 @@
if (GB(image, 0, SPRITE_WIDTH) != 0) DrawGroundSprite(image, pal);
+ /* End now if industries are invisible */
+ if (IsInvisibilitySet(TO_INDUSTRIES)) return;
+
foreach_draw_tile_seq(dtss, dts->seq) {
if (GB(dtss->image.sprite, 0, SPRITE_WIDTH) == 0) continue;
--- a/src/npf.cpp Sun Apr 06 14:12:19 2008 +0000
+++ b/src/npf.cpp Sun Apr 06 23:07:42 2008 +0000
@@ -980,10 +980,10 @@
* dest_tile, not just any stop of that station.
* So only for train orders to stations we fill fstd->station_index, for all
* others only dest_coords */
- if (v->current_order.type == OT_GOTO_STATION && v->type == VEH_TRAIN) {
- fstd->station_index = v->current_order.dest;
+ if (v->current_order.IsType(OT_GOTO_STATION) && v->type == VEH_TRAIN) {
+ fstd->station_index = v->current_order.GetDestination();
/* Let's take the closest tile of the station as our target for trains */
- fstd->dest_coords = CalcClosestStationTile(v->current_order.dest, v->tile);
+ fstd->dest_coords = CalcClosestStationTile(fstd->station_index, v->tile);
} else {
fstd->dest_coords = v->dest_tile;
fstd->station_index = INVALID_STATION;
--- a/src/oldloader.cpp Sun Apr 06 14:12:19 2008 +0000
+++ b/src/oldloader.cpp Sun Apr 06 23:07:42 2008 +0000
@@ -345,8 +345,8 @@
* (loading) order which causes assertions and the like later on.
*/
if (!IsPlayerBuildableVehicleType(v) ||
- (v->IsPrimaryVehicle() && v->current_order.type == OT_NOTHING)) {
- v->current_order.type = OT_DUMMY;
+ (v->IsPrimaryVehicle() && v->current_order.IsType(OT_NOTHING))) {
+ v->current_order.MakeDummy();
}
FOR_ALL_VEHICLES_FROM(u, v->index + 1) {
@@ -504,7 +504,7 @@
{
if (!LoadChunk(ls, NULL, order_chunk)) return false;
- AssignOrder(new (num) Order(), UnpackOldOrder(_old_order));
+ new (num) Order(UnpackOldOrder(_old_order));
/* Relink the orders to eachother (in TTD(Patch) the orders for one
vehicle are behind eachother, with an invalid order (OT_NOTHING) as indication that
@@ -1008,8 +1008,8 @@
OCL_SVAR( OC_UINT8, Vehicle, z_pos ),
OCL_SVAR( OC_UINT8, Vehicle, direction ),
OCL_NULL( 2 ), ///< x_offs and y_offs, calculated automatically
- OCL_NULL( 2 ), ///< sprite_width and sprite_height, calculated automatically
- OCL_NULL( 1 ), ///< z_height, calculated automatically
+ OCL_NULL( 2 ), ///< x_extent and y_extent, calculated automatically
+ OCL_NULL( 1 ), ///< z_extent, calculated automatically
OCL_SVAR( OC_UINT8, Vehicle, owner ),
OCL_SVAR( OC_TILE, Vehicle, tile ),
@@ -1101,7 +1101,7 @@
*/
if (old_id < 5000) v->orders = GetOrder(old_id);
}
- AssignOrder(&v->current_order, UnpackOldOrder(_old_order));
+ v->current_order.AssignOrder(UnpackOldOrder(_old_order));
/* For some reason we need to correct for this */
switch (v->spritenum) {
--- a/src/openttd.cpp Sun Apr 06 14:12:19 2008 +0000
+++ b/src/openttd.cpp Sun Apr 06 23:07:42 2008 +0000
@@ -95,7 +95,7 @@
extern void SetDifficultyLevel(int mode, GameOptions *gm_opt);
extern Player* DoStartupNewPlayer(bool is_ai);
extern void ShowOSErrorBox(const char *buf);
-extern void SetDefaultRailGui();
+extern void InitializeRailGUI();
/* TODO: usrerror() for errors which are not of an internal nature but
* caused by the user, i.e. missing files or fatal configuration errors.
@@ -712,7 +712,7 @@
DoCommandP(0, (_patches.autorenew << 15 ) | (_patches.autorenew_months << 16) | 4, _patches.autorenew_money, NULL, CMD_SET_AUTOREPLACE);
SettingsDisableElrail(_patches.disable_elrails);
- SetDefaultRailGui();
+ InitializeRailGUI();
#ifdef ENABLE_NETWORK
/* We are the server, we start a new player (not dedicated),
@@ -1973,7 +1973,12 @@
for (TileIndex t = 0; t < map_size; t++) {
if (IsTileType(t, MP_CLEAR) && IsClearGround(t, CLEAR_FIELDS)) {
+ /* remove fields */
MakeClear(t, CLEAR_GRASS, 3);
+ } else if (IsTileType(t, MP_CLEAR) || IsTileType(t, MP_TREES)) {
+ /* remove fences around fields */
+ SetFenceSE(t, 0);
+ SetFenceSW(t, 0);
}
}
@@ -1992,13 +1997,11 @@
Vehicle *v;
FOR_ALL_ORDERS(order) {
- order->refit_cargo = CT_NO_REFIT;
- order->refit_subtype = CT_NO_REFIT;
+ order->SetRefit(CT_NO_REFIT);
}
FOR_ALL_VEHICLES(v) {
- v->current_order.refit_cargo = CT_NO_REFIT;
- v->current_order.refit_subtype = CT_NO_REFIT;
+ v->current_order.SetRefit(CT_NO_REFIT);
}
}
@@ -2007,7 +2010,7 @@
if (CheckSavegameVersion(38)) _patches.disable_elrails = false;
/* do the same as when elrails were enabled/disabled manually just now */
SettingsDisableElrail(_patches.disable_elrails);
- SetDefaultRailGui();
+ InitializeRailGUI();
/* From version 53, the map array was changed for house tiles to allow
* space for newhouses grf features. A new byte, m7, was also added. */
@@ -2183,7 +2186,7 @@
FOR_ALL_VEHICLES(v) {
if ((v->type != VEH_TRAIN || IsFrontEngine(v)) && // for all locs
!(v->vehstatus & (VS_STOPPED | VS_CRASHED)) && // not stopped or crashed
- v->current_order.type == OT_LOADING) { // loading
+ v->current_order.IsType(OT_LOADING)) { // loading
GetStation(v->last_station_visited)->loading_vehicles.push_back(v);
/* The loading finished flag is *only* set when actually completely
@@ -2200,7 +2203,7 @@
for (iter = st->loading_vehicles.begin(); iter != st->loading_vehicles.end();) {
Vehicle *v = *iter;
iter++;
- if (v->current_order.type != OT_LOADING) st->loading_vehicles.remove(v);
+ if (!v->current_order.IsType(OT_LOADING)) st->loading_vehicles.remove(v);
}
}
}
@@ -2312,8 +2315,9 @@
/* Update go to buoy orders because they are just waypoints */
Order *order;
FOR_ALL_ORDERS(order) {
- if (order->type == OT_GOTO_STATION && GetStation(order->dest)->IsBuoy()) {
- order->flags = 0;
+ if (order->IsType(OT_GOTO_STATION) && GetStation(order->GetDestination())->IsBuoy()) {
+ order->SetLoadType(0);
+ order->SetUnloadType(0);
}
}
--- a/src/order_base.h Sun Apr 06 14:12:19 2008 +0000
+++ b/src/order_base.h Sun Apr 06 23:07:42 2008 +0000
@@ -9,6 +9,10 @@
#include "oldpool.h"
#include "core/bitmath_func.hpp"
#include "cargo_type.h"
+#include "depot_type.h"
+#include "station_type.h"
+#include "vehicle_type.h"
+#include "waypoint_type.h"
DECLARE_OLD_POOL(Order, Order, 6, 1000)
@@ -18,14 +22,20 @@
* - REF_ORDER (all REFs are currently limited to 16 bits!!)
*/
struct Order : PoolItem<Order, OrderID, &_Order_pool> {
- Order *next; ///< Pointer to next order. If NULL, end of list
+private:
+ friend const struct SaveLoad *GetVehicleDescription(VehicleType vt); ///< Saving and loading the current order of vehicles.
+ friend void Load_VEHS(); ///< Loading of ancient vehicles.
+ friend const struct SaveLoad *GetOrderDescription(); ///< Saving and loading of orders.
- OrderTypeByte type;
- uint8 flags;
- DestinationID dest; ///< The destionation of the order.
+ OrderTypeByte type; ///< The type of order
+ uint8 flags; ///< 'Sub'type of order
+ DestinationID dest; ///< The destination of the order.
- CargoID refit_cargo; // Refit CargoID
- byte refit_subtype; // Refit subtype
+ CargoID refit_cargo; ///< Refit CargoID
+ byte refit_subtype; ///< Refit subtype
+
+public:
+ Order *next; ///< Pointer to next order. If NULL, end of list
uint16 wait_time; ///< How long in ticks to wait at the destination.
uint16 travel_time; ///< How long in ticks the journey to this destination should take.
@@ -34,12 +44,166 @@
~Order() { this->type = OT_NOTHING; }
/**
+ * Create an order based on a packed representation of that order.
+ * @param packed the packed representation.
+ */
+ Order(uint32 packed);
+
+ /**
* Check if a Order really exists.
+ * @return true if the order is valid.
*/
inline bool IsValid() const { return this->type != OT_NOTHING; }
+ /**
+ * Check whether this order is of the given type.
+ * @param type the type to check against.
+ * @return true if the order matches.
+ */
+ inline bool IsType(OrderType type) const { return this->type == type; }
+
+ /**
+ * Get the type of order of this order.
+ * @return the order type.
+ */
+ inline OrderType GetType() const { return this->type; }
+
+ /**
+ * 'Free' the order
+ * @note ONLY use on "current_order" vehicle orders!
+ */
void Free();
+
+ /**
+ * Makes this order a Go To Station order.
+ * @param destsination the station to go to.
+ */
+ void MakeGoToStation(StationID destination);
+
+ /**
+ * Makes this order a Go To Depot order.
+ * @param destination the depot to go to.
+ * @param order is this order a 'default' order, or an overriden vehicle order?
+ * @param cargo the cargo type to change to.
+ * @param subtype the subtype to change to.
+ */
+ void MakeGoToDepot(DepotID destination, bool order, CargoID cargo = CT_NO_REFIT, byte subtype = 0);
+
+ /**
+ * Makes this order a Go To Waypoint order.
+ * @param destination the waypoint to go to.
+ */
+ void MakeGoToWaypoint(WaypointID destination);
+
+ /**
+ * Makes this order a Loading order.
+ * @param ordered is this an ordered stop?
+ */
+ void MakeLoading(bool ordered);
+
+ /**
+ * Makes this order a Leave Station order.
+ */
+ void MakeLeaveStation();
+
+ /**
+ * Makes this order a Dummy order.
+ */
+ void MakeDummy();
+
+ /**
+ * Free a complete order chain.
+ * @note do not use on "current_order" vehicle orders!
+ */
void FreeChain();
+
+ /**
+ * Gets the destination of this order.
+ * @pre IsType(OT_GOTO_WAYPOINT) || IsType(OT_GOTO_DEPOT) || IsType(OT_GOTO_STATION).
+ * @return the destination of the order.
+ */
+ inline DestinationID GetDestination() const { return this->dest; }
+
+ /**
+ * Sets the destination of this order.
+ * @param destination the new destination of the order.
+ * @pre IsType(OT_GOTO_WAYPOINT) || IsType(OT_GOTO_DEPOT) || IsType(OT_GOTO_STATION).
+ */
+ inline void SetDestination(DestinationID destination) { this->dest = destination; }
+
+ /**
+ * Is this order a refit order.
+ * @pre IsType(OT_GOTO_DEPOT)
+ * @return true if a refit should happen.
+ */
+ inline bool IsRefit() const { return this->refit_cargo < NUM_CARGO; }
+
+ /**
+ * Get the cargo to to refit to.
+ * @pre IsType(OT_GOTO_DEPOT)
+ * @return the cargo type.
+ */
+ inline CargoID GetRefitCargo() const { return this->refit_cargo; }
+
+ /**
+ * Get the cargo subtype to to refit to.
+ * @pre IsType(OT_GOTO_DEPOT)
+ * @return the cargo subtype.
+ */
+ inline byte GetRefitSubtype() const { return this->refit_subtype; }
+
+ /**
+ * Make this depot order also a refit order.
+ * @param cargo the cargo type to change to.
+ * @param subtype the subtype to change to.
+ * @pre IsType(OT_GOTO_DEPOT).
+ */
+ void SetRefit(CargoID cargo, byte subtype = 0);
+
+ /** How must the consist be loaded? */
+ inline byte GetLoadType() const { return this->flags & OFB_FULL_LOAD; }
+ /** How must the consist be unloaded? */
+ inline byte GetUnloadType() const { return GB(this->flags, 0, 2); }
+ /** Where must we stop? */
+ inline byte GetNonStopType() const { return this->flags & OFB_NON_STOP; }
+ /** What caused us going to the depot? */
+ inline byte GetDepotOrderType() const { return this->flags; }
+ /** What are we going to do when in the depot. */
+ inline byte GetDepotActionType() const { return this->flags; }
+
+ /** Set how the consist must be loaded. */
+ inline void SetLoadType(byte load_type) { SB(this->flags, 2, 1, !!load_type); }
+ /** Set how the consist must be unloaded. */
+ inline void SetUnloadType(byte unload_type) { SB(this->flags, 0, 2, unload_type); }
+ /** Set whether we must stop at stations or not. */
+ inline void SetNonStopType(byte non_stop_type) { SB(this->flags, 3, 1, !!non_stop_type); }
+ /** Set the cause to go to the depot. */
+ inline void SetDepotOrderType(byte depot_order_type) { this->flags = depot_order_type; }
+ /** Set what we are going to do in the depot. */
+ inline void SetDepotActionType(byte depot_service_type) { this->flags = depot_service_type; }
+
+ bool ShouldStopAtStation(const Vehicle *v, StationID station) const;
+
+ /**
+ * Assign the given order to this one.
+ * @param other the data to copy (except next pointer).
+ */
+ void AssignOrder(const Order &other);
+
+ /**
+ * Does this order have the same type, flags and destination?
+ * @param other the second order to compare to.
+ * @return true if the type, flags and destination match.
+ */
+ bool Equals(const Order &other) const;
+
+ /**
+ * Pack this order into a 32 bits integer, or actually only
+ * the type, flags and destination.
+ * @return the packed representation.
+ * @note unpacking is done in the constructor.
+ */
+ uint32 Pack() const;
};
static inline VehicleOrderID GetMaxOrderIndex()
@@ -57,62 +221,13 @@
return GetOrderPoolSize();
}
-inline void Order::Free()
-{
- this->type = OT_NOTHING;
- this->flags = 0;
- this->dest = 0;
- this->next = NULL;
-}
-
-inline void Order::FreeChain()
-{
- if (next != NULL) next->FreeChain();
- delete this;
-}
-
#define FOR_ALL_ORDERS_FROM(order, start) for (order = GetOrder(start); order != NULL; order = (order->index + 1U < GetOrderPoolSize()) ? GetOrder(order->index + 1U) : NULL) if (order->IsValid())
#define FOR_ALL_ORDERS(order) FOR_ALL_ORDERS_FROM(order, 0)
#define FOR_VEHICLE_ORDERS(v, order) for (order = v->orders; order != NULL; order = order->next)
-static inline bool HasOrderPoolFree(uint amount)
-{
- const Order *order;
-
- /* There is always room if not all blocks in the pool are reserved */
- if (_Order_pool.CanAllocateMoreBlocks()) return true;
-
- FOR_ALL_ORDERS(order) if (!order->IsValid() && --amount == 0) return true;
-
- return false;
-}
-
-
-/* Pack and unpack routines */
-
-static inline uint32 PackOrder(const Order *order)
-{
- return order->dest << 16 | order->flags << 8 | order->type;
-}
-
-static inline Order UnpackOrder(uint32 packed)
-{
- Order order;
- order.type = (OrderType)GB(packed, 0, 8);
- order.flags = GB(packed, 8, 8);
- order.dest = GB(packed, 16, 16);
- order.next = NULL;
- order.index = 0; // avoid compiler warning
- order.refit_cargo = CT_NO_REFIT;
- order.refit_subtype = 0;
- order.wait_time = 0;
- order.travel_time = 0;
- return order;
-}
-
-void AssignOrder(Order *order, Order data);
+/* (Un)pack routines */
Order UnpackOldOrder(uint16 packed);
#endif /* ORDER_H */
--- a/src/order_cmd.cpp Sun Apr 06 14:12:19 2008 +0000
+++ b/src/order_cmd.cpp Sun Apr 06 23:07:42 2008 +0000
@@ -23,6 +23,8 @@
#include "settings_type.h"
#include "string_func.h"
#include "newgrf_cargo.h"
+#include "timetable.h"
+#include "vehicle_func.h"
#include "table/strings.h"
@@ -38,33 +40,102 @@
DEFINE_OLD_POOL_GENERIC(Order, Order)
-/**
- *
- * Unpacks a order from savegames made with TTD(Patch)
- *
- */
-Order UnpackOldOrder(uint16 packed)
+void Order::Free()
{
- Order order;
- order.type = (OrderType)GB(packed, 0, 4);
- order.flags = GB(packed, 4, 4);
- order.dest = GB(packed, 8, 8);
- order.next = NULL;
+ this->type = OT_NOTHING;
+ this->flags = 0;
+ this->dest = 0;
+ this->next = NULL;
+}
- order.refit_cargo = CT_NO_REFIT;
- order.refit_subtype = 0;
- order.wait_time = 0;
- order.travel_time = 0;
- order.index = 0; // avoid compiler warning
+void Order::MakeGoToStation(StationID destination)
+{
+ this->type = OT_GOTO_STATION;
+ this->flags = 0;
+ this->dest = destination;
+}
- // Sanity check
- // TTD stores invalid orders as OT_NOTHING with non-zero flags/station
- if (!order.IsValid() && (order.flags != 0 || order.dest != 0)) {
- order.type = OT_DUMMY;
- order.flags = 0;
- }
+void Order::MakeGoToDepot(DepotID destination, bool order, CargoID cargo, byte subtype)
+{
+ this->type = OT_GOTO_DEPOT;
+ this->flags = order ? OFB_PART_OF_ORDERS : OFB_NON_STOP;
+ this->dest = destination;
+ this->SetRefit(cargo, subtype);
+}
- return order;
+void Order::MakeGoToWaypoint(WaypointID destination)
+{
+ this->type = OT_GOTO_WAYPOINT;
+ this->flags = 0;
+ this->dest = destination;
+}
+
+void Order::MakeLoading(bool ordered)
+{
+ this->type = OT_LOADING;
+ if (!ordered) this->flags = 0;
+}
+
+void Order::MakeLeaveStation()
+{
+ this->type = OT_LEAVESTATION;
+ this->flags = 0;
+}
+
+void Order::MakeDummy()
+{
+ this->type = OT_DUMMY;
+ this->flags = 0;
+}
+
+void Order::SetRefit(CargoID cargo, byte subtype)
+{
+ this->refit_cargo = cargo;
+ this->refit_subtype = subtype;
+}
+
+void Order::FreeChain()
+{
+ if (next != NULL) next->FreeChain();
+ delete this;
+}
+
+bool Order::Equals(const Order &other) const
+{
+ return
+ this->type == other.type &&
+ this->flags == other.flags &&
+ this->dest == other.dest;
+}
+
+static bool HasOrderPoolFree(uint amount)
+{
+ const Order *order;
+
+ /* There is always room if not all blocks in the pool are reserved */
+ if (_Order_pool.CanAllocateMoreBlocks()) return true;
+
+ FOR_ALL_ORDERS(order) if (!order->IsValid() && --amount == 0) return true;
+
+ return false;
+}
+
+uint32 Order::Pack() const
+{
+ return this->dest << 16 | this->flags << 8 | this->type;
+}
+
+Order::Order(uint32 packed)
+{
+ this->type = (OrderType)GB(packed, 0, 8);
+ this->flags = GB(packed, 8, 8);
+ this->dest = GB(packed, 16, 16);
+ this->next = NULL;
+ this->index = 0; // avoid compiler warning
+ this->refit_cargo = CT_NO_REFIT;
+ this->refit_subtype = 0;
+ this->wait_time = 0;
+ this->travel_time = 0;
}
/**
@@ -74,16 +145,26 @@
*/
static Order UnpackVersion4Order(uint16 packed)
{
- Order order;
- order.type = (OrderType)GB(packed, 0, 4);
- order.flags = GB(packed, 4, 4);
- order.dest = GB(packed, 8, 8);
- order.next = NULL;
- order.index = 0; // avoid compiler warning
- order.refit_cargo = CT_NO_REFIT;
- order.refit_subtype = 0;
- order.wait_time = 0;
- order.travel_time = 0;
+ return Order(GB(packed, 8, 8) << 16 | GB(packed, 4, 4) << 8 | GB(packed, 0, 4));
+}
+
+/**
+ *
+ * Unpacks a order from savegames made with TTD(Patch)
+ *
+ */
+Order UnpackOldOrder(uint16 packed)
+{
+ Order order = UnpackVersion4Order(packed);
+
+ /*
+ * Sanity check
+ * TTD stores invalid orders as OT_NOTHING with non-zero flags/station
+ */
+ if (!order.IsValid() && (order.GetLoadType() != 0 || order.GetUnloadType() != 0 || order.GetDestination() != 0)) {
+ order.MakeDummy();
+ }
+
return order;
}
@@ -109,9 +190,9 @@
Order temp_order;
temp_order = *order1;
- AssignOrder(order1, *order2);
+ order1->AssignOrder(*order2);
order1->next = order2->next;
- AssignOrder(order2, temp_order);
+ order2->AssignOrder(temp_order);
order2->next = temp_order.next;
}
@@ -121,17 +202,17 @@
* This function makes sure that the index is maintained correctly
*
*/
-void AssignOrder(Order *order, Order data)
+void Order::AssignOrder(const Order &other)
{
- order->type = data.type;
- order->flags = data.flags;
- order->dest = data.dest;
+ this->type = other.type;
+ this->flags = other.flags;
+ this->dest = other.dest;
- order->refit_cargo = data.refit_cargo;
- order->refit_subtype = data.refit_subtype;
+ this->refit_cargo = other.refit_cargo;
+ this->refit_subtype = other.refit_subtype;
- order->wait_time = data.wait_time;
- order->travel_time = data.travel_time;
+ this->wait_time = other.wait_time;
+ this->travel_time = other.travel_time;
}
@@ -152,10 +233,10 @@
static TileIndex GetOrderLocation(const Order& o)
{
- switch (o.type) {
+ switch (o.GetType()) {
default: NOT_REACHED();
- case OT_GOTO_STATION: return GetStation(o.dest)->xy;
- case OT_GOTO_DEPOT: return GetDepot(o.dest)->xy;
+ case OT_GOTO_STATION: return GetStation(o.GetDestination())->xy;
+ case OT_GOTO_DEPOT: return GetDepot(o.GetDestination())->xy;
}
}
@@ -175,7 +256,7 @@
Vehicle *v;
VehicleID veh = GB(p1, 0, 16);
VehicleOrderID sel_ord = GB(p1, 16, 16);
- Order new_order = UnpackOrder(p2);
+ Order new_order(p2);
if (!IsValidVehicleID(veh)) return CMD_ERROR;
@@ -185,12 +266,11 @@
/* Check if the inserted order is to the correct destination (owner, type),
* and has the correct flags if any */
- switch (new_order.type) {
+ switch (new_order.GetType()) {
case OT_GOTO_STATION: {
- const Station *st;
+ if (!IsValidStationID(new_order.GetDestination())) return CMD_ERROR;
- if (!IsValidStationID(new_order.dest)) return CMD_ERROR;
- st = GetStation(new_order.dest);
+ const Station *st = GetStation(new_order.GetDestination());
if (st->owner != OWNER_NONE && !CheckOwnership(st->owner)) {
return CMD_ERROR;
@@ -222,10 +302,12 @@
default: return CMD_ERROR;
}
+ if (new_order.GetNonStopType() != OFB_NO_NON_STOP && v->type != VEH_TRAIN) return CMD_ERROR;
+
/* Order flags can be any of the following for stations:
* [full-load | unload] [+ transfer] [+ non-stop]
* non-stop orders (if any) are only valid for trains */
- switch (new_order.flags) {
+ switch (new_order.GetLoadType() | new_order.GetUnloadType()) {
case 0:
case OFB_FULL_LOAD:
case OFB_FULL_LOAD | OFB_TRANSFER:
@@ -234,15 +316,6 @@
case OFB_TRANSFER:
break;
- case OFB_NON_STOP:
- case OFB_NON_STOP | OFB_FULL_LOAD:
- case OFB_NON_STOP | OFB_FULL_LOAD | OFB_TRANSFER:
- case OFB_NON_STOP | OFB_UNLOAD:
- case OFB_NON_STOP | OFB_UNLOAD | OFB_TRANSFER:
- case OFB_NON_STOP | OFB_TRANSFER:
- if (v->type != VEH_TRAIN) return CMD_ERROR;
- break;
-
default: return CMD_ERROR;
}
break;
@@ -250,10 +323,9 @@
case OT_GOTO_DEPOT: {
if (v->type == VEH_AIRCRAFT) {
- const Station* st;
+ if (!IsValidStationID(new_order.GetDestination())) return CMD_ERROR;
- if (!IsValidStationID(new_order.dest)) return CMD_ERROR;
- st = GetStation(new_order.dest);
+ const Station *st = GetStation(new_order.GetDestination());
if (!CheckOwnership(st->owner) ||
!(st->facilities & FACIL_AIRPORT) ||
@@ -262,10 +334,9 @@
return CMD_ERROR;
}
} else {
- const Depot* dp;
+ if (!IsValidDepotID(new_order.GetDestination())) return CMD_ERROR;
- if (!IsValidDepotID(new_order.dest)) return CMD_ERROR;
- dp = GetDepot(new_order.dest);
+ const Depot *dp = GetDepot(new_order.GetDestination());
if (!CheckOwnership(GetTileOwner(dp->xy))) return CMD_ERROR;
@@ -286,39 +357,35 @@
}
}
+ if (new_order.GetNonStopType() != OFB_NO_NON_STOP && v->type != VEH_TRAIN) return CMD_ERROR;
+
/* Order flags can be any of the following for depots:
* order [+ halt] [+ non-stop]
* non-stop orders (if any) are only valid for trains */
- switch (new_order.flags) {
+ switch (new_order.GetDepotOrderType() | new_order.GetDepotActionType()) {
case OFB_PART_OF_ORDERS:
case OFB_PART_OF_ORDERS | OFB_HALT_IN_DEPOT:
break;
- case OFB_NON_STOP | OFB_PART_OF_ORDERS:
- case OFB_NON_STOP | OFB_PART_OF_ORDERS | OFB_HALT_IN_DEPOT:
- if (v->type != VEH_TRAIN) return CMD_ERROR;
- break;
-
default: return CMD_ERROR;
}
break;
}
case OT_GOTO_WAYPOINT: {
- const Waypoint* wp;
if (v->type != VEH_TRAIN) return CMD_ERROR;
- if (!IsValidWaypointID(new_order.dest)) return CMD_ERROR;
- wp = GetWaypoint(new_order.dest);
+ if (!IsValidWaypointID(new_order.GetDestination())) return CMD_ERROR;
+ const Waypoint *wp = GetWaypoint(new_order.GetDestination());
if (!CheckOwnership(GetTileOwner(wp->xy))) return CMD_ERROR;
/* Order flags can be any of the following for waypoints:
* [non-stop]
* non-stop orders (if any) are only valid for trains */
- switch (new_order.flags) {
- case 0: break;
+ switch (new_order.GetNonStopType()) {
+ case OFB_NO_NON_STOP: break;
case OFB_NON_STOP:
if (v->type != VEH_TRAIN) return CMD_ERROR;
@@ -345,7 +412,7 @@
* If the order is to be inserted at the beginning of the order list this
* finds the last order in the list. */
for (const Order *o = v->orders; o != NULL; o = o->next) {
- if (o->type == OT_GOTO_STATION || o->type == OT_GOTO_DEPOT) prev = o;
+ if (o->IsType(OT_GOTO_STATION) || o->IsType(OT_GOTO_DEPOT)) prev = o;
if (++n == sel_ord && prev != NULL) break;
}
if (prev != NULL) {
@@ -362,7 +429,7 @@
if (flags & DC_EXEC) {
Vehicle *u;
Order *new_o = new Order();
- AssignOrder(new_o, new_order);
+ new_o->AssignOrder(new_order);
/* Create new order and link in list */
if (v->orders == NULL) {
@@ -519,9 +586,8 @@
/* NON-stop flag is misused to see if a train is in a station that is
* on his order list or not */
- if (sel_ord == u->cur_order_index && u->current_order.type == OT_LOADING &&
- HasBit(u->current_order.flags, OF_NON_STOP)) {
- u->current_order.flags = 0;
+ if (sel_ord == u->cur_order_index && u->current_order.IsType(OT_LOADING)) {
+ u->current_order.SetNonStopType(OFB_NO_NON_STOP);
}
/* Update any possible open window of the vehicle */
@@ -558,12 +624,7 @@
if (v->type == VEH_ROAD) ClearSlot(v);
- if (v->current_order.type == OT_LOADING) {
- v->LeaveStation();
- /* NON-stop flag is misused to see if a train is in a station that is
- * on his order list or not */
- if (HasBit(v->current_order.flags, OF_NON_STOP)) v->current_order.flags = 0;
- }
+ if (v->current_order.IsType(OT_LOADING)) v->LeaveStation();
InvalidateVehicleOrder(v);
}
@@ -689,29 +750,33 @@
if (sel_ord >= v->num_orders) return CMD_ERROR;
order = GetVehicleOrder(v, sel_ord);
- if ((order->type != OT_GOTO_STATION || GetStation(order->dest)->IsBuoy()) &&
- (order->type != OT_GOTO_DEPOT || p2 == OF_UNLOAD) &&
- (order->type != OT_GOTO_WAYPOINT || p2 != OF_NON_STOP)) {
+ if ((!order->IsType(OT_GOTO_STATION) || GetStation(order->GetDestination())->IsBuoy()) &&
+ (!order->IsType(OT_GOTO_DEPOT) || p2 == OF_UNLOAD) &&
+ (!order->IsType(OT_GOTO_WAYPOINT) || p2 != OF_NON_STOP)) {
return CMD_ERROR;
}
if (flags & DC_EXEC) {
switch (p2) {
- case OF_FULL_LOAD:
- ToggleBit(order->flags, OF_FULL_LOAD);
- if (order->type != OT_GOTO_DEPOT) ClrBit(order->flags, OF_UNLOAD);
- break;
- case OF_UNLOAD:
- ToggleBit(order->flags, OF_UNLOAD);
- ClrBit(order->flags, OF_FULL_LOAD);
- break;
- case OF_NON_STOP:
- ToggleBit(order->flags, OF_NON_STOP);
- break;
- case OF_TRANSFER:
- ToggleBit(order->flags, OF_TRANSFER);
- break;
- default: NOT_REACHED();
+ case OF_FULL_LOAD:
+ if (order->IsType(OT_GOTO_DEPOT)) {
+ order->SetDepotOrderType(order->GetDepotOrderType() ^ OFB_SERVICE_IF_NEEDED);
+ } else {
+ order->SetLoadType(order->GetUnloadType() ^ OFB_FULL_LOAD);
+ order->SetUnloadType(order->GetUnloadType() & ~OFB_UNLOAD);
+ }
+ break;
+ case OF_UNLOAD:
+ order->SetUnloadType(order->GetUnloadType() ^ OFB_UNLOAD);
+ order->SetLoadType(0);
+ break;
+ case OF_NON_STOP:
+ order->SetNonStopType(order->GetNonStopType() ^ OFB_NON_STOP);
+ break;
+ case OF_TRANSFER:
+ order->SetUnloadType(order->GetUnloadType() ^ OFB_TRANSFER);
+ break;
+ default: NOT_REACHED();
}
/* Update the windows and full load flags, also for vehicles that share the same order list */
@@ -731,9 +796,9 @@
* when this function is called.
*/
if (sel_ord == u->cur_order_index &&
- u->current_order.type != OT_GOTO_DEPOT &&
- HasBit(u->current_order.flags, OF_FULL_LOAD) != HasBit(order->flags, OF_FULL_LOAD)) {
- ToggleBit(u->current_order.flags, OF_FULL_LOAD);
+ !u->current_order.IsType(OT_GOTO_DEPOT) &&
+ u->current_order.GetLoadType() != order->GetLoadType()) {
+ u->current_order.SetLoadType(order->GetLoadType());
}
InvalidateVehicleOrder(u);
}
@@ -828,8 +893,8 @@
TileIndex required_dst = INVALID_TILE;
FOR_VEHICLE_ORDERS(src, order) {
- if (order->type == OT_GOTO_STATION) {
- const Station *st = GetStation(order->dest);
+ if (order->IsType(OT_GOTO_STATION)) {
+ const Station *st = GetStation(order->GetDestination());
if (IsCargoInClass(dst->cargo_type, CC_PASSENGERS)) {
if (st->bus_stops != NULL) required_dst = st->bus_stops->xy;
} else {
@@ -857,7 +922,7 @@
order_dst = &dst->orders;
FOR_VEHICLE_ORDERS(src, order) {
*order_dst = new Order();
- AssignOrder(*order_dst, *order);
+ (*order_dst)->AssignOrder(*order);
order_dst = &(*order_dst)->next;
}
@@ -906,8 +971,7 @@
if (flags & DC_EXEC) {
Vehicle *u;
- order->refit_cargo = cargo;
- order->refit_subtype = subtype;
+ order->SetRefit(cargo, subtype);
u = GetFirstVehicleFromSharedList(v);
for (; u != NULL; u = u->next_shared) {
@@ -915,9 +979,8 @@
InvalidateVehicleOrder(u);
/* If the vehicle already got the current depot set as current order, then update current order as well */
- if (u->cur_order_index == order_number && HasBit(u->current_order.flags, OF_PART_OF_ORDERS)) {
- u->current_order.refit_cargo = cargo;
- u->current_order.refit_subtype = subtype;
+ if (u->cur_order_index == order_number && HasBit(u->current_order.GetDepotOrderType(), OF_PART_OF_ORDERS)) {
+ u->current_order.SetRefit(cargo, subtype);
}
}
}
@@ -1000,7 +1063,7 @@
* in network the commands are queued before send, the second insert always
* fails in test mode. By bypassing the test-mode, that no longer is a problem. */
for (uint i = 0; bak->order[i].IsValid(); i++) {
- if (!DoCommandP(0, v->index + (i << 16), PackOrder(&bak->order[i]), NULL,
+ if (!DoCommandP(0, v->index + (i << 16), bak->order[i].Pack(), NULL,
CMD_INSERT_ORDER | CMD_NO_TEST_IF_IN_NETWORK)) {
break;
}
@@ -1106,13 +1169,13 @@
FOR_VEHICLE_ORDERS(v, order) {
/* Dummy order? */
- if (order->type == OT_DUMMY) {
+ if (order->IsType(OT_DUMMY)) {
problem_type = 1;
break;
}
/* Does station have a load-bay for this vehicle? */
- if (order->type == OT_GOTO_STATION) {
- const Station* st = GetStation(order->dest);
+ if (order->IsType(OT_GOTO_STATION)) {
+ const Station* st = GetStation(order->GetDestination());
TileIndex required_tile = GetStationTileForVehicle(v, st);
n_st++;
@@ -1124,9 +1187,7 @@
if (v->num_orders > 1) {
const Order* last = GetLastVehicleOrder(v);
- if (v->orders->type == last->type &&
- v->orders->flags == last->flags &&
- v->orders->dest == last->dest) {
+ if (v->orders->Equals(*last)) {
problem_type = 2;
}
}
@@ -1174,20 +1235,18 @@
}
order = &v->current_order;
- if ((v->type == VEH_AIRCRAFT && order->type == OT_GOTO_DEPOT ? OT_GOTO_STATION : order->type) == type &&
- v->current_order.dest == destination) {
- order->type = OT_DUMMY;
- order->flags = 0;
+ if ((v->type == VEH_AIRCRAFT && order->IsType(OT_GOTO_DEPOT) ? OT_GOTO_STATION : order->GetType()) == type &&
+ v->current_order.GetDestination() == destination) {
+ order->MakeDummy();
InvalidateWindow(WC_VEHICLE_VIEW, v->index);
}
/* Clear the order from the order-list */
invalidate = false;
FOR_VEHICLE_ORDERS(v, order) {
- if ((v->type == VEH_AIRCRAFT && order->type == OT_GOTO_DEPOT ? OT_GOTO_STATION : order->type) == type &&
- order->dest == destination) {
- order->type = OT_DUMMY;
- order->flags = 0;
+ if ((v->type == VEH_AIRCRAFT && order->IsType(OT_GOTO_DEPOT) ? OT_GOTO_STATION : order->GetType()) == type &&
+ order->GetDestination() == destination) {
+ order->MakeDummy();
invalidate = true;
}
}
@@ -1209,7 +1268,7 @@
const Order *order;
FOR_VEHICLE_ORDERS(v, order) {
- if (order->type == OT_GOTO_DEPOT)
+ if (order->IsType(OT_GOTO_DEPOT))
return true;
}
@@ -1275,7 +1334,6 @@
return (_patches.servint_ispercent) ? Clamp(index, MIN_SERVINT_PERCENT, MAX_SERVINT_PERCENT) : Clamp(index, MIN_SERVINT_DAYS, MAX_SERVINT_DAYS);
}
-
/**
*
* Check if a vehicle has any valid orders
@@ -1283,15 +1341,152 @@
* @return false if there are no valid orders
*
*/
-bool CheckForValidOrders(const Vehicle* v)
+static bool CheckForValidOrders(const Vehicle *v)
{
const Order *order;
- FOR_VEHICLE_ORDERS(v, order) if (order->type != OT_DUMMY) return true;
+ FOR_VEHICLE_ORDERS(v, order) if (!order->IsType(OT_DUMMY)) return true;
return false;
}
+/**
+ * Handle the orders of a vehicle and determine the next place
+ * to go to if needed.
+ * @param v the vehicle to do this for.
+ * @return true *if* the vehicle is eligible for reversing
+ * (basically only when leaving a station).
+ */
+bool ProcessOrders(Vehicle *v)
+{
+ switch (v->current_order.GetType()) {
+ case OT_GOTO_DEPOT:
+ /* Let a depot order in the orderlist interrupt. */
+ if (!(v->current_order.GetDepotOrderType() & OFB_PART_OF_ORDERS)) return false;
+
+ if ((v->current_order.GetDepotOrderType() & OFB_SERVICE_IF_NEEDED) && !VehicleNeedsService(v)) {
+ UpdateVehicleTimetable(v, true);
+ v->cur_order_index++;
+ }
+ break;
+
+ case OT_LOADING:
+ return false;
+
+ case OT_LEAVESTATION:
+ if (v->type != VEH_AIRCRAFT) return false;
+ break;
+
+ default: break;
+ }
+
+ /**
+ * Reversing because of order change is allowed only just after leaving a
+ * station (and the difficulty setting to allowed, of course)
+ * this can be detected because only after OT_LEAVESTATION, current_order
+ * will be reset to nothing. (That also happens if no order, but in that case
+ * it won't hit the point in code where may_reverse is checked)
+ */
+ bool may_reverse = v->current_order.IsType(OT_NOTHING);
+
+ /* Check if we've reached the waypoint? */
+ if (v->current_order.IsType(OT_GOTO_WAYPOINT) && v->tile == v->dest_tile) {
+ UpdateVehicleTimetable(v, true);
+ v->cur_order_index++;
+ }
+
+ /* Check if we've reached a non-stop station while TTDPatch nonstop is enabled.. */
+ if (_patches.new_nonstop &&
+ v->current_order.GetNonStopType() & OFB_NON_STOP &&
+ IsTileType(v->tile, MP_STATION) &&
+ v->current_order.GetDestination() == GetStationIndex(v->tile)) {
+ v->last_station_visited = v->current_order.GetDestination();
+ UpdateVehicleTimetable(v, true);
+ v->cur_order_index++;
+ }
+
+ /* Get the current order */
+ if (v->cur_order_index >= v->num_orders) v->cur_order_index = 0;
+
+ const Order *order = GetVehicleOrder(v, v->cur_order_index);
+
+ /* If no order, do nothing. */
+ if (order == NULL || (v->type == VEH_AIRCRAFT && order->IsType(OT_DUMMY) && !CheckForValidOrders(v))) {
+ if (v->type == VEH_AIRCRAFT) {
+ /* Aircraft do something vastly different here, so handle separately */
+ extern void HandleMissingAircraftOrders(Vehicle *v);
+ HandleMissingAircraftOrders(v);
+ return false;
+ }
+
+ v->current_order.Free();
+ v->dest_tile = 0;
+ if (v->type == VEH_ROAD) ClearSlot(v);
+ return false;
+ }
+
+ /* If it is unchanged, keep it. */
+ if (order->Equals(v->current_order) &&
+ (v->type != VEH_SHIP || !order->IsType(OT_GOTO_STATION) || GetStation(order->GetDestination())->dock_tile != 0)) {
+ return false;
+ }
+
+ /* Otherwise set it, and determine the destination tile. */
+ v->current_order = *order;
+
+ InvalidateVehicleOrder(v);
+ switch (v->type) {
+ default:
+ NOT_REACHED();
+
+ case VEH_ROAD:
+ case VEH_TRAIN:
+ break;
+
+ case VEH_AIRCRAFT:
+ case VEH_SHIP:
+ InvalidateWindowClasses(v->GetVehicleListWindowClass());
+ break;
+ }
+
+ switch (order->GetType()) {
+ case OT_GOTO_STATION:
+ v->dest_tile = v->GetOrderStationLocation(order->GetDestination());
+ break;
+
+ case OT_GOTO_DEPOT:
+ if (v->type != VEH_AIRCRAFT) v->dest_tile = GetDepot(order->GetDestination())->xy;
+ break;
+
+ case OT_GOTO_WAYPOINT:
+ v->dest_tile = GetWaypoint(order->GetDestination())->xy;
+ break;
+
+ default:
+ v->dest_tile = 0;
+ return false;
+ }
+
+ return may_reverse;
+}
+
+/**
+ * Check whether the given vehicle should stop at the given station
+ * based on this order and the non-stop settings.
+ * @param v the vehicle that might be stopping.
+ * @param station the station to stop at.
+ * @return true if the vehicle should stop.
+ */
+bool Order::ShouldStopAtStation(const Vehicle *v, StationID station) const
+{
+ return
+ v->last_station_visited != station && // Do stop only when we've not just been there
+ type == OT_GOTO_STATION && // Do stop only when going to a station
+ /* Finally do stop when the non-stop flag is not set, or when we should stop at
+ * this station according to the new_nonstop setting. */
+ (!(this->flags & OFB_NON_STOP) || ((this->dest != station) == _patches.new_nonstop));
+}
+
void InitializeOrders()
{
_Order_pool.CleanPool();
@@ -1300,6 +1495,7 @@
_backup_orders_tile = 0;
}
+const SaveLoad *GetOrderDescription() {
static const SaveLoad _order_desc[] = {
SLE_VAR(Order, type, SLE_UINT8),
SLE_VAR(Order, flags, SLE_UINT8),
@@ -1315,6 +1511,8 @@
SLE_CONDNULL(10, 5, 35),
SLE_END()
};
+ return _order_desc;
+}
static void Save_ORDR()
{
@@ -1322,7 +1520,7 @@
FOR_ALL_ORDERS(order) {
SlSetArrayIndex(order->index);
- SlObject(order, _order_desc);
+ SlObject(order, GetOrderDescription());
}
}
@@ -1344,7 +1542,7 @@
for (i = 0; i < len; ++i) {
Order *order = new (i) Order();
- AssignOrder(order, UnpackVersion4Order(orders[i]));
+ order->AssignOrder(UnpackVersion4Order(orders[i]));
}
free(orders);
@@ -1355,8 +1553,7 @@
SlArray(orders, len, SLE_UINT32);
for (i = 0; i < len; ++i) {
- Order *order = new (i) Order();
- AssignOrder(order, UnpackOrder(orders[i]));
+ new (i) Order(orders[i]);
}
free(orders);
@@ -1375,7 +1572,7 @@
while ((index = SlIterateArray()) != -1) {
Order *order = new (index) Order();
- SlObject(order, _order_desc);
+ SlObject(order, GetOrderDescription());
}
}
}
--- a/src/order_func.h Sun Apr 06 14:12:19 2008 +0000
+++ b/src/order_func.h Sun Apr 06 23:07:42 2008 +0000
@@ -35,7 +35,7 @@
bool VehicleHasDepotOrders(const Vehicle *v);
void CheckOrders(const Vehicle*);
void DeleteVehicleOrders(Vehicle *v);
-bool CheckForValidOrders(const Vehicle* v);
+bool ProcessOrders(Vehicle *v);
#define MIN_SERVINT_PERCENT 5
#define MAX_SERVINT_PERCENT 90
--- a/src/order_gui.cpp Sun Apr 06 14:12:19 2008 +0000
+++ b/src/order_gui.cpp Sun Apr 06 23:07:42 2008 +0000
@@ -91,22 +91,22 @@
return (sel <= v->num_orders && sel >= 0) ? sel : INVALID_ORDER;
}
-static StringID StationOrderStrings[] = {
- STR_8806_GO_TO,
- STR_GO_TO_TRANSFER,
- STR_8807_GO_TO_UNLOAD,
- STR_GO_TO_TRANSFER_UNLOAD,
- STR_8808_GO_TO_LOAD,
- STR_GO_TO_TRANSFER_LOAD,
- STR_NULL,
- STR_NULL,
- STR_880A_GO_NON_STOP_TO,
- STR_GO_TO_NON_STOP_TRANSFER,
- STR_880B_GO_NON_STOP_TO_UNLOAD,
- STR_GO_TO_NON_STOP_TRANSFER_UNLOAD,
- STR_880C_GO_NON_STOP_TO_LOAD,
- STR_GO_TO_NON_STOP_TRANSFER_LOAD,
- STR_NULL
+static StringID _station_order_strings[][7] = {
+ {
+ STR_8806_GO_TO,
+ STR_GO_TO_TRANSFER,
+ STR_8807_GO_TO_UNLOAD,
+ STR_GO_TO_TRANSFER_UNLOAD,
+ STR_8808_GO_TO_LOAD,
+ STR_GO_TO_TRANSFER_LOAD
+ }, {
+ STR_880A_GO_NON_STOP_TO,
+ STR_GO_TO_NON_STOP_TRANSFER,
+ STR_880B_GO_NON_STOP_TO_UNLOAD,
+ STR_GO_TO_NON_STOP_TRANSFER_UNLOAD,
+ STR_880C_GO_NON_STOP_TO_LOAD,
+ STR_GO_TO_NON_STOP_TRANSFER_LOAD
+ }
};
static void DrawOrdersWindow(Window *w)
@@ -153,9 +153,9 @@
w->ShowWidget(ORDER_WIDGET_UNLOAD); // Unload
if (order != NULL) {
- switch (order->type) {
+ switch (order->GetType()) {
case OT_GOTO_STATION:
- if (!GetStation(order->dest)->IsBuoy()) break;
+ if (!GetStation(order->GetDestination())->IsBuoy()) break;
/* Fall-through */
case OT_GOTO_WAYPOINT:
@@ -194,15 +194,15 @@
if (i - w->vscroll.pos < w->vscroll.cap) {
SetDParam(1, 6);
- switch (order->type) {
+ switch (order->GetType()) {
case OT_DUMMY:
SetDParam(1, STR_INVALID_ORDER);
- SetDParam(2, order->dest);
+ SetDParam(2, order->GetDestination());
break;
case OT_GOTO_STATION:
- SetDParam(1, StationOrderStrings[order->flags]);
- SetDParam(2, order->dest);
+ SetDParam(1, _station_order_strings[!!order->GetNonStopType()][order->GetLoadType() | order->GetUnloadType()]);
+ SetDParam(2, order->GetDestination());
break;
case OT_GOTO_DEPOT: {
@@ -210,24 +210,24 @@
if (v->type == VEH_AIRCRAFT) {
s = STR_GO_TO_AIRPORT_HANGAR;
- SetDParam(2, order->dest);
+ SetDParam(2, order->GetDestination());
} else {
- SetDParam(2, GetDepot(order->dest)->town_index);
+ SetDParam(2, GetDepot(order->GetDestination())->town_index);
switch (v->type) {
- case VEH_TRAIN: s = (order->flags & OFB_NON_STOP) ? STR_880F_GO_NON_STOP_TO_TRAIN_DEPOT : STR_GO_TO_TRAIN_DEPOT; break;
+ case VEH_TRAIN: s = (order->GetNonStopType() & OFB_NON_STOP) ? STR_880F_GO_NON_STOP_TO_TRAIN_DEPOT : STR_GO_TO_TRAIN_DEPOT; break;
case VEH_ROAD: s = STR_GO_TO_ROADVEH_DEPOT; break;
case VEH_SHIP: s = STR_GO_TO_SHIP_DEPOT; break;
default: break;
}
}
- if (order->flags & OFB_FULL_LOAD) s++; /* service at */
+ if (order->GetDepotOrderType() & OFB_SERVICE_IF_NEEDED) s++; /* service at */
SetDParam(1, s);
- if (order->refit_cargo < NUM_CARGO) {
+ if (order->IsRefit()) {
SetDParam(3, STR_REFIT_ORDER);
- SetDParam(4, GetCargo(order->refit_cargo)->name);
+ SetDParam(4, GetCargo(order->GetRefitCargo())->name);
} else {
SetDParam(3, STR_EMPTY);
}
@@ -235,8 +235,8 @@
}
case OT_GOTO_WAYPOINT:
- SetDParam(1, (order->flags & OFB_NON_STOP) ? STR_GO_NON_STOP_TO_WAYPOINT : STR_GO_TO_WAYPOINT);
- SetDParam(2, order->dest);
+ SetDParam(1, (order->GetNonStopType() & OFB_NON_STOP) ? STR_GO_NON_STOP_TO_WAYPOINT : STR_GO_TO_WAYPOINT);
+ SetDParam(2, order->GetDestination());
break;
default: break;
@@ -263,8 +263,6 @@
Order order;
order.next = NULL;
order.index = 0;
- order.refit_cargo = CT_INVALID;
- order.refit_subtype = 0;
// check depot first
if (_patches.gotodepot) {
@@ -272,9 +270,7 @@
case MP_RAILWAY:
if (v->type == VEH_TRAIN && IsTileOwner(tile, _local_player)) {
if (IsRailDepot(tile)) {
- order.type = OT_GOTO_DEPOT;
- order.flags = OFB_PART_OF_ORDERS;
- order.dest = GetDepotByTile(tile)->index;
+ order.MakeGoToDepot(GetDepotByTile(tile)->index, true);
return order;
}
}
@@ -282,9 +278,7 @@
case MP_ROAD:
if (IsRoadDepot(tile) && v->type == VEH_ROAD && IsTileOwner(tile, _local_player)) {
- order.type = OT_GOTO_DEPOT;
- order.flags = OFB_PART_OF_ORDERS;
- order.dest = GetDepotByTile(tile)->index;
+ order.MakeGoToDepot(GetDepotByTile(tile)->index, true);
return order;
}
break;
@@ -292,9 +286,7 @@
case MP_STATION:
if (v->type != VEH_AIRCRAFT) break;
if (IsHangar(tile) && IsTileOwner(tile, _local_player)) {
- order.type = OT_GOTO_DEPOT;
- order.flags = OFB_PART_OF_ORDERS;
- order.dest = GetStationIndex(tile);
+ order.MakeGoToDepot(GetStationIndex(tile), true);
return order;
}
break;
@@ -305,9 +297,7 @@
IsTileOwner(tile, _local_player)) {
TileIndex tile2 = GetOtherShipDepotTile(tile);
- order.type = OT_GOTO_DEPOT;
- order.flags = OFB_PART_OF_ORDERS;
- order.dest = GetDepotByTile(tile < tile2 ? tile : tile2)->index;
+ order.MakeGoToDepot(GetDepotByTile(tile < tile2 ? tile : tile2)->index, true);
return order;
}
@@ -321,9 +311,7 @@
v->type == VEH_TRAIN &&
IsTileOwner(tile, _local_player) &&
IsRailWaypoint(tile)) {
- order.type = OT_GOTO_WAYPOINT;
- order.flags = 0;
- order.dest = GetWaypointByTile(tile)->index;
+ order.MakeGoToWaypoint(GetWaypointByTile(tile)->index);
return order;
}
@@ -339,9 +327,7 @@
(facil=FACIL_BUS_STOP, v->type == VEH_ROAD && IsCargoInClass(v->cargo_type, CC_PASSENGERS)) ||
(facil=FACIL_TRUCK_STOP, 1);
if (st->facilities & facil) {
- order.type = OT_GOTO_STATION;
- order.flags = 0;
- order.dest = st_index;
+ order.MakeGoToStation(st_index);
return order;
}
}
@@ -349,7 +335,6 @@
// not found
order.Free();
- order.dest = INVALID_STATION;
return order;
}
@@ -387,7 +372,7 @@
cmd = GetOrderCmdFromTile(v, tile);
if (!cmd.IsValid()) return;
- if (DoCommandP(v->tile, v->index + (OrderGetSel(w) << 16), PackOrder(&cmd), NULL, CMD_INSERT_ORDER | CMD_MSG(STR_8833_CAN_T_INSERT_NEW_ORDER))) {
+ if (DoCommandP(v->tile, v->index + (OrderGetSel(w) << 16), cmd.Pack(), NULL, CMD_INSERT_ORDER | CMD_MSG(STR_8833_CAN_T_INSERT_NEW_ORDER))) {
if (WP(w, order_d).sel != -1) WP(w,order_d).sel++;
ResetObjectToPlace();
}
@@ -576,10 +561,10 @@
const Order *ord = GetVehicleOrder(v, sel);
TileIndex xy;
- switch (ord->type) {
- case OT_GOTO_STATION: xy = GetStation(ord->dest)->xy ; break;
- case OT_GOTO_DEPOT: xy = (v->type == VEH_AIRCRAFT) ? GetStation(ord->dest)->xy : GetDepot(ord->dest)->xy; break;
- case OT_GOTO_WAYPOINT: xy = GetWaypoint(ord->dest)->xy; break;
+ switch (ord->GetType()) {
+ case OT_GOTO_STATION: xy = GetStation(ord->GetDestination())->xy ; break;
+ case OT_GOTO_DEPOT: xy = (v->type == VEH_AIRCRAFT) ? GetStation(ord->GetDestination())->xy : GetDepot(ord->GetDestination())->xy; break;
+ case OT_GOTO_WAYPOINT: xy = GetWaypoint(ord->GetDestination())->xy; break;
default: xy = 0; break;
}
@@ -691,7 +676,7 @@
int s = OrderGetSel(w);
if (e->we.click.widget != ORDER_WIDGET_FULL_LOAD) break;
- if (s == v->num_orders || GetVehicleOrder(v, s)->type != OT_GOTO_DEPOT) {
+ if (s == v->num_orders || !GetVehicleOrder(v, s)->IsType(OT_GOTO_DEPOT)) {
GuiShowTooltips(STR_8857_MAKE_THE_HIGHLIGHTED_ORDER);
} else {
GuiShowTooltips(STR_SERVICE_HINT);
--- a/src/order_type.h Sun Apr 06 14:12:19 2008 +0000
+++ b/src/order_type.h Sun Apr 06 23:07:42 2008 +0000
@@ -52,8 +52,10 @@
//Flags for depots:
/** The current depot-order was initiated because it was in the vehicle's order list */
+ OFB_MANUAL_ORDER = 0x0,
OFB_PART_OF_ORDERS = 0x2,
/** if OFB_PART_OF_ORDERS is not set, this will cause the vehicle to be stopped in the depot */
+ OFB_NORMAL_ACTION = 0x0,
OFB_HALT_IN_DEPOT = 0x4,
/** if OFB_PART_OF_ORDERS is set, this will cause the order only be come active if the vehicle needs servicing */
OFB_SERVICE_IF_NEEDED = 0x4, //used when OFB_PART_OF_ORDERS is set.
@@ -61,6 +63,7 @@
//Common flags
/** This causes the vehicle not to stop at intermediate OR the destination station (depending on patch settings)
* @todo make this two different flags */
+ OFB_NO_NON_STOP = 0x0,
OFB_NON_STOP = 0x8
};
--- a/src/pathfind.cpp Sun Apr 06 14:12:19 2008 +0000
+++ b/src/pathfind.cpp Sun Apr 06 23:07:42 2008 +0000
@@ -17,6 +17,7 @@
#include "depot.h"
#include "tunnelbridge_map.h"
#include "core/random_func.hpp"
+#include "core/alloc_func.hpp"
#include "tunnelbridge.h"
/* remember which tiles we have already visited so we don't visit them again. */
@@ -111,34 +112,7 @@
return true;
}
-static const byte _bits_mask[4] = {
- 0x19,
- 0x16,
- 0x25,
- 0x2A,
-};
-
-static const DiagDirection _tpf_new_direction[14] = {
- DIAGDIR_NE, DIAGDIR_SE, DIAGDIR_NE, DIAGDIR_SE, DIAGDIR_SW, DIAGDIR_SE,
- INVALID_DIAGDIR, INVALID_DIAGDIR,
- DIAGDIR_SW, DIAGDIR_NW, DIAGDIR_NW, DIAGDIR_SW, DIAGDIR_NW, DIAGDIR_NE,
-};
-
-static const DiagDirection _tpf_prev_direction[14] = {
- DIAGDIR_NE, DIAGDIR_SE, DIAGDIR_SE, DIAGDIR_NE, DIAGDIR_SE, DIAGDIR_SW,
- INVALID_DIAGDIR, INVALID_DIAGDIR,
- DIAGDIR_SW, DIAGDIR_NW, DIAGDIR_SW, DIAGDIR_NW, DIAGDIR_NE, DIAGDIR_NW,
-};
-
-
-static const byte _otherdir_mask[4] = {
- 0x10,
- 0,
- 0x5,
- 0x2A,
-};
-
-static void TPFMode2(TrackPathFinder* tpf, TileIndex tile, DiagDirection direction)
+static void TPFModeShip(TrackPathFinder* tpf, TileIndex tile, DiagDirection direction)
{
RememberData rd;
@@ -152,8 +126,7 @@
if (++tpf->rd.cur_length > 50)
return;
- TrackStatus ts = GetTileTrackStatus(tile, tpf->tracktype, tpf->sub_type);
- TrackBits bits = (TrackBits)(TrackStatusToTrackBits(ts) & _bits_mask[direction]);
+ TrackBits bits = TrackStatusToTrackBits(GetTileTrackStatus(tile, tpf->tracktype, tpf->sub_type)) & DiagdirReachesTracks(direction);
if (bits == TRACK_BIT_NONE) return;
assert(TileX(tile) != MapMaxX() && TileY(tile) != MapMaxY());
@@ -173,10 +146,10 @@
tpf->rd.last_choosen_track = track;
}
- tpf->the_dir = (Trackdir)(track + (HasBit(_otherdir_mask[direction], track) ? 8 : 0));
+ tpf->the_dir = TrackEnterdirToTrackdir(track, direction);
if (!tpf->enum_proc(tile, tpf->userdata, tpf->the_dir, tpf->rd.cur_length)) {
- TPFMode2(tpf, tile, _tpf_new_direction[tpf->the_dir]);
+ TPFModeShip(tpf, tile, TrackdirToExitdir(tpf->the_dir));
}
tpf->rd = rd;
@@ -208,9 +181,7 @@
return true;
}
-static const uint16 _tpfmode1_and[4] = { 0x1009, 0x16, 0x520, 0x2A00 };
-
-static void TPFMode1(TrackPathFinder* tpf, TileIndex tile, DiagDirection direction)
+static void TPFModeNormal(TrackPathFinder* tpf, TileIndex tile, DiagDirection direction)
{
const TileIndex tile_org = tile;
@@ -252,78 +223,70 @@
}
}
- uint32 bits = TrackStatusToTrackdirBits(GetTileTrackStatus(tile, tpf->tracktype, tpf->sub_type));
+ TrackdirBits trackdirbits = TrackStatusToTrackdirBits(GetTileTrackStatus(tile, tpf->tracktype, tpf->sub_type));
/* Check in case of rail if the owner is the same */
if (tpf->tracktype == TRANSPORT_RAIL) {
- if (bits != 0 && TrackStatusToTrackdirBits(GetTileTrackStatus(tile_org, TRANSPORT_RAIL, 0)) != TRACKDIR_BIT_NONE) {
+ if (trackdirbits != TRACKDIR_BIT_NONE && TrackStatusToTrackdirBits(GetTileTrackStatus(tile_org, TRANSPORT_RAIL, 0)) != TRACKDIR_BIT_NONE) {
if (GetTileOwner(tile_org) != GetTileOwner(tile)) return;
}
}
tpf->rd.cur_length++;
- if ((byte)bits != tpf->var2) {
- bits &= _tpfmode1_and[direction];
- bits |= bits >> 8;
- }
- bits &= 0xBF;
+ trackdirbits &= DiagdirReachesTrackdirs(direction);
+ TrackBits bits = TrackdirBitsToTrackBits(trackdirbits);
- if (bits != 0) {
+ if (bits != TRACK_BIT_NONE) {
if (!tpf->disable_tile_hash || (tpf->rd.cur_length <= 64 && (KillFirstBit(bits) == 0 || ++tpf->rd.depth <= 7))) {
do {
- int i = FIND_FIRST_BIT(bits);
- bits = KillFirstBit(bits);
+ Track track = RemoveFirstTrack(&bits);
- tpf->the_dir = (Trackdir)((_otherdir_mask[direction] & (byte)(1 << i)) ? (i + 8) : i);
+ tpf->the_dir = TrackEnterdirToTrackdir(track, direction);
RememberData rd = tpf->rd;
/* make sure we are not leaving from invalid side */
if (TPFSetTileBit(tpf, tile, tpf->the_dir) && CanAccessTileInDir(tile, TrackdirToExitdir(tpf->the_dir), tpf->tracktype) &&
!tpf->enum_proc(tile, tpf->userdata, tpf->the_dir, tpf->rd.cur_length) ) {
- TPFMode1(tpf, tile, _tpf_new_direction[tpf->the_dir]);
+ TPFModeNormal(tpf, tile, TrackdirToExitdir(tpf->the_dir));
}
tpf->rd = rd;
- } while (bits != 0);
+ } while (bits != TRACK_BIT_NONE);
}
}
}
-void FollowTrack(TileIndex tile, uint16 flags, uint sub_type, DiagDirection direction, TPFEnumProc *enum_proc, TPFAfterProc *after_proc, void *data)
+void FollowTrack(TileIndex tile, PathfindFlags flags, TransportType tt, uint sub_type, DiagDirection direction, TPFEnumProc *enum_proc, TPFAfterProc *after_proc, void *data)
{
- TrackPathFinder tpf;
+ assert(IsValidDiagDirection(direction));
- assert(direction < 4);
+ SmallStackSafeStackAlloc<TrackPathFinder, 1> tpf;
/* initialize path finder variables */
- tpf.userdata = data;
- tpf.enum_proc = enum_proc;
- tpf.new_link = tpf.links;
- tpf.num_links_left = lengthof(tpf.links);
-
- tpf.rd.cur_length = 0;
- tpf.rd.depth = 0;
- tpf.rd.last_choosen_track = INVALID_TRACK;
+ tpf->userdata = data;
+ tpf->enum_proc = enum_proc;
+ tpf->new_link = tpf->links;
+ tpf->num_links_left = lengthof(tpf->links);
- tpf.var2 = HasBit(flags, 15) ? 0x43 : 0xFF; // 0x8000
-
- tpf.disable_tile_hash = HasBit(flags, 12); // 0x1000
-
+ tpf->rd.cur_length = 0;
+ tpf->rd.depth = 0;
+ tpf->rd.last_choosen_track = INVALID_TRACK;
- tpf.tracktype = (TransportType)(flags & 0xFF);
- tpf.sub_type = sub_type;
+ tpf->disable_tile_hash = (flags & PATHFIND_FLAGS_DISABLE_TILE_HASH) != 0;
- if (HasBit(flags, 11)) {
- tpf.enum_proc(tile, data, INVALID_TRACKDIR, 0);
- TPFMode2(&tpf, tile, direction);
+ tpf->tracktype = tt;
+ tpf->sub_type = sub_type;
+
+ if ((flags & PATHFIND_FLAGS_SHIP_MODE) != 0) {
+ tpf->enum_proc(tile, data, INVALID_TRACKDIR, 0);
+ TPFModeShip(tpf, tile, direction);
} else {
/* clear the hash_heads */
- memset(tpf.hash_head, 0, sizeof(tpf.hash_head));
- TPFMode1(&tpf, tile, direction);
+ memset(tpf->hash_head, 0, sizeof(tpf->hash_head));
+ TPFModeNormal(tpf, tile, direction);
}
- if (after_proc != NULL)
- after_proc(&tpf);
+ if (after_proc != NULL) after_proc(tpf);
}
struct StackedItem {
@@ -336,15 +299,6 @@
byte first_track;
};
-static const Trackdir _new_trackdir[6][4] = {
-{TRACKDIR_X_NE, INVALID_TRACKDIR, TRACKDIR_X_SW, INVALID_TRACKDIR,},
-{INVALID_TRACKDIR, TRACKDIR_Y_SE, INVALID_TRACKDIR, TRACKDIR_Y_NW,},
-{INVALID_TRACKDIR, TRACKDIR_UPPER_E, TRACKDIR_UPPER_W, INVALID_TRACKDIR,},
-{TRACKDIR_LOWER_E, INVALID_TRACKDIR, INVALID_TRACKDIR, TRACKDIR_LOWER_W,},
-{TRACKDIR_LEFT_N, TRACKDIR_LEFT_S, INVALID_TRACKDIR, INVALID_TRACKDIR,},
-{INVALID_TRACKDIR, INVALID_TRACKDIR, TRACKDIR_RIGHT_S, TRACKDIR_RIGHT_N,},
-};
-
struct HashLink {
TileIndex tile;
uint16 typelength;
@@ -595,7 +549,7 @@
HeapifyDown(tpf);
/* Make sure we havn't already visited this tile. */
- } while (!NtpCheck(tpf, tile, _tpf_prev_direction[si.track], si.cur_length));
+ } while (!NtpCheck(tpf, tile, ReverseDiagDir(TrackdirToExitdir(ReverseTrackdir(si.track))), si.cur_length));
/* Add the length of this track. */
si.cur_length += _length_of_track[si.track];
@@ -605,7 +559,7 @@
return;
assert(si.track <= 13);
- direction = _tpf_new_direction[si.track];
+ direction = TrackdirToExitdir(si.track);
start_at:
/* If the tile is the entry tile of a tunnel, and we're not going out of the tunnel,
@@ -649,8 +603,7 @@
if (!IsTileType(tile, MP_RAILWAY) || !IsPlainRailTile(tile)) {
/* We found a tile which is not a normal railway tile.
* Determine which tracks that exist on this tile. */
- TrackStatus ts = GetTileTrackStatus(tile, TRANSPORT_RAIL, 0) & _tpfmode1_and[direction];
- bits = TrackStatusToTrackBits(ts);
+ bits = TrackdirBitsToTrackBits(TrackStatusToTrackdirBits(GetTileTrackStatus(tile, TRANSPORT_RAIL, 0)) & DiagdirReachesTrackdirs(direction));
/* Check that the tile contains exactly one track */
if (bits == 0 || KillFirstBit(bits) != 0) break;
@@ -666,7 +619,7 @@
* bits - bitmask of which track that exist on the tile (exactly one bit is set)
* direction - which direction are we moving in?
*******************/
- si.track = _new_trackdir[FIND_FIRST_BIT(bits)][direction];
+ si.track = TrackEnterdirToTrackdir(FindFirstTrack(bits), direction);
si.cur_length += _length_of_track[si.track];
goto callback_and_continue;
}
@@ -689,7 +642,7 @@
/* If we reach here, the tile has exactly one track, and this
track is reachable = > Rail segment continues */
- track = _new_trackdir[FIND_FIRST_BIT(bits)][direction];
+ track = TrackEnterdirToTrackdir(FindFirstTrack(bits), direction);
assert(track != INVALID_TRACKDIR);
si.cur_length += _length_of_track[track];
@@ -738,7 +691,7 @@
}
/* continue with the next track */
- direction = _tpf_new_direction[track];
+ direction = TrackdirToExitdir(track);
/* safety check if we're running around chasing our tail... (infinite loop) */
if (tile == tile_org) {
@@ -779,7 +732,7 @@
si.tile = tile;
while (bits != TRACK_BIT_NONE) {
Track track = RemoveFirstTrack(&bits);
- si.track = _new_trackdir[track][direction];
+ si.track = TrackEnterdirToTrackdir(track, direction);
assert(si.track != 0xFF);
si.priority = si.cur_length + estimation;
@@ -820,18 +773,18 @@
/** new pathfinder for trains. better and faster. */
void NewTrainPathfind(TileIndex tile, TileIndex dest, RailTypes railtypes, DiagDirection direction, NTPEnumProc* enum_proc, void* data)
{
- NewTrackPathFinder tpf;
+ SmallStackSafeStackAlloc<NewTrackPathFinder, 1> tpf;
- tpf.dest = dest;
- tpf.userdata = data;
- tpf.enum_proc = enum_proc;
- tpf.tracktype = TRANSPORT_RAIL;
- tpf.railtypes = railtypes;
- tpf.maxlength = min(_patches.pf_maxlength * 3, 10000);
- tpf.nstack = 0;
- tpf.new_link = tpf.links;
- tpf.num_links_left = lengthof(tpf.links);
- memset(tpf.hash_head, 0, sizeof(tpf.hash_head));
+ tpf->dest = dest;
+ tpf->userdata = data;
+ tpf->enum_proc = enum_proc;
+ tpf->tracktype = TRANSPORT_RAIL;
+ tpf->railtypes = railtypes;
+ tpf->maxlength = min(_patches.pf_maxlength * 3, 10000);
+ tpf->nstack = 0;
+ tpf->new_link = tpf->links;
+ tpf->num_links_left = lengthof(tpf->links);
+ memset(tpf->hash_head, 0, sizeof(tpf->hash_head));
- NTPEnum(&tpf, tile, direction);
+ NTPEnum(tpf, tile, direction);
}
--- a/src/pathfind.h Sun Apr 06 14:12:19 2008 +0000
+++ b/src/pathfind.h Sun Apr 06 23:07:42 2008 +0000
@@ -58,7 +58,6 @@
TransportType tracktype;
uint sub_type;
- byte var2;
bool disable_tile_hash;
uint16 hash_head[0x400];
@@ -67,7 +66,15 @@
TrackPathFinderLink links[0x400]; ///< hopefully, this is enough.
};
-void FollowTrack(TileIndex tile, uint16 flags, uint sub_type, DiagDirection direction, TPFEnumProc* enum_proc, TPFAfterProc* after_proc, void* data);
+/** Some flags to modify the behaviour of original pathfinder */
+enum PathfindFlags {
+ PATHFIND_FLAGS_NONE = 0,
+ PATHFIND_FLAGS_SHIP_MODE = 0x0800, ///< pathfinder with some optimizations for ships, but does not work for other types.
+ PATHFIND_FLAGS_DISABLE_TILE_HASH = 0x1000, ///< do not check for searching in circles
+};
+DECLARE_ENUM_AS_BIT_SET(PathfindFlags)
+
+void FollowTrack(TileIndex tile, PathfindFlags flags, TransportType tt, uint sub_type, DiagDirection direction, TPFEnumProc* enum_proc, TPFAfterProc* after_proc, void* data);
void NewTrainPathfind(TileIndex tile, TileIndex dest, RailTypes railtypes, DiagDirection direction, NTPEnumProc* enum_proc, void* data);
#endif /* PATHFIND_H */
--- a/src/rail_cmd.cpp Sun Apr 06 14:12:19 2008 +0000
+++ b/src/rail_cmd.cpp Sun Apr 06 23:07:42 2008 +0000
@@ -1771,7 +1771,12 @@
if (ti->tileh != SLOPE_FLAT) DrawFoundation(ti, FOUNDATION_LEVELED);
if (IsRailDepot(ti->tile)) {
- dts = &_depot_gfx_table[GetRailDepotDirection(ti->tile)];
+ if (IsInvisibilitySet(TO_BUILDINGS)) {
+ /* Draw rail instead of depot */
+ dts = &_depot_invisible_gfx_table[GetRailDepotDirection(ti->tile)];
+ } else {
+ dts = &_depot_gfx_table[GetRailDepotDirection(ti->tile)];
+ }
relocation = rti->total_offset;
@@ -1835,6 +1840,9 @@
if (HasCatenary(GetRailType(ti->tile))) DrawCatenary(ti);
+ /* End now if buildings are invisible */
+ if (IsInvisibilitySet(TO_BUILDINGS)) return;
+
foreach_draw_tile_seq(dtss, dts->seq) {
SpriteID image = dtss->image.sprite;
SpriteID pal;
--- a/src/rail_gui.cpp Sun Apr 06 14:12:19 2008 +0000
+++ b/src/rail_gui.cpp Sun Apr 06 23:07:42 2008 +0000
@@ -45,9 +45,9 @@
static DiagDirection _build_depot_direction;
static byte _waypoint_count = 1;
static byte _cur_waypoint_type;
-static bool _convert_signal_button; // convert signal button in the signal GUI pressed
-static SignalVariant _cur_signal_variant; // set the signal variant (for signal GUI)
-static SignalType _cur_signal_type; // set the signal type (for signal GUI)
+static bool _convert_signal_button; ///< convert signal button in the signal GUI pressed
+static SignalVariant _cur_signal_variant; ///< set the signal variant (for signal GUI)
+static SignalType _cur_signal_type; ///< set the signal type (for signal GUI)
static struct {
byte orientation;
@@ -205,17 +205,26 @@
DoCommandP(tile, track, 0, CcPlaySound1E,
CMD_REMOVE_SIGNALS | CMD_MSG(STR_1013_CAN_T_REMOVE_SIGNALS_FROM));
} else {
- if (!_patches.enable_signal_gui) _cur_signal_variant = _cur_year < _patches.semaphore_build_before ? SIG_SEMAPHORE : SIG_ELECTRIC;
+ const Window *w = FindWindowById(WC_BUILD_SIGNAL, 0);
/* various bitstuffed elements for CmdBuildSingleSignal() */
uint32 p1 = track;
- SB(p1, 3, 1, _ctrl_pressed);
- SB(p1, 4, 1, _cur_signal_variant);
- SB(p1, 5, 2, _patches.enable_signal_gui ? _cur_signal_type : SIGTYPE_NORMAL);
- SB(p1, 7, 1, _convert_signal_button);
+
+ if (w != NULL) {
+ /* signal GUI is used */
+ SB(p1, 3, 1, _ctrl_pressed);
+ SB(p1, 4, 1, _cur_signal_variant);
+ SB(p1, 5, 2, _cur_signal_type);
+ SB(p1, 7, 1, _convert_signal_button);
+ } else {
+ SB(p1, 3, 1, _ctrl_pressed);
+ SB(p1, 4, 1, (_cur_year < _patches.semaphore_build_before ? SIG_SEMAPHORE : SIG_ELECTRIC));
+ SB(p1, 5, 2, SIGTYPE_NORMAL);
+ SB(p1, 7, 1, 0);
+ }
DoCommandP(tile, p1, 0, CcPlaySound1E, CMD_BUILD_SIGNALS |
- CMD_MSG(_convert_signal_button ? STR_SIGNAL_CAN_T_CONVERT_SIGNALS_HERE : STR_1010_CAN_T_BUILD_SIGNALS_HERE));
+ CMD_MSG((w != NULL && _convert_signal_button) ? STR_SIGNAL_CAN_T_CONVERT_SIGNALS_HERE : STR_1010_CAN_T_BUILD_SIGNALS_HERE));
}
}
@@ -364,7 +373,7 @@
/** The "build signal"-button proc from BuildRailToolbWndProc() (start ShowSignalBuilder() and/or HandleAutoSignalPlacement()) */
static void BuildRailClick_AutoSignals(Window *w)
{
- if (_patches.enable_signal_gui) {
+ if (_patches.enable_signal_gui != _ctrl_pressed) {
if (HandlePlacePushButton(w, RTW_BUILD_SIGNALS, ANIMCURSOR_BUILDSIGNALS, VHM_RECT, PlaceRail_AutoSignals)) ShowSignalBuilder();
} else {
HandlePlacePushButton(w, RTW_BUILD_SIGNALS, ANIMCURSOR_BUILDSIGNALS, VHM_RECT, PlaceRail_AutoSignals);
@@ -454,11 +463,20 @@
return;
}
- /* XXX Steal ctrl for autosignal function, until we get some GUI */
- SB(p2, 3, 1, 0);
- SB(p2, 4, 1, _cur_year < _patches.semaphore_build_before);
- SB(p2, 6, 1, _ctrl_pressed);
- SB(p2, 24, 8, _patches.drag_signals_density);
+ const Window *w = FindWindowById(WC_BUILD_SIGNAL, 0);
+
+ if (w != NULL) {
+ /* signal GUI is used */
+ SB(p2, 3, 1, 0);
+ SB(p2, 4, 1, _cur_signal_variant);
+ SB(p2, 6, 1, _ctrl_pressed);
+ SB(p2, 24, 8, _patches.drag_signals_density);
+ } else {
+ SB(p2, 3, 1, 0);
+ SB(p2, 4, 1, (_cur_year < _patches.semaphore_build_before ? SIG_SEMAPHORE : SIG_ELECTRIC));
+ SB(p2, 6, 1, _ctrl_pressed);
+ SB(p2, 24, 8, _patches.drag_signals_density);
+ }
/* _patches.drag_signals_density is given as a parameter such that each user
* in a network game can specify his/her own signal density */
@@ -583,7 +601,7 @@
case WE_PLACE_DRAG: {
/* no dragging if you have pressed the convert button */
- if (_convert_signal_button && w->IsWidgetLowered(RTW_BUILD_SIGNALS)) return;
+ if (FindWindowById(WC_BUILD_SIGNAL, 0) != NULL && _convert_signal_button && w->IsWidgetLowered(RTW_BUILD_SIGNALS)) return;
VpSelectTilesWithMethod(e->we.place.pt.x, e->we.place.pt.y, e->we.place.select_method);
return;
@@ -918,8 +936,9 @@
DrawStringCentered(74, 101 + y_offset, STR_3004_PLATFORM_LENGTH, TC_FROMSTRING);
DrawStringCentered(74, 141 + y_offset, STR_3066_COVERAGE_AREA_HIGHLIGHT, TC_FROMSTRING);
- int text_end = DrawStationCoverageAreaText(2, 166 + y_offset, SCT_ALL, rad) + 4;
- if (text_end > w->widget[BRSW_BACKGROUND].bottom) {
+ int text_end = DrawStationCoverageAreaText(2, 166 + y_offset, SCT_ALL, rad, false);
+ text_end = DrawStationCoverageAreaText(2, text_end + 4, SCT_ALL, rad, true) + 4;
+ if (text_end != w->widget[BRSW_BACKGROUND].bottom) {
SetWindowDirty(w);
ResizeWindowForWidget(w, BRSW_BACKGROUND, 0, text_end - w->widget[BRSW_BACKGROUND].bottom);
SetWindowDirty(w);
@@ -1310,11 +1329,19 @@
break;
case BSW_DRAG_SIGNALS_DENSITY_DECREASE:
- if (_patches.drag_signals_density > 1) _patches.drag_signals_density--;
+ if (_patches.drag_signals_density > 1) {
+ _patches.drag_signals_density--;
+ const Window *w = FindWindowById(WC_GAME_OPTIONS, 0);
+ if (w != NULL) SetWindowDirty(w);
+ }
break;
case BSW_DRAG_SIGNALS_DENSITY_INCREASE:
- if (_patches.drag_signals_density < 20) _patches.drag_signals_density++;
+ if (_patches.drag_signals_density < 20) {
+ _patches.drag_signals_density++;
+ const Window *w = FindWindowById(WC_GAME_OPTIONS, 0);
+ if (w != NULL) SetWindowDirty(w);
+ }
break;
default: break;
@@ -1367,14 +1394,9 @@
/**
* Open the signal selection window
- * @pre reset all signal GUI relevant variables
*/
static void ShowSignalBuilder()
{
- _convert_signal_button = false;
- _cur_signal_variant = _cur_year < _patches.semaphore_build_before ? SIG_SEMAPHORE : SIG_ELECTRIC;
- _cur_signal_type = SIGTYPE_NORMAL;
-
AllocateWindowDesc(&_signal_builder_desc);
}
@@ -1583,7 +1605,7 @@
MarkWholeScreenDirty();
}
-void SetDefaultRailGui()
+static void SetDefaultRailGui()
{
if (_local_player == PLAYER_SPECTATOR || !IsValidPlayer(_local_player)) return;
@@ -1632,5 +1654,36 @@
}
}
+/**
+ * Updates the current signal variant used in the signal GUI
+ * to the one adequate to current year.
+ * @param 0 needed to be called when a patch setting changes
+ * @return success, needed for patch settings
+ */
+int32 ResetSignalVariant(int32 = 0)
+{
+ SignalVariant new_variant = (_cur_year < _patches.semaphore_build_before ? SIG_SEMAPHORE : SIG_ELECTRIC);
+ if (new_variant != _cur_signal_variant) {
+ Window *w = FindWindowById(WC_BUILD_SIGNAL, 0);
+ if (w != NULL) {
+ SetWindowDirty(w);
+ w->RaiseWidget((_cur_signal_variant == SIG_ELECTRIC ? BSW_ELECTRIC_NORM : BSW_SEMAPHORE_NORM) + _cur_signal_type);
+ }
+ _cur_signal_variant = new_variant;
+ }
+ return 0;
+}
+
+/** Resets the rail GUI - sets default railtype to build
+ * and resets the signal GUI
+ */
+void InitializeRailGUI()
+{
+ SetDefaultRailGui();
+
+ _convert_signal_button = false;
+ _cur_signal_type = SIGTYPE_NORMAL;
+ ResetSignalVariant();
+}
--- a/src/rail_gui.h Sun Apr 06 14:12:19 2008 +0000
+++ b/src/rail_gui.h Sun Apr 06 23:07:42 2008 +0000
@@ -9,5 +9,6 @@
void ShowBuildRailToolbar(RailType railtype, int button);
void ReinitGuiAfterToggleElrail(bool disable);
+int32 ResetSignalVariant(int32 = 0);
#endif /* RAIL_GUI_H */
--- a/src/road_cmd.cpp Sun Apr 06 14:12:19 2008 +0000
+++ b/src/road_cmd.cpp Sun Apr 06 23:07:42 2008 +0000
@@ -342,7 +342,7 @@
* @param other The other existent RoadBits
* @return The costs for these RoadBits on this slope
*/
-static CommandCost CheckRoadSlope(Slope tileh, RoadBits* pieces, RoadBits existing, RoadBits other)
+static CommandCost CheckRoadSlope(Slope tileh, RoadBits *pieces, RoadBits existing, RoadBits other)
{
/* Remove already build pieces */
CLRBITS(*pieces, existing);
@@ -418,7 +418,7 @@
CommandCost CmdBuildRoad(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
{
CommandCost cost(EXPENSES_CONSTRUCTION);
- CommandCost ret;
+
RoadBits existing = ROAD_NONE;
RoadBits other_bits = ROAD_NONE;
@@ -484,8 +484,6 @@
break;
case MP_RAILWAY: {
- Axis roaddir;
-
if (IsSteepSlope(tileh)) {
return_cmd_error(STR_1000_LAND_SLOPED_IN_WRONG_DIRECTION);
}
@@ -496,6 +494,8 @@
}
if (GetRailTileType(tile) != RAIL_TILE_NORMAL) goto do_clear;
+
+ Axis roaddir;
switch (GetTrackBits(tile)) {
case TRACK_BIT_X:
if (pieces & ROAD_X) goto do_clear;
@@ -534,16 +534,17 @@
if (GetVehicleTunnelBridge(tile, GetOtherTunnelBridgeEnd(tile)) != NULL) return CMD_ERROR;
break;
- default:
+ default: {
do_clear:;
- ret = DoCommand(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
+ CommandCost ret = DoCommand(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
if (CmdFailed(ret)) return ret;
cost.AddCost(ret);
+ } break;
}
if (other_bits != pieces) {
/* Check the foundation/slopes when adding road/tram bits */
- ret = CheckRoadSlope(tileh, &pieces, existing, other_bits);
+ CommandCost ret = CheckRoadSlope(tileh, &pieces, existing, other_bits);
/* Return an error if we need to build a foundation (ret != 0) but the
* current patch-setting is turned off (or stupid AI@work) */
if (CmdFailed(ret) || (ret.GetCost() != 0 && !_patches.build_on_slopes)) {
@@ -643,8 +644,7 @@
*/
CommandCost CmdBuildLongRoad(TileIndex end_tile, uint32 flags, uint32 p1, uint32 p2)
{
- TileIndex start_tile, tile;
- CommandCost ret, cost(EXPENSES_CONSTRUCTION);
+ CommandCost cost(EXPENSES_CONSTRUCTION);
bool had_bridge = false;
bool had_tunnel = false;
bool had_success = false;
@@ -654,7 +654,7 @@
if (p1 >= MapSize()) return CMD_ERROR;
- start_tile = p1;
+ TileIndex start_tile = p1;
RoadType rt = (RoadType)GB(p2, 3, 2);
if (!IsValidRoadType(rt) || !ValParamRoadType(rt)) return CMD_ERROR;
@@ -678,7 +678,7 @@
/* No disallowed direction bits have to be toggled */
if (!HasBit(p2, 5)) drd = DRD_NONE;
- tile = start_tile;
+ TileIndex tile = start_tile;
/* Start tile is the small number. */
for (;;) {
RoadBits bits = HasBit(p2, 2) ? ROAD_Y : ROAD_X;
@@ -686,7 +686,7 @@
if (tile == end_tile && !HasBit(p2, 1)) bits &= ROAD_NW | ROAD_NE;
if (tile == start_tile && HasBit(p2, 0)) bits &= ROAD_SE | ROAD_SW;
- ret = DoCommand(tile, drd << 6 | rt << 4 | bits, 0, flags, CMD_BUILD_ROAD);
+ CommandCost ret = DoCommand(tile, drd << 6 | rt << 4 | bits, 0, flags, CMD_BUILD_ROAD);
if (CmdFailed(ret)) {
if (_error_message != STR_1007_ALREADY_BUILT) return CMD_ERROR;
} else {
@@ -729,13 +729,11 @@
*/
CommandCost CmdRemoveLongRoad(TileIndex end_tile, uint32 flags, uint32 p1, uint32 p2)
{
- TileIndex start_tile, tile;
- CommandCost ret, cost(EXPENSES_CONSTRUCTION);
- Money money;
+ CommandCost cost(EXPENSES_CONSTRUCTION);
if (p1 >= MapSize()) return CMD_ERROR;
- start_tile = p1;
+ TileIndex start_tile = p1;
RoadType rt = (RoadType)GB(p2, 3, 2);
if (!IsValidRoadType(rt)) return CMD_ERROR;
@@ -751,8 +749,8 @@
p2 ^= IsInsideMM(p2 & 3, 1, 3) ? 3 : 0;
}
- money = GetAvailableMoneyForCommand();
- tile = start_tile;
+ Money money = GetAvailableMoneyForCommand();
+ TileIndex tile = start_tile;
/* Start tile is the small number. */
for (;;) {
RoadBits bits = HasBit(p2, 2) ? ROAD_Y : ROAD_X;
@@ -762,7 +760,7 @@
/* try to remove the halves. */
if (bits != 0) {
- ret = RemoveRoad(tile, flags & ~DC_EXEC, bits, rt, true);
+ CommandCost ret = RemoveRoad(tile, flags & ~DC_EXEC, bits, rt, true);
if (CmdSucceeded(ret)) {
if (flags & DC_EXEC) {
money -= ret.GetCost();
@@ -796,15 +794,12 @@
*/
CommandCost CmdBuildRoadDepot(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
{
- CommandCost cost;
- Slope tileh;
-
DiagDirection dir = Extract<DiagDirection, 0>(p1);
RoadType rt = (RoadType)GB(p1, 2, 2);
if (!IsValidRoadType(rt) || !ValParamRoadType(rt)) return CMD_ERROR;
- tileh = GetTileSlope(tile, NULL);
+ Slope tileh = GetTileSlope(tile, NULL);
if (tileh != SLOPE_FLAT && (
!_patches.build_on_slopes ||
IsSteepSlope(tileh) ||
@@ -813,7 +808,7 @@
return_cmd_error(STR_0007_FLAT_LAND_REQUIRED);
}
- cost = DoCommand(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
+ CommandCost cost = DoCommand(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
if (CmdFailed(cost)) return CMD_ERROR;
if (MayHaveBridgeAbove(tile) && IsBridgeAbove(tile)) return_cmd_error(STR_5007_MUST_DEMOLISH_BRIDGE_FIRST);
@@ -834,8 +829,7 @@
static CommandCost RemoveRoadDepot(TileIndex tile, uint32 flags)
{
- if (!CheckTileOwnership(tile) && _current_player != OWNER_WATER)
- return CMD_ERROR;
+ if (!CheckTileOwnership(tile) && _current_player != OWNER_WATER) return CMD_ERROR;
if (!EnsureNoVehicleOnGround(tile)) return CMD_ERROR;
@@ -967,8 +961,11 @@
* @param ti information about the tile (slopes, height etc)
* @param tram the roadbits for the tram
*/
-void DrawTramCatenary(TileInfo *ti, RoadBits tram)
+void DrawTramCatenary(const TileInfo *ti, RoadBits tram)
{
+ /* Do not draw catenary if it is invisible */
+ if (IsInvisibilitySet(TO_CATENARY)) return;
+
/* Don't draw the catenary under a low bridge */
if (MayHaveBridgeAbove(ti->tile) && IsBridgeAbove(ti->tile) && !IsTransparencySet(TO_CATENARY)) {
uint height = GetBridgeHeight(GetNorthernBridgeEnd(ti->tile));
@@ -999,7 +996,7 @@
* @param dy the offset from the top of the BB of the tile
* @param h the height of the sprite to draw
*/
-static void DrawRoadDetail(SpriteID img, TileInfo *ti, int dx, int dy, int h)
+static void DrawRoadDetail(SpriteID img, const TileInfo *ti, int dx, int dy, int h)
{
int x = ti->x | dx;
int y = ti->y | dy;
@@ -1012,15 +1009,13 @@
* Draw ground sprite and road pieces
* @param ti TileInfo
*/
-static void DrawRoadBits(TileInfo* ti)
+static void DrawRoadBits(TileInfo *ti)
{
RoadBits road = GetRoadBits(ti->tile, ROADTYPE_ROAD);
RoadBits tram = GetRoadBits(ti->tile, ROADTYPE_TRAM);
- const DrawRoadTileStruct *drts;
SpriteID image = 0;
SpriteID pal = PAL_NONE;
- Roadside roadside;
if (ti->tileh != SLOPE_FLAT) {
DrawFoundation(ti, GetRoadFoundation(ti->tileh, road | tram));
@@ -1032,7 +1027,7 @@
if (image == 0) image = _road_tile_sprites_1[road != ROAD_NONE ? road : tram];
- roadside = GetRoadside(ti->tile);
+ Roadside roadside = GetRoadside(ti->tile);
if (AlwaysDrawUnpavedRoads(ti->tile, roadside)) {
image += 19;
@@ -1092,7 +1087,7 @@
if (CountBits(road) < 2) return;
/* Draw extra details. */
- for (drts = _road_display_table[roadside][road | tram]; drts->image != 0; drts++) {
+ for (const DrawRoadTileStruct *drts = _road_display_table[roadside][road | tram]; drts->image != 0; drts++) {
DrawRoadDetail(drts->image, ti, drts->subcoord_x, drts->subcoord_y, 0x10);
}
}
@@ -1105,17 +1100,16 @@
break;
case ROAD_TILE_CROSSING: {
- SpriteID image;
- SpriteID pal = PAL_NONE;
- Roadside roadside = GetRoadside(ti->tile);
-
if (ti->tileh != SLOPE_FLAT) DrawFoundation(ti, FOUNDATION_LEVELED);
- image = GetRailTypeInfo(GetRailType(ti->tile))->base_sprites.crossing;
+ SpriteID image = GetRailTypeInfo(GetRailType(ti->tile))->base_sprites.crossing;
+ SpriteID pal = PAL_NONE;
if (GetCrossingRoadAxis(ti->tile) == AXIS_X) image++;
if (IsCrossingBarred(ti->tile)) image += 2;
+ Roadside roadside = GetRoadside(ti->tile);
+
if (AlwaysDrawUnpavedRoads(ti->tile, roadside)) {
image += 8;
} else {
@@ -1137,14 +1131,11 @@
default:
case ROAD_TILE_DEPOT: {
- const DrawTileSprites* dts;
- const DrawTileSeqStruct* dtss;
- SpriteID palette;
-
if (ti->tileh != SLOPE_FLAT) DrawFoundation(ti, FOUNDATION_LEVELED);
- palette = PLAYER_SPRITE_COLOR(GetTileOwner(ti->tile));
+ SpriteID palette = PLAYER_SPRITE_COLOR(GetTileOwner(ti->tile));
+ const DrawTileSprites *dts;
if (HasTileRoadType(ti->tile, ROADTYPE_TRAM)) {
dts = &_tram_depot[GetRoadDepotDirection(ti->tile)];
} else {
@@ -1153,7 +1144,10 @@
DrawGroundSprite(dts->ground.sprite, PAL_NONE);
- for (dtss = dts->seq; dtss->image.sprite != 0; dtss++) {
+ /* End now if buildings are invisible */
+ if (IsInvisibilitySet(TO_BUILDINGS)) break;
+
+ for (const DrawTileSeqStruct *dtss = dts->seq; dtss->image.sprite != 0; dtss++) {
SpriteID image = dtss->image.sprite;
SpriteID pal;
@@ -1180,15 +1174,14 @@
void DrawRoadDepotSprite(int x, int y, DiagDirection dir, RoadType rt)
{
SpriteID palette = PLAYER_SPRITE_COLOR(_local_player);
- const DrawTileSprites* dts = (rt == ROADTYPE_TRAM) ? &_tram_depot[dir] : &_road_depot[dir];
- const DrawTileSeqStruct* dtss;
+ const DrawTileSprites *dts = (rt == ROADTYPE_TRAM) ? &_tram_depot[dir] : &_road_depot[dir];
x += 33;
y += 17;
DrawSprite(dts->ground.sprite, PAL_NONE, x, y);
- for (dtss = dts->seq; dtss->image.sprite != 0; dtss++) {
+ for (const DrawTileSeqStruct *dtss = dts->seq; dtss->image.sprite != 0; dtss++) {
Point pt = RemapCoords(dtss->delta_x, dtss->delta_y, dtss->delta_z);
SpriteID image = dtss->image.sprite;
@@ -1268,7 +1261,7 @@
if (IsRoadDepot(tile)) return;
- const Town* t = ClosestTownFromTile(tile, (uint)-1);
+ const Town *t = ClosestTownFromTile(tile, (uint)-1);
if (!HasRoadWorks(tile)) {
HouseZonesBits grp = HZB_TOWN_EDGE;
--- a/src/road_gui.cpp Sun Apr 06 14:12:19 2008 +0000
+++ b/src/road_gui.cpp Sun Apr 06 23:07:42 2008 +0000
@@ -175,7 +175,7 @@
static void BuildRoadOutsideStation(TileIndex tile, DiagDirection direction)
{
tile += TileOffsByDiagDir(direction);
- // if there is a roadpiece just outside of the station entrance, build a connecting route
+ /* if there is a roadpiece just outside of the station entrance, build a connecting route */
if (IsNormalRoadTile(tile)) {
if (GetRoadBits(tile, _cur_roadtype) != ROAD_NONE) {
DoCommandP(tile, _cur_roadtype << 4 | DiagDirToRoadBits(ReverseDiagDir(direction)), 0, NULL, CMD_BUILD_ROAD);
@@ -409,7 +409,7 @@
* @param w The toolbar window
* @param clicked_widget The widget which the player clicked just now
*/
-static void UpdateOptionWidgetStatus(Window *w, int clicked_widget)
+static void UpdateOptionWidgetStatus(Window *w, RoadToolbarWidgets clicked_widget)
{
/* The remove and the one way button state is driven
* by the other buttons so they don't act on themselfs.
@@ -419,15 +419,18 @@
w->RaiseWidget(RTW_ONE_WAY);
w->InvalidateWidget(RTW_ONE_WAY);
break;
+
case RTW_ONE_WAY:
w->RaiseWidget(RTW_REMOVE);
w->InvalidateWidget(RTW_REMOVE);
break;
+
case RTW_BUS_STATION:
case RTW_TRUCK_STATION:
w->DisableWidget(RTW_ONE_WAY);
w->SetWidgetDisabledState(RTW_REMOVE, !w->IsWidgetLowered(clicked_widget));
break;
+
case RTW_ROAD_X:
case RTW_ROAD_Y:
case RTW_AUTOROAD:
@@ -436,6 +439,7 @@
RTW_ONE_WAY,
WIDGET_LIST_END);
break;
+
default:
/* When any other buttons than road/station, raise and
* disable the removal button */
@@ -454,157 +458,163 @@
static void BuildRoadToolbWndProc(Window *w, WindowEvent *e)
{
switch (e->event) {
- case WE_CREATE:
- w->SetWidgetsDisabledState(true,
- RTW_REMOVE,
- RTW_ONE_WAY,
- WIDGET_LIST_END);
- break;
+ case WE_CREATE:
+ w->SetWidgetsDisabledState(true,
+ RTW_REMOVE,
+ RTW_ONE_WAY,
+ WIDGET_LIST_END);
+ break;
- case WE_PAINT:
- w->SetWidgetsDisabledState(!CanBuildVehicleInfrastructure(VEH_ROAD),
- RTW_DEPOT,
- RTW_BUS_STATION,
- RTW_TRUCK_STATION,
- WIDGET_LIST_END);
- DrawWindowWidgets(w);
- break;
+ case WE_PAINT:
+ w->SetWidgetsDisabledState(!CanBuildVehicleInfrastructure(VEH_ROAD),
+ RTW_DEPOT,
+ RTW_BUS_STATION,
+ RTW_TRUCK_STATION,
+ WIDGET_LIST_END);
+ DrawWindowWidgets(w);
+ break;
- case WE_CLICK:
- if (e->we.click.widget >= RTW_ROAD_X) {
- _remove_button_clicked = false;
- _one_way_button_clicked = false;
- _build_road_button_proc[e->we.click.widget - RTW_ROAD_X](w);
- }
- UpdateOptionWidgetStatus(w, e->we.click.widget);
- if (_ctrl_pressed) RoadToolbar_CtrlChanged(w);
- break;
-
- case WE_KEYPRESS:
- for (uint8 i = 0; i != lengthof(_road_keycodes); i++) {
- if (e->we.keypress.keycode == _road_keycodes[i]) {
- e->we.keypress.cont = false;
+ case WE_CLICK:
+ if (e->we.click.widget >= RTW_ROAD_X) {
_remove_button_clicked = false;
_one_way_button_clicked = false;
- _build_road_button_proc[i](w);
- UpdateOptionWidgetStatus(w, i + RTW_ROAD_X);
- if (_ctrl_pressed) RoadToolbar_CtrlChanged(w);
- break;
+ _build_road_button_proc[e->we.click.widget - RTW_ROAD_X](w);
}
- }
- MarkTileDirty(_thd.pos.x, _thd.pos.y); // redraw tile selection
- break;
-
- case WE_PLACE_OBJ:
- _remove_button_clicked = w->IsWidgetLowered(RTW_REMOVE);
- _one_way_button_clicked = w->IsWidgetLowered(RTW_ONE_WAY);
- _place_proc(e->we.place.tile);
- break;
-
- case WE_ABORT_PLACE_OBJ:
- w->RaiseButtons();
- w->SetWidgetsDisabledState(true,
- RTW_REMOVE,
- RTW_ONE_WAY,
- WIDGET_LIST_END);
- w->InvalidateWidget(RTW_REMOVE);
- w->InvalidateWidget(RTW_ONE_WAY);
-
- w = FindWindowById(WC_BUS_STATION, 0);
- if (w != NULL) WP(w, def_d).close = true;
- w = FindWindowById(WC_TRUCK_STATION, 0);
- if (w != NULL) WP(w, def_d).close = true;
- w = FindWindowById(WC_BUILD_DEPOT, 0);
- if (w != NULL) WP(w, def_d).close = true;
- break;
+ UpdateOptionWidgetStatus(w, (RoadToolbarWidgets)e->we.click.widget);
+ if (_ctrl_pressed) RoadToolbar_CtrlChanged(w);
+ break;
- case WE_PLACE_DRAG:
- /* Here we update the end tile flags
- * of the road placement actions.
- * At first we reset the end halfroad
- * bits and if needed we set them again. */
- switch (e->we.place.select_proc) {
- case DDSP_PLACE_ROAD_X_DIR:
- _place_road_flag &= ~RF_END_HALFROAD_X;
- if (e->we.place.pt.x & 8) _place_road_flag |= RF_END_HALFROAD_X;
- break;
-
- case DDSP_PLACE_ROAD_Y_DIR:
- _place_road_flag &= ~RF_END_HALFROAD_Y;
- if (e->we.place.pt.y & 8) _place_road_flag |= RF_END_HALFROAD_Y;
- break;
-
- case DDSP_PLACE_AUTOROAD:
- _place_road_flag &= ~(RF_END_HALFROAD_Y | RF_END_HALFROAD_X);
- if (e->we.place.pt.y & 8) _place_road_flag |= RF_END_HALFROAD_Y;
- if (e->we.place.pt.x & 8) _place_road_flag |= RF_END_HALFROAD_X;
+ case WE_KEYPRESS:
+ for (uint i = 0; i != lengthof(_road_keycodes); i++) {
+ if (e->we.keypress.keycode == _road_keycodes[i]) {
+ e->we.keypress.cont = false;
+ _remove_button_clicked = false;
+ _one_way_button_clicked = false;
+ _build_road_button_proc[i](w);
+ UpdateOptionWidgetStatus(w, (RoadToolbarWidgets)(i + RTW_ROAD_X));
+ if (_ctrl_pressed) RoadToolbar_CtrlChanged(w);
+ break;
+ }
+ }
+ MarkTileDirty(_thd.pos.x, _thd.pos.y); // redraw tile selection
+ break;
- /* For autoroad we need to update the
- * direction of the road */
- if (_thd.size.x > _thd.size.y || (_thd.size.x == _thd.size.y &&
- ( (_tile_fract_coords.x < _tile_fract_coords.y && (_tile_fract_coords.x + _tile_fract_coords.y) < 16) ||
- (_tile_fract_coords.x > _tile_fract_coords.y && (_tile_fract_coords.x + _tile_fract_coords.y) > 16) ))) {
- /* Set dir = X */
- _place_road_flag &= ~RF_DIR_Y;
- } else {
- /* Set dir = Y */
- _place_road_flag |= RF_DIR_Y;
- }
+ case WE_PLACE_OBJ:
+ _remove_button_clicked = w->IsWidgetLowered(RTW_REMOVE);
+ _one_way_button_clicked = w->IsWidgetLowered(RTW_ONE_WAY);
+ _place_proc(e->we.place.tile);
+ break;
- break;
- }
-
- VpSelectTilesWithMethod(e->we.place.pt.x, e->we.place.pt.y, e->we.place.select_method);
- return;
+ case WE_ABORT_PLACE_OBJ:
+ w->RaiseButtons();
+ w->SetWidgetsDisabledState(true,
+ RTW_REMOVE,
+ RTW_ONE_WAY,
+ WIDGET_LIST_END);
+ w->InvalidateWidget(RTW_REMOVE);
+ w->InvalidateWidget(RTW_ONE_WAY);
- case WE_PLACE_MOUSEUP:
- if (e->we.place.pt.x != -1) {
- TileIndex start_tile = e->we.place.starttile;
- TileIndex end_tile = e->we.place.tile;
+ w = FindWindowById(WC_BUS_STATION, 0);
+ if (w != NULL) WP(w, def_d).close = true;
+ w = FindWindowById(WC_TRUCK_STATION, 0);
+ if (w != NULL) WP(w, def_d).close = true;
+ w = FindWindowById(WC_BUILD_DEPOT, 0);
+ if (w != NULL) WP(w, def_d).close = true;
+ break;
+ case WE_PLACE_DRAG:
+ /* Here we update the end tile flags
+ * of the road placement actions.
+ * At first we reset the end halfroad
+ * bits and if needed we set them again. */
switch (e->we.place.select_proc) {
- case DDSP_BUILD_BRIDGE:
- ResetObjectToPlace();
- ShowBuildBridgeWindow(start_tile, end_tile, TRANSPORT_ROAD, RoadTypeToRoadTypes(_cur_roadtype));
+ case DDSP_PLACE_ROAD_X_DIR:
+ _place_road_flag &= ~RF_END_HALFROAD_X;
+ if (e->we.place.pt.x & 8) _place_road_flag |= RF_END_HALFROAD_X;
break;
- case DDSP_DEMOLISH_AREA:
- DoCommandP(end_tile, start_tile, 0, CcPlaySound10, CMD_CLEAR_AREA | CMD_MSG(STR_00B5_CAN_T_CLEAR_THIS_AREA));
+ case DDSP_PLACE_ROAD_Y_DIR:
+ _place_road_flag &= ~RF_END_HALFROAD_Y;
+ if (e->we.place.pt.y & 8) _place_road_flag |= RF_END_HALFROAD_Y;
break;
- case DDSP_PLACE_ROAD_X_DIR:
- case DDSP_PLACE_ROAD_Y_DIR:
case DDSP_PLACE_AUTOROAD:
- /* Flag description:
- * Use the first three bits (0x07) if dir == Y
- * else use the last 2 bits (X dir has
- * not the 3rd bit set) */
- _place_road_flag = (RoadFlags)((_place_road_flag & RF_DIR_Y) ? (_place_road_flag & 0x07) : (_place_road_flag >> 3));
+ _place_road_flag &= ~(RF_END_HALFROAD_Y | RF_END_HALFROAD_X);
+ if (e->we.place.pt.y & 8) _place_road_flag |= RF_END_HALFROAD_Y;
+ if (e->we.place.pt.x & 8) _place_road_flag |= RF_END_HALFROAD_X;
- DoCommandP(end_tile, start_tile, _place_road_flag | (_cur_roadtype << 3) | (_one_way_button_clicked << 5), CcPlaySound1D,
- (_ctrl_pressed || _remove_button_clicked) ?
- CMD_REMOVE_LONG_ROAD | CMD_NO_WATER | CMD_MSG(_road_type_infos[_cur_roadtype].err_remove_road) :
- CMD_BUILD_LONG_ROAD | CMD_NO_WATER | CMD_MSG(_road_type_infos[_cur_roadtype].err_build_road));
+ /* For autoroad we need to update the
+ * direction of the road */
+ if (_thd.size.x > _thd.size.y || (_thd.size.x == _thd.size.y &&
+ ( (_tile_fract_coords.x < _tile_fract_coords.y && (_tile_fract_coords.x + _tile_fract_coords.y) < 16) ||
+ (_tile_fract_coords.x > _tile_fract_coords.y && (_tile_fract_coords.x + _tile_fract_coords.y) > 16) ))) {
+ /* Set dir = X */
+ _place_road_flag &= ~RF_DIR_Y;
+ } else {
+ /* Set dir = Y */
+ _place_road_flag |= RF_DIR_Y;
+ }
+
+ break;
+
+ default:
break;
}
- }
- break;
-
- case WE_PLACE_PRESIZE: {
- TileIndex tile = e->we.place.tile;
- DoCommand(tile, 0x200 | RoadTypeToRoadTypes(_cur_roadtype), 0, DC_AUTO, CMD_BUILD_TUNNEL);
- VpSetPresizeRange(tile, _build_tunnel_endtile == 0 ? tile : _build_tunnel_endtile);
- break;
- }
+ VpSelectTilesWithMethod(e->we.place.pt.x, e->we.place.pt.y, e->we.place.select_method);
+ return;
- case WE_DESTROY:
- if (_patches.link_terraform_toolbar) DeleteWindowById(WC_SCEN_LAND_GEN, 0);
- break;
+ case WE_PLACE_MOUSEUP:
+ if (e->we.place.pt.x != -1) {
+ TileIndex start_tile = e->we.place.starttile;
+ TileIndex end_tile = e->we.place.tile;
- case WE_CTRL_CHANGED:
- if (RoadToolbar_CtrlChanged(w)) e->we.ctrl.cont = false;
- break;
+ switch (e->we.place.select_proc) {
+ default: NOT_REACHED();
+ case DDSP_BUILD_BRIDGE:
+ ResetObjectToPlace();
+ ShowBuildBridgeWindow(start_tile, end_tile, TRANSPORT_ROAD, RoadTypeToRoadTypes(_cur_roadtype));
+ break;
+
+ case DDSP_DEMOLISH_AREA:
+ DoCommandP(end_tile, start_tile, 0, CcPlaySound10, CMD_CLEAR_AREA | CMD_MSG(STR_00B5_CAN_T_CLEAR_THIS_AREA));
+ break;
+
+ case DDSP_PLACE_ROAD_X_DIR:
+ case DDSP_PLACE_ROAD_Y_DIR:
+ case DDSP_PLACE_AUTOROAD:
+ /* Flag description:
+ * Use the first three bits (0x07) if dir == Y
+ * else use the last 2 bits (X dir has
+ * not the 3rd bit set) */
+ _place_road_flag = (RoadFlags)((_place_road_flag & RF_DIR_Y) ? (_place_road_flag & 0x07) : (_place_road_flag >> 3));
+
+ DoCommandP(end_tile, start_tile, _place_road_flag | (_cur_roadtype << 3) | (_one_way_button_clicked << 5), CcPlaySound1D,
+ (_ctrl_pressed || _remove_button_clicked) ?
+ CMD_REMOVE_LONG_ROAD | CMD_NO_WATER | CMD_MSG(_road_type_infos[_cur_roadtype].err_remove_road) :
+ CMD_BUILD_LONG_ROAD | CMD_NO_WATER | CMD_MSG(_road_type_infos[_cur_roadtype].err_build_road));
+ break;
+ }
+ }
+ break;
+
+ case WE_PLACE_PRESIZE: {
+ TileIndex tile = e->we.place.tile;
+
+ DoCommand(tile, 0x200 | RoadTypeToRoadTypes(_cur_roadtype), 0, DC_AUTO, CMD_BUILD_TUNNEL);
+ VpSetPresizeRange(tile, _build_tunnel_endtile == 0 ? tile : _build_tunnel_endtile);
+ } break;
+
+ case WE_DESTROY:
+ if (_patches.link_terraform_toolbar) DeleteWindowById(WC_SCEN_LAND_GEN, 0);
+ break;
+
+ case WE_CTRL_CHANGED:
+ if (RoadToolbar_CtrlChanged(w)) e->we.ctrl.cont = false;
+ break;
+
+ default:
+ break;
}
}
@@ -724,39 +734,47 @@
static void BuildRoadDepotWndProc(Window *w, WindowEvent *e)
{
switch (e->event) {
- case WE_CREATE: w->LowerWidget(_road_depot_orientation + BRDW_DEPOT_NE); break;
-
- case WE_PAINT:
- DrawWindowWidgets(w);
-
- DrawRoadDepotSprite(70, 17, DIAGDIR_NE, _cur_roadtype);
- DrawRoadDepotSprite(70, 69, DIAGDIR_SE, _cur_roadtype);
- DrawRoadDepotSprite( 2, 69, DIAGDIR_SW, _cur_roadtype);
- DrawRoadDepotSprite( 2, 17, DIAGDIR_NW, _cur_roadtype);
- break;
+ case WE_CREATE:
+ w->LowerWidget(_road_depot_orientation + BRDW_DEPOT_NE);
+ break;
- case WE_CLICK:
- switch (e->we.click.widget) {
- case BRDW_DEPOT_NW:
- case BRDW_DEPOT_NE:
- case BRDW_DEPOT_SW:
- case BRDW_DEPOT_SE:
- w->RaiseWidget(_road_depot_orientation + BRDW_DEPOT_NE);
- _road_depot_orientation = (DiagDirection)(e->we.click.widget - BRDW_DEPOT_NE);
- w->LowerWidget(_road_depot_orientation + BRDW_DEPOT_NE);
- SndPlayFx(SND_15_BEEP);
- SetWindowDirty(w);
- break;
- }
- break;
+ case WE_PAINT:
+ DrawWindowWidgets(w);
- case WE_MOUSELOOP:
- if (WP(w, def_d).close) DeleteWindow(w);
- break;
+ DrawRoadDepotSprite(70, 17, DIAGDIR_NE, _cur_roadtype);
+ DrawRoadDepotSprite(70, 69, DIAGDIR_SE, _cur_roadtype);
+ DrawRoadDepotSprite( 2, 69, DIAGDIR_SW, _cur_roadtype);
+ DrawRoadDepotSprite( 2, 17, DIAGDIR_NW, _cur_roadtype);
+ break;
- case WE_DESTROY:
- if (!WP(w, def_d).close) ResetObjectToPlace();
- break;
+ case WE_CLICK:
+ switch (e->we.click.widget) {
+ case BRDW_DEPOT_NW:
+ case BRDW_DEPOT_NE:
+ case BRDW_DEPOT_SW:
+ case BRDW_DEPOT_SE:
+ w->RaiseWidget(_road_depot_orientation + BRDW_DEPOT_NE);
+ _road_depot_orientation = (DiagDirection)(e->we.click.widget - BRDW_DEPOT_NE);
+ w->LowerWidget(_road_depot_orientation + BRDW_DEPOT_NE);
+ SndPlayFx(SND_15_BEEP);
+ SetWindowDirty(w);
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case WE_MOUSELOOP:
+ if (WP(w, def_d).close) DeleteWindow(w);
+ break;
+
+ case WE_DESTROY:
+ if (!WP(w, def_d).close) ResetObjectToPlace();
+ break;
+
+ default:
+ break;
}
}
@@ -824,93 +842,101 @@
static void RoadStationPickerWndProc(Window *w, WindowEvent *e)
{
switch (e->event) {
- case WE_CREATE:
- /* Trams don't have non-drivethrough stations */
- if (_cur_roadtype == ROADTYPE_TRAM && _road_station_picker_orientation < DIAGDIR_END) {
- _road_station_picker_orientation = DIAGDIR_END;
- }
- w->SetWidgetsDisabledState(_cur_roadtype == ROADTYPE_TRAM,
- BRSW_STATION_NE,
- BRSW_STATION_SE,
- BRSW_STATION_SW,
- BRSW_STATION_NW,
- WIDGET_LIST_END);
-
- w->LowerWidget(_road_station_picker_orientation + BRSW_STATION_NE);
- w->LowerWidget(_station_show_coverage + BRSW_LT_OFF);
- break;
-
- case WE_PAINT: {
- if (WP(w, def_d).close) return;
-
- DrawWindowWidgets(w);
-
- if (_station_show_coverage) {
- int rad = _patches.modified_catchment ? CA_TRUCK /* = CA_BUS */ : CA_UNMODIFIED;
- SetTileSelectBigSize(-rad, -rad, 2 * rad, 2 * rad);
- } else {
- SetTileSelectSize(1, 1);
- }
-
- StationType st = (w->window_class == WC_BUS_STATION) ? STATION_BUS : STATION_TRUCK;
-
- StationPickerDrawSprite(103, 35, st, INVALID_RAILTYPE, ROADTYPE_ROAD, 0);
- StationPickerDrawSprite(103, 85, st, INVALID_RAILTYPE, ROADTYPE_ROAD, 1);
- StationPickerDrawSprite( 35, 85, st, INVALID_RAILTYPE, ROADTYPE_ROAD, 2);
- StationPickerDrawSprite( 35, 35, st, INVALID_RAILTYPE, ROADTYPE_ROAD, 3);
-
- StationPickerDrawSprite(171, 35, st, INVALID_RAILTYPE, _cur_roadtype, 4);
- StationPickerDrawSprite(171, 85, st, INVALID_RAILTYPE, _cur_roadtype, 5);
+ case WE_CREATE:
+ /* Trams don't have non-drivethrough stations */
+ if (_cur_roadtype == ROADTYPE_TRAM && _road_station_picker_orientation < DIAGDIR_END) {
+ _road_station_picker_orientation = DIAGDIR_END;
+ }
+ w->SetWidgetsDisabledState(_cur_roadtype == ROADTYPE_TRAM,
+ BRSW_STATION_NE,
+ BRSW_STATION_SE,
+ BRSW_STATION_SW,
+ BRSW_STATION_NW,
+ WIDGET_LIST_END);
- int text_end = DrawStationCoverageAreaText(2, 146,
- (w->window_class == WC_BUS_STATION) ? SCT_PASSENGERS_ONLY : SCT_NON_PASSENGERS_ONLY,
- 3) + 4;
- if (text_end > w->widget[BRSW_BACKGROUND].bottom) {
- SetWindowDirty(w);
- ResizeWindowForWidget(w, BRSW_BACKGROUND, 0, text_end - w->widget[BRSW_BACKGROUND].bottom);
- SetWindowDirty(w);
- }
-
- } break;
+ w->LowerWidget(_road_station_picker_orientation + BRSW_STATION_NE);
+ w->LowerWidget(_station_show_coverage + BRSW_LT_OFF);
+ break;
- case WE_CLICK: {
- switch (e->we.click.widget) {
- case BRSW_STATION_NE:
- case BRSW_STATION_SE:
- case BRSW_STATION_SW:
- case BRSW_STATION_NW:
- case BRSW_STATION_X:
- case BRSW_STATION_Y:
- w->RaiseWidget(_road_station_picker_orientation + BRSW_STATION_NE);
- _road_station_picker_orientation = (DiagDirection)(e->we.click.widget - BRSW_STATION_NE);
- w->LowerWidget(_road_station_picker_orientation + BRSW_STATION_NE);
- SndPlayFx(SND_15_BEEP);
+ case WE_PAINT: {
+ if (WP(w, def_d).close) return;
+
+ DrawWindowWidgets(w);
+
+ if (_station_show_coverage) {
+ int rad = _patches.modified_catchment ? CA_TRUCK /* = CA_BUS */ : CA_UNMODIFIED;
+ SetTileSelectBigSize(-rad, -rad, 2 * rad, 2 * rad);
+ } else {
+ SetTileSelectSize(1, 1);
+ }
+
+ StationType st = (w->window_class == WC_BUS_STATION) ? STATION_BUS : STATION_TRUCK;
+
+ StationPickerDrawSprite(103, 35, st, INVALID_RAILTYPE, ROADTYPE_ROAD, 0);
+ StationPickerDrawSprite(103, 85, st, INVALID_RAILTYPE, ROADTYPE_ROAD, 1);
+ StationPickerDrawSprite( 35, 85, st, INVALID_RAILTYPE, ROADTYPE_ROAD, 2);
+ StationPickerDrawSprite( 35, 35, st, INVALID_RAILTYPE, ROADTYPE_ROAD, 3);
+
+ StationPickerDrawSprite(171, 35, st, INVALID_RAILTYPE, _cur_roadtype, 4);
+ StationPickerDrawSprite(171, 85, st, INVALID_RAILTYPE, _cur_roadtype, 5);
+
+ int text_end = DrawStationCoverageAreaText(2, 146,
+ (w->window_class == WC_BUS_STATION) ? SCT_PASSENGERS_ONLY : SCT_NON_PASSENGERS_ONLY,
+ 3, false);
+ text_end = DrawStationCoverageAreaText(2, text_end + 4,
+ (w->window_class == WC_BUS_STATION) ? SCT_PASSENGERS_ONLY : SCT_NON_PASSENGERS_ONLY,
+ 3, true) + 4;
+ if (text_end > w->widget[BRSW_BACKGROUND].bottom) {
SetWindowDirty(w);
- break;
-
- case BRSW_LT_OFF:
- case BRSW_LT_ON:
- w->RaiseWidget(_station_show_coverage + BRSW_LT_OFF);
- _station_show_coverage = (e->we.click.widget != BRSW_LT_OFF);
- w->LowerWidget(_station_show_coverage + BRSW_LT_OFF);
- SndPlayFx(SND_15_BEEP);
+ ResizeWindowForWidget(w, BRSW_BACKGROUND, 0, text_end - w->widget[BRSW_BACKGROUND].bottom);
SetWindowDirty(w);
- break;
- }
- } break;
+ }
+ } break;
- case WE_MOUSELOOP: {
- if (WP(w, def_d).close) {
- DeleteWindow(w);
- return;
- }
+ case WE_CLICK:
+ switch (e->we.click.widget) {
+ case BRSW_STATION_NE:
+ case BRSW_STATION_SE:
+ case BRSW_STATION_SW:
+ case BRSW_STATION_NW:
+ case BRSW_STATION_X:
+ case BRSW_STATION_Y:
+ w->RaiseWidget(_road_station_picker_orientation + BRSW_STATION_NE);
+ _road_station_picker_orientation = (DiagDirection)(e->we.click.widget - BRSW_STATION_NE);
+ w->LowerWidget(_road_station_picker_orientation + BRSW_STATION_NE);
+ SndPlayFx(SND_15_BEEP);
+ SetWindowDirty(w);
+ break;
- CheckRedrawStationCoverage(w);
- } break;
+ case BRSW_LT_OFF:
+ case BRSW_LT_ON:
+ w->RaiseWidget(_station_show_coverage + BRSW_LT_OFF);
+ _station_show_coverage = (e->we.click.widget != BRSW_LT_OFF);
+ w->LowerWidget(_station_show_coverage + BRSW_LT_OFF);
+ SndPlayFx(SND_15_BEEP);
+ SetWindowDirty(w);
+ break;
- case WE_DESTROY:
- if (!WP(w, def_d).close) ResetObjectToPlace();
- break;
+ default:
+ break;
+ }
+ break;
+
+ case WE_MOUSELOOP:
+ if (WP(w, def_d).close) {
+ DeleteWindow(w);
+ return;
+ }
+
+ CheckRedrawStationCoverage(w);
+ break;
+
+ case WE_DESTROY:
+ if (!WP(w, def_d).close) ResetObjectToPlace();
+ break;
+
+ default:
+ break;
}
}
--- a/src/road_internal.h Sun Apr 06 14:12:19 2008 +0000
+++ b/src/road_internal.h Sun Apr 06 23:07:42 2008 +0000
@@ -31,6 +31,6 @@
* @param ti information about the tile (position, slope)
* @param tram the roadbits to draw the catenary for
*/
-void DrawTramCatenary(TileInfo *ti, RoadBits tram);
+void DrawTramCatenary(const TileInfo *ti, RoadBits tram);
#endif /* ROAD_INTERNAL_H */
--- a/src/roadveh.h Sun Apr 06 14:12:19 2008 +0000
+++ b/src/roadveh.h Sun Apr 06 23:07:42 2008 +0000
@@ -76,6 +76,7 @@
bool IsInDepot() const { return this->u.road.state == RVSB_IN_DEPOT; }
void Tick();
void OnNewDay();
+ TileIndex GetOrderStationLocation(StationID station);
};
byte GetRoadVehLength(const Vehicle *v);
--- a/src/roadveh_cmd.cpp Sun Apr 06 14:12:19 2008 +0000
+++ b/src/roadveh_cmd.cpp Sun Apr 06 23:07:42 2008 +0000
@@ -10,7 +10,6 @@
#include "road_map.h"
#include "roadveh.h"
#include "station_map.h"
-#include "timetable.h"
#include "command_func.h"
#include "station_base.h"
#include "news_func.h"
@@ -438,7 +437,7 @@
/* search in all directions */
for (DiagDirection d = DIAGDIR_BEGIN; d < DIAGDIR_END; d++) {
- FollowTrack(v->tile, TRANSPORT_ROAD, v->u.road.compatible_roadtypes, d, EnumRoadSignalFindDepot, NULL, &rfdd);
+ FollowTrack(v->tile, PATHFIND_FLAGS_NONE, TRANSPORT_ROAD, v->u.road.compatible_roadtypes, d, EnumRoadSignalFindDepot, NULL, &rfdd);
}
if (rfdd.best_length != UINT_MAX) return GetDepotByTile(rfdd.tile);
@@ -478,14 +477,15 @@
if (v->IsInDepot()) return CMD_ERROR;
/* If the current orders are already goto-depot */
- if (v->current_order.type == OT_GOTO_DEPOT) {
- if (!!(p2 & DEPOT_SERVICE) == HasBit(v->current_order.flags, OF_HALT_IN_DEPOT)) {
+ if (v->current_order.IsType(OT_GOTO_DEPOT)) {
+ bool halt_in_depot = HasBit(v->current_order.GetDepotActionType(), OF_HALT_IN_DEPOT);
+ if (!!(p2 & DEPOT_SERVICE) == halt_in_depot) {
/* We called with a different DEPOT_SERVICE setting.
* Now we change the setting to apply the new one and let the vehicle head for the same depot.
* Note: the if is (true for requesting service == true for ordered to stop in depot) */
if (flags & DC_EXEC) {
- ClrBit(v->current_order.flags, OF_PART_OF_ORDERS);
- ToggleBit(v->current_order.flags, OF_HALT_IN_DEPOT);
+ v->current_order.SetDepotOrderType(OFB_MANUAL_ORDER);
+ v->current_order.SetDepotActionType(halt_in_depot ? OFB_NORMAL_ACTION : OFB_HALT_IN_DEPOT);
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
}
return CommandCost();
@@ -495,11 +495,9 @@
if (flags & DC_EXEC) {
/* If the orders to 'goto depot' are in the orders list (forced servicing),
* then skip to the next order; effectively cancelling this forced service */
- if (HasBit(v->current_order.flags, OF_PART_OF_ORDERS))
- v->cur_order_index++;
+ if (v->current_order.GetDepotOrderType() & OFB_PART_OF_ORDERS) v->cur_order_index++;
- v->current_order.type = OT_DUMMY;
- v->current_order.flags = 0;
+ v->current_order.MakeDummy();
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
}
return CommandCost();
@@ -509,14 +507,11 @@
if (dep == NULL) return_cmd_error(STR_9019_UNABLE_TO_FIND_LOCAL_DEPOT);
if (flags & DC_EXEC) {
- if (v->current_order.type == OT_LOADING) v->LeaveStation();
+ if (v->current_order.IsType(OT_LOADING)) v->LeaveStation();
ClearSlot(v);
- v->current_order.type = OT_GOTO_DEPOT;
- v->current_order.flags = OFB_NON_STOP;
- if (!(p2 & DEPOT_SERVICE)) SetBit(v->current_order.flags, OF_HALT_IN_DEPOT);
- v->current_order.refit_cargo = CT_INVALID;
- v->current_order.dest = dep->index;
+ v->current_order.MakeGoToDepot(dep->index, false);
+ if (!(p2 & DEPOT_SERVICE)) v->current_order.SetDepotActionType(OFB_HALT_IN_DEPOT);
v->dest_tile = dep->xy;
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
}
@@ -586,9 +581,9 @@
uint32 x = _delta_xy_table[direction];
this->x_offs = GB(x, 0, 8);
this->y_offs = GB(x, 8, 8);
- this->sprite_width = GB(x, 16, 8);
- this->sprite_height = GB(x, 24, 8);
- this->z_height = 6;
+ this->x_extent = GB(x, 16, 8);
+ this->y_extent = GB(x, 24, 8);
+ this->z_extent = 6;
}
static void ClearCrashedStation(Vehicle *v)
@@ -758,89 +753,32 @@
}
}
-static void ProcessRoadVehOrder(Vehicle *v)
+TileIndex RoadVehicle::GetOrderStationLocation(StationID station)
{
- const Order *order;
-
- switch (v->current_order.type) {
- case OT_GOTO_DEPOT:
- /* Let a depot order in the orderlist interrupt. */
- if (!(v->current_order.flags & OFB_PART_OF_ORDERS)) return;
- if (v->current_order.flags & OFB_SERVICE_IF_NEEDED &&
- !VehicleNeedsService(v)) {
- UpdateVehicleTimetable(v, true);
- v->cur_order_index++;
- }
- break;
+ if (station == this->last_station_visited) this->last_station_visited = INVALID_STATION;
- case OT_LOADING:
- case OT_LEAVESTATION:
- return;
-
- default: break;
- }
-
- if (v->cur_order_index >= v->num_orders) v->cur_order_index = 0;
-
- order = GetVehicleOrder(v, v->cur_order_index);
+ TileIndex dest = INVALID_TILE;
+ const RoadStop *rs = GetStation(station)->GetPrimaryRoadStop(this);
+ if (rs != NULL) {
+ uint mindist = MAX_UVALUE(uint);
- if (order == NULL) {
- v->current_order.Free();
- v->dest_tile = 0;
- ClearSlot(v);
- return;
- }
+ for (; rs != NULL; rs = rs->GetNextRoadStop(this)) {
+ uint dist = DistanceManhattan(this->tile, rs->xy);
- if (order->type == v->current_order.type &&
- order->flags == v->current_order.flags &&
- order->dest == v->current_order.dest) {
- return;
+ if (dist < mindist) {
+ mindist = dist;
+ dest = rs->xy;
+ }
+ }
}
- v->current_order = *order;
-
- switch (order->type) {
- case OT_GOTO_STATION: {
- if (order->dest == v->last_station_visited) {
- v->last_station_visited = INVALID_STATION;
- }
-
- const RoadStop *rs = GetStation(order->dest)->GetPrimaryRoadStop(v);
-
- TileIndex dest = INVALID_TILE;
- if (rs != NULL) {
- uint mindist = MAX_UVALUE(uint);
-
- for (; rs != NULL; rs = rs->GetNextRoadStop(v)) {
- uint dist = DistanceManhattan(v->tile, rs->xy);
-
- if (dist < mindist) {
- mindist = dist;
- dest = rs->xy;
- }
- }
- }
-
- if (dest != INVALID_TILE) {
- v->dest_tile = dest;
- } else {
- /* There is no stop left at the station, so don't even TRY to go there */
- v->cur_order_index++;
- v->dest_tile = 0;
- }
- break;
- }
-
- case OT_GOTO_DEPOT:
- v->dest_tile = GetDepot(order->dest)->xy;
- break;
-
- default:
- v->dest_tile = 0;
- break;
+ if (dest != INVALID_TILE) {
+ return dest;
+ } else {
+ /* There is no stop left at the station, so don't even TRY to go there */
+ this->cur_order_index++;
+ return 0;
}
-
- InvalidateVehicleOrder(v);
}
static void StartRoadVehSound(const Vehicle* v)
@@ -1286,7 +1224,7 @@
if (best_track == INVALID_TRACKDIR) best_track = (Trackdir)i; // in case we don't find the path, just pick a track
frd.maxtracklen = UINT_MAX;
frd.mindist = UINT_MAX;
- FollowTrack(tile, TRANSPORT_ROAD, v->u.road.compatible_roadtypes, _road_pf_directions[i], EnumRoadTrackFindDist, NULL, &frd);
+ FollowTrack(tile, PATHFIND_FLAGS_NONE, TRANSPORT_ROAD, v->u.road.compatible_roadtypes, _road_pf_directions[i], EnumRoadTrackFindDist, NULL, &frd);
if (frd.mindist < best_dist || (frd.mindist == best_dist && frd.maxtracklen < best_maxlen)) {
best_dist = frd.mindist;
@@ -1808,7 +1746,7 @@
if (IsRoadVehFront(v) && ((IsInsideMM(v->u.road.state, RVSB_IN_ROAD_STOP, RVSB_IN_ROAD_STOP_END) &&
_road_veh_data_1[v->u.road.state - RVSB_IN_ROAD_STOP + (_opt.road_side << RVS_DRIVE_SIDE)] == v->u.road.frame) ||
(IsInsideMM(v->u.road.state, RVSB_IN_DT_ROAD_STOP, RVSB_IN_DT_ROAD_STOP_END) &&
- v->current_order.dest == GetStationIndex(v->tile) &&
+ v->current_order.GetDestination() == GetStationIndex(v->tile) &&
GetRoadStopType(v->tile) == (IsCargoInClass(v->cargo_type, CC_PASSENGERS) ? ROADSTOP_BUS : ROADSTOP_TRUCK) &&
v->u.road.frame == RVC_DRIVE_THROUGH_STOP_FRAME))) {
@@ -1818,8 +1756,8 @@
/* Vehicle is at the stop position (at a bay) in a road stop.
* Note, if vehicle is loading/unloading it has already been handled,
* so if we get here the vehicle has just arrived or is just ready to leave. */
- if (v->current_order.type != OT_LEAVESTATION &&
- v->current_order.type != OT_GOTO_DEPOT) {
+ if (!v->current_order.IsType(OT_LEAVESTATION) &&
+ !v->current_order.IsType(OT_GOTO_DEPOT)) {
/* Vehicle has arrived at a bay in a road stop */
if (IsDriveThroughStopTile(v->tile)) {
@@ -1856,7 +1794,7 @@
}
/* Vehicle is ready to leave a bay in a road stop */
- if (v->current_order.type != OT_GOTO_DEPOT) {
+ if (!v->current_order.IsType(OT_GOTO_DEPOT)) {
if (rs->IsEntranceBusy()) {
/* Road stop entrance is busy, so wait as there is nowhere else to go */
v->cur_speed = 0;
@@ -1882,12 +1820,12 @@
if (v->dest_tile != v->u.road.slot->xy) {
DEBUG(ms, 2, " stop tile 0x%X is not destination tile 0x%X. Multistop desync", v->u.road.slot->xy, v->dest_tile);
}
- if (v->current_order.type != OT_GOTO_STATION) {
- DEBUG(ms, 2, " current order type (%d) is not OT_GOTO_STATION", v->current_order.type);
+ if (!v->current_order.IsType(OT_GOTO_STATION)) {
+ DEBUG(ms, 2, " current order type (%d) is not OT_GOTO_STATION", v->current_order.GetType());
} else {
- if (v->current_order.dest != st->index)
+ if (v->current_order.GetDestination() != st->index)
DEBUG(ms, 2, " current station %d is not target station in current_order.station (%d)",
- st->index, v->current_order.dest);
+ st->index, v->current_order.GetDestination());
}
DEBUG(ms, 2, " force a slot clearing");
@@ -1942,10 +1880,10 @@
if (v->vehstatus & VS_STOPPED) return;
- ProcessRoadVehOrder(v);
+ ProcessOrders(v);
v->HandleLoading();
- if (v->current_order.type == OT_LOADING) return;
+ if (v->current_order.IsType(OT_LOADING)) return;
if (v->IsInDepot() && RoadVehLeaveDepot(v, true)) return;
@@ -1986,26 +1924,23 @@
const Depot *depot = FindClosestRoadDepot(v);
if (depot == NULL || DistanceManhattan(v->tile, depot->xy) > 12) {
- if (v->current_order.type == OT_GOTO_DEPOT) {
- v->current_order.type = OT_DUMMY;
- v->current_order.flags = 0;
+ if (v->current_order.IsType(OT_GOTO_DEPOT)) {
+ v->current_order.MakeDummy();
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
}
return;
}
- if (v->current_order.type == OT_GOTO_DEPOT &&
- v->current_order.flags & OFB_NON_STOP &&
+ if (v->current_order.IsType(OT_GOTO_DEPOT) &&
+ v->current_order.GetNonStopType() & OFB_NON_STOP &&
!Chance16(1, 20)) {
return;
}
- if (v->current_order.type == OT_LOADING) v->LeaveStation();
+ if (v->current_order.IsType(OT_LOADING)) v->LeaveStation();
ClearSlot(v);
- v->current_order.type = OT_GOTO_DEPOT;
- v->current_order.flags = OFB_NON_STOP;
- v->current_order.dest = depot->index;
+ v->current_order.MakeGoToDepot(depot->index, false);
v->dest_tile = depot->xy;
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
}
@@ -2023,15 +1958,15 @@
CheckOrders(this);
/* Current slot has expired */
- if (this->current_order.type == OT_GOTO_STATION && this->u.road.slot != NULL && this->u.road.slot_age-- == 0) {
+ if (this->current_order.IsType(OT_GOTO_STATION) && this->u.road.slot != NULL && this->u.road.slot_age-- == 0) {
DEBUG(ms, 3, "Slot expired for vehicle %d (index %d) at stop 0x%X",
this->unitnumber, this->index, this->u.road.slot->xy);
ClearSlot(this);
}
/* update destination */
- if (!(this->vehstatus & VS_STOPPED) && this->current_order.type == OT_GOTO_STATION && this->u.road.slot == NULL && !(this->vehstatus & VS_CRASHED)) {
- Station *st = GetStation(this->current_order.dest);
+ if (!(this->vehstatus & VS_STOPPED) && this->current_order.IsType(OT_GOTO_STATION) && this->u.road.slot == NULL && !(this->vehstatus & VS_CRASHED)) {
+ Station *st = GetStation(this->current_order.GetDestination());
RoadStop *rs = st->GetPrimaryRoadStop(this);
RoadStop *best = NULL;
--- a/src/roadveh_gui.cpp Sun Apr 06 14:12:19 2008 +0000
+++ b/src/roadveh_gui.cpp Sun Apr 06 23:07:42 2008 +0000
@@ -109,15 +109,29 @@
* 0, we draw enough vehicles for 10 standard vehicle lengths. */
int max_length = (count == 0) ? 80 : count * 8;
- for (int dx = 0 ; v != NULL && dx < max_length ; dx += v->u.road.cached_veh_length, v = v->Next()) {
- if (dx + v->u.road.cached_veh_length > 0 && dx <= max_length) {
+ /* Width of highlight box */
+ int highlight_w = 0;
+
+ for (int dx = 0; v != NULL && dx < max_length ; v = v->Next()) {
+ int width = v->u.road.cached_veh_length;
+
+ if (dx + width > 0 && dx <= max_length) {
SpriteID pal = (v->vehstatus & VS_CRASHED) ? PALETTE_CRASH : GetVehiclePalette(v);
DrawSprite(v->GetImage(DIR_W), pal, x + 14 + RoadVehLengthToPixels(dx), y + 6);
if (v->index == selection) {
- DrawFrameRect(x - 1, y - 1, x + 28, y + 12, 15, FR_BORDERONLY);
+ /* Set the highlight position */
+ highlight_w = RoadVehLengthToPixels(width);
+ } else if (_cursor.vehchain && highlight_w != 0) {
+ highlight_w += RoadVehLengthToPixels(width);
}
}
+
+ dx += width;
+ }
+
+ if (highlight_w != 0) {
+ DrawFrameRect(x - 1, y - 1, x - 1 + highlight_w, y + 12, 15, FR_BORDERONLY);
}
}
--- a/src/settings.cpp Sun Apr 06 14:12:19 2008 +0000
+++ b/src/settings.cpp Sun Apr 06 23:07:42 2008 +0000
@@ -51,6 +51,7 @@
#include "transparency.h"
#include "textbuf_gui.h"
#include "string_func.h"
+#include "rail_gui.h"
#include "gui.h"
#include "town.h"
#include "video/video_driver.hpp"
@@ -1201,6 +1202,15 @@
return 0;
}
+static int32 DragSignalsDensityChanged(int32)
+{
+ const Window *w = FindWindowById(WC_BUILD_SIGNAL, 0);
+
+ if (w != NULL) SetWindowDirty(w);
+
+ return 0;
+}
+
/**
* Check for right TownLayout usage in editor mode.
* The No Road mode is not desirable since towns have to be
@@ -1290,6 +1300,7 @@
SDTG_VAR("player_face", SLE_UINT32, S, 0, _player_face, 0,0,0xFFFFFFFF,0, STR_NULL, NULL),
SDTG_VAR("transparency_options", SLE_UINT, S, 0, _transparency_opt, 0,0,0x1FF,0, STR_NULL, NULL),
SDTG_VAR("transparency_locks", SLE_UINT, S, 0, _transparency_lock, 0,0,0x1FF,0, STR_NULL, NULL),
+ SDTG_VAR("invisibility_options", SLE_UINT, S, 0, _invisibility_opt, 0,0, 0xFF,0, STR_NULL, NULL),
SDTG_STR("keyboard", SLE_STRB, S, 0, _keyboard_opt[0], NULL, STR_NULL, NULL),
SDTG_STR("keyboard_caps", SLE_STRB, S, 0, _keyboard_opt[1], NULL, STR_NULL, NULL),
SDTG_END()
@@ -1373,7 +1384,6 @@
SDT_VAR(Patches, errmsg_duration, SLE_UINT8, S, 0, 5, 0, 20, 0, STR_CONFIG_PATCHES_ERRMSG_DURATION, NULL),
SDT_VAR(Patches, toolbar_pos, SLE_UINT8, S,MS, 0, 0, 2, 0, STR_CONFIG_PATCHES_TOOLBAR_POS, v_PositionMainToolbar),
SDT_VAR(Patches, window_snap_radius, SLE_UINT8, S,D0, 10, 1, 32, 0, STR_CONFIG_PATCHES_SNAP_RADIUS, NULL),
- SDT_BOOL(Patches, invisible_trees, S, 0, false, STR_CONFIG_PATCHES_INVISIBLE_TREES, RedrawScreen),
SDT_BOOL(Patches, population_in_label, S, 0, true, STR_CONFIG_PATCHES_POPULATION_IN_LABEL, PopulationInLabelActive),
SDT_VAR(Patches, map_x, SLE_UINT8, S, 0, 8, 6, 11, 0, STR_CONFIG_PATCHES_MAP_X, NULL),
SDT_VAR(Patches, map_y, SLE_UINT8, S, 0, 8, 6, 11, 0, STR_CONFIG_PATCHES_MAP_Y, NULL),
@@ -1397,8 +1407,8 @@
SDT_BOOL(Patches, signal_side, N,NN, true, STR_CONFIG_PATCHES_SIGNALSIDE, RedrawScreen),
SDT_BOOL(Patches, always_small_airport, 0,NN, false, STR_CONFIG_PATCHES_SMALL_AIRPORTS, NULL),
SDT_BOOL(Patches, enable_signal_gui, S, 0, false, STR_CONFIG_PATCHES_ENABLE_SIGNAL_GUI, NULL),
- SDT_VAR(Patches, drag_signals_density,SLE_UINT8,S, 0, 4, 1, 20, 0, STR_CONFIG_PATCHES_DRAG_SIGNALS_DENSITY,NULL),
- SDT_VAR(Patches, semaphore_build_before,SLE_INT32, S, NC, 1975, MIN_YEAR, MAX_YEAR, 1, STR_CONFIG_PATCHES_SEMAPHORE_BUILD_BEFORE_DATE, NULL),
+ SDT_VAR(Patches, drag_signals_density,SLE_UINT8,S, 0, 4, 1, 20, 0, STR_CONFIG_PATCHES_DRAG_SIGNALS_DENSITY,DragSignalsDensityChanged),
+ SDT_VAR(Patches, semaphore_build_before,SLE_INT32, S, NC, 1975, MIN_YEAR, MAX_YEAR, 1, STR_CONFIG_PATCHES_SEMAPHORE_BUILD_BEFORE_DATE, ResetSignalVariant),
SDT_CONDVAR(Patches, town_layout, SLE_UINT8, 59, SL_MAX_VERSION, 0, MS, TL_ORIGINAL, TL_NO_ROADS, NUM_TLS - 1, 1, STR_CONFIG_PATCHES_TOWN_LAYOUT, CheckTownLayout),
/***************************************************************************/
--- a/src/settings_gui.cpp Sun Apr 06 14:12:19 2008 +0000
+++ b/src/settings_gui.cpp Sun Apr 06 23:07:42 2008 +0000
@@ -712,7 +712,6 @@
"toolbar_pos",
"measure_tooltip",
"window_snap_radius",
- "invisible_trees",
"population_in_label",
"link_terraform_toolbar",
"liveries",
--- a/src/settings_type.h Sun Apr 06 14:12:19 2008 +0000
+++ b/src/settings_type.h Sun Apr 06 23:07:42 2008 +0000
@@ -98,7 +98,6 @@
bool realistic_acceleration; ///< realistic acceleration for trains
bool wagon_speed_limits; ///< enable wagon speed limits
bool forbid_90_deg; ///< forbid trains to make 90 deg turns
- bool invisible_trees; ///< don't show trees when buildings are transparent
bool no_servicing_if_no_breakdowns; ///< dont send vehicles to depot when breakdowns are disabled
bool link_terraform_toolbar; ///< display terraform toolbar when displaying rail, road, water and airport toolbars
bool reverse_scroll; ///< Right-Click-Scrolling scrolls in the opposite direction
--- a/src/ship.h Sun Apr 06 14:12:19 2008 +0000
+++ b/src/ship.h Sun Apr 06 23:07:42 2008 +0000
@@ -42,6 +42,7 @@
bool IsInDepot() const { return this->u.ship.state == 0x80; }
void Tick();
void OnNewDay();
+ TileIndex GetOrderStationLocation(StationID station);
};
#endif /* SHIP_H */
--- a/src/ship_cmd.cpp Sun Apr 06 14:12:19 2008 +0000
+++ b/src/ship_cmd.cpp Sun Apr 06 23:07:42 2008 +0000
@@ -153,17 +153,14 @@
const Depot *depot = FindClosestShipDepot(v);
if (depot == NULL || DistanceManhattan(v->tile, depot->xy) > 12) {
- if (v->current_order.type == OT_GOTO_DEPOT) {
- v->current_order.type = OT_DUMMY;
- v->current_order.flags = 0;
+ if (v->current_order.IsType(OT_GOTO_DEPOT)) {
+ v->current_order.MakeDummy();
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
}
return;
}
- v->current_order.type = OT_GOTO_DEPOT;
- v->current_order.flags = OFB_NON_STOP;
- v->current_order.dest = depot->index;
+ v->current_order.MakeGoToDepot(depot->index, false);
v->dest_tile = depot->xy;
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
}
@@ -242,66 +239,17 @@
PlayShipSound(this);
}
-static void ProcessShipOrder(Vehicle *v)
+TileIndex Ship::GetOrderStationLocation(StationID station)
{
- const Order *order;
-
- switch (v->current_order.type) {
- case OT_GOTO_DEPOT:
- if (!(v->current_order.flags & OFB_PART_OF_ORDERS)) return;
- if (v->current_order.flags & OFB_SERVICE_IF_NEEDED &&
- !VehicleNeedsService(v)) {
- UpdateVehicleTimetable(v, true);
- v->cur_order_index++;
- }
- break;
+ if (station == this->last_station_visited) this->last_station_visited = INVALID_STATION;
- case OT_LOADING:
- case OT_LEAVESTATION:
- return;
-
- default: break;
- }
-
- if (v->cur_order_index >= v->num_orders) v->cur_order_index = 0;
-
- order = GetVehicleOrder(v, v->cur_order_index);
-
- if (order == NULL) {
- v->current_order.Free();
- v->dest_tile = 0;
- return;
+ Station *st = GetStation(station);
+ if (st->dock_tile != 0) {
+ return TILE_ADD(st->dock_tile, ToTileIndexDiff(GetDockOffset(st->dock_tile)));
+ } else {
+ this->cur_order_index++;
+ return 0;
}
-
- if (order->type == v->current_order.type &&
- order->flags == v->current_order.flags &&
- order->dest == v->current_order.dest &&
- (order->type != OT_GOTO_STATION || GetStation(order->dest)->dock_tile != 0))
- return;
-
- v->current_order = *order;
-
- if (order->type == OT_GOTO_STATION) {
- const Station *st;
-
- if (order->dest == v->last_station_visited)
- v->last_station_visited = INVALID_STATION;
-
- st = GetStation(order->dest);
- if (st->dock_tile != 0) {
- v->dest_tile = TILE_ADD(st->dock_tile, ToTileIndexDiff(GetDockOffset(st->dock_tile)));
- } else {
- v->cur_order_index++;
- }
- } else if (order->type == OT_GOTO_DEPOT) {
- v->dest_tile = GetDepot(order->dest)->xy;
- } else {
- v->dest_tile = 0;
- }
-
- InvalidateVehicleOrder(v);
-
- InvalidateWindowClasses(WC_SHIPS_LIST);
}
void Ship::UpdateDeltaXY(Direction direction)
@@ -322,9 +270,9 @@
uint32 x = _delta_xy_table[direction];
this->x_offs = GB(x, 0, 8);
this->y_offs = GB(x, 8, 8);
- this->sprite_width = GB(x, 16, 8);
- this->sprite_height = GB(x, 24, 8);
- this->z_height = 6;
+ this->x_extent = GB(x, 16, 8);
+ this->y_extent = GB(x, 24, 8);
+ this->z_extent = 6;
}
void RecalcShipStuff(Vehicle *v)
@@ -474,7 +422,7 @@
pfs.best_bird_dist = (uint)-1;
pfs.best_length = (uint)-1;
- FollowTrack(tile, 0x1800 | TRANSPORT_WATER, 0, (DiagDirection)_ship_search_directions[i][dir], (TPFEnumProc*)ShipTrackFollower, NULL, &pfs);
+ FollowTrack(tile, PATHFIND_FLAGS_SHIP_MODE | PATHFIND_FLAGS_DISABLE_TILE_HASH, TRANSPORT_WATER, 0, (DiagDirection)_ship_search_directions[i][dir], (TPFEnumProc*)ShipTrackFollower, NULL, &pfs);
if (best_track != INVALID_TRACK) {
if (pfs.best_bird_dist != 0) {
@@ -650,10 +598,10 @@
if (v->vehstatus & VS_STOPPED) return;
- ProcessShipOrder(v);
+ ProcessOrders(v);
v->HandleLoading();
- if (v->current_order.type == OT_LOADING) return;
+ if (v->current_order.IsType(OT_LOADING)) return;
CheckShipLeaveDepot(v);
@@ -674,40 +622,38 @@
/* A leave station order only needs one tick to get processed, so we can
* always skip ahead. */
- if (v->current_order.type == OT_LEAVESTATION) {
+ if (v->current_order.IsType(OT_LEAVESTATION)) {
v->current_order.Free();
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
} else if (v->dest_tile != 0) {
/* We have a target, let's see if we reached it... */
- if (v->current_order.type == OT_GOTO_STATION &&
+ if (v->current_order.IsType(OT_GOTO_STATION) &&
IsBuoyTile(v->dest_tile) &&
DistanceManhattan(v->dest_tile, gp.new_tile) <= 3) {
/* We got within 3 tiles of our target buoy, so let's skip to our
* next order */
UpdateVehicleTimetable(v, true);
v->cur_order_index++;
- v->current_order.type = OT_DUMMY;
+ v->current_order.MakeDummy();
InvalidateVehicleOrder(v);
} else {
/* Non-buoy orders really need to reach the tile */
if (v->dest_tile == gp.new_tile) {
- if (v->current_order.type == OT_GOTO_DEPOT) {
+ if (v->current_order.IsType(OT_GOTO_DEPOT)) {
if ((gp.x & 0xF) == 8 && (gp.y & 0xF) == 8) {
VehicleEnterDepot(v);
return;
}
- } else if (v->current_order.type == OT_GOTO_STATION) {
- Station *st;
-
- v->last_station_visited = v->current_order.dest;
+ } else if (v->current_order.IsType(OT_GOTO_STATION)) {
+ v->last_station_visited = v->current_order.GetDestination();
/* Process station in the orderlist. */
- st = GetStation(v->current_order.dest);
+ Station *st = GetStation(v->current_order.GetDestination());
if (st->facilities & FACIL_DOCK) { // ugly, ugly workaround for problem with ships able to drop off cargo at wrong stations
ShipArrivesAt(v, st);
v->BeginLoading();
} else { // leave stations without docks right aways
- v->current_order.type = OT_LEAVESTATION;
+ v->current_order.MakeLeaveStation();
v->cur_order_index++;
InvalidateVehicleOrder(v);
}
@@ -996,14 +942,15 @@
if (v->IsInDepot()) return CMD_ERROR;
/* If the current orders are already goto-depot */
- if (v->current_order.type == OT_GOTO_DEPOT) {
- if (!!(p2 & DEPOT_SERVICE) == HasBit(v->current_order.flags, OF_HALT_IN_DEPOT)) {
+ if (v->current_order.IsType(OT_GOTO_DEPOT)) {
+ bool halt_in_depot = HasBit(v->current_order.GetDepotActionType(), OF_HALT_IN_DEPOT);
+ if (!!(p2 & DEPOT_SERVICE) == halt_in_depot) {
/* We called with a different DEPOT_SERVICE setting.
* Now we change the setting to apply the new one and let the vehicle head for the same depot.
* Note: the if is (true for requesting service == true for ordered to stop in depot) */
if (flags & DC_EXEC) {
- ClrBit(v->current_order.flags, OF_PART_OF_ORDERS);
- ToggleBit(v->current_order.flags, OF_HALT_IN_DEPOT);
+ v->current_order.SetDepotOrderType(OFB_MANUAL_ORDER);
+ v->current_order.SetDepotActionType(halt_in_depot ? OFB_NORMAL_ACTION : OFB_HALT_IN_DEPOT);
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
}
return CommandCost();
@@ -1013,11 +960,9 @@
if (flags & DC_EXEC) {
/* If the orders to 'goto depot' are in the orders list (forced servicing),
* then skip to the next order; effectively cancelling this forced service */
- if (HasBit(v->current_order.flags, OF_PART_OF_ORDERS))
- v->cur_order_index++;
+ if (v->current_order.GetDepotOrderType() & OFB_PART_OF_ORDERS) v->cur_order_index++;
- v->current_order.type = OT_DUMMY;
- v->current_order.flags = 0;
+ v->current_order.MakeDummy();
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
}
return CommandCost();
@@ -1027,14 +972,11 @@
if (dep == NULL) return_cmd_error(STR_981A_UNABLE_TO_FIND_LOCAL_DEPOT);
if (flags & DC_EXEC) {
- if (v->current_order.type == OT_LOADING) v->LeaveStation();
+ if (v->current_order.IsType(OT_LOADING)) v->LeaveStation();
v->dest_tile = dep->xy;
- v->current_order.type = OT_GOTO_DEPOT;
- v->current_order.flags = OFB_NON_STOP;
- if (!(p2 & DEPOT_SERVICE)) SetBit(v->current_order.flags, OF_HALT_IN_DEPOT);
- v->current_order.refit_cargo = CT_INVALID;
- v->current_order.dest = dep->index;
+ v->current_order.MakeGoToDepot(dep->index, false);
+ if (!(p2 & DEPOT_SERVICE)) v->current_order.SetDepotActionType(OFB_HALT_IN_DEPOT);
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
}
--- a/src/slope_func.h Sun Apr 06 14:12:19 2008 +0000
+++ b/src/slope_func.h Sun Apr 06 23:07:42 2008 +0000
@@ -54,7 +54,7 @@
*/
static inline Slope RemoveHalftileSlope(Slope s)
{
- return (Slope)(s & ~SLOPE_HALFTILE_MASK);
+ return s & ~SLOPE_HALFTILE_MASK;
}
/**
@@ -71,7 +71,7 @@
static inline Slope ComplementSlope(Slope s)
{
assert(!IsSteepSlope(s) && !IsHalftileSlope(s));
- return (Slope)(0xF ^ s);
+ return s ^ SLOPE_ELEVATED;
}
/**
@@ -200,7 +200,7 @@
*/
static inline Slope SteepSlope(Corner corner)
{
- return (Slope)(SLOPE_STEEP | SlopeWithThreeCornersRaised(OppositeCorner(corner)));
+ return SLOPE_STEEP | SlopeWithThreeCornersRaised(OppositeCorner(corner));
}
/**
--- a/src/slope_type.h Sun Apr 06 14:12:19 2008 +0000
+++ b/src/slope_type.h Sun Apr 06 23:07:42 2008 +0000
@@ -70,6 +70,7 @@
SLOPE_HALFTILE_E = SLOPE_HALFTILE | (CORNER_E << 6), ///< the east halftile is leveled (non continuous slope)
SLOPE_HALFTILE_N = SLOPE_HALFTILE | (CORNER_N << 6), ///< the north halftile is leveled (non continuous slope)
};
+DECLARE_ENUM_AS_BIT_SET(Slope)
/**
--- a/src/station_cmd.cpp Sun Apr 06 14:12:19 2008 +0000
+++ b/src/station_cmd.cpp Sun Apr 06 23:07:42 2008 +0000
@@ -465,12 +465,13 @@
for (int yc = y1; yc != y2; yc++) {
for (int xc = x1; xc != x2; xc++) {
- if (!(IsInsideBS(xc, x, w) && IsInsideBS(yc, y, h))) {
- TileIndex tile = TileXY(xc, yc);
-
+ TileIndex tile = TileXY(xc, yc);
+
+ if (!IsTileType(tile, MP_STATION)) {
GetProducedCargoProc *gpc = _tile_type_procs[GetTileType(tile)]->get_produced_cargo_proc;
if (gpc != NULL) {
- CargoID cargos[2] = { CT_INVALID, CT_INVALID };
+ CargoID cargos[256]; // Required for CBID_HOUSE_PRODUCE_CARGO.
+ memset(cargos, CT_INVALID, 256);
gpc(tile, cargos);
for (uint i = 0; i < lengthof(cargos); ++i) {
@@ -1898,7 +1899,7 @@
if (player == INVALID_PLAYER || v->owner == player) {
const Order *order;
FOR_VEHICLE_ORDERS(v, order) {
- if (order->type == OT_GOTO_STATION && order->dest == station) {
+ if (order->IsType(OT_GOTO_STATION) && order->GetDestination() == station) {
return true;
}
}
@@ -2184,6 +2185,9 @@
DrawTramCatenary(ti, axis == AXIS_X ? ROAD_X : ROAD_Y);
}
+ /* End now if buildings are invisible */
+ if (IsInvisibilitySet(TO_BUILDINGS)) return;
+
const DrawTileSeqStruct *dtss;
foreach_draw_tile_seq(dtss, t->seq) {
SpriteID image = dtss->image.sprite;
@@ -2396,33 +2400,27 @@
static VehicleEnterTileStatus VehicleEnter_Station(Vehicle *v, TileIndex tile, int x, int y)
{
+ StationID station_id = GetStationIndex(tile);
+ if (!v->current_order.ShouldStopAtStation(v, station_id)) return VETSB_CONTINUE;
+
if (v->type == VEH_TRAIN) {
if (IsRailwayStation(tile) && IsFrontEngine(v) &&
!IsCompatibleTrainStationTile(tile + TileOffsByDiagDir(DirToDiagDir(v->direction)), tile)) {
- StationID station_id = GetStationIndex(tile);
-
- if ((!(v->current_order.flags & OFB_NON_STOP) && !_patches.new_nonstop) ||
- (v->current_order.type == OT_GOTO_STATION && v->current_order.dest == station_id)) {
- if (!(_patches.new_nonstop && v->current_order.flags & OFB_NON_STOP) &&
- v->current_order.type != OT_LEAVESTATION &&
- v->last_station_visited != station_id) {
- DiagDirection dir = DirToDiagDir(v->direction);
-
- x &= 0xF;
- y &= 0xF;
-
- if (DiagDirToAxis(dir) != AXIS_X) Swap(x, y);
- if (y == TILE_SIZE / 2) {
- if (dir != DIAGDIR_SE && dir != DIAGDIR_SW) x = TILE_SIZE - 1 - x;
- if (x == 12) return VETSB_ENTERED_STATION | (VehicleEnterTileStatus)(station_id << VETS_STATION_ID_OFFSET); /* enter station */
- if (x < 12) {
- uint16 spd;
-
- v->vehstatus |= VS_TRAIN_SLOWING;
- spd = _enter_station_speedtable[x];
- if (spd < v->cur_speed) v->cur_speed = spd;
- }
- }
+ DiagDirection dir = DirToDiagDir(v->direction);
+
+ x &= 0xF;
+ y &= 0xF;
+
+ if (DiagDirToAxis(dir) != AXIS_X) Swap(x, y);
+ if (y == TILE_SIZE / 2) {
+ if (dir != DIAGDIR_SE && dir != DIAGDIR_SW) x = TILE_SIZE - 1 - x;
+ if (x == 12) return VETSB_ENTERED_STATION | (VehicleEnterTileStatus)(station_id << VETS_STATION_ID_OFFSET); /* enter station */
+ if (x < 12) {
+ uint16 spd;
+
+ v->vehstatus |= VS_TRAIN_SLOWING;
+ spd = _enter_station_speedtable[x];
+ if (spd < v->cur_speed) v->cur_speed = spd;
}
}
}
@@ -2440,7 +2438,7 @@
/* Check if the vehicle is stopping at this road stop */
if (GetRoadStopType(tile) == (IsCargoInClass(v->cargo_type, CC_PASSENGERS) ? ROADSTOP_BUS : ROADSTOP_TRUCK) &&
- v->current_order.dest == GetStationIndex(tile)) {
+ v->current_order.GetDestination() == GetStationIndex(tile)) {
SetBit(v->u.road.state, RVS_IS_STOPPING);
rs->AllocateDriveThroughBay(side);
}
--- a/src/station_gui.h Sun Apr 06 14:12:19 2008 +0000
+++ b/src/station_gui.h Sun Apr 06 23:07:42 2008 +0000
@@ -58,7 +58,7 @@
SCT_ALL
};
-int DrawStationCoverageAreaText(int sx, int sy, StationCoverageType sct, int rad);
+int DrawStationCoverageAreaText(int sx, int sy, StationCoverageType sct, int rad, bool supplies);
void CheckRedrawStationCoverage(const Window *w);
extern bool _station_show_coverage;
--- a/src/stdafx.h Sun Apr 06 14:12:19 2008 +0000
+++ b/src/stdafx.h Sun Apr 06 23:07:42 2008 +0000
@@ -32,8 +32,15 @@
#include <stdint.h>
#endif
#else
- #define INT64_MAX 9223372036854775807LL
- #define INT64_MIN (-INT64_MAX - 1)
+ #define UINT64_MAX (18446744073709551615ULL)
+ #define INT64_MAX (9223372036854775807LL)
+ #define INT64_MIN (-INT64_MAX - 1)
+ #define UINT32_MAX (4294967295U)
+ #define INT32_MAX (2147483647)
+ #define INT32_MIN (-INT32_MAX - 1)
+ #define UINT16_MAX (65535U)
+ #define INT16_MAX (32767)
+ #define INT16_MIN (-INT16_MAX - 1)
#endif
#include <cstdio>
--- a/src/strgen/strgen.cpp Sun Apr 06 14:12:19 2008 +0000
+++ b/src/strgen/strgen.cpp Sun Apr 06 23:07:42 2008 +0000
@@ -1287,7 +1287,7 @@
int CDECL main(int argc, char* argv[])
{
- char pathbuf[256];
+ char pathbuf[MAX_PATH];
const char *src_dir = ".";
const char *dest_dir = NULL;
--- a/src/subsidy_gui.cpp Sun Apr 06 14:12:19 2008 +0000
+++ b/src/subsidy_gui.cpp Sun Apr 06 23:07:42 2008 +0000
@@ -92,7 +92,7 @@
ConvertDateToYMD(_date, &ymd);
- int width = w->width - 2;
+ int width = w->width - 13; // scroll bar = 11 + pixel each side
y = 15;
x = 1;
DrawStringTruncated(x, y, STR_2026_SUBSIDIES_ON_OFFER_FOR, TC_FROMSTRING, width);
@@ -133,8 +133,10 @@
xt = DrawStringTruncated(x + 2, y, STR_202C_FROM_TO, TC_FROMSTRING, width - 2);
- SetDParam(0, _date - ymd.day + 768 - s->age * 32);
- DrawStringTruncated(xt, y, STR_202D_UNTIL, TC_FROMSTRING, width - xt);
+ if ((xt > 3) && (width - xt) > 9 ) { // do not draw if it will get on the scrollbar or if last drawing did nothing
+ SetDParam(0, _date - ymd.day + 768 - s->age * 32);
+ DrawStringTruncated(xt, y, STR_202D_UNTIL, TC_FROMSTRING, width - xt);
+ }
y += 10;
num++;
}
@@ -159,17 +161,20 @@
}
static const Widget _subsidies_list_widgets[] = {
-{ WWT_CLOSEBOX, RESIZE_NONE, 13, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
-{ WWT_CAPTION, RESIZE_RIGHT, 13, 11, 307, 0, 13, STR_2025_SUBSIDIES, STR_018C_WINDOW_TITLE_DRAG_THIS},
-{ WWT_STICKYBOX, RESIZE_LR, 13, 308, 319, 0, 13, STR_NULL, STR_STICKY_BUTTON},
-{ WWT_PANEL, RESIZE_RIGHT, 13, 0, 319, 14, 126, 0x0, STR_01FD_CLICK_ON_SERVICE_TO_CENTER},
+{ WWT_CLOSEBOX, RESIZE_NONE, 13, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
+{ WWT_CAPTION, RESIZE_RIGHT, 13, 11, 307, 0, 13, STR_2025_SUBSIDIES, STR_018C_WINDOW_TITLE_DRAG_THIS},
+{ WWT_STICKYBOX, RESIZE_LR, 13, 308, 319, 0, 13, STR_NULL, STR_STICKY_BUTTON},
+{ WWT_PANEL, RESIZE_RB, 13, 0, 307, 14, 126, 0x0, STR_01FD_CLICK_ON_SERVICE_TO_CENTER},
+{ WWT_SCROLLBAR, RESIZE_LRB, 13, 308, 319, 14, 114, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST}, // IDW_SCROLLBAR
+{ WWT_RESIZEBOX, RESIZE_LRTB, 13, 308, 319, 115, 126, 0x0, STR_RESIZE_BUTTON}, // IDW_RESIZE
+
{ WIDGETS_END},
};
static const WindowDesc _subsidies_list_desc = {
- WDP_AUTO, WDP_AUTO, 320, 127, 630, 127,
+ WDP_AUTO, WDP_AUTO, 320, 127, 320, 127,
WC_SUBSIDIES_LIST, WC_NONE,
- WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON,
+ WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON | WDF_RESIZABLE,
_subsidies_list_widgets,
SubsidiesListWndProc
};
--- a/src/table/sprites.h Sun Apr 06 14:12:19 2008 +0000
+++ b/src/table/sprites.h Sun Apr 06 23:07:42 2008 +0000
@@ -849,11 +849,15 @@
* and an end tile (half a tube on the near side, maked _END
*/
SPR_BTTUB_X_FRONT_BEG = 2559,
- SPR_BTTUB_X_FRONT_MID = 2660,
+ SPR_BTTUB_X_FRONT_MID = 2560,
SPR_BTTUB_X_FRONT_END = 2561,
SPR_BTTUB_Y_FRONT_END = 2562,
SPR_BTTUB_Y_FRONT_MID = 2563,
SPR_BTTUB_Y_FRONT_BEG = 2564,
+ SPR_BTTUB_X_PILLAR_BEG = 2565,
+ SPR_BTTUB_X_PILLAR_MID = 2566,
+ SPR_BTTUB_Y_PILLAR_MID = 2567,
+ SPR_BTTUB_Y_PILLAR_BEG = 2568,
SPR_BTTUB_X_RAIL_REAR_BEG = 2569,
SPR_BTTUB_X_RAIL_REAR_MID = 2570,
SPR_BTTUB_X_RAIL_REAR_END = 2571,
--- a/src/table/track_land.h Sun Apr 06 14:12:19 2008 +0000
+++ b/src/table/track_land.h Sun Apr 06 23:07:42 2008 +0000
@@ -33,6 +33,12 @@
{ {SPR_FLAT_GRASS_TILE, PAL_NONE}, _depot_gfx_NW }
};
+static const DrawTileSprites _depot_invisible_gfx_table[] = {
+ { {SPR_RAIL_TRACK_X, PAL_NONE}, _depot_gfx_NE },
+ { {SPR_RAIL_TRACK_Y, PAL_NONE}, _depot_gfx_SE },
+ { {SPR_RAIL_TRACK_X, PAL_NONE}, _depot_gfx_SW },
+ { {SPR_RAIL_TRACK_Y, PAL_NONE}, _depot_gfx_NW }
+};
static const DrawTileSeqStruct _waypoint_gfx_X[] = {
TILE_SEQ_LINE((1 << PALETTE_MODIFIER_COLOR) | SPR_WAYPOINT_X_1, 0, 0, 16, 5)
--- a/src/terraform_cmd.cpp Sun Apr 06 14:12:19 2008 +0000
+++ b/src/terraform_cmd.cpp Sun Apr 06 23:07:42 2008 +0000
@@ -35,8 +35,8 @@
};
struct TerraformerState {
- int modheight_count; ///< amount of entries in "modheight".
- int tile_table_count; ///< amount of entries in "tile_table".
+ int modheight_count; ///< amount of entries in "modheight".
+ int tile_table_count; ///< amount of entries in "tile_table".
/**
* Dirty tiles, i.e.\ at least one corner changed.
@@ -49,7 +49,7 @@
TerraformerHeightMod modheight[TERRAFORMER_MODHEIGHT_SIZE]; ///< Height modifications.
};
-TileIndex _terraform_err_tile;
+TileIndex _terraform_err_tile; ///< first tile we couldn't terraform
/**
* Gets the TileHeight (height of north corner) of a tile as of current terraforming progress.
@@ -58,12 +58,11 @@
* @param tile Tile.
* @return TileHeight.
*/
-static int TerraformGetHeightOfTile(TerraformerState *ts, TileIndex tile)
+static int TerraformGetHeightOfTile(const TerraformerState *ts, TileIndex tile)
{
- TerraformerHeightMod *mod = ts->modheight;
- int count;
+ const TerraformerHeightMod *mod = ts->modheight;
- for (count = ts->modheight_count; count != 0; count--, mod++) {
+ for (int count = ts->modheight_count; count != 0; count--, mod++) {
if (mod->tile == tile) return mod->height;
}
@@ -85,6 +84,7 @@
* But during house- or industry-construction multiple corners can be terraformed at once. */
TerraformerHeightMod *mod = ts->modheight;
int count = ts->modheight_count;
+
while ((count > 0) && (mod->tile != tile)) {
mod++;
count--;
@@ -110,12 +110,9 @@
*/
static void TerraformAddDirtyTile(TerraformerState *ts, TileIndex tile)
{
- int count;
- TileIndex *t;
+ int count = ts->tile_table_count;
- count = ts->tile_table_count;
-
- for (t = ts->tile_table; count != 0; count--, t++) {
+ for (TileIndex *t = ts->tile_table; count != 0; count--, t++) {
if (*t == tile) return;
}
@@ -149,8 +146,6 @@
*/
static CommandCost TerraformTileHeight(TerraformerState *ts, TileIndex tile, int height)
{
- CommandCost total_cost(EXPENSES_CONSTRUCTION);
-
assert(tile < MapSize());
/* Check range of destination height */
@@ -184,6 +179,8 @@
/* Store the height modification */
TerraformSetHeightOfTile(ts, tile, height);
+ CommandCost total_cost(EXPENSES_CONSTRUCTION);
+
/* Increment cost */
total_cost.AddCost(_price.terraform);
@@ -228,17 +225,17 @@
*/
CommandCost CmdTerraformLand(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
{
- TerraformerState ts;
+ /* Make an extra check for map-bounds cause we add tiles to the originating tile */
+ if (tile + TileDiffXY(1, 1) >= MapSize()) return CMD_ERROR;
+
+ _terraform_err_tile = INVALID_TILE;
+
CommandCost total_cost(EXPENSES_CONSTRUCTION);
int direction = (p2 != 0 ? 1 : -1);
-
- _terraform_err_tile = 0;
+ TerraformerState ts;
ts.modheight_count = ts.tile_table_count = 0;
- /* Make an extra check for map-bounds cause we add tiles to the originating tile */
- if (tile + TileDiffXY(1, 1) >= MapSize()) return CMD_ERROR;
-
/* Compute the costs and the terraforming result in a model of the landscape */
if ((p1 & SLOPE_W) != 0) {
TileIndex t = tile + TileDiffXY(1, 0);
@@ -270,10 +267,9 @@
/* Check if the terraforming is valid wrt. tunnels, bridges and objects on the surface */
{
- int count;
TileIndex *ti = ts.tile_table;
- for (count = ts.tile_table_count; count != 0; count--, ti++) {
+ for (int count = ts.tile_table_count; count != 0; count--, ti++) {
TileIndex tile = *ti;
/* Find new heights of tile corners */
@@ -287,11 +283,11 @@
uint z_max = max(max(z_N, z_W), max(z_S, z_E));
/* Compute tile slope */
- uint tileh = (z_max > z_min + 1 ? SLOPE_STEEP : SLOPE_FLAT);
- if (z_W > z_min) tileh += SLOPE_W;
- if (z_S > z_min) tileh += SLOPE_S;
- if (z_E > z_min) tileh += SLOPE_E;
- if (z_N > z_min) tileh += SLOPE_N;
+ Slope tileh = (z_max > z_min + 1 ? SLOPE_STEEP : SLOPE_FLAT);
+ if (z_W > z_min) tileh |= SLOPE_W;
+ if (z_S > z_min) tileh |= SLOPE_S;
+ if (z_E > z_min) tileh |= SLOPE_E;
+ if (z_N > z_min) tileh |= SLOPE_N;
/* Check if bridge would take damage */
if (direction == 1 && MayHaveBridgeAbove(tile) && IsBridgeAbove(tile) &&
@@ -305,7 +301,7 @@
return_cmd_error(STR_1002_EXCAVATION_WOULD_DAMAGE);
}
/* Check tiletype-specific things, and add extra-cost */
- CommandCost cost = _tile_type_procs[GetTileType(tile)]->terraform_tile_proc(tile, flags | DC_AUTO, z_min * TILE_HEIGHT, (Slope) tileh);
+ CommandCost cost = _tile_type_procs[GetTileType(tile)]->terraform_tile_proc(tile, flags | DC_AUTO, z_min * TILE_HEIGHT, tileh);
if (CmdFailed(cost)) {
_terraform_err_tile = tile;
return cost;
@@ -350,49 +346,41 @@
*/
CommandCost CmdLevelLand(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
{
- int size_x, size_y;
- int ex;
- int ey;
- int sx, sy;
- uint h, oldh, curh;
- CommandCost money;
- CommandCost ret;
- CommandCost cost(EXPENSES_CONSTRUCTION);
-
if (p1 >= MapSize()) return CMD_ERROR;
/* remember level height */
- oldh = TileHeight(p1);
+ uint oldh = TileHeight(p1);
/* compute new height */
- h = oldh + p2;
+ uint h = oldh + p2;
/* Check range of destination height */
if (h > MAX_TILE_HEIGHT) return_cmd_error((oldh == 0) ? STR_1003_ALREADY_AT_SEA_LEVEL : STR_1004_TOO_HIGH);
/* make sure sx,sy are smaller than ex,ey */
- ex = TileX(tile);
- ey = TileY(tile);
- sx = TileX(p1);
- sy = TileY(p1);
+ int ex = TileX(tile);
+ int ey = TileY(tile);
+ int sx = TileX(p1);
+ int sy = TileY(p1);
if (ex < sx) Swap(ex, sx);
if (ey < sy) Swap(ey, sy);
tile = TileXY(sx, sy);
- size_x = ex - sx + 1;
- size_y = ey - sy + 1;
+ int size_x = ex - sx + 1;
+ int size_y = ey - sy + 1;
- money.AddCost(GetAvailableMoneyForCommand());
+ Money money = GetAvailableMoneyForCommand();
+ CommandCost cost(EXPENSES_CONSTRUCTION);
BEGIN_TILE_LOOP(tile2, size_x, size_y, tile) {
- curh = TileHeight(tile2);
+ uint curh = TileHeight(tile2);
while (curh != h) {
- ret = DoCommand(tile2, SLOPE_N, (curh > h) ? 0 : 1, flags & ~DC_EXEC, CMD_TERRAFORM_LAND);
+ CommandCost ret = DoCommand(tile2, SLOPE_N, (curh > h) ? 0 : 1, flags & ~DC_EXEC, CMD_TERRAFORM_LAND);
if (CmdFailed(ret)) break;
if (flags & DC_EXEC) {
- money.AddCost(-ret.GetCost());
- if (money.GetCost() < 0) {
+ money -= ret.GetCost();
+ if (money < 0) {
_additional_cash_required = ret.GetCost();
return cost;
}
--- a/src/timetable_cmd.cpp Sun Apr 06 14:12:19 2008 +0000
+++ b/src/timetable_cmd.cpp Sun Apr 06 23:07:42 2008 +0000
@@ -24,7 +24,7 @@
order->wait_time = time;
}
- if (v->cur_order_index == order_number && HasBit(v->current_order.flags, OF_PART_OF_ORDERS)) {
+ if (v->cur_order_index == order_number && HasBit(v->current_order.GetDepotOrderType(), OF_PART_OF_ORDERS)) {
if (is_journey) {
v->current_order.travel_time = time;
} else {
@@ -69,8 +69,8 @@
bool packed_time = HasBit(p1, 25);
bool is_journey = HasBit(p1, 24) || packed_time;
if (!is_journey) {
- if (order->type != OT_GOTO_STATION) return_cmd_error(STR_TIMETABLE_ONLY_WAIT_AT_STATIONS);
- if (_patches.new_nonstop && (order->flags & OFB_NON_STOP)) return_cmd_error(STR_TIMETABLE_NOT_STOPPING_HERE);
+ if (!order->IsType(OT_GOTO_STATION)) return_cmd_error(STR_TIMETABLE_ONLY_WAIT_AT_STATIONS);
+ if (_patches.new_nonstop && (order->GetNonStopType() & OFB_NON_STOP)) return_cmd_error(STR_TIMETABLE_NOT_STOPPING_HERE);
}
if (flags & DC_EXEC) {
--- a/src/timetable_gui.cpp Sun Apr 06 14:12:19 2008 +0000
+++ b/src/timetable_gui.cpp Sun Apr 06 23:07:42 2008 +0000
@@ -79,7 +79,7 @@
w->EnableWidget(TTV_CLEAR_TIME);
} else {
const Order *order = GetVehicleOrder(v, (selected + 1) / 2);
- bool disable = order == NULL || order->type != OT_GOTO_STATION || (_patches.new_nonstop && (order->flags & OFB_NON_STOP));
+ bool disable = order == NULL || !order->IsType(OT_GOTO_STATION) || (_patches.new_nonstop && (order->GetNonStopType() & OFB_NON_STOP));
w->SetWidgetDisabledState(TTV_CHANGE_TIME, disable);
w->SetWidgetDisabledState(TTV_CLEAR_TIME, disable);
@@ -113,14 +113,14 @@
if (i % 2 == 0) {
SetDParam(2, STR_EMPTY);
- switch (order->type) {
+ switch (order->GetType()) {
case OT_DUMMY:
SetDParam(0, STR_INVALID_ORDER);
break;
case OT_GOTO_STATION:
- SetDParam(0, (order->flags & OFB_NON_STOP) ? STR_880A_GO_NON_STOP_TO : STR_8806_GO_TO);
- SetDParam(1, order->dest);
+ SetDParam(0, (order->GetNonStopType() & OFB_NON_STOP) ? STR_880A_GO_NON_STOP_TO : STR_8806_GO_TO);
+ SetDParam(1, order->GetDestination());
if (order->wait_time > 0) {
SetDParam(2, STR_TIMETABLE_STAY_FOR);
@@ -134,26 +134,26 @@
if (v->type == VEH_AIRCRAFT) {
string = STR_GO_TO_AIRPORT_HANGAR;
- SetDParam(1, order->dest);
+ SetDParam(1, order->GetDestination());
} else {
- SetDParam(1, GetDepot(order->dest)->town_index);
+ SetDParam(1, GetDepot(order->GetDestination())->town_index);
switch (v->type) {
- case VEH_TRAIN: string = (order->flags & OFB_NON_STOP) ? STR_880F_GO_NON_STOP_TO_TRAIN_DEPOT : STR_GO_TO_TRAIN_DEPOT; break;
+ case VEH_TRAIN: string = (order->GetNonStopType() & OFB_NON_STOP) ? STR_880F_GO_NON_STOP_TO_TRAIN_DEPOT : STR_GO_TO_TRAIN_DEPOT; break;
case VEH_ROAD: string = STR_GO_TO_ROADVEH_DEPOT; break;
case VEH_SHIP: string = STR_GO_TO_SHIP_DEPOT; break;
default: break;
}
}
- if (order->flags & OFB_FULL_LOAD) string++; // Service at orders
+ if (order->GetDepotOrderType() & OFB_SERVICE_IF_NEEDED) string++; /* service at */
SetDParam(0, string);
} break;
case OT_GOTO_WAYPOINT:
- SetDParam(0, (order->flags & OFB_NON_STOP) ? STR_GO_NON_STOP_TO_WAYPOINT : STR_GO_TO_WAYPOINT);
- SetDParam(1, order->dest);
+ SetDParam(0, (order->GetNonStopType() & OFB_NON_STOP) ? STR_GO_NON_STOP_TO_WAYPOINT : STR_GO_TO_WAYPOINT);
+ SetDParam(1, order->GetDestination());
break;
default: break;
@@ -197,7 +197,7 @@
for (const Order *order = GetVehicleOrder(v, 0); order != NULL; order = order->next) {
total_time += order->travel_time + order->wait_time;
if (order->travel_time == 0) complete = false;
- if (order->wait_time == 0 && order->type == OT_GOTO_STATION && !(_patches.new_nonstop && (order->flags & OFB_NON_STOP))) complete = false;
+ if (order->wait_time == 0 && order->IsType(OT_GOTO_STATION) && !(_patches.new_nonstop && (order->GetNonStopType() & OFB_NON_STOP))) complete = false;
}
if (total_time != 0) {
--- a/src/town.h Sun Apr 06 14:12:19 2008 +0000
+++ b/src/town.h Sun Apr 06 23:07:42 2008 +0000
@@ -6,6 +6,7 @@
#define TOWN_H
#include "oldpool.h"
+#include "core/bitmath_func.hpp"
#include "core/random_func.hpp"
#include "cargo_type.h"
#include "tile_type.h"
@@ -13,6 +14,7 @@
#include "town_type.h"
#include "player_type.h"
#include "newgrf_string_type.h"
+#include "settings_type.h"
enum {
HOUSE_NO_CLASS = 0,
@@ -45,12 +47,17 @@
DECLARE_ENUM_AS_BIT_SET(BuildingFlags)
enum HouseZonesBits {
+ HZB_BEGIN = 0,
HZB_TOWN_EDGE = 0,
HZB_TOWN_OUTSKIRT,
HZB_TOWN_OUTER_SUBURB,
HZB_TOWN_INNER_SUBURB,
HZB_TOWN_CENTRE,
+ HZB_END,
};
+assert_compile(HZB_END == 5);
+
+DECLARE_POSTFIX_INCREMENT(HouseZonesBits)
enum HouseZones { ///< Bit Value Meaning
HZ_NOZNS = 0x0000, ///< 0 This is just to get rid of zeros, meaning none
@@ -156,11 +163,14 @@
bool larger_town;
/* NOSAVE: UpdateTownRadius updates this given the house count. */
- uint16 radius[5];
+ uint16 radius[HZB_END];
/* NOSAVE: The number of each type of building in the town. */
BuildingCounts building_counts;
+ /* NOSAVE: The town specific road layout */
+ TownLayout layout;
+
/**
* Creates a new town
*/
@@ -170,8 +180,21 @@
~Town();
inline bool IsValid() const { return this->xy != 0; }
+
+ void InitializeLayout();
+
+ inline TownLayout GetActiveLayout() const;
};
+/**
+ * Get the current valid layout for the town
+ * @return the active layout for this town
+ */
+inline TownLayout Town::GetActiveLayout() const
+{
+ return (_patches.town_layout == TL_RANDOM) ? this->layout : _patches.town_layout;
+}
+
struct HouseSpec {
/* Standard properties */
Year min_date; ///< introduction year of the house
@@ -314,7 +337,6 @@
extern Town *_cleared_town;
extern int _cleared_town_rating;
-uint OriginalTileRandomiser(uint x, uint y);
void ResetHouses();
void ClearTownHouse(Town *t, TileIndex tile);
@@ -327,4 +349,34 @@
HouseZonesBits GetTownRadiusGroup(const Town* t, TileIndex tile);
void SetTownRatingTestMode(bool mode);
+/**
+ * Calculate a hash value from a tile position
+ *
+ * @param x The X coordinate
+ * @param y The Y coordinate
+ * @return The hash of the tile
+ */
+static inline uint TileHash(uint x, uint y)
+{
+ uint hash = x >> 4;
+ hash ^= x >> 6;
+ hash ^= y >> 4;
+ hash -= y >> 6;
+ return hash;
+}
+
+/**
+ * Get the last two bits of the TileHash
+ * from a tile position.
+ *
+ * @see TileHash()
+ * @param x The X coordinate
+ * @param y The Y coordinate
+ * @return The last two bits from hash of the tile
+ */
+static inline uint TileHash2Bit(uint x, uint y)
+{
+ return GB(TileHash(x, y), 0, 2);
+}
+
#endif /* TOWN_H */
--- a/src/town_cmd.cpp Sun Apr 06 14:12:19 2008 +0000
+++ b/src/town_cmd.cpp Sun Apr 06 23:07:42 2008 +0000
@@ -107,6 +107,23 @@
this->xy = 0;
}
+/**
+ * Generate a random town road layout.
+ *
+ * The layout is based on the TileHash.
+ */
+void Town::InitializeLayout()
+{
+ this->layout = (TownLayout)(TileHash(TileX(this->xy), TileY(this->xy)) % NUM_TLS);
+
+ /* Set invalid layouts to valid ones */
+ switch (this->layout) {
+ default: break;
+ case TL_RANDOM: this->layout = TL_ORIGINAL; break;
+ case TL_NO_ROADS: this->layout = TL_BETTER_ROADS; break;
+ }
+}
+
// Local
static int _grow_town_result;
@@ -125,21 +142,10 @@
}
typedef void TownDrawTileProc(const TileInfo *ti);
-static TownDrawTileProc * const _town_draw_tile_procs[1] = {
+static TownDrawTileProc *const _town_draw_tile_procs[1] = {
TownDrawHouseLift
};
-uint OriginalTileRandomiser(uint x, uint y)
-{
- uint variant;
- variant = x >> 4;
- variant ^= x >> 6;
- variant ^= y >> 4;
- variant -= y >> 6;
- variant &= 3;
- return variant;
-}
-
/**
* Return a random direction
*
@@ -157,9 +163,6 @@
*/
static void DrawTile_Town(TileInfo *ti)
{
- const DrawBuildingsTileStruct *dcts;
- SpriteID image;
- SpriteID pal;
HouseID house_id = GetHouseType(ti->tile);
if (house_id >= NEW_HOUSE_OFFSET) {
@@ -175,16 +178,17 @@
}
/* Retrieve pointer to the draw town tile struct */
- dcts = &_town_draw_tile_data[house_id << 4 | OriginalTileRandomiser(ti->x, ti->y) << 2 | GetHouseBuildingStage(ti->tile)];
+ const DrawBuildingsTileStruct *dcts = &_town_draw_tile_data[house_id << 4 | TileHash2Bit(ti->x, ti->y) << 2 | GetHouseBuildingStage(ti->tile)];
if (ti->tileh != SLOPE_FLAT) DrawFoundation(ti, FOUNDATION_LEVELED);
- image = dcts->ground.sprite;
- pal = dcts->ground.pal;
- DrawGroundSprite(image, pal);
+ DrawGroundSprite(dcts->ground.sprite, dcts->ground.pal);
+
+ /* If houses are invisible, do not draw the upper part */
+ if (IsInvisibilitySet(TO_HOUSES)) return;
/* Add a house on top of the ground? */
- image = dcts->building.sprite;
+ SpriteID image = dcts->building.sprite;
if (image != 0) {
AddSortableSpriteToDraw(image, dcts->building.pal,
ti->x + dcts->subtile_x,
@@ -224,8 +228,6 @@
*/
static void AnimateTile_Town(TileIndex tile)
{
- int pos, dest;
-
if (GetHouseType(tile) >= NEW_HOUSE_OFFSET) {
AnimateNewHouseTile(tile);
return;
@@ -243,21 +245,21 @@
}
if (!LiftHasDestination(tile)) {
- int i;
-
- /* Building has 6 floors, number 0 .. 6, where 1 is illegal.
- * This is due to the fact that the first floor is, in the graphics,
+ uint i;
+
+ /* Building has 6 floors, number 0 .. 6, where 1 is illegal.
+ * This is due to the fact that the first floor is, in the graphics,
* the height of 2 'normal' floors.
- * Furthermore, there are 6 lift positions from floor N (incl) to floor N + 1 (excl) */
+ * Furthermore, there are 6 lift positions from floor N (incl) to floor N + 1 (excl) */
do {
- i = (Random() & 7) - 1;
- } while (i < 0 || i == 1 || i * 6 == GetLiftPosition(tile));
+ i = RandomRange(7);
+ } while (i == 1 || i * 6 == GetLiftPosition(tile));
SetLiftDestination(tile, i);
}
- pos = GetLiftPosition(tile);
- dest = GetLiftDestination(tile) * 6;
+ int pos = GetLiftPosition(tile);
+ int dest = GetLiftDestination(tile) * 6;
pos += (pos < dest) ? 1 : -1;
SetLiftPosition(tile, pos);
@@ -274,7 +276,7 @@
*/
static bool IsCloseToTown(TileIndex tile, uint dist)
{
- const Town* t;
+ const Town *t;
FOR_ALL_TOWNS(t) {
if (DistanceManhattan(tile, t->xy) < dist) return true;
@@ -307,10 +309,8 @@
*/
void UpdateTownVirtCoord(Town *t)
{
- Point pt;
-
MarkTownSignDirty(t);
- pt = RemapCoords2(TileX(t->xy) * TILE_SIZE, TileY(t->xy) * TILE_SIZE);
+ Point pt = RemapCoords2(TileX(t->xy) * TILE_SIZE, TileY(t->xy) * TILE_SIZE);
SetDParam(0, t->index);
SetDParam(1, t->population);
UpdateViewportSignPos(&t->sign, pt.x, pt.y - 24,
@@ -348,10 +348,9 @@
*/
uint32 GetWorldPopulation()
{
- uint32 pop;
- const Town* t;
-
- pop = 0;
+ uint32 pop = 0;
+ const Town *t;
+
FOR_ALL_TOWNS(t) pop += t->population;
return pop;
}
@@ -403,10 +402,7 @@
*/
static void TileLoop_Town(TileIndex tile)
{
- Town *t;
- uint32 r;
HouseID house_id = GetHouseType(tile);
- HouseSpec *hs = GetHouseSpecs(house_id);
/* NewHouseTileLoop returns false if Callback 21 succeeded, i.e. the house
* doesn't exist any more, so don't continue here. */
@@ -418,16 +414,18 @@
return;
}
+ const HouseSpec *hs = GetHouseSpecs(house_id);
+
/* If the lift has a destination, it is already an animated tile. */
if ((hs->building_flags & BUILDING_IS_ANIMATED) &&
house_id < NEW_HOUSE_OFFSET &&
!LiftHasDestination(tile) &&
- Chance16(1, 2))
+ Chance16(1, 2)) {
AddAnimatedTile(tile);
-
- t = GetTownByTile(tile);
-
- r = Random();
+ }
+
+ Town *t = GetTownByTile(tile);
+ uint32 r = Random();
if (HasBit(hs->callback_mask, CBM_HOUSE_PRODUCE_CARGO)) {
for (uint i = 0; i < 256; i++) {
@@ -460,22 +458,18 @@
} else {
if (GB(r, 0, 8) < hs->population) {
uint amt = GB(r, 0, 8) / 8 + 1;
- uint moved;
if (_economy.fluct <= 0) amt = (amt + 1) >> 1;
t->new_max_pass += amt;
- moved = MoveGoodsToStation(tile, 1, 1, CT_PASSENGERS, amt);
- t->new_act_pass += moved;
+ t->new_act_pass += MoveGoodsToStation(tile, 1, 1, CT_PASSENGERS, amt);
}
if (GB(r, 8, 8) < hs->mail_generation) {
uint amt = GB(r, 8, 8) / 8 + 1;
- uint moved;
if (_economy.fluct <= 0) amt = (amt + 1) >> 1;
t->new_max_mail += amt;
- moved = MoveGoodsToStation(tile, 1, 1, CT_MAIL, amt);
- t->new_act_mail += moved;
+ t->new_act_mail += MoveGoodsToStation(tile, 1, 1, CT_MAIL, amt);
}
}
@@ -508,19 +502,17 @@
static CommandCost ClearTile_Town(TileIndex tile, byte flags)
{
- int rating;
- CommandCost cost(EXPENSES_CONSTRUCTION);
- Town *t;
- HouseSpec *hs = GetHouseSpecs(GetHouseType(tile));
-
if (flags & DC_AUTO) return_cmd_error(STR_2004_BUILDING_MUST_BE_DEMOLISHED);
if (!CanDeleteHouse(tile)) return CMD_ERROR;
+ const HouseSpec *hs = GetHouseSpecs(GetHouseType(tile));
+
+ CommandCost cost(EXPENSES_CONSTRUCTION);
cost.AddCost(_price.remove_house * hs->removal_cost >> 8);
- rating = hs->remove_rating_decrease;
+ int rating = hs->remove_rating_decrease;
_cleared_town_rating += rating;
- _cleared_town = t = GetTownByTile(tile);
+ Town *t = _cleared_town = GetTownByTile(tile);
if (IsValidPlayer(_current_player)) {
if (rating > t->ratings[_current_player] && !(flags & DC_NO_TOWN_RATING) && !_cheats.magic_bulldozer.value) {
@@ -537,9 +529,36 @@
return cost;
}
+static void GetProducedCargo_Town(TileIndex tile, CargoID *b)
+{
+ HouseID house_id = GetHouseType(tile);
+ const HouseSpec *hs = GetHouseSpecs(house_id);
+ Town *t = GetTownByTile(tile);
+
+ if (HasBit(hs->callback_mask, CBM_HOUSE_PRODUCE_CARGO)) {
+ for (uint i = 0; i < 256; i++) {
+ uint16 callback = GetHouseCallback(CBID_HOUSE_PRODUCE_CARGO, i, 0, house_id, t, tile);
+
+ if (callback == CALLBACK_FAILED || callback == CALLBACK_HOUSEPRODCARGO_END) break;
+
+ CargoID cargo = GetCargoTranslation(GB(callback, 8, 7), hs->grffile);
+
+ if (cargo == CT_INVALID) continue;
+ *(b++) = cargo;
+ }
+ } else {
+ if (hs->population > 0) {
+ *(b++) = CT_PASSENGERS;
+ }
+ if (hs->mail_generation > 0) {
+ *(b++) = CT_MAIL;
+ }
+ }
+}
+
static void GetAcceptedCargo_Town(TileIndex tile, AcceptedCargo ac)
{
- HouseSpec *hs = GetHouseSpecs(GetHouseType(tile));
+ const HouseSpec *hs = GetHouseSpecs(GetHouseType(tile));
CargoID accepts[3];
/* Set the initial accepted cargo types */
@@ -702,11 +721,12 @@
/**
* Check if a Road is allowed on a given tile
*
+ * @param t The current town
* @param tile The target tile
* @param dir The direction in which we want to extend the town
* @return true if it is allowed else false
*/
-static bool IsRoadAllowedHere(TileIndex tile, DiagDirection dir)
+static bool IsRoadAllowedHere(Town *t, TileIndex tile, DiagDirection dir)
{
if (TileX(tile) < 2 || TileX(tile) >= MapMaxX() || TileY(tile) < 2 || TileY(tile) >= MapMaxY()) return false;
@@ -727,7 +747,7 @@
if (cur_slope == SLOPE_FLAT) {
no_slope:
/* Tile has no slope */
- switch (_patches.town_layout) {
+ switch (t->GetActiveLayout()) {
default: NOT_REACHED();
case TL_ORIGINAL: // Disallow the road if any neighboring tile has a road (distance: 1)
@@ -762,25 +782,21 @@
static bool TerraformTownTile(TileIndex tile, int edges, int dir)
{
- CommandCost r;
-
TILE_ASSERT(tile);
- r = DoCommand(tile, edges, dir, DC_AUTO | DC_NO_WATER, CMD_TERRAFORM_LAND);
- if (CmdFailed(r) || r.GetCost() >= 126 * 16) return false;
+ CommandCost r = DoCommand(tile, edges, dir, DC_AUTO | DC_NO_WATER, CMD_TERRAFORM_LAND);
+ if (CmdFailed(r) || r.GetCost() >= (_price.terraform + 2) * 8) return false;
DoCommand(tile, edges, dir, DC_AUTO | DC_NO_WATER | DC_EXEC, CMD_TERRAFORM_LAND);
return true;
}
static void LevelTownLand(TileIndex tile)
{
- Slope tileh;
-
TILE_ASSERT(tile);
/* Don't terraform if land is plain or if there's a house there. */
if (IsTileType(tile, MP_HOUSE)) return;
- tileh = GetTileSlope(tile, NULL);
+ Slope tileh = GetTileSlope(tile, NULL);
if (tileh == SLOPE_FLAT) return;
/* First try up, then down */
@@ -798,13 +814,13 @@
* @return the RoadBit of the current tile regarding
* the selected town layout
*/
-static RoadBits GetTownRoadGridElement(Town* t, TileIndex tile, DiagDirection dir)
+static RoadBits GetTownRoadGridElement(Town *t, TileIndex tile, DiagDirection dir)
{
/* align the grid to the downtown */
TileIndexDiffC grid_pos = TileIndexToTileIndexDiffC(t->xy, tile); // Vector from downtown to the tile
RoadBits rcmd = ROAD_NONE;
- switch (_patches.town_layout) {
+ switch (t->GetActiveLayout()) {
default: NOT_REACHED();
case TL_2X2_GRID:
@@ -987,7 +1003,7 @@
LevelTownLand(tile);
/* Is a road allowed here? */
- switch (_patches.town_layout) {
+ switch (t1->GetActiveLayout()) {
default: NOT_REACHED();
case TL_NO_ROADS: /* Disallow Roads */
@@ -1001,7 +1017,7 @@
case TL_BETTER_ROADS:
case TL_ORIGINAL:
- if (!IsRoadAllowedHere(tile, target_dir)) return;
+ if (!IsRoadAllowedHere(t1, tile, target_dir)) return;
DiagDirection source_dir = ReverseDiagDir(target_dir);
@@ -1010,7 +1026,7 @@
do target_dir = RandomDiagDir(); while (target_dir == source_dir);
}
- if (!IsRoadAllowedHere(TileAddByDiagDir(tile, target_dir), target_dir)) {
+ if (!IsRoadAllowedHere(t1, TileAddByDiagDir(tile, target_dir), target_dir)) {
/* A road is not allowed to continue the randomized road,
* return if the road we're trying to build is curved. */
if (target_dir != ReverseDiagDir(source_dir)) return;
@@ -1035,7 +1051,7 @@
* the fitting RoadBits */
_grow_town_result = GROWTH_SEARCH_STOPPED;
- switch (_patches.town_layout) {
+ switch (t1->GetActiveLayout()) {
default: NOT_REACHED();
case TL_NO_ROADS: /* Disallow Roads */
@@ -1073,7 +1089,7 @@
/* Don't walk into water. */
if (IsWaterTile(house_tile)) return;
- switch (_patches.town_layout) {
+ switch (t1->GetActiveLayout()) {
default: NOT_REACHED();
case TL_NO_ROADS:
@@ -1097,7 +1113,7 @@
/* Allow a house at the edge. 60% chance or
* always ok if no road allowed. */
rcmd = DiagDirToRoadBits(target_dir);
- allow_house = (!IsRoadAllowedHere(house_tile, target_dir) || Chance16(6, 10));
+ allow_house = (!IsRoadAllowedHere(t1, house_tile, target_dir) || Chance16(6, 10));
break;
}
@@ -1151,7 +1167,7 @@
/* Number of times to search.
* Better roads, 2X2 and 3X3 grid grow quite fast so we give
* them a little handicap. */
- switch (_patches.town_layout) {
+ switch (t->GetActiveLayout()) {
case TL_BETTER_ROADS:
_grow_town_result = 10 + t->num_houses * 2 / 9;
break;
@@ -1218,10 +1234,11 @@
}
/** Grow the town
- * @Return true if a house was built, or no if the build failed. */
+ * @param t town to grow
+ * @return true iff a house was built
+ */
static bool GrowTown(Town *t)
{
-
/* Let the town be a ghost town
* The player wanted it in such a way. Thus there he has it. ;)
* Never reached in editor mode. */
@@ -1244,7 +1261,6 @@
{ 2, -2},
{ 0, 0}
};
- const TileIndexDiffC *ptr;
/* Current player is a town */
PlayerID old_player = _current_player;
@@ -1253,6 +1269,7 @@
TileIndex tile = t->xy; // The tile we are working with ATM
/* Find a road that we can base the construction on. */
+ const TileIndexDiffC *ptr;
for (ptr = _town_coord_mod; ptr != endof(_town_coord_mod); ++ptr) {
if (GetTownRoadBits(tile) != ROAD_NONE) {
int r = GrowTownAtRoad(t, tile);
@@ -1343,7 +1360,7 @@
uint32 grfid = grf ? GetGRFTownNameId(_opt.town_name - _nb_orig_names) : 0;
uint16 townnametype = grf ? GetGRFTownNameType(_opt.town_name - _nb_orig_names) : SPECSTR_TOWNNAME_START + _opt.town_name;
- assert(townnameparts);
+ assert(townnameparts != NULL);
for (;;) {
restart:
@@ -1392,7 +1409,6 @@
static void DoCreateTown(Town *t, TileIndex tile, uint32 townnameparts, TownSizeMode size_mode, uint size)
{
extern int _nb_orig_names;
- int x, i;
t->xy = tile;
t->num_houses = 0;
@@ -1419,8 +1435,7 @@
t->act_food = 0;
t->act_water = 0;
- for (i = 0; i != MAX_PLAYERS; i++)
- t->ratings[i] = 500;
+ for (uint i = 0; i != MAX_PLAYERS; i++) t->ratings[i] = RATING_INITIAL;
t->have_ratings = 0;
t->exclusivity = INVALID_PLAYER;
@@ -1441,8 +1456,10 @@
UpdateTownVirtCoord(t);
_town_sort_dirty = true;
+ t->InitializeLayout();
+
/* Random town size. */
- x = (Random() & 0xF) + 8;
+ int x = (Random() & 0xF) + 8;
switch (size_mode) {
default: NOT_REACHED();
@@ -1465,7 +1482,7 @@
t->num_houses += x;
UpdateTownRadius(t);
- i = x * 4;
+ int i = x * 4;
do {
GrowTown(t);
} while (--i);
@@ -1485,8 +1502,6 @@
*/
CommandCost CmdBuildTown(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
{
- uint32 townnameparts;
-
/* Only in the scenario editor */
if (_game_mode != GM_EDITOR) return CMD_ERROR;
if (p2 > TSM_CITY) return CMD_ERROR;
@@ -1504,6 +1519,8 @@
if (IsCloseToTown(tile, 20))
return_cmd_error(STR_0238_TOO_CLOSE_TO_ANOTHER_TOWN);
+ uint32 townnameparts;
+
/* Get a unique name for the town. */
if (!CreateTownName(&townnameparts))
return_cmd_error(STR_023A_TOO_MANY_TOWNS);
@@ -1525,13 +1542,9 @@
Town *CreateRandomTown(uint attempts, TownSizeMode mode, uint size)
{
- TileIndex tile;
- Town *t;
- uint32 townnameparts;
-
do {
/* Generate a tile index not too close from the edge */
- tile = RandomTile();
+ TileIndex tile = RandomTile();
if (DistanceFromEdge(tile) < 20) continue;
/* Make sure the tile is plain */
@@ -1540,16 +1553,19 @@
/* Check not too close to a town */
if (IsCloseToTown(tile, 20)) continue;
+ uint32 townnameparts;
+
/* Get a unique name for the town. */
if (!CreateTownName(&townnameparts)) break;
/* Allocate a town struct */
- t = new Town(tile);
+ Town *t = new Town(tile);
if (t == NULL) break;
DoCreateTown(t, tile, townnameparts, mode, size);
return t;
- } while (--attempts);
+ } while (--attempts != 0);
+
return NULL;
}
@@ -1590,17 +1606,15 @@
* @param tile TileIndex where radius needs to be found
* @return the bit position of the given zone, as defined in HouseZones
*/
-HouseZonesBits GetTownRadiusGroup(const Town* t, TileIndex tile)
+HouseZonesBits GetTownRadiusGroup(const Town *t, TileIndex tile)
{
uint dist = DistanceSquare(tile, t->xy);
- HouseZonesBits smallest;
- uint i;
if (t->fund_buildings_months && dist <= 25) return HZB_TOWN_CENTRE;
- smallest = HZB_TOWN_EDGE;
- for (i = 0; i != lengthof(t->radius); i++) {
- if (dist < t->radius[i]) smallest = (HouseZonesBits)i;
+ HouseZonesBits smallest = HZB_TOWN_EDGE;
+ for (HouseZonesBits i = HZB_BEGIN; i < HZB_END; i++) {
+ if (dist < t->radius[i]) smallest = i;
}
return smallest;
@@ -1730,7 +1744,7 @@
{
TileIndexDiffC grid_pos = TileIndexToTileIndexDiffC(t->xy, tile);
- switch (_patches.town_layout) {
+ switch (t->GetActiveLayout()) {
case TL_2X2_GRID:
if ((grid_pos.x % 3) == 0 || (grid_pos.y % 3) == 0) return false;
break;
@@ -1761,7 +1775,7 @@
uint dx = MapSize() + TileX(t->xy) - TileX(tile);
uint dy = MapSize() + TileY(t->xy) - TileY(tile);
- switch (_patches.town_layout) {
+ switch (t->GetActiveLayout()) {
case TL_2X2_GRID:
if ((dx % 3) != 0 || (dy % 3) != 0) return false;
break;
@@ -1866,7 +1880,7 @@
/* Generate a list of all possible houses that can be built. */
for (uint i = 0; i < HOUSE_MAX; i++) {
- HouseSpec *hs = GetHouseSpecs(i);
+ const HouseSpec *hs = GetHouseSpecs(i);
/* Verify that the candidate house spec matches the current tile status */
if ((~hs->building_availability & bitmask) == 0 && hs->enabled) {
/* Without NewHouses, all houses have probability '1' */
@@ -1895,7 +1909,7 @@
houses[i] = houses[num];
probs[i] = probs[num];
- HouseSpec *hs = GetHouseSpecs(house);
+ const HouseSpec *hs = GetHouseSpecs(house);
if (_loaded_newgrf_features.has_newhouses) {
if (hs->override != 0) {
@@ -1979,11 +1993,9 @@
void ClearTownHouse(Town *t, TileIndex tile)
{
+ assert(IsTileType(tile, MP_HOUSE));
+
HouseID house = GetHouseType(tile);
- uint eflags;
- HouseSpec *hs;
-
- assert(IsTileType(tile, MP_HOUSE));
/* need to align the tile to point to the upper left corner of the house */
if (house >= 3) { // house id 0,1,2 MUST be single tile houses, or this code breaks.
@@ -2002,7 +2014,7 @@
}
}
- hs = GetHouseSpecs(house);
+ const HouseSpec *hs = GetHouseSpecs(house);
/* Remove population from the town if the house is finished. */
if (IsHouseCompleted(tile)) {
@@ -2020,7 +2032,7 @@
}
/* Do the actual clearing of tiles */
- eflags = hs->building_flags;
+ uint eflags = hs->building_flags;
DoClearTownHouseHelper(tile);
if (eflags & BUILDING_2_TILES_X) DoClearTownHouseHelper(tile + TileDiffXY(1, 0));
if (eflags & BUILDING_2_TILES_Y) DoClearTownHouseHelper(tile + TileDiffXY(0, 1));
@@ -2049,15 +2061,13 @@
*/
CommandCost CmdRenameTown(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
{
- Town *t;
-
if (!IsValidTownID(p1) || StrEmpty(_cmd_text)) return CMD_ERROR;
- t = GetTown(p1);
-
if (!IsUniqueTownName(_cmd_text)) return_cmd_error(STR_NAME_MUST_BE_UNIQUE);
if (flags & DC_EXEC) {
+ Town *t = GetTown(p1);
+
free(t->name);
t->name = strdup(_cmd_text);
@@ -2073,16 +2083,14 @@
/** Called from GUI */
void ExpandTown(Town *t)
{
- uint amount, n;
-
_generating_world = true;
/* The more houses, the faster we grow */
- amount = RandomRange(ClampToU16(t->num_houses / 10)) + 3;
+ uint amount = RandomRange(ClampToU16(t->num_houses / 10)) + 3;
t->num_houses += amount;
UpdateTownRadius(t);
- n = amount * 10;
+ uint n = amount * 10;
do GrowTown(t); while (--n);
t->num_houses -= amount;
@@ -2096,22 +2104,22 @@
2, 4, 9, 35, 48, 53, 117, 175
};
-static void TownActionAdvertiseSmall(Town* t)
+static void TownActionAdvertiseSmall(Town *t)
{
ModifyStationRatingAround(t->xy, _current_player, 0x40, 10);
}
-static void TownActionAdvertiseMedium(Town* t)
+static void TownActionAdvertiseMedium(Town *t)
{
ModifyStationRatingAround(t->xy, _current_player, 0x70, 15);
}
-static void TownActionAdvertiseLarge(Town* t)
+static void TownActionAdvertiseLarge(Town *t)
{
ModifyStationRatingAround(t->xy, _current_player, 0xA0, 20);
}
-static void TownActionRoadRebuild(Town* t)
+static void TownActionRoadRebuild(Town *t)
{
t->road_build_months = 6;
@@ -2124,9 +2132,6 @@
static bool DoBuildStatueOfCompany(TileIndex tile, TownID town_id)
{
- PlayerID old;
- CommandCost r;
-
/* Statues can be build on slopes, just like houses. Only the steep slopes is a no go. */
if (IsSteepSlope(GetTileSlope(tile, NULL))) return false;
@@ -2136,9 +2141,9 @@
return false;
}
- old = _current_player;
+ PlayerID old = _current_player;
_current_player = OWNER_NONE;
- r = DoCommand(tile, 0, 0, DC_EXEC, CMD_LANDSCAPE_CLEAR);
+ CommandCost r = DoCommand(tile, 0, 0, DC_EXEC, CMD_LANDSCAPE_CLEAR);
_current_player = old;
if (CmdFailed(r)) return false;
@@ -2165,15 +2170,16 @@
* in order to find a free tile to place a statue
* @param t town to search in
*/
-static void TownActionBuildStatue(Town* t)
+static void TownActionBuildStatue(Town *t)
{
TileIndex tile = t->xy;
- if (CircularTileSearch(tile, 9, SearchTileForStatue, t->index))
+ if (CircularTileSearch(tile, 9, SearchTileForStatue, t->index)) {
SetBit(t->statues, _current_player); // Once found and built, "inform" the Town
+ }
}
-static void TownActionFundBuildings(Town* t)
+static void TownActionFundBuildings(Town *t)
{
/* Build next tick */
t->grow_counter = 1;
@@ -2183,7 +2189,7 @@
t->fund_buildings_months = 3;
}
-static void TownActionBuyRights(Town* t)
+static void TownActionBuyRights(Town *t)
{
/* Check if it's allowed to by the rights */
if (!_patches.exclusive_rights) return;
@@ -2194,15 +2200,14 @@
ModifyStationRatingAround(t->xy, _current_player, 130, 17);
}
-static void TownActionBribe(Town* t)
+static void TownActionBribe(Town *t)
{
- if (!RandomRange(15)) {
- Station *st;
-
+ if (Chance16(1, 14)) {
/* set as unwanted for 6 months */
t->unwanted[_current_player] = 6;
/* set all close by station ratings to 0 */
+ Station *st;
FOR_ALL_STATIONS(st) {
if (st->town == t && st->owner == _current_player) {
for (CargoID i = 0; i < NUM_CARGO; i++) st->goods[i].rating = 0;
@@ -2225,8 +2230,8 @@
}
}
-typedef void TownActionProc(Town* t);
-static TownActionProc * const _town_action_proc[] = {
+typedef void TownActionProc(Town *t);
+static TownActionProc *const _town_action_proc[] = {
TownActionAdvertiseSmall,
TownActionAdvertiseMedium,
TownActionAdvertiseLarge,
@@ -2249,11 +2254,9 @@
*/
CommandCost CmdDoTownAction(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
{
- Town *t;
-
if (!IsValidTownID(p1) || p2 > lengthof(_town_action_proc)) return CMD_ERROR;
- t = GetTown(p1);
+ Town *t = GetTown(p1);
if (!HasBit(GetMaskOfTownActions(NULL, _current_player, t), p2)) return CMD_ERROR;
@@ -2269,32 +2272,39 @@
static void UpdateTownGrowRate(Town *t)
{
- int n;
- Station *st;
- uint16 m;
- Player *p;
-
- /* Reset player ratings if they're low */
+ /* Increase player ratings if they're low */
+ const Player *p;
FOR_ALL_PLAYERS(p) {
- if (p->is_active && t->ratings[p->index] <= 200) {
- t->ratings[p->index] += 5;
+ if (p->is_active) {
+ t->ratings[p->index] = min((int)RATING_GROWTH_MAXIMUM, t->ratings[p->index] + RATING_GROWTH_UP_STEP);
}
}
- n = 0;
+ int n = 0;
+
+ const Station *st;
FOR_ALL_STATIONS(st) {
if (DistanceSquare(st->xy, t->xy) <= t->radius[0]) {
if (st->time_since_load <= 20 || st->time_since_unload <= 20) {
n++;
- if (IsValidPlayer(st->owner) && t->ratings[st->owner] <= 1000-12)
- t->ratings[st->owner] += 12;
+ if (IsValidPlayer(st->owner)) {
+ int new_rating = t->ratings[st->owner] + RATING_STATION_UP_STEP;
+ t->ratings[st->owner] = min(new_rating, INT16_MAX); // do not let it overflow
+ }
} else {
- if (IsValidPlayer(st->owner) && t->ratings[st->owner] >= -1000+15)
- t->ratings[st->owner] -= 15;
+ if (IsValidPlayer(st->owner)) {
+ int new_rating = t->ratings[st->owner] + RATING_STATION_DOWN_STEP;
+ t->ratings[st->owner] = max(new_rating, INT16_MIN);
+ }
}
}
}
+ /* clamp all ratings to valid values */
+ for (uint i = 0; i < MAX_PLAYERS; i++) {
+ t->ratings[i] = Clamp(t->ratings[i], RATING_MINIMUM, RATING_MAXIMUM);
+ }
+
ClrBit(t->flags12, TOWN_IS_FUNDED);
if (_patches.town_growth_rate == 0 && t->fund_buildings_months == 0) return;
@@ -2305,6 +2315,8 @@
{ 320, 420, 300, 220, 160, 100 } // Normal values
};
+ uint16 m;
+
if (t->fund_buildings_months != 0) {
m = _grow_count_values[0][min(n, 5)];
t->fund_buildings_months--;
@@ -2355,7 +2367,7 @@
static void UpdateTownUnwanted(Town *t)
{
- const Player* p;
+ const Player *p;
FOR_ALL_PLAYERS(p) {
if (t->unwanted[p->index] > 0) t->unwanted[p->index]--;
@@ -2364,14 +2376,12 @@
bool CheckIfAuthorityAllows(TileIndex tile)
{
- Town *t;
-
if (!IsValidPlayer(_current_player)) return true;
- t = ClosestTownFromTile(tile, _patches.dist_local_authority);
+ Town *t = ClosestTownFromTile(tile, _patches.dist_local_authority);
if (t == NULL) return true;
- if (t->ratings[_current_player] > -200) return true;
+ if (t->ratings[_current_player] > RATING_VERYPOOR) return true;
_error_message = STR_2009_LOCAL_AUTHORITY_REFUSES;
SetDParam(0, t->index);
@@ -2380,14 +2390,14 @@
}
-Town* CalcClosestTownFromTile(TileIndex tile, uint threshold)
+Town *CalcClosestTownFromTile(TileIndex tile, uint threshold)
{
Town *t;
- uint dist, best = threshold;
+ uint best = threshold;
Town *best_town = NULL;
FOR_ALL_TOWNS(t) {
- dist = DistanceManhattan(tile, t->xy);
+ uint dist = DistanceManhattan(tile, t->xy);
if (dist < best) {
best = dist;
best_town = t;
@@ -2430,8 +2440,6 @@
void ChangeTownRating(Town *t, int add, int max)
{
- int rating;
-
/* if magic_bulldozer cheat is active, town doesn't penaltize for removing stuff */
if (t == NULL ||
!IsValidPlayer(_current_player) ||
@@ -2441,7 +2449,7 @@
SetBit(t->have_ratings, _current_player);
- rating = _town_rating_test ? t->test_rating : t->ratings[_current_player];
+ int rating = _town_rating_test ? t->test_rating : t->ratings[_current_player];
if (add < 0) {
if (rating > max) {
@@ -2471,8 +2479,6 @@
bool CheckforTownRating(uint32 flags, Town *t, byte type)
{
- int modemod;
-
/* if magic_bulldozer cheat is active, town doesn't restrict your destructive actions */
if (t == NULL || !IsValidPlayer(_current_player) || _cheats.magic_bulldozer.value)
return true;
@@ -2481,7 +2487,7 @@
* owned by a town no removal if rating is lower than ... depends now on
* difficulty setting. Minimum town rating selected by difficulty level
*/
- modemod = _default_rating_settings[_opt.diff.town_council_tolerance][type];
+ int modemod = _default_rating_settings[_opt.diff.town_council_tolerance][type];
if ((_town_rating_test ? t->test_rating : t->ratings[_current_player]) < 16 + modemod && !(flags & DC_NO_TOWN_RATING)) {
SetDParam(0, t->index);
@@ -2510,15 +2516,14 @@
void InitializeTowns()
{
- Subsidy *s;
-
/* Clean the town pool and create 1 block in it */
_Town_pool.CleanPool();
_Town_pool.AddBlockToPool();
memset(_subsidies, 0, sizeof(_subsidies));
- for (s=_subsidies; s != endof(_subsidies); s++)
+ for (Subsidy *s = _subsidies; s != endof(_subsidies); s++) {
s->cargo_type = CT_INVALID;
+ }
_cur_town_ctr = 0;
_cur_town_iter = 0;
@@ -2530,7 +2535,7 @@
{
if (AutoslopeEnabled()) {
HouseID house = GetHouseType(tile);
- HouseSpec *hs = GetHouseSpecs(house);
+ const HouseSpec *hs = GetHouseSpecs(house);
/* Here we differ from TTDP by checking TILE_NOT_SLOPED */
if (((hs->building_flags & TILE_NOT_SLOPED) == 0) && !IsSteepSlope(tileh_new) &&
@@ -2551,7 +2556,7 @@
AnimateTile_Town, /* animate_tile_proc */
TileLoop_Town, /* tile_loop_clear */
ChangeTileOwner_Town, /* change_tile_owner_clear */
- NULL, /* get_produced_cargo_proc */
+ GetProducedCargo_Town, /* get_produced_cargo_proc */
NULL, /* vehicle_enter_tile_proc */
GetFoundation_Town, /* get_foundation_proc */
TerraformTile_Town, /* terraform_tile_proc */
@@ -2694,6 +2699,9 @@
void AfterLoadTown()
{
_town_sort_dirty = true;
+
+ Town *t;
+ FOR_ALL_TOWNS(t) t->InitializeLayout();
}
extern const ChunkHandler _town_chunk_handlers[] = {
--- a/src/town_type.h Sun Apr 06 14:12:19 2008 +0000
+++ b/src/town_type.h Sun Apr 06 23:07:42 2008 +0000
@@ -35,12 +35,19 @@
RATING_MAXIMUM = RATING_OUTSTANDING,
+ RATING_INITIAL = 500, ///< initial rating
+
/* RATINGS AFFECTING NUMBERS */
RATING_TREE_DOWN_STEP = -35,
RATING_TREE_MINIMUM = RATING_MINIMUM,
RATING_TREE_UP_STEP = 7,
RATING_TREE_MAXIMUM = 220,
+ RATING_GROWTH_UP_STEP = 5, ///< when a town grows, all players have rating increased a bit ...
+ RATING_GROWTH_MAXIMUM = RATING_MEDIOCRE, ///< ... up to RATING_MEDIOCRE
+ RATING_STATION_UP_STEP = 12, ///< when a town grows, player gains reputation for all well serviced stations ...
+ RATING_STATION_DOWN_STEP = -15, ///< ... but loses for bad serviced stations
+
RATING_TUNNEL_BRIDGE_DOWN_STEP = -250,
RATING_TUNNEL_BRIDGE_MINIMUM = 0,
@@ -66,6 +73,8 @@
TL_2X2_GRID, ///< Geometric 2x2 grid algorithm
TL_3X3_GRID, ///< Geometric 3x3 grid algorithm
+ TL_RANDOM, ///< Random town layout
+
NUM_TLS, ///< Number of town layouts
};
--- a/src/train.h Sun Apr 06 14:12:19 2008 +0000
+++ b/src/train.h Sun Apr 06 23:07:42 2008 +0000
@@ -306,6 +306,7 @@
bool IsStoppedInDepot() const { return CheckTrainStoppedInDepot(this) >= 0; }
void Tick();
void OnNewDay();
+ TileIndex GetOrderStationLocation(StationID station);
};
#endif /* TRAIN_H */
--- a/src/train_cmd.cpp Sun Apr 06 14:12:19 2008 +0000
+++ b/src/train_cmd.cpp Sun Apr 06 23:07:42 2008 +0000
@@ -11,7 +11,6 @@
#include "gui.h"
#include "station_map.h"
#include "tunnel_map.h"
-#include "timetable.h"
#include "articulated_vehicles.h"
#include "command_func.h"
#include "pathfind.h"
@@ -304,27 +303,6 @@
AM_BRAKE
};
-static bool TrainShouldStop(const Vehicle* v, TileIndex tile)
-{
- const Order* o = &v->current_order;
- StationID sid = GetStationIndex(tile);
-
- assert(v->type == VEH_TRAIN);
- /* When does a train drive through a station
- * first we deal with the "new nonstop handling" */
- if (_patches.new_nonstop && o->flags & OFB_NON_STOP && sid == o->dest) {
- return false;
- }
-
- if (v->last_station_visited == sid) return false;
-
- if (sid != o->dest && (o->flags & OFB_NON_STOP || _patches.new_nonstop)) {
- return false;
- }
-
- return true;
-}
-
/** new acceleration*/
static int GetTrainAcceleration(Vehicle *v, bool mode)
{
@@ -387,7 +365,7 @@
}
if (IsTileType(v->tile, MP_STATION) && IsFrontEngine(v)) {
- if (TrainShouldStop(v, v->tile)) {
+ if (v->current_order.ShouldStopAtStation(v, GetStationIndex(v->tile))) {
int station_length = GetStationByTile(v->tile)->GetPlatformLength(v->tile, DirToDiagDir(v->direction));
int st_max_speed = 120;
@@ -1530,9 +1508,9 @@
uint32 x = _delta_xy_table[direction];
this->x_offs = GB(x, 0, 8);
this->y_offs = GB(x, 8, 8);
- this->sprite_width = GB(x, 16, 8);
- this->sprite_height = GB(x, 24, 8);
- this->z_height = 6;
+ this->x_extent = GB(x, 16, 8);
+ this->y_extent = GB(x, 24, 8);
+ this->z_extent = 6;
}
static void UpdateVarsAfterSwap(Vehicle *v)
@@ -2130,14 +2108,15 @@
if (v->vehstatus & VS_CRASHED) return CMD_ERROR;
- if (v->current_order.type == OT_GOTO_DEPOT) {
- if (!!(p2 & DEPOT_SERVICE) == HasBit(v->current_order.flags, OF_HALT_IN_DEPOT)) {
+ if (v->current_order.IsType(OT_GOTO_DEPOT)) {
+ bool halt_in_depot = HasBit(v->current_order.GetDepotActionType(), OF_HALT_IN_DEPOT);
+ if (!!(p2 & DEPOT_SERVICE) == halt_in_depot) {
/* We called with a different DEPOT_SERVICE setting.
* Now we change the setting to apply the new one and let the vehicle head for the same depot.
* Note: the if is (true for requesting service == true for ordered to stop in depot) */
if (flags & DC_EXEC) {
- ClrBit(v->current_order.flags, OF_PART_OF_ORDERS);
- ToggleBit(v->current_order.flags, OF_HALT_IN_DEPOT);
+ v->current_order.SetDepotOrderType(OFB_MANUAL_ORDER);
+ v->current_order.SetDepotActionType(halt_in_depot ? OFB_NORMAL_ACTION : OFB_HALT_IN_DEPOT);
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
}
return CommandCost();
@@ -2145,12 +2124,11 @@
if (p2 & DEPOT_DONT_CANCEL) return CMD_ERROR; // Requested no cancelation of depot orders
if (flags & DC_EXEC) {
- if (HasBit(v->current_order.flags, OF_PART_OF_ORDERS)) {
- v->cur_order_index++;
- }
-
- v->current_order.type = OT_DUMMY;
- v->current_order.flags = 0;
+ /* If the orders to 'goto depot' are in the orders list (forced servicing),
+ * then skip to the next order; effectively cancelling this forced service */
+ if (v->current_order.GetDepotOrderType() & OFB_PART_OF_ORDERS) v->cur_order_index++;
+
+ v->current_order.MakeDummy();
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
}
return CommandCost();
@@ -2164,14 +2142,11 @@
if (tfdd.best_length == (uint)-1) return_cmd_error(STR_883A_UNABLE_TO_FIND_ROUTE_TO);
if (flags & DC_EXEC) {
- if (v->current_order.type == OT_LOADING) v->LeaveStation();
+ if (v->current_order.IsType(OT_LOADING)) v->LeaveStation();
v->dest_tile = tfdd.tile;
- v->current_order.type = OT_GOTO_DEPOT;
- v->current_order.flags = OFB_NON_STOP;
- if (!(p2 & DEPOT_SERVICE)) SetBit(v->current_order.flags, OF_HALT_IN_DEPOT);
- v->current_order.dest = GetDepotByTile(tfdd.tile)->index;
- v->current_order.refit_cargo = CT_INVALID;
+ v->current_order.MakeGoToDepot(GetDepotByTile(tfdd.tile)->index, false);
+ if (!(p2 & DEPOT_SERVICE)) v->current_order.SetDepotActionType(OFB_HALT_IN_DEPOT);
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
/* If there is no depot in front, reverse automatically */
if (tfdd.reverse) DoCommand(v->tile, v->index, 0, DC_EXEC, CMD_REVERSE_TRAIN_DIRECTION);
@@ -2369,11 +2344,7 @@
static void FillWithStationData(TrainTrackFollowerData* fd, const Vehicle* v)
{
fd->dest_coords = v->dest_tile;
- if (v->current_order.type == OT_GOTO_STATION) {
- fd->station_index = v->current_order.dest;
- } else {
- fd->station_index = INVALID_STATION;
- }
+ fd->station_index = v->current_order.IsType(OT_GOTO_STATION) ? v->current_order.GetDestination() : INVALID_STATION;
}
static const byte _initial_tile_subcoord[6][4][3] = {
@@ -2385,13 +2356,6 @@
{{ 0, 0, 0 }, { 0, 0, 0 }, { 0, 8, 4 }, { 7, 15, 0 }},
};
-static const uint32 _reachable_tracks[4] = {
- 0x10091009,
- 0x00160016,
- 0x05200520,
- 0x2A002A00,
-};
-
static const byte _search_directions[6][4] = {
{ 0, 9, 2, 9 }, ///< track 1
{ 9, 1, 9, 3 }, ///< track 2
@@ -2536,8 +2500,6 @@
assert(v->u.rail.track);
- int i = _search_directions[FIND_FIRST_BIT(v->u.rail.track)][DirToDiagDir(v->direction)];
-
switch (_patches.pathfinder_for_trains) {
case VPF_YAPF: { /* YAPF */
reverse_best = YapfCheckReverseTrain(v);
@@ -2570,6 +2532,8 @@
default:
case VPF_NTP: { /* NTP */
+ int i = _search_directions[FindFirstTrack(v->u.rail.track)][DirToDiagDir(v->direction)];
+
int best_track = -1;
uint reverse = 0;
uint best_bird_dist = 0;
@@ -2624,94 +2588,11 @@
return reverse_best != 0;
}
-static bool ProcessTrainOrder(Vehicle *v)
+TileIndex Train::GetOrderStationLocation(StationID station)
{
- switch (v->current_order.type) {
- case OT_GOTO_DEPOT:
- if (!(v->current_order.flags & OFB_PART_OF_ORDERS)) return false;
- if ((v->current_order.flags & OFB_SERVICE_IF_NEEDED) &&
- !VehicleNeedsService(v)) {
- UpdateVehicleTimetable(v, true);
- v->cur_order_index++;
- }
- break;
-
- case OT_LOADING:
- case OT_LEAVESTATION:
- return false;
-
- default: break;
- }
-
- /**
- * Reversing because of order change is allowed only just after leaving a
- * station (and the difficulty setting to allowed, of course)
- * this can be detected because only after OT_LEAVESTATION, current_order
- * will be reset to nothing. (That also happens if no order, but in that case
- * it won't hit the point in code where may_reverse is checked)
- */
- bool may_reverse = v->current_order.type == OT_NOTHING;
-
- /* check if we've reached the waypoint? */
- if (v->current_order.type == OT_GOTO_WAYPOINT && v->tile == v->dest_tile) {
- UpdateVehicleTimetable(v, true);
- v->cur_order_index++;
- }
-
- /* check if we've reached a non-stop station while TTDPatch nonstop is enabled.. */
- if (_patches.new_nonstop &&
- v->current_order.flags & OFB_NON_STOP &&
- IsTileType(v->tile, MP_STATION) &&
- v->current_order.dest == GetStationIndex(v->tile)) {
- UpdateVehicleTimetable(v, true);
- v->cur_order_index++;
- }
-
- /* Get the current order */
- if (v->cur_order_index >= v->num_orders) v->cur_order_index = 0;
-
- const Order *order = GetVehicleOrder(v, v->cur_order_index);
-
- /* If no order, do nothing. */
- if (order == NULL) {
- v->current_order.Free();
- v->dest_tile = 0;
- return false;
- }
-
- /* If it is unchanged, keep it. */
- if (order->type == v->current_order.type &&
- order->flags == v->current_order.flags &&
- order->dest == v->current_order.dest)
- return false;
-
- /* Otherwise set it, and determine the destination tile. */
- v->current_order = *order;
-
- v->dest_tile = 0;
-
- InvalidateVehicleOrder(v);
-
- switch (order->type) {
- case OT_GOTO_STATION:
- if (order->dest == v->last_station_visited)
- v->last_station_visited = INVALID_STATION;
- v->dest_tile = GetStation(order->dest)->xy;
- break;
-
- case OT_GOTO_DEPOT:
- v->dest_tile = GetDepot(order->dest)->xy;
- break;
-
- case OT_GOTO_WAYPOINT:
- v->dest_tile = GetWaypoint(order->dest)->xy;
- break;
-
- default:
- return false;
- }
-
- return may_reverse && CheckReverseTrain(v);
+ if (station == this->last_station_visited) this->last_station_visited = INVALID_STATION;
+
+ return GetStation(station)->xy;
}
void Train::MarkDirty()
@@ -2779,7 +2660,6 @@
}
v->BeginLoading();
- v->current_order.dest = 0;
}
static byte AfterSetTrainPos(Vehicle *v, bool new_tile)
@@ -2902,17 +2782,13 @@
}
}
-static const DiagDirection _otherside_signal_directions[] = {
- DIAGDIR_NE, DIAGDIR_SE, DIAGDIR_NE, DIAGDIR_SE, DIAGDIR_SW, DIAGDIR_SE, INVALID_DIAGDIR, INVALID_DIAGDIR,
- DIAGDIR_SW, DIAGDIR_NW, DIAGDIR_NW, DIAGDIR_SW, DIAGDIR_NW, DIAGDIR_NE
-};
-
static void TrainMovedChangeSignals(TileIndex tile, DiagDirection dir)
{
if (IsTileType(tile, MP_RAILWAY) &&
GetRailTileType(tile) == RAIL_TILE_SIGNALS) {
- uint i = FindFirstBit2x64(GetTrackBits(tile) * 0x101 & _reachable_tracks[dir]);
- UpdateSignalsOnSegment(tile, _otherside_signal_directions[i], GetTileOwner(tile));
+ TrackdirBits tracks = TrackBitsToTrackdirBits(GetTrackBits(tile)) & DiagdirReachesTrackdirs(dir);
+ Trackdir trackdir = FindFirstTrackdir(tracks);
+ UpdateSignalsOnSegment(tile, TrackdirToExitdir(trackdir), GetTileOwner(tile));
}
}
@@ -3076,7 +2952,7 @@
return;
}
- if (v->current_order.type == OT_LEAVESTATION) {
+ if (v->current_order.IsType(OT_LEAVESTATION)) {
v->current_order.Free();
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
}
@@ -3091,9 +2967,11 @@
/* Get the status of the tracks in the new tile and mask
* away the bits that aren't reachable. */
- TrackStatus ts = GetTileTrackStatus(gp.new_tile, TRANSPORT_RAIL, 0, ReverseDiagDir(enterdir)) & _reachable_tracks[enterdir];
- TrackdirBits trackdirbits = TrackStatusToTrackdirBits(ts);
- TrackBits red_signals = TrackdirBitsToTrackBits(TrackStatusToRedSignals(ts));
+ TrackStatus ts = GetTileTrackStatus(gp.new_tile, TRANSPORT_RAIL, 0, ReverseDiagDir(enterdir));
+ TrackdirBits reachable_trackdirs = DiagdirReachesTrackdirs(enterdir);
+
+ TrackdirBits trackdirbits = TrackStatusToTrackdirBits(ts) & reachable_trackdirs;
+ TrackBits red_signals = TrackdirBitsToTrackBits(TrackStatusToRedSignals(ts) & reachable_trackdirs);
TrackBits bits = TrackdirBitsToTrackBits(trackdirbits);
if (_patches.pathfinder_for_trains != VPF_NTP && _patches.forbid_90_deg && prev == NULL) {
@@ -3521,9 +3399,11 @@
TileIndex tile = v->tile + TileOffsByDiagDir(dir);
/* Determine the track status on the next tile */
- TrackStatus ts = GetTileTrackStatus(tile, TRANSPORT_RAIL, 0, ReverseDiagDir(dir)) & _reachable_tracks[dir];
- TrackdirBits trackdirbits = TrackStatusToTrackdirBits(ts);
- TrackdirBits red_signals = TrackStatusToRedSignals(ts);
+ TrackStatus ts = GetTileTrackStatus(tile, TRANSPORT_RAIL, 0, ReverseDiagDir(dir));
+ TrackdirBits reachable_trackdirs = DiagdirReachesTrackdirs(dir);
+
+ TrackdirBits trackdirbits = TrackStatusToTrackdirBits(ts) & reachable_trackdirs;
+ TrackdirBits red_signals = TrackStatusToRedSignals(ts) & reachable_trackdirs;
/* We are sure the train is not entering a depot, it is detected above */
@@ -3574,7 +3454,7 @@
/* exit if train is stopped */
if (v->vehstatus & VS_STOPPED && v->cur_speed == 0) return;
- if (ProcessTrainOrder(v)) {
+ if (ProcessOrders(v) && CheckReverseTrain(v)) {
v->load_unload_time_rem = 0;
v->cur_speed = 0;
v->subspeed = 0;
@@ -3584,7 +3464,7 @@
v->HandleLoading(mode);
- if (v->current_order.type == OT_LOADING) return;
+ if (v->current_order.IsType(OT_LOADING)) return;
if (CheckTrainStayInDepot(v)) return;
@@ -3668,12 +3548,11 @@
TrainFindDepotData tfdd = FindClosestTrainDepot(v, MAX_ACCEPTABLE_DEPOT_DIST);
/* Only go to the depot if it is not too far out of our way. */
if (tfdd.best_length == (uint)-1 || tfdd.best_length > MAX_ACCEPTABLE_DEPOT_DIST) {
- if (v->current_order.type == OT_GOTO_DEPOT) {
+ if (v->current_order.IsType(OT_GOTO_DEPOT)) {
/* If we were already heading for a depot but it has
* suddenly moved farther away, we continue our normal
* schedule? */
- v->current_order.type = OT_DUMMY;
- v->current_order.flags = 0;
+ v->current_order.MakeDummy();
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
}
return;
@@ -3681,15 +3560,13 @@
const Depot* depot = GetDepotByTile(tfdd.tile);
- if (v->current_order.type == OT_GOTO_DEPOT &&
- v->current_order.dest != depot->index &&
+ if (v->current_order.IsType(OT_GOTO_DEPOT) &&
+ v->current_order.GetDestination() != depot->index &&
!Chance16(3, 16)) {
return;
}
- v->current_order.type = OT_GOTO_DEPOT;
- v->current_order.flags = OFB_NON_STOP;
- v->current_order.dest = depot->index;
+ v->current_order.MakeGoToDepot(depot->index, false);
v->dest_tile = tfdd.tile;
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
}
@@ -3707,8 +3584,8 @@
CheckOrders(this);
/* update destination */
- if (this->current_order.type == OT_GOTO_STATION) {
- TileIndex tile = GetStation(this->current_order.dest)->train_tile;
+ if (this->current_order.IsType(OT_GOTO_STATION)) {
+ TileIndex tile = GetStation(this->current_order.GetDestination())->train_tile;
if (tile != 0) this->dest_tile = tile;
}
--- a/src/train_gui.cpp Sun Apr 06 14:12:19 2008 +0000
+++ b/src/train_gui.cpp Sun Apr 06 23:07:42 2008 +0000
@@ -98,6 +98,8 @@
/* Set the highlight position */
highlight_l = WagonLengthToPixels(dx) + 1;
highlight_r = WagonLengthToPixels(dx + width) + 1;
+ } else if (_cursor.vehchain && highlight_r != 0) {
+ highlight_r += WagonLengthToPixels(width);
}
}
}
--- a/src/transparency.h Sun Apr 06 14:12:19 2008 +0000
+++ b/src/transparency.h Sun Apr 06 23:07:42 2008 +0000
@@ -28,6 +28,7 @@
typedef uint TransparencyOptionBits; ///< transparency option bits
extern TransparencyOptionBits _transparency_opt;
extern TransparencyOptionBits _transparency_lock;
+extern TransparencyOptionBits _invisibility_opt;
/**
* Check if the transparency option bit is set
@@ -41,6 +42,17 @@
}
/**
+ * Check if the invisibility option bit is set
+ * and if we aren't in the game menu (there's never transparency)
+ *
+ * @param to the structure which invisibility option is ask for
+ */
+static inline bool IsInvisibilitySet(TransparencyOption to)
+{
+ return (HasBit(_transparency_opt & _invisibility_opt, to) && _game_mode != GM_MENU);
+}
+
+/**
* Toggle the transparency option bit
*
* @param to the transparency option to be toggled
@@ -51,6 +63,34 @@
}
/**
+ * Toggle the invisibility option bit
+ *
+ * @param to the structure which invisibility option is toggle
+ */
+static inline void ToggleInvisibility(TransparencyOption to)
+{
+ ToggleBit(_invisibility_opt, to);
+}
+
+/**
+ * Toggles between invisible and solid state.
+ * If object is transparent, then it is made invisible.
+ * Used by the keyboard shortcuts.
+ *
+ * @param to the object type which invisibility option to toggle
+ */
+static inline void ToggleInvisibilityWithTransparency(TransparencyOption to)
+{
+ if (IsInvisibilitySet(to)) {
+ ClrBit(_invisibility_opt, to);
+ ClrBit(_transparency_opt, to);
+ } else {
+ SetBit(_invisibility_opt, to);
+ SetBit(_transparency_opt, to);
+ }
+}
+
+/**
* Toggle the transparency lock bit
*
* @param to the transparency option to be locked or unlocked
--- a/src/transparency_gui.cpp Sun Apr 06 14:12:19 2008 +0000
+++ b/src/transparency_gui.cpp Sun Apr 06 23:07:42 2008 +0000
@@ -13,6 +13,7 @@
TransparencyOptionBits _transparency_opt;
TransparencyOptionBits _transparency_lock;
+TransparencyOptionBits _invisibility_opt;
enum TransparencyToolbarWidgets{
TTW_WIDGET_SIGNS = 3, ///< Make signs background transparent
@@ -25,6 +26,9 @@
TTW_WIDGET_CATENARY, ///< Make catenary transparent
TTW_WIDGET_LOADING, ///< Make loading indicators transparent
TTW_WIDGET_END, ///< End of toggle buttons
+
+ /* Panel with buttons for invisibility */
+ TTW_BUTTONS = 12, ///< Panel with 'invisibility' buttons
};
static void TransparencyToolbWndProc(Window *w, WindowEvent *e)
@@ -41,6 +45,18 @@
for (uint i = TO_SIGNS; i < TO_END; i++) {
if (HasBit(_transparency_lock, i)) DrawSprite(SPR_LOCK, PAL_NONE, w->widget[TTW_WIDGET_SIGNS + i].left + 1, w->widget[TTW_WIDGET_SIGNS + i].top + 1);
}
+
+ /* Do not draw button for invisible loading indicators */
+ for (uint i = 0; i < 8; i++) {
+ if (i < TTW_WIDGET_BRIDGES - TTW_WIDGET_SIGNS) {
+ DrawFrameRect(i * 22, 38, i * 22 + 19, 46, true, HasBit(_invisibility_opt, i) ? FR_LOWERED : FR_NONE);
+ } else if (i == TTW_WIDGET_BRIDGES - TTW_WIDGET_SIGNS) {
+ DrawFrameRect(i * 22, 38, i * 22 + 41, 46, true, HasBit(_invisibility_opt, i) ? FR_LOWERED : FR_NONE);
+ } else { // i > TTW_WIDGET_BRIDGES - TTW_WIDGET_SIGNS
+ DrawFrameRect((i + 1) * 22, 38, (i + 1) * 22 + 19, 46, true, HasBit(_invisibility_opt, i) ? FR_LOWERED : FR_NONE);
+ }
+ }
+
break;
case WE_CLICK:
@@ -55,7 +71,23 @@
SndPlayFx(SND_15_BEEP);
MarkWholeScreenDirty();
}
+ } else if (e->we.click.widget == TTW_BUTTONS) {
+ uint x = e->we.click.pt.x / 22;
+
+ if (x > TTW_WIDGET_BRIDGES - TTW_WIDGET_SIGNS) x--;
+ if (x > TTW_WIDGET_CATENARY - TTW_WIDGET_SIGNS) break;
+
+ ToggleInvisibility((TransparencyOption)x);
+ SndPlayFx(SND_15_BEEP);
+
+ /* Redraw whole screen only if transparency is set */
+ if (IsTransparencySet((TransparencyOption)x)) {
+ MarkWholeScreenDirty();
+ } else {
+ w->InvalidateWidget(TTW_BUTTONS);
+ }
}
+
break;
}
}
@@ -77,11 +109,13 @@
{ WWT_IMGBTN, RESIZE_NONE, 7, 175, 196, 14, 35, SPR_BUILD_X_ELRAIL, STR_TRANSPARENT_CATENARY_DESC},
{ WWT_IMGBTN, RESIZE_NONE, 7, 197, 218, 14, 35, SPR_IMG_TRAINLIST, STR_TRANSPARENT_LOADING_DESC},
+{ WWT_PANEL, RESIZE_NONE, 7, 0, 218, 36, 48, 0x0, STR_TRANSPARENT_INVISIBLE_DESC},
+
{ WIDGETS_END},
};
static const WindowDesc _transparency_desc = {
- WDP_ALIGN_TBR, 58+36, 219, 36, 219, 36,
+ WDP_ALIGN_TBR, 58+36, 219, 49, 219, 49,
WC_TRANSPARENCY_TOOLBAR, WC_NONE,
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON,
_transparency_widgets,
--- a/src/tree_cmd.cpp Sun Apr 06 14:12:19 2008 +0000
+++ b/src/tree_cmd.cpp Sun Apr 06 23:07:42 2008 +0000
@@ -445,7 +445,7 @@
DrawClearLandFence(ti);
/* Do not draw trees when the invisible trees patch and transparency tree are set */
- if (IsTransparencySet(TO_TREES) && _patches.invisible_trees) return;
+ if (IsInvisibilitySet(TO_TREES)) return;
uint16 tmp = ti->x;
--- a/src/tunnelbridge_cmd.cpp Sun Apr 06 14:12:19 2008 +0000
+++ b/src/tunnelbridge_cmd.cpp Sun Apr 06 23:07:42 2008 +0000
@@ -719,7 +719,11 @@
*/
static void DrawBridgePillars(const PalSpriteID *psid, const TileInfo* ti, Axis axis, BridgeType type, int x, int y, int z_bridge)
{
+ /* Do not draw bridge pillars if they are invisible */
+ if (IsInvisibilitySet(TO_BRIDGES)) return;
+
SpriteID image = psid->sprite;
+
if (image != 0) {
bool drawfarpillar = !HasBit(GetBridgeSpec(type)->flags, 0);
@@ -771,8 +775,9 @@
* @param z the z of the bridge
* @param offset number representing whether to level or sloped and the direction
* @param overlay do we want to still see the road?
+ * @param head are we drawing bridge head?
*/
-static void DrawBridgeTramBits(int x, int y, byte z, int offset, bool overlay)
+static void DrawBridgeTramBits(int x, int y, byte z, int offset, bool overlay, bool head)
{
static const SpriteID tram_offsets[2][6] = { { 107, 108, 109, 110, 111, 112 }, { 4, 5, 15, 16, 17, 18 } };
static const SpriteID back_offsets[6] = { 95, 96, 99, 102, 100, 101 };
@@ -785,7 +790,12 @@
/* The sprites under the vehicles are drawn as SpriteCombine. StartSpriteCombine() has already been called
* The bounding boxes here are the same as for bridge front/roof */
- AddSortableSpriteToDraw(SPR_TRAMWAY_BASE + tram_offsets[overlay][offset], PAL_NONE, x, y, size_x[offset], size_y[offset], 0x28, z, IsTransparencySet(TO_BRIDGES));
+ if (head || !IsInvisibilitySet(TO_BRIDGES)) {
+ AddSortableSpriteToDraw(SPR_TRAMWAY_BASE + tram_offsets[overlay][offset], PAL_NONE, x, y, size_x[offset], size_y[offset], 0x28, z, !head && IsTransparencySet(TO_BRIDGES));
+ }
+
+ /* Do not draw catenary if it is set invisible */
+ if (IsInvisibilitySet(TO_CATENARY)) return;
AddSortableSpriteToDraw(SPR_TRAMWAY_BASE + back_offsets[offset], PAL_NONE, x, y, size_x[offset], size_y[offset], 0x28, z, IsTransparencySet(TO_CATENARY));
@@ -856,11 +866,14 @@
DrawGroundSprite(SPR_TRAMWAY_BASE + tunnel_sprites[rts - ROADTYPES_TRAM][tunnelbridge_direction], PAL_NONE);
- catenary = true;
- StartSpriteCombine();
- AddSortableSpriteToDraw(SPR_TRAMWAY_TUNNEL_WIRES + tunnelbridge_direction, PAL_NONE, ti->x, ti->y, BB_data[10], BB_data[11], TILE_HEIGHT, ti->z, IsTransparencySet(TO_CATENARY), BB_data[8], BB_data[9], BB_Z_SEPARATOR);
+ /* Do not draw wires if they are invisible */
+ if (!IsInvisibilitySet(TO_CATENARY)) {
+ catenary = true;
+ StartSpriteCombine();
+ AddSortableSpriteToDraw(SPR_TRAMWAY_TUNNEL_WIRES + tunnelbridge_direction, PAL_NONE, ti->x, ti->y, BB_data[10], BB_data[11], TILE_HEIGHT, ti->z, IsTransparencySet(TO_CATENARY), BB_data[8], BB_data[9], BB_Z_SEPARATOR);
+ }
}
- } else if (HasCatenary(GetRailType(ti->tile))) {
+ } else if (!IsInvisibilitySet(TO_CATENARY) && HasCatenary(GetRailType(ti->tile))) {
DrawCatenary(ti);
catenary = true;
@@ -916,9 +929,8 @@
/* HACK set the height of the BB of a sloped ramp to 1 so a vehicle on
* it doesn't disappear behind it
*/
- AddSortableSpriteToDraw(
- psid->sprite, psid->pal, ti->x, ti->y, 16, 16, ti->tileh == SLOPE_FLAT ? 0 : 8, ti->z, IsTransparencySet(TO_BRIDGES)
- );
+ /* Bridge heads are drawn solid no matter how invisibility/transparency is set */
+ AddSortableSpriteToDraw(psid->sprite, psid->pal, ti->x, ti->y, 16, 16, ti->tileh == SLOPE_FLAT ? 0 : 8, ti->z);
if (transport_type == TRANSPORT_ROAD) {
RoadTypes rts = GetRoadTypes(ti->tile);
@@ -933,7 +945,7 @@
offset += 2;
}
/* DrawBridgeTramBits() calls EndSpriteCombine() and StartSpriteCombine() */
- DrawBridgeTramBits(ti->x, ti->y, z, offset, HasBit(rts, ROADTYPE_ROAD));
+ DrawBridgeTramBits(ti->x, ti->y, z, offset, HasBit(rts, ROADTYPE_ROAD), true);
}
EndSpriteCombine();
} else if (HasCatenary(GetRailType(ti->tile))) {
@@ -1044,10 +1056,12 @@
if (transport_type == TRANSPORT_ROAD) StartSpriteCombine();
/* Draw floor and far part of bridge*/
- if (axis == AXIS_X) {
- AddSortableSpriteToDraw(psid->sprite, psid->pal, x, y, 16, 1, 0x28, z, IsTransparencySet(TO_BRIDGES), 0, 0, BRIDGE_Z_START);
- } else {
- AddSortableSpriteToDraw(psid->sprite, psid->pal, x, y, 1, 16, 0x28, z, IsTransparencySet(TO_BRIDGES), 0, 0, BRIDGE_Z_START);
+ if (!IsInvisibilitySet(TO_BRIDGES)) {
+ if (axis == AXIS_X) {
+ AddSortableSpriteToDraw(psid->sprite, psid->pal, x, y, 16, 1, 0x28, z, IsTransparencySet(TO_BRIDGES), 0, 0, BRIDGE_Z_START);
+ } else {
+ AddSortableSpriteToDraw(psid->sprite, psid->pal, x, y, 1, 16, 0x28, z, IsTransparencySet(TO_BRIDGES), 0, 0, BRIDGE_Z_START);
+ }
}
psid++;
@@ -1057,7 +1071,7 @@
if (HasBit(rts, ROADTYPE_TRAM)) {
/* DrawBridgeTramBits() calls EndSpriteCombine() and StartSpriteCombine() */
- DrawBridgeTramBits(x, y, bridge_z, axis ^ 1, HasBit(rts, ROADTYPE_ROAD));
+ DrawBridgeTramBits(x, y, bridge_z, axis ^ 1, HasBit(rts, ROADTYPE_ROAD), false);
} else {
EndSpriteCombine();
StartSpriteCombine();
@@ -1067,17 +1081,22 @@
}
/* draw roof, the component of the bridge which is logically between the vehicle and the camera */
- if (axis == AXIS_X) {
- y += 12;
- if (psid->sprite & SPRITE_MASK) AddSortableSpriteToDraw(psid->sprite, psid->pal, x, y, 16, 4, 0x28, z, IsTransparencySet(TO_BRIDGES), 0, 3, BRIDGE_Z_START);
- } else {
- x += 12;
- if (psid->sprite & SPRITE_MASK) AddSortableSpriteToDraw(psid->sprite, psid->pal, x, y, 4, 16, 0x28, z, IsTransparencySet(TO_BRIDGES), 3, 0, BRIDGE_Z_START);
+ if (!IsInvisibilitySet(TO_BRIDGES)) {
+ if (axis == AXIS_X) {
+ y += 12;
+ if (psid->sprite & SPRITE_MASK) AddSortableSpriteToDraw(psid->sprite, psid->pal, x, y, 16, 4, 0x28, z, IsTransparencySet(TO_BRIDGES), 0, 3, BRIDGE_Z_START);
+ } else {
+ x += 12;
+ if (psid->sprite & SPRITE_MASK) AddSortableSpriteToDraw(psid->sprite, psid->pal, x, y, 4, 16, 0x28, z, IsTransparencySet(TO_BRIDGES), 3, 0, BRIDGE_Z_START);
+ }
}
/* Draw TramFront as SpriteCombine */
if (transport_type == TRANSPORT_ROAD) EndSpriteCombine();
+ /* Do not draw anything more if bridges are invisible */
+ if (IsInvisibilitySet(TO_BRIDGES)) return;
+
psid++;
if (ti->z + 5 == z) {
/* draw poles below for small bridges */
--- a/src/unmovable_cmd.cpp Sun Apr 06 14:12:19 2008 +0000
+++ b/src/unmovable_cmd.cpp Sun Apr 06 23:07:42 2008 +0000
@@ -171,6 +171,8 @@
if (ti->tileh != SLOPE_FLAT) DrawFoundation(ti, FOUNDATION_LEVELED);
DrawClearLandTile(ti, 2);
+ if (IsInvisibilitySet(TO_STRUCTURES)) break;
+
AddSortableSpriteToDraw(
dtu->image.sprite, PAL_NONE, ti->x | dtu->delta_x, ti->y | dtu->delta_y,
dtu->size_x, dtu->size_y, dtu->size_z, ti->z,
@@ -185,6 +187,8 @@
DrawGroundSprite(SPR_CONCRETE_GROUND, PAL_NONE);
+ if (IsInvisibilitySet(TO_STRUCTURES)) break;
+
AddSortableSpriteToDraw(SPR_STATUE_COMPANY, PLAYER_SPRITE_COLOR(GetTileOwner(ti->tile)), ti->x, ti->y, 16, 16, 25, ti->z, IsTransparencySet(TO_STRUCTURES));
break;
@@ -211,6 +215,8 @@
t = &_unmovable_display_datas[GetCompanyHQSection(ti->tile)];
DrawGroundSprite(t->ground.sprite, palette);
+ if (IsInvisibilitySet(TO_STRUCTURES)) break;
+
foreach_draw_tile_seq(dtss, t->seq) {
AddSortableSpriteToDraw(
dtss->image.sprite, palette,
--- a/src/vehicle.cpp Sun Apr 06 14:12:19 2008 +0000
+++ b/src/vehicle.cpp Sun Apr 06 23:07:42 2008 +0000
@@ -120,10 +120,10 @@
bool VehicleNeedsService(const Vehicle *v)
{
if (v->vehstatus & (VS_STOPPED | VS_CRASHED)) return false;
- if (v->current_order.type != OT_GOTO_DEPOT || !(v->current_order.flags & OFB_PART_OF_ORDERS)) { // Don't interfere with a depot visit by the order list
+ if (!v->current_order.IsType(OT_GOTO_DEPOT) || !(v->current_order.GetDepotOrderType() & OFB_PART_OF_ORDERS)) { // Don't interfere with a depot visit by the order list
if (_patches.gotodepot && VehicleHasDepotOrders(v)) return false;
- if (v->current_order.type == OT_LOADING) return false;
- if (v->current_order.type == OT_GOTO_DEPOT && v->current_order.flags & OFB_HALT_IN_DEPOT) return false;
+ if (v->current_order.IsType(OT_LOADING)) return false;
+ if (v->current_order.IsType(OT_GOTO_DEPOT) && v->current_order.GetDepotActionType() & OFB_HALT_IN_DEPOT) return false;
}
if (_patches.no_servicing_if_no_breakdowns && _opt.diff.vehicle_breakdowns == 0) {
@@ -631,7 +631,7 @@
{
/* We need to set v->leave_depot_instantly as we have no control of it's contents at this time.
* Vehicle should stop in the depot if it was in 'stopping' state - train intered depot while slowing down. */
- if ((HasBit(v->current_order.flags, OF_HALT_IN_DEPOT) && !HasBit(v->current_order.flags, OF_PART_OF_ORDERS) && v->current_order.type == OT_GOTO_DEPOT) ||
+ if ((HasBit(v->current_order.GetDepotActionType(), OF_HALT_IN_DEPOT) && !HasBit(v->current_order.GetDepotOrderType(), OF_PART_OF_ORDERS) && v->current_order.IsType(OT_GOTO_DEPOT)) ||
(v->vehstatus & VS_STOPPED)) {
/* we keep the vehicle in the depot since the user ordered it to stay */
v->leave_depot_instantly = false;
@@ -767,7 +767,7 @@
}
AddSortableSpriteToDraw(image, pal, v->x_pos + v->x_offs, v->y_pos + v->y_offs,
- v->sprite_width, v->sprite_height, v->z_height, v->z_pos, (v->vehstatus & VS_SHADOW) != 0);
+ v->x_extent, v->y_extent, v->z_extent, v->z_pos, (v->vehstatus & VS_SHADOW) != 0);
}
void ViewportAddVehicles(DrawPixelInfo *dpi)
@@ -2033,7 +2033,7 @@
const Order *order;
FOR_VEHICLE_ORDERS(v, order) {
- if (order->type == OT_GOTO_STATION && order->dest == index) {
+ if (order->IsType(OT_GOTO_STATION) && order->GetDestination() == index) {
if (n == *length_of_array) ExtendVehicleListSize(sort_list, length_of_array, 50);
(*sort_list)[n++] = v;
break;
@@ -2077,7 +2077,7 @@
const Order *order;
FOR_VEHICLE_ORDERS(v, order) {
- if (order->type == OT_GOTO_DEPOT && order->dest == index) {
+ if (order->IsType(OT_GOTO_DEPOT) && order->GetDestination() == index) {
if (n == *length_of_array) ExtendVehicleListSize(sort_list, length_of_array, 25);
(*sort_list)[n++] = v;
break;
@@ -2174,7 +2174,7 @@
max += v->cargo_cap;
if (v->cargo_cap != 0) {
unloading += HasBit(v->vehicle_flags, VF_CARGO_UNLOADING) ? 1 : 0;
- loading |= (u->current_order.flags & OFB_UNLOAD) == 0 && st->goods[v->cargo_type].days_since_pickup != 255;
+ loading |= !HasBit(u->current_order.GetUnloadType(), OF_UNLOAD) && st->goods[v->cargo_type].days_since_pickup != 255;
cars++;
}
}
@@ -2235,20 +2235,19 @@
TriggerVehicle(v, VEHICLE_TRIGGER_DEPOT);
- if (v->current_order.type == OT_GOTO_DEPOT) {
+ if (v->current_order.IsType(OT_GOTO_DEPOT)) {
Order t;
InvalidateWindow(WC_VEHICLE_VIEW, v->index);
t = v->current_order;
- v->current_order.type = OT_DUMMY;
- v->current_order.flags = 0;
-
- if (t.refit_cargo < NUM_CARGO) {
+ v->current_order.MakeDummy();
+
+ if (t.IsRefit()) {
CommandCost cost;
_current_player = v->owner;
- cost = DoCommand(v->tile, v->index, t.refit_cargo | t.refit_subtype << 8, DC_EXEC, GetCmdRefitVeh(v));
+ cost = DoCommand(v->tile, v->index, t.GetRefitCargo() | t.GetRefitSubtype() << 8, DC_EXEC, GetCmdRefitVeh(v));
if (CmdFailed(cost)) {
v->leave_depot_instantly = false; // We ensure that the vehicle stays in the depot
@@ -2263,11 +2262,11 @@
}
}
- if (HasBit(t.flags, OF_PART_OF_ORDERS)) {
+ if (HasBit(t.GetDepotOrderType(), OF_PART_OF_ORDERS)) {
/* Part of orders */
UpdateVehicleTimetable(v, true);
v->cur_order_index++;
- } else if (HasBit(t.flags, OF_HALT_IN_DEPOT)) {
+ } else if (HasBit(t.GetDepotActionType(), OF_HALT_IN_DEPOT)) {
/* Force depot visit */
v->vehstatus |= VS_STOPPED;
if (v->owner == _local_player) {
@@ -3054,7 +3053,7 @@
}
/** Will be called when vehicles need to be loaded. */
-static void Load_VEHS()
+void Load_VEHS()
{
int index;
Vehicle *v;
@@ -3097,7 +3096,7 @@
if (CheckSavegameVersion(5)) {
/* Convert the current_order.type (which is a mix of type and flags, because
* in those versions, they both were 4 bits big) to type and flags */
- v->current_order.flags = (v->current_order.type & 0xF0) >> 4;
+ v->current_order.flags = GB(v->current_order.type, 4, 4);
v->current_order.type.m_val &= 0x0F;
}
@@ -3131,25 +3130,22 @@
{
assert(IsTileType(tile, MP_STATION) || type == VEH_SHIP);
- if (this->current_order.type == OT_GOTO_STATION &&
- this->current_order.dest == this->last_station_visited) {
- /* Arriving at the ordered station.
- * Keep the load/unload flags, as we (obviously) still need them. */
- this->current_order.flags &= OFB_FULL_LOAD | OFB_UNLOAD | OFB_TRANSFER;
-
+ if (this->current_order.IsType(OT_GOTO_STATION) &&
+ this->current_order.GetDestination() == this->last_station_visited) {
/* Furthermore add the Non Stop flag to mark that this station
* is the actual destination of the vehicle, which is (for example)
* necessary to be known for HandleTrainLoading to determine
* whether the train is lost or not; not marking a train lost
* that arrives at random stations is bad. */
- this->current_order.flags |= OFB_NON_STOP;
+ this->current_order.SetNonStopType(OFB_NON_STOP);
+
+ current_order.MakeLoading(true);
UpdateVehicleTimetable(this, true);
} else {
- /* This is just an unordered intermediate stop */
- this->current_order.flags = 0;
+ this->current_order.SetNonStopType(OFB_NO_NON_STOP);
+ current_order.MakeLoading(false);
}
- current_order.type = OT_LOADING;
GetStation(this->last_station_visited)->loading_vehicles.push_back(this);
VehiclePayment(this);
@@ -3165,13 +3161,12 @@
void Vehicle::LeaveStation()
{
- assert(current_order.type == OT_LOADING);
+ assert(current_order.IsType(OT_LOADING));
/* Only update the timetable if the vehicle was supposed to stop here. */
- if (current_order.flags & OFB_NON_STOP) UpdateVehicleTimetable(this, false);
-
- current_order.type = OT_LEAVESTATION;
- current_order.flags = 0;
+ if (current_order.GetNonStopType() != OFB_NO_NON_STOP) UpdateVehicleTimetable(this, false);
+
+ current_order.MakeLeaveStation();
GetStation(this->last_station_visited)->loading_vehicles.remove(this);
HideFillingPercent(this->fill_percent_te_id);
@@ -3181,7 +3176,7 @@
void Vehicle::HandleLoading(bool mode)
{
- switch (this->current_order.type) {
+ switch (this->current_order.GetType()) {
case OT_LOADING: {
uint wait_time = max(this->current_order.wait_time - this->lateness_counter, 0);
@@ -3195,7 +3190,7 @@
this->LeaveStation();
/* If this was not the final order, don't remove it from the list. */
- if (!(b.flags & OFB_NON_STOP)) return;
+ if (!(b.GetNonStopType() & OFB_NON_STOP)) return;
break;
}
@@ -3234,9 +3229,9 @@
{
this->x_offs = 0;
this->y_offs = 0;
- this->sprite_width = 1;
- this->sprite_height = 1;
- this->z_height = 1;
+ this->x_extent = 1;
+ this->y_extent = 1;
+ this->z_extent = 1;
}
void StopAllVehicles()
--- a/src/vehicle_base.h Sun Apr 06 14:12:19 2008 +0000
+++ b/src/vehicle_base.h Sun Apr 06 23:07:42 2008 +0000
@@ -223,9 +223,9 @@
// 0xfd == custom sprite, 0xfe == custom second head sprite
// 0xff == reserved for another custom sprite
uint16 cur_image; // sprite number for this vehicle
- byte sprite_width; // width of vehicle sprite
- byte sprite_height; // height of vehicle sprite
- byte z_height; // z-height of vehicle sprite
+ byte x_extent; // x-extent of vehicle bounding box
+ byte y_extent; // y-extent of vehicle bounding box
+ byte z_extent; // z-extent of vehicle bounding box
int8 x_offs; // x offset for vehicle sprite
int8 y_offs; // y offset for vehicle sprite
EngineID engine_type;
@@ -488,6 +488,15 @@
inline bool IsOrderListShared() const { return this->next_shared != NULL || this->prev_shared != NULL; };
bool NeedsAutorenewing(const Player *p) const;
+
+ /**
+ * Determine the location for the station where the vehicle goes to next.
+ * Things done for example are allocating slots in a road stop or exact
+ * location of the platform is determined for ships.
+ * @param station the station to make the next location of the vehicle.
+ * @return the location (tile) to aim for.
+ */
+ virtual TileIndex GetOrderStationLocation(StationID station) { return INVALID_TILE; }
};
/**
--- a/src/vehicle_gui.cpp Sun Apr 06 14:12:19 2008 +0000
+++ b/src/vehicle_gui.cpp Sun Apr 06 23:07:42 2008 +0000
@@ -917,10 +917,10 @@
if (sel == 0) DrawString(x - 6, y, STR_SMALL_RIGHT_ARROW, TC_BLACK);
sel--;
- if (order->type == OT_GOTO_STATION) {
- if (v->type == VEH_SHIP && GetStation(order->dest)->IsBuoy()) continue;
+ if (order->IsType(OT_GOTO_STATION)) {
+ if (v->type == VEH_SHIP && GetStation(order->GetDestination())->IsBuoy()) continue;
- SetDParam(0, order->dest);
+ SetDParam(0, order->GetDestination());
DrawString(x, y, STR_A036, TC_FROMSTRING);
y += 6;
@@ -1952,9 +1952,9 @@
str = STR_8861_STOPPED;
}
} else { // vehicle is in a "normal" state, show current order
- switch (v->current_order.type) {
+ switch (v->current_order.GetType()) {
case OT_GOTO_STATION: {
- SetDParam(0, v->current_order.dest);
+ SetDParam(0, v->current_order.GetDestination());
SetDParam(1, v->GetDisplaySpeed());
str = STR_HEADING_FOR_STATION + _patches.vehicle_speed;
} break;
@@ -1962,14 +1962,14 @@
case OT_GOTO_DEPOT: {
if (v->type == VEH_AIRCRAFT) {
/* Aircrafts always go to a station, even if you say depot */
- SetDParam(0, v->current_order.dest);
+ SetDParam(0, v->current_order.GetDestination());
SetDParam(1, v->GetDisplaySpeed());
} else {
- Depot *depot = GetDepot(v->current_order.dest);
+ Depot *depot = GetDepot(v->current_order.GetDestination());
SetDParam(0, depot->town_index);
SetDParam(1, v->GetDisplaySpeed());
}
- if (HasBit(v->current_order.flags, OF_HALT_IN_DEPOT) && !HasBit(v->current_order.flags, OF_PART_OF_ORDERS)) {
+ if (HasBit(v->current_order.GetDepotActionType(), OF_HALT_IN_DEPOT) && !HasBit(v->current_order.GetDepotOrderType(), OF_PART_OF_ORDERS)) {
str = _heading_for_depot_strings[v->type] + _patches.vehicle_speed;
} else {
str = _heading_for_depot_service_strings[v->type] + _patches.vehicle_speed;
@@ -1982,7 +1982,7 @@
case OT_GOTO_WAYPOINT: {
assert(v->type == VEH_TRAIN);
- SetDParam(0, v->current_order.dest);
+ SetDParam(0, v->current_order.GetDestination());
str = STR_HEADING_FOR_WAYPOINT + _patches.vehicle_speed;
SetDParam(1, v->GetDisplaySpeed());
break;
--- a/src/viewport.cpp Sun Apr 06 14:12:19 2008 +0000
+++ b/src/viewport.cpp Sun Apr 06 23:07:42 2008 +0000
@@ -27,11 +27,15 @@
#include "player_func.h"
#include "settings_type.h"
#include "station_func.h"
+#include "core/alloc_func.hpp"
#include "table/sprites.h"
#include "table/strings.h"
-#define VIEWPORT_DRAW_MEM (65536 * 2)
+enum {
+ VIEWPORT_DRAW_MEM = (65536 * 2),
+ PARENT_LIST_SIZE = 6144,
+};
PlaceProc *_place_proc;
Point _tile_fract_coords;
@@ -1226,8 +1230,8 @@
const Sign *si;
int left, top, right, bottom;
- if (!HasBit(_display_opt, DO_SHOW_SIGNS))
- return;
+ /* Signs are turned off or are invisible */
+ if (!HasBit(_display_opt, DO_SHOW_SIGNS) || IsInvisibilitySet(TO_SIGNS)) return;
left = dpi->left;
top = dpi->top;
@@ -1491,6 +1495,12 @@
uint16 colour;
if (ss->width != 0) {
+ /* Do not draw signs nor station names if they are set invisible */
+ if (IsInvisibilitySet(TO_SIGNS) && ss->string != STR_2806) {
+ ss = ss->next;
+ continue;
+ }
+
int x = UnScaleByZoom(ss->x, zoom) - 1;
int y = UnScaleByZoom(ss->y, zoom) - 1;
int bottom = y + 11;
@@ -1541,8 +1551,8 @@
int y;
DrawPixelInfo *old_dpi;
- byte mem[VIEWPORT_DRAW_MEM];
- ParentSpriteToDraw *parent_list[6144];
+ SmallStackSafeStackAlloc<byte, VIEWPORT_DRAW_MEM> mem;
+ SmallStackSafeStackAlloc<ParentSpriteToDraw*, PARENT_LIST_SIZE> parent_list;
_cur_vd = &vd;
@@ -1566,9 +1576,9 @@
vd.dpi.dst_ptr = BlitterFactoryBase::GetCurrentBlitter()->MoveTo(old_dpi->dst_ptr, x - old_dpi->left, y - old_dpi->top);
vd.parent_list = parent_list;
- vd.eof_parent_list = endof(parent_list);
+ vd.eof_parent_list = parent_list.EndOf();
vd.spritelist_mem = mem;
- vd.eof_spritelist_mem = endof(mem) - sizeof(LARGEST_SPRITELIST_STRUCT);
+ vd.eof_spritelist_mem = mem.EndOf() - sizeof(LARGEST_SPRITELIST_STRUCT);
vd.last_string = &vd.first_string;
vd.first_string = NULL;
vd.last_tile = &vd.first_tile;
@@ -1954,7 +1964,8 @@
{
const Sign *si;
- if (!HasBit(_display_opt, DO_SHOW_SIGNS) || _current_player == PLAYER_SPECTATOR) return false;
+ /* Signs are turned off, or they are transparent and invisibility is ON, or player is a spectator */
+ if (!HasBit(_display_opt, DO_SHOW_SIGNS) || IsInvisibilitySet(TO_SIGNS) || _current_player == PLAYER_SPECTATOR) return false;
switch (vp->zoom) {
case ZOOM_LVL_NORMAL:
--- a/src/water_cmd.cpp Sun Apr 06 14:12:19 2008 +0000
+++ b/src/water_cmd.cpp Sun Apr 06 23:07:42 2008 +0000
@@ -597,6 +597,9 @@
if (image < 4) image += water_base;
if (draw_ground) DrawGroundSprite(image, PAL_NONE);
+ /* End now if buildings are invisible */
+ if (IsInvisibilitySet(TO_BUILDINGS)) return;
+
for (; wdts->delta_x != 0x80; wdts++) {
AddSortableSpriteToDraw(wdts->image + base + ((wdts->image < 24) ? locks_base : 0), palette,
ti->x + wdts->delta_x, ti->y + wdts->delta_y,
@@ -1040,7 +1043,7 @@
if (IsTileType(dest, MP_WATER)) continue;
uint z_dest;
- Slope slope_dest = (Slope)(GetFoundationSlope(dest, &z_dest) & ~SLOPE_HALFTILE_MASK & ~SLOPE_STEEP);
+ Slope slope_dest = GetFoundationSlope(dest, &z_dest) & ~SLOPE_HALFTILE_MASK & ~SLOPE_STEEP;
if (z_dest > 0) continue;
if (!HasBit(_flood_from_dirs[slope_dest], ReverseDir(dir))) continue;
@@ -1050,7 +1053,7 @@
break;
case FLOOD_DRYUP: {
- Slope slope_here = (Slope)(GetFoundationSlope(tile, NULL) & ~SLOPE_HALFTILE_MASK & ~SLOPE_STEEP);
+ Slope slope_here = GetFoundationSlope(tile, NULL) & ~SLOPE_HALFTILE_MASK & ~SLOPE_STEEP;
uint check_dirs = _flood_from_dirs[slope_here];
uint dir;
FOR_EACH_SET_BIT(dir, check_dirs) {
@@ -1097,7 +1100,7 @@
uint dir;
FOR_EACH_SET_BIT(dir, check_dirs) {
TileIndex dest = TILE_ADD(tile, TileOffsByDir((Direction)dir));
- Slope slope_dest = (Slope)(GetTileSlope(dest, NULL) & ~SLOPE_STEEP);
+ Slope slope_dest = GetTileSlope(dest, NULL) & ~SLOPE_STEEP;
if (slope_dest == SLOPE_FLAT || IsSlopeWithOneCornerRaised(slope_dest)) {
MakeShore(tile);
break;
--- a/src/waypoint.cpp Sun Apr 06 14:12:19 2008 +0000
+++ b/src/waypoint.cpp Sun Apr 06 23:07:42 2008 +0000
@@ -236,7 +236,7 @@
FOR_ALL_VEHICLES(v) {
if (v->type == VEH_TRAIN &&
v->First() == v &&
- v->current_order.type == OT_GOTO_WAYPOINT &&
+ v->current_order.IsType(OT_GOTO_WAYPOINT) &&
v->dest_tile == wp->xy) {
v->dest_tile = tile;
}
--- a/src/yapf/yapf_destrail.hpp Sun Apr 06 14:12:19 2008 +0000
+++ b/src/yapf/yapf_destrail.hpp Sun Apr 06 23:07:42 2008 +0000
@@ -86,18 +86,18 @@
public:
void SetDestination(Vehicle* v)
{
- switch (v->current_order.type) {
+ switch (v->current_order.GetType()) {
case OT_GOTO_STATION:
- m_destTile = CalcStationCenterTile(v->current_order.dest);
- m_dest_station_id = v->current_order.dest;
+ m_destTile = CalcStationCenterTile(v->current_order.GetDestination());
+ m_dest_station_id = v->current_order.GetDestination();
m_destTrackdirs = INVALID_TRACKDIR_BIT;
break;
case OT_GOTO_WAYPOINT: {
- Waypoint *wp = GetWaypoint(v->current_order.dest);
+ Waypoint *wp = GetWaypoint(v->current_order.GetDestination());
if (wp == NULL) {
/* Invalid waypoint in orders! */
- DEBUG(yapf, 0, "Invalid waypoint in orders == 0x%04X (train %d, player %d)", v->current_order.dest, v->unitnumber, (PlayerID)v->owner);
+ DEBUG(yapf, 0, "Invalid waypoint in orders == 0x%04X (train %d, player %d)", v->current_order.GetDestination(), v->unitnumber, (PlayerID)v->owner);
break;
}
m_destTile = wp->xy;
--- a/src/yapf/yapf_road.cpp Sun Apr 06 14:12:19 2008 +0000
+++ b/src/yapf/yapf_road.cpp Sun Apr 06 23:07:42 2008 +0000
@@ -84,7 +84,7 @@
const Vehicle* v = Yapf().GetVehicle();
// we have reached the vehicle's destination - segment should end here to avoid target skipping
- if (v->current_order.type == OT_GOTO_STATION && tile == v->dest_tile) break;
+ if (v->current_order.IsType(OT_GOTO_STATION) && tile == v->dest_tile) break;
// stop if we have just entered the depot
if (IsTileDepotType(tile, TRANSPORT_ROAD) && trackdir == DiagdirToDiagTrackdir(ReverseDiagDir(GetRoadDepotDirection(tile)))) {