1
0
Fork 0

(svn r19551) [1.0] -Backport from trunk:

- Feature: Add rail speed limit to land area information window (r19434)
- Fix: [NewGRF] Bytes and words get sign-extended for temporary/persistent storage (r19497)
- Fix: Stop reducing the size of the vehicle list after selecting a vehicle with a long description (r19480)
- Fix: Implement custom sound effect for helicopter take-off [FS#3668] (r19364)
- Update: Plural type of Slovak (r19452)
release/1.0
rubidium 2010-04-03 19:48:01 +00:00
parent 6837650080
commit 3106bb110e
17 changed files with 55 additions and 16 deletions

View File

@ -16,8 +16,6 @@
* *
* \b 1.0.0 * \b 1.0.0
* *
* 1.0.0 is not yet released. The following changes are not set in stone yet.
*
* API additions: * API additions:
* \li AIBaseStation * \li AIBaseStation
* \li AIEngine::IsBuildable * \li AIEngine::IsBuildable

View File

@ -876,7 +876,11 @@ static bool AircraftController(Aircraft *v)
/* Make sure the rotors don't rotate too fast */ /* Make sure the rotors don't rotate too fast */
if (u->cur_speed > 32) { if (u->cur_speed > 32) {
v->cur_speed = 0; 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 { } else {
u->cur_speed = 32; u->cur_speed = 32;
count = UpdateAircraftSpeed(v); count = UpdateAircraftSpeed(v);

View File

@ -1122,8 +1122,9 @@ struct BuildVehicleWindow : Window {
} }
} }
if (needed_height != this->details_height) { // Details window are not high enough, enlarge them. 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->details_height = needed_height;
this->ReInit(); this->ReInit(0, resize);
return; return;
} }
} }

View File

@ -26,7 +26,7 @@ extern IndustryPool _industry_pool;
* Defines the internal data of a functionnal industry * Defines the internal data of a functionnal industry
*/ */
struct Industry : IndustryPool::PoolItem<&_industry_pool> { struct Industry : IndustryPool::PoolItem<&_industry_pool> {
typedef PersistentStorageArray<uint32, 16> PersistentStorage; typedef PersistentStorageArray<int32, 16> PersistentStorage;
TileArea location; ///< Location of the industry TileArea location; ///< Location of the industry
const Town *town; ///< Nearest town const Town *town; ///< Nearest town

View File

@ -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_NEWGRF_NAME :{BLACK}NewGRF: {LTBLUE}{RAW_STRING}
STR_LAND_AREA_INFORMATION_CARGO_ACCEPTED :{BLACK}Cargo accepted: {LTBLUE} STR_LAND_AREA_INFORMATION_CARGO_ACCEPTED :{BLACK}Cargo accepted: {LTBLUE}
STR_LAND_AREA_INFORMATION_CARGO_EIGHTS :({COMMA}/8 {STRING}) 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 # Description of land area of different tiles
STR_LAI_CLEAR_DESCRIPTION_ROCKS :Rocks STR_LAI_CLEAR_DESCRIPTION_ROCKS :Rocks

View File

@ -1,7 +1,7 @@
##name Slovak ##name Slovak
##ownname Slovensky ##ownname Slovensky
##isocode sk_SK ##isocode sk_SK
##plural 6 ##plural 10
##textdir ltr ##textdir ltr
##digitsep . ##digitsep .
##digitsepcur . ##digitsepcur .

View File

@ -157,6 +157,7 @@ public:
td.station_class = STR_NULL; td.station_class = STR_NULL;
td.station_name = STR_NULL; td.station_name = STR_NULL;
td.rail_speed = 0;
td.grf = NULL; td.grf = NULL;
@ -243,6 +244,13 @@ public:
line_nr++; 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 */ /* NewGRF name */
if (td.grf != NULL) { if (td.grf != NULL) {
SetDParamStr(0, td.grf); SetDParamStr(0, td.grf);

View File

@ -42,7 +42,7 @@ TileLayoutSpriteGroup::~TileLayoutSpriteGroup()
free(this->dts); free(this->dts);
} }
TemporaryStorageArray<uint32, 0x110> _temp_store; TemporaryStorageArray<int32, 0x110> _temp_store;
static inline uint32 GetVariable(const ResolverObject *object, byte variable, byte parameter, bool *available) 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_AND: return last_value & value;
case DSGA_OP_OR: return last_value | value; case DSGA_OP_OR: return last_value | value;
case DSGA_OP_XOR: 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_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_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_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); case DSGA_OP_UCMP: return ((U)last_value == (U)value) ? 1 : ((U)last_value < (U)value ? 0 : 2);

View File

@ -31,7 +31,7 @@
*/ */
static inline uint32 GetRegister(uint i) static inline uint32 GetRegister(uint i)
{ {
extern TemporaryStorageArray<uint32, 0x110> _temp_store; extern TemporaryStorageArray<int32, 0x110> _temp_store;
return _temp_store.Get(i); return _temp_store.Get(i);
} }

View File

@ -37,7 +37,7 @@ struct BaseStorageArray
* @param pos the position to write at * @param pos the position to write at
* @param value the value to write * @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 pos the position to write at
* @param value the value to write * @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 */ /* Out of the scope of the array */
if (pos >= SIZE) return; if (pos >= SIZE) return;
@ -138,7 +138,7 @@ struct TemporaryStorageArray : BaseStorageArray {
* @param pos the position to write at * @param pos the position to write at
* @param value the value to write * @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 */ /* Out of the scope of the array */
if (pos >= SIZE) return; if (pos >= SIZE) return;

View File

@ -571,7 +571,7 @@ static TextRefStack *_newgrf_textrefstack = &_newgrf_normal_textrefstack;
*/ */
void PrepareTextRefStackUsage(byte numEntries) void PrepareTextRefStackUsage(byte numEntries)
{ {
extern TemporaryStorageArray<uint32, 0x110> _temp_store; extern TemporaryStorageArray<int32, 0x110> _temp_store;
_newgrf_textrefstack->ResetStack(); _newgrf_textrefstack->ResetStack();

View File

@ -2523,6 +2523,8 @@ static bool ClickTile_Track(TileIndex tile)
static void GetTileDesc_Track(TileIndex tile, TileDesc *td) 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); td->owner[0] = GetTileOwner(tile);
switch (GetRailTileType(tile)) { switch (GetRailTileType(tile)) {
case RAIL_TILE_NORMAL: case RAIL_TILE_NORMAL:
@ -2596,6 +2598,11 @@ static void GetTileDesc_Track(TileIndex tile, TileDesc *td)
case RAIL_TILE_DEPOT: case RAIL_TILE_DEPOT:
td->str = STR_LAI_RAIL_DESCRIPTION_TRAIN_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; break;
default: default:

View File

@ -1500,6 +1500,10 @@ static void GetTileDesc_Road(TileIndex tile, TileDesc *td)
rail_owner = GetTileOwner(tile); rail_owner = GetTileOwner(tile);
if (HasBit(rts, ROADTYPE_ROAD)) road_owner = GetRoadOwner(tile, ROADTYPE_ROAD); if (HasBit(rts, ROADTYPE_ROAD)) road_owner = GetRoadOwner(tile, ROADTYPE_ROAD);
if (HasBit(rts, ROADTYPE_TRAM)) tram_owner = GetRoadOwner(tile, ROADTYPE_TRAM); if (HasBit(rts, ROADTYPE_TRAM)) tram_owner = GetRoadOwner(tile, ROADTYPE_TRAM);
const RailtypeInfo *rti = GetRailTypeInfo(GetRailType(tile));
td->rail_speed = rti->max_speed;
break; break;
} }

View File

@ -2575,6 +2575,9 @@ static void GetTileDesc_Station(TileIndex tile, TileDesc *td)
td->grf = gc->name; td->grf = gc->name;
} }
} }
const RailtypeInfo *rti = GetRailTypeInfo(GetRailType(tile));
td->rail_speed = rti->max_speed;
} }
StringID str; StringID str;

View File

@ -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] /* Three forms, special cases for numbers ending in 1 and 2, 3, 4, except those ending in 1[1-4]
* Used in: * Used in:
* Croatian, Russian, Slovak, Ukrainian */ * Croatian, Russian, Ukrainian */
case 6: case 6:
return n % 10 == 1 && n % 100 != 11 ? 0 : n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 10 || n % 100 >= 20) ? 1 : 2; 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 /* Three forms, special cases for one and 2, 3, or 4
* Used in: * Used in:
* Czech */ * Czech, Slovak */
case 10: case 10:
return n == 1 ? 0 : n >= 2 && n <= 4 ? 1 : 2; return n == 1 ? 0 : n >= 2 && n <= 4 ? 1 : 2;

View File

@ -59,6 +59,7 @@ struct TileDesc {
StringID station_name; ///< Type of station within the class StringID station_name; ///< Type of station within the class
const char *grf; ///< newGRF used for the tile contents const char *grf; ///< newGRF used for the tile contents
uint64 dparam[2]; ///< Parameters of the \a str string uint64 dparam[2]; ///< Parameters of the \a str string
uint16 rail_speed; ///< Speed limit of rail
}; };
/** /**

View File

@ -1312,6 +1312,18 @@ static void GetTileDesc_TunnelBridge(TileIndex tile, TileDesc *td)
td->owner[i] = tram_owner; 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;
}
}
}
} }