diff --git a/src/ai/api/ai_changelog.hpp b/src/ai/api/ai_changelog.hpp index 813ca16692..4aa6e7a51b 100644 --- a/src/ai/api/ai_changelog.hpp +++ b/src/ai/api/ai_changelog.hpp @@ -16,8 +16,6 @@ * * \b 1.0.0 * - * 1.0.0 is not yet released. The following changes are not set in stone yet. - * * API additions: * \li AIBaseStation * \li AIEngine::IsBuildable diff --git a/src/aircraft_cmd.cpp b/src/aircraft_cmd.cpp index e5be7fe5b1..e26b84c378 100644 --- a/src/aircraft_cmd.cpp +++ b/src/aircraft_cmd.cpp @@ -876,7 +876,11 @@ static bool AircraftController(Aircraft *v) /* Make sure the rotors don't rotate too fast */ if (u->cur_speed > 32) { v->cur_speed = 0; - if (--u->cur_speed == 32) SndPlayVehicleFx(SND_18_HELICOPTER, v); + if (--u->cur_speed == 32) { + if (!PlayVehicleSound(v, VSE_START)) { + SndPlayVehicleFx(SND_18_HELICOPTER, v); + } + } } else { u->cur_speed = 32; count = UpdateAircraftSpeed(v); diff --git a/src/build_vehicle_gui.cpp b/src/build_vehicle_gui.cpp index b521935f74..6af8b9714c 100644 --- a/src/build_vehicle_gui.cpp +++ b/src/build_vehicle_gui.cpp @@ -1122,8 +1122,9 @@ struct BuildVehicleWindow : Window { } } if (needed_height != this->details_height) { // Details window are not high enough, enlarge them. + int resize = needed_height - this->details_height; this->details_height = needed_height; - this->ReInit(); + this->ReInit(0, resize); return; } } diff --git a/src/industry.h b/src/industry.h index 99ba24924e..325c53ccb9 100644 --- a/src/industry.h +++ b/src/industry.h @@ -26,7 +26,7 @@ extern IndustryPool _industry_pool; * Defines the internal data of a functionnal industry */ struct Industry : IndustryPool::PoolItem<&_industry_pool> { - typedef PersistentStorageArray PersistentStorage; + typedef PersistentStorageArray PersistentStorage; TileArea location; ///< Location of the industry const Town *town; ///< Nearest town diff --git a/src/lang/english.txt b/src/lang/english.txt index afd07a89bb..4770a20cfc 100644 --- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -2124,6 +2124,7 @@ STR_LAND_AREA_INFORMATION_STATION_TYPE :{BLACK}Station STR_LAND_AREA_INFORMATION_NEWGRF_NAME :{BLACK}NewGRF: {LTBLUE}{RAW_STRING} STR_LAND_AREA_INFORMATION_CARGO_ACCEPTED :{BLACK}Cargo accepted: {LTBLUE} STR_LAND_AREA_INFORMATION_CARGO_EIGHTS :({COMMA}/8 {STRING}) +STR_LANG_AREA_INFORMATION_RAIL_SPEED_LIMIT :{BLACK}Rail speed limit: {LTBLUE}{VELOCITY} # Description of land area of different tiles STR_LAI_CLEAR_DESCRIPTION_ROCKS :Rocks diff --git a/src/lang/slovak.txt b/src/lang/slovak.txt index b9da027374..8a0d9f4aab 100644 --- a/src/lang/slovak.txt +++ b/src/lang/slovak.txt @@ -1,7 +1,7 @@ ##name Slovak ##ownname Slovensky ##isocode sk_SK -##plural 6 +##plural 10 ##textdir ltr ##digitsep . ##digitsepcur . diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp index cc326edea4..4029239db3 100644 --- a/src/misc_gui.cpp +++ b/src/misc_gui.cpp @@ -157,6 +157,7 @@ public: td.station_class = STR_NULL; td.station_name = STR_NULL; + td.rail_speed = 0; td.grf = NULL; @@ -243,6 +244,13 @@ public: line_nr++; } + /* Rail speed limit */ + if (td.rail_speed != 0) { + SetDParam(0, td.rail_speed); + GetString(this->landinfo_data[line_nr], STR_LANG_AREA_INFORMATION_RAIL_SPEED_LIMIT, lastof(this->landinfo_data[line_nr])); + line_nr++; + } + /* NewGRF name */ if (td.grf != NULL) { SetDParamStr(0, td.grf); diff --git a/src/newgrf_spritegroup.cpp b/src/newgrf_spritegroup.cpp index 993a75102e..19b73c63ce 100644 --- a/src/newgrf_spritegroup.cpp +++ b/src/newgrf_spritegroup.cpp @@ -42,7 +42,7 @@ TileLayoutSpriteGroup::~TileLayoutSpriteGroup() free(this->dts); } -TemporaryStorageArray _temp_store; +TemporaryStorageArray _temp_store; static inline uint32 GetVariable(const ResolverObject *object, byte variable, byte parameter, bool *available) @@ -118,9 +118,9 @@ static U EvalAdjustT(const DeterministicSpriteGroupAdjust *adjust, ResolverObjec case DSGA_OP_AND: return last_value & value; case DSGA_OP_OR: return last_value | value; case DSGA_OP_XOR: return last_value ^ value; - case DSGA_OP_STO: _temp_store.Store(value, last_value); return last_value; + case DSGA_OP_STO: _temp_store.Store((U)value, (S)last_value); return last_value; case DSGA_OP_RST: return value; - case DSGA_OP_STOP: if (object->psa != NULL) object->psa->Store(value, last_value); return last_value; + case DSGA_OP_STOP: if (object->psa != NULL) object->psa->Store((U)value, (S)last_value); return last_value; case DSGA_OP_ROR: return RotateRight(last_value, value); case DSGA_OP_SCMP: return ((S)last_value == (S)value) ? 1 : ((S)last_value < (S)value ? 0 : 2); case DSGA_OP_UCMP: return ((U)last_value == (U)value) ? 1 : ((U)last_value < (U)value ? 0 : 2); diff --git a/src/newgrf_spritegroup.h b/src/newgrf_spritegroup.h index 22c202aa68..2a2ca216e5 100644 --- a/src/newgrf_spritegroup.h +++ b/src/newgrf_spritegroup.h @@ -31,7 +31,7 @@ */ static inline uint32 GetRegister(uint i) { - extern TemporaryStorageArray _temp_store; + extern TemporaryStorageArray _temp_store; return _temp_store.Get(i); } diff --git a/src/newgrf_storage.h b/src/newgrf_storage.h index 4e43f124b8..cff102acef 100644 --- a/src/newgrf_storage.h +++ b/src/newgrf_storage.h @@ -37,7 +37,7 @@ struct BaseStorageArray * @param pos the position to write at * @param value the value to write */ - virtual void Store(uint pos, uint32 value) = 0; + virtual void Store(uint pos, int32 value) = 0; }; /** @@ -70,7 +70,7 @@ struct PersistentStorageArray : BaseStorageArray { * @param pos the position to write at * @param value the value to write */ - void Store(uint pos, uint32 value) + void Store(uint pos, int32 value) { /* Out of the scope of the array */ if (pos >= SIZE) return; @@ -138,7 +138,7 @@ struct TemporaryStorageArray : BaseStorageArray { * @param pos the position to write at * @param value the value to write */ - void Store(uint pos, uint32 value) + void Store(uint pos, int32 value) { /* Out of the scope of the array */ if (pos >= SIZE) return; diff --git a/src/newgrf_text.cpp b/src/newgrf_text.cpp index a0f5cb9d7f..ca26adf8b3 100644 --- a/src/newgrf_text.cpp +++ b/src/newgrf_text.cpp @@ -571,7 +571,7 @@ static TextRefStack *_newgrf_textrefstack = &_newgrf_normal_textrefstack; */ void PrepareTextRefStackUsage(byte numEntries) { - extern TemporaryStorageArray _temp_store; + extern TemporaryStorageArray _temp_store; _newgrf_textrefstack->ResetStack(); diff --git a/src/rail_cmd.cpp b/src/rail_cmd.cpp index d8f7ceb2aa..54b9c75f38 100644 --- a/src/rail_cmd.cpp +++ b/src/rail_cmd.cpp @@ -2523,6 +2523,8 @@ static bool ClickTile_Track(TileIndex tile) static void GetTileDesc_Track(TileIndex tile, TileDesc *td) { + const RailtypeInfo *rti = GetRailTypeInfo(GetRailType(tile)); + td->rail_speed = rti->max_speed; td->owner[0] = GetTileOwner(tile); switch (GetRailTileType(tile)) { case RAIL_TILE_NORMAL: @@ -2596,6 +2598,11 @@ static void GetTileDesc_Track(TileIndex tile, TileDesc *td) case RAIL_TILE_DEPOT: td->str = STR_LAI_RAIL_DESCRIPTION_TRAIN_DEPOT; + if (td->rail_speed > 0) { + td->rail_speed = min(td->rail_speed, 61); + } else { + td->rail_speed = 61; + } break; default: diff --git a/src/road_cmd.cpp b/src/road_cmd.cpp index 3cf8f84653..70fc176585 100644 --- a/src/road_cmd.cpp +++ b/src/road_cmd.cpp @@ -1500,6 +1500,10 @@ static void GetTileDesc_Road(TileIndex tile, TileDesc *td) rail_owner = GetTileOwner(tile); if (HasBit(rts, ROADTYPE_ROAD)) road_owner = GetRoadOwner(tile, ROADTYPE_ROAD); if (HasBit(rts, ROADTYPE_TRAM)) tram_owner = GetRoadOwner(tile, ROADTYPE_TRAM); + + const RailtypeInfo *rti = GetRailTypeInfo(GetRailType(tile)); + td->rail_speed = rti->max_speed; + break; } diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp index 9258965ede..32ad4fd957 100644 --- a/src/station_cmd.cpp +++ b/src/station_cmd.cpp @@ -2575,6 +2575,9 @@ static void GetTileDesc_Station(TileIndex tile, TileDesc *td) td->grf = gc->name; } } + + const RailtypeInfo *rti = GetRailTypeInfo(GetRailType(tile)); + td->rail_speed = rti->max_speed; } StringID str; diff --git a/src/strings.cpp b/src/strings.cpp index e27560b53f..c673e54ff8 100644 --- a/src/strings.cpp +++ b/src/strings.cpp @@ -410,7 +410,7 @@ static int DeterminePluralForm(int64 count) /* Three forms, special cases for numbers ending in 1 and 2, 3, 4, except those ending in 1[1-4] * Used in: - * Croatian, Russian, Slovak, Ukrainian */ + * Croatian, Russian, Ukrainian */ case 6: return n % 10 == 1 && n % 100 != 11 ? 0 : n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 10 || n % 100 >= 20) ? 1 : 2; @@ -434,7 +434,7 @@ static int DeterminePluralForm(int64 count) /* Three forms, special cases for one and 2, 3, or 4 * Used in: - * Czech */ + * Czech, Slovak */ case 10: return n == 1 ? 0 : n >= 2 && n <= 4 ? 1 : 2; diff --git a/src/tile_cmd.h b/src/tile_cmd.h index d8eede25dc..b2c6a04547 100644 --- a/src/tile_cmd.h +++ b/src/tile_cmd.h @@ -59,6 +59,7 @@ struct TileDesc { StringID station_name; ///< Type of station within the class const char *grf; ///< newGRF used for the tile contents uint64 dparam[2]; ///< Parameters of the \a str string + uint16 rail_speed; ///< Speed limit of rail }; /** diff --git a/src/tunnelbridge_cmd.cpp b/src/tunnelbridge_cmd.cpp index c30bd23049..f8bf9d2a6f 100644 --- a/src/tunnelbridge_cmd.cpp +++ b/src/tunnelbridge_cmd.cpp @@ -1312,6 +1312,18 @@ static void GetTileDesc_TunnelBridge(TileIndex tile, TileDesc *td) td->owner[i] = tram_owner; } } + + if (tt == TRANSPORT_RAIL) { + const RailtypeInfo *rti = GetRailTypeInfo(GetRailType(tile)); + td->rail_speed = rti->max_speed; + + if (!IsTunnel(tile)) { + uint16 spd = GetBridgeSpec(GetBridgeType(tile))->speed; + if (td->rail_speed == 0 || spd < td->rail_speed) { + td->rail_speed = spd; + } + } + } }