mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-07-10 22:34:10 +01:00
(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)
This commit is contained in:
parent
391127bfaf
commit
f4d1d082ab
@ -446,6 +446,7 @@ static uint8 LiveryHelper(EngineID engine, const Vehicle *v)
|
|||||||
const Livery *l;
|
const Livery *l;
|
||||||
|
|
||||||
if (v == NULL) {
|
if (v == NULL) {
|
||||||
|
if (!IsValidPlayer(_current_player)) return 0;
|
||||||
l = GetEngineLivery(engine, _current_player, INVALID_ENGINE, NULL);
|
l = GetEngineLivery(engine, _current_player, INVALID_ENGINE, NULL);
|
||||||
} else if (v->type == VEH_TRAIN) {
|
} 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);
|
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 0x45: return v->unitnumber;
|
||||||
case 0x46: return v->engine_type;
|
case 0x46: return v->engine_type;
|
||||||
case 0x47: return GB(v->engine_type, 8, 8);
|
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 0x49: return v->day_counter;
|
||||||
case 0x4A: return v->breakdowns_since_last_service;
|
case 0x4A: return v->breakdowns_since_last_service;
|
||||||
case 0x4B: return v->breakdown_ctr;
|
case 0x4B: return v->breakdown_ctr;
|
||||||
|
@ -34,7 +34,7 @@ extern const char _openttd_revision[] = "@@VERSION@@";
|
|||||||
* final release will always have a lower version number than the released
|
* final release will always have a lower version number than the released
|
||||||
* version, thus making comparisions on specific revisions easy.
|
* 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__
|
#ifdef __MORPHOS__
|
||||||
/**
|
/**
|
||||||
|
@ -180,7 +180,7 @@ static CommandCost RemoveRoad(TileIndex tile, uint32 flags, RoadBits pieces, Roa
|
|||||||
RoadBits present = GetRoadBits(tile, rt);
|
RoadBits present = GetRoadBits(tile, rt);
|
||||||
RoadBits c = pieces;
|
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 &&
|
if (GetTileSlope(tile, NULL) != SLOPE_FLAT &&
|
||||||
(present == ROAD_Y || present == ROAD_X)) {
|
(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 (town_check) ChangeTownRating(t, -road_remove_cost[(byte)edge_road], RATING_ROAD_MINIMUM);
|
||||||
if (flags & DC_EXEC) {
|
if (flags & DC_EXEC) {
|
||||||
present ^= c;
|
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) {
|
if (present == ROAD_NONE) {
|
||||||
RoadTypes rts = GetRoadTypes(tile) & ComplementRoadTypes(RoadTypeToRoadTypes(rt));
|
RoadTypes rts = GetRoadTypes(tile) & ComplementRoadTypes(RoadTypeToRoadTypes(rt));
|
||||||
if (rts == ROADTYPES_NONE) {
|
if (rts == ROADTYPES_NONE) {
|
||||||
|
@ -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 (!Station::CanAllocateItem()) return_cmd_error(STR_3008_TOO_MANY_STATIONS_LOADING);
|
||||||
|
|
||||||
if (flags & DC_EXEC) {
|
if (flags & DC_EXEC) {
|
||||||
st = new Station();
|
st = new Station(tile_org);
|
||||||
|
|
||||||
st->town = ClosestTownFromTile(tile_org, (uint)-1);
|
st->town = ClosestTownFromTile(tile_org, (uint)-1);
|
||||||
GenerateStationName(st, tile_org, STATIONNAMING_RAIL);
|
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 (!Station::CanAllocateItem()) return_cmd_error(STR_3008_TOO_MANY_STATIONS_LOADING);
|
||||||
|
|
||||||
if (flags & DC_EXEC) {
|
if (flags & DC_EXEC) {
|
||||||
st = new Station();
|
st = new Station(tile);
|
||||||
|
|
||||||
st->town = ClosestTownFromTile(tile, (uint)-1);
|
st->town = ClosestTownFromTile(tile, (uint)-1);
|
||||||
GenerateStationName(st, tile, STATIONNAMING_ROAD);
|
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 (!Station::CanAllocateItem()) return_cmd_error(STR_3008_TOO_MANY_STATIONS_LOADING);
|
||||||
|
|
||||||
if (flags & DC_EXEC) {
|
if (flags & DC_EXEC) {
|
||||||
st = new Station();
|
st = new Station(tile);
|
||||||
|
|
||||||
st->town = ClosestTownFromTile(tile, (uint)-1);
|
st->town = ClosestTownFromTile(tile, (uint)-1);
|
||||||
GenerateStationName(st, tile, !(afc->flags & AirportFTAClass::AIRPLANES) ? STATIONNAMING_HELIPORT : STATIONNAMING_AIRPORT);
|
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 (!Station::CanAllocateItem()) return_cmd_error(STR_3008_TOO_MANY_STATIONS_LOADING);
|
||||||
|
|
||||||
if (flags & DC_EXEC) {
|
if (flags & DC_EXEC) {
|
||||||
Station *st = new Station();
|
Station *st = new Station(tile);
|
||||||
|
|
||||||
st->town = ClosestTownFromTile(tile, (uint)-1);
|
st->town = ClosestTownFromTile(tile, (uint)-1);
|
||||||
GenerateStationName(st, tile, STATIONNAMING_BUOY);
|
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 (!Station::CanAllocateItem()) return_cmd_error(STR_3008_TOO_MANY_STATIONS_LOADING);
|
||||||
|
|
||||||
if (flags & DC_EXEC) {
|
if (flags & DC_EXEC) {
|
||||||
st = new Station();
|
st = new Station(tile);
|
||||||
|
|
||||||
st->town = ClosestTownFromTile(tile, (uint)-1);
|
st->town = ClosestTownFromTile(tile, (uint)-1);
|
||||||
GenerateStationName(st, tile, STATIONNAMING_DOCK);
|
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)
|
void BuildOilRig(TileIndex tile)
|
||||||
{
|
{
|
||||||
Station *st = new Station();
|
Station *st = new Station(tile);
|
||||||
|
|
||||||
if (st == NULL) {
|
if (st == NULL) {
|
||||||
DEBUG(misc, 0, "Can't allocate station for oilrig at 0x%X, reverting to oilrig only", tile);
|
DEBUG(misc, 0, "Can't allocate station for oilrig at 0x%X, reverting to oilrig only", tile);
|
||||||
|
@ -2438,7 +2438,7 @@ void SetTownRatingTestMode(bool mode)
|
|||||||
static int ref_count = 0;
|
static int ref_count = 0;
|
||||||
if (mode) {
|
if (mode) {
|
||||||
if (ref_count == 0) {
|
if (ref_count == 0) {
|
||||||
_town_test_ratings.empty();
|
_town_test_ratings.clear();
|
||||||
}
|
}
|
||||||
ref_count++;
|
ref_count++;
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user