diff --git a/src/newgrf_engine.cpp b/src/newgrf_engine.cpp index ef31b976c9..6e0cc07a57 100644 --- a/src/newgrf_engine.cpp +++ b/src/newgrf_engine.cpp @@ -446,6 +446,7 @@ static uint8 LiveryHelper(EngineID engine, const Vehicle *v) 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 @@ static uint32 VehicleGetVariable(const ResolverObject *object, byte variable, by 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; diff --git a/src/rev.cpp.in b/src/rev.cpp.in index 0db42ac602..b163a27e14 100644 --- a/src/rev.cpp.in +++ b/src/rev.cpp.in @@ -34,7 +34,7 @@ extern const char _openttd_revision[] = "@@VERSION@@"; * 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__ /** diff --git a/src/road_cmd.cpp b/src/road_cmd.cpp index 11ff5b9468..0249d1e6d3 100644 --- a/src/road_cmd.cpp +++ b/src/road_cmd.cpp @@ -180,7 +180,7 @@ static CommandCost RemoveRoad(TileIndex tile, uint32 flags, RoadBits pieces, Roa 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 @@ static CommandCost RemoveRoad(TileIndex tile, uint32 flags, RoadBits pieces, Roa 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) { diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp index a62b6a0ed6..cd764a9f27 100644 --- a/src/station_cmd.cpp +++ b/src/station_cmd.cpp @@ -984,7 +984,7 @@ CommandCost CmdBuildRailroadStation(TileIndex tile_org, uint32 flags, uint32 p1, 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 @@ CommandCost CmdBuildRoadStop(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) 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 @@ CommandCost CmdBuildAirport(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) 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 @@ CommandCost CmdBuildBuoy(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) 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 @@ CommandCost CmdBuildDock(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) 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 @@ uint MoveGoodsToStation(TileIndex tile, int w, int h, CargoID type, uint amount) 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); diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp index 030e0295d5..202cafcd53 100644 --- a/src/town_cmd.cpp +++ b/src/town_cmd.cpp @@ -2438,7 +2438,7 @@ void SetTownRatingTestMode(bool mode) static int ref_count = 0; if (mode) { if (ref_count == 0) { - _town_test_ratings.empty(); + _town_test_ratings.clear(); } ref_count++; } else {