(svn r13198) [0.6] -Backport from trunk (r12910, r12914, r12915, r12919, r12920):
- Fix: Town rating was affected even after the test run (r12920)
- Fix: Flood road tiles even when there are road works in progress [FS#1965] (r12919)
- Fix: Do not initialize Station struct with tile=0, buoys will never change that value [FS#1960] (r12915)
- Fix: Game crash when a spectator/server tried to show an engine with no owner when a NewGRF requested a specific variable (r12914)
- Fix: Report reverse sprite status (FD/FE) to NewGRF for manually toggled vehicles (r12910)
--- a/src/newgrf_engine.cpp Thu May 08 17:30:02 2008 +0000
+++ b/src/newgrf_engine.cpp Tue May 20 19:57:22 2008 +0000
@@ -446,6 +446,7 @@
const Livery *l;
if (v == NULL) {
+ if (!IsValidPlayer(_current_player)) return 0;
l = GetEngineLivery(engine, _current_player, INVALID_ENGINE, NULL);
} else if (v->type == VEH_TRAIN) {
l = GetEngineLivery((v->u.rail.first_engine != INVALID_ENGINE && (IsArticulatedPart(v) || UsesWagonOverride(v))) ? v->u.rail.first_engine : v->engine_type, v->owner, v->u.rail.first_engine, v);
@@ -692,7 +693,10 @@
case 0x45: return v->unitnumber;
case 0x46: return v->engine_type;
case 0x47: return GB(v->engine_type, 8, 8);
- case 0x48: return v->spritenum;
+ case 0x48:
+ if (v->type != VEH_TRAIN || v->spritenum != 0xFD) return v->spritenum;
+ return HasBit(v->u.rail.flags, VRF_REVERSE_DIRECTION) ? 0xFE : 0xFD;
+
case 0x49: return v->day_counter;
case 0x4A: return v->breakdowns_since_last_service;
case 0x4B: return v->breakdown_ctr;
--- a/src/rev.cpp.in Thu May 08 17:30:02 2008 +0000
+++ b/src/rev.cpp.in Tue May 20 19:57:22 2008 +0000
@@ -34,7 +34,7 @@
* final release will always have a lower version number than the released
* version, thus making comparisions on specific revisions easy.
*/
-uint32 _openttd_newgrf_version = 0 << 28 | 6 << 24 | 0 << 20 | 0 << 19 | (@@REVISION@@ & ((1 << 19) - 1));
+uint32 _openttd_newgrf_version = 0 << 28 | 6 << 24 | 1 << 20 | 0 << 19 | (@@REVISION@@ & ((1 << 19) - 1));
#ifdef __MORPHOS__
/**
--- a/src/road_cmd.cpp Thu May 08 17:30:02 2008 +0000
+++ b/src/road_cmd.cpp Tue May 20 19:57:22 2008 +0000
@@ -180,7 +180,7 @@
RoadBits present = GetRoadBits(tile, rt);
RoadBits c = pieces;
- if (HasRoadWorks(tile)) return_cmd_error(STR_ROAD_WORKS_IN_PROGRESS);
+ if (HasRoadWorks(tile) && _current_player != OWNER_WATER) return_cmd_error(STR_ROAD_WORKS_IN_PROGRESS);
if (GetTileSlope(tile, NULL) != SLOPE_FLAT &&
(present == ROAD_Y || present == ROAD_X)) {
@@ -195,6 +195,16 @@
if (town_check) ChangeTownRating(t, -road_remove_cost[(byte)edge_road], RATING_ROAD_MINIMUM);
if (flags & DC_EXEC) {
present ^= c;
+ if (HasRoadWorks(tile)) {
+ /* flooding tile with road works, don't forget to remove the effect vehicle too */
+ assert(_current_player == OWNER_WATER);
+ Vehicle *v;
+ FOR_ALL_VEHICLES(v) {
+ if (v->type == VEH_SPECIAL && TileVirtXY(v->x_pos, v->y_pos) == tile) {
+ delete v;
+ }
+ }
+ }
if (present == ROAD_NONE) {
RoadTypes rts = GetRoadTypes(tile) & ComplementRoadTypes(RoadTypeToRoadTypes(rt));
if (rts == ROADTYPES_NONE) {
--- a/src/station_cmd.cpp Thu May 08 17:30:02 2008 +0000
+++ b/src/station_cmd.cpp Tue May 20 19:57:22 2008 +0000
@@ -984,7 +984,7 @@
if (!Station::CanAllocateItem()) return_cmd_error(STR_3008_TOO_MANY_STATIONS_LOADING);
if (flags & DC_EXEC) {
- st = new Station();
+ st = new Station(tile_org);
st->town = ClosestTownFromTile(tile_org, (uint)-1);
GenerateStationName(st, tile_org, STATIONNAMING_RAIL);
@@ -1398,7 +1398,7 @@
if (!Station::CanAllocateItem()) return_cmd_error(STR_3008_TOO_MANY_STATIONS_LOADING);
if (flags & DC_EXEC) {
- st = new Station();
+ st = new Station(tile);
st->town = ClosestTownFromTile(tile, (uint)-1);
GenerateStationName(st, tile, STATIONNAMING_ROAD);
@@ -1704,7 +1704,7 @@
if (!Station::CanAllocateItem()) return_cmd_error(STR_3008_TOO_MANY_STATIONS_LOADING);
if (flags & DC_EXEC) {
- st = new Station();
+ st = new Station(tile);
st->town = ClosestTownFromTile(tile, (uint)-1);
GenerateStationName(st, tile, !(afc->flags & AirportFTAClass::AIRPLANES) ? STATIONNAMING_HELIPORT : STATIONNAMING_AIRPORT);
@@ -1820,7 +1820,7 @@
if (!Station::CanAllocateItem()) return_cmd_error(STR_3008_TOO_MANY_STATIONS_LOADING);
if (flags & DC_EXEC) {
- Station *st = new Station();
+ Station *st = new Station(tile);
st->town = ClosestTownFromTile(tile, (uint)-1);
GenerateStationName(st, tile, STATIONNAMING_BUOY);
@@ -1983,7 +1983,7 @@
if (!Station::CanAllocateItem()) return_cmd_error(STR_3008_TOO_MANY_STATIONS_LOADING);
if (flags & DC_EXEC) {
- st = new Station();
+ st = new Station(tile);
st->town = ClosestTownFromTile(tile, (uint)-1);
GenerateStationName(st, tile, STATIONNAMING_DOCK);
@@ -2798,7 +2798,7 @@
void BuildOilRig(TileIndex tile)
{
- Station *st = new Station();
+ Station *st = new Station(tile);
if (st == NULL) {
DEBUG(misc, 0, "Can't allocate station for oilrig at 0x%X, reverting to oilrig only", tile);
--- a/src/town_cmd.cpp Thu May 08 17:30:02 2008 +0000
+++ b/src/town_cmd.cpp Tue May 20 19:57:22 2008 +0000
@@ -2438,7 +2438,7 @@
static int ref_count = 0;
if (mode) {
if (ref_count == 0) {
- _town_test_ratings.empty();
+ _town_test_ratings.clear();
}
ref_count++;
} else {