1
0
Fork 0

(svn r22652) [1.1] -Backport from trunk:

- Fix: [NewGRF] Implement variables 25 and 7F for railtypes (r22633)
- Fix: [NewGRF] Additional text in fund industry window is NewGRF supplied and thus should have a default colour (r22631)
- Fix: Also initialise _old_vds with newgame settings; TTD savegames do not contain these settings [FS#4622] (r22626)
- Fix: Do not zero the orders of disaster vehicles when converting savegames [FS#4642] (r22625)
release/1.1
rubidium 2011-07-10 20:25:59 +00:00
parent a1826a043e
commit a873aa3337
9 changed files with 25 additions and 7 deletions

View File

@ -459,7 +459,7 @@ public:
str = GetGRFStringID(indsp->grf_prop.grffile->grfid, 0xD000 + callback_res); // No. here's the new string
if (str != STR_UNDEFINED) {
PrepareTextRefStackUsage(6);
DrawStringMultiLine(left, right, y, bottom, str);
DrawStringMultiLine(left, right, y, bottom, str, TC_YELLOW);
StopTextRefStackUsage();
}
}

View File

@ -4490,6 +4490,7 @@ static void RailTypeMapSpriteGroup(ByteReader *buf, uint8 idcount)
if (railtypes[i] != INVALID_RAILTYPE) {
RailtypeInfo *rti = &_railtypes[railtypes[i]];
rti->grffile[ctype] = _cur_grffile;
rti->group[ctype] = _cur_grffile->spritegroups[groupid];
}
}

View File

@ -67,7 +67,7 @@ static const SpriteGroup *RailTypeResolveReal(const ResolverObject *object, cons
return NULL;
}
static inline void NewRailTypeResolver(ResolverObject *res, TileIndex tile, TileContext context)
static inline void NewRailTypeResolver(ResolverObject *res, TileIndex tile, TileContext context, const GRFFile *grffile)
{
res->GetRandomBits = &RailTypeGetRandomBits;
res->GetTriggers = &RailTypeGetTriggers;
@ -85,6 +85,8 @@ static inline void NewRailTypeResolver(ResolverObject *res, TileIndex tile, Tile
res->trigger = 0;
res->reseed = 0;
res->count = 0;
res->grffile = grffile;
}
SpriteID GetCustomRailSprite(const RailtypeInfo *rti, TileIndex tile, RailTypeSpriteGroup rtsg, TileContext context)
@ -96,7 +98,7 @@ SpriteID GetCustomRailSprite(const RailtypeInfo *rti, TileIndex tile, RailTypeSp
const SpriteGroup *group;
ResolverObject object;
NewRailTypeResolver(&object, tile, context);
NewRailTypeResolver(&object, tile, context, rti->grffile[rtsg]);
group = SpriteGroup::Resolve(rti->group[rtsg], &object);
if (group == NULL || group->GetNumResults() == 0) return 0;
@ -126,5 +128,7 @@ uint8 GetReverseRailTypeTranslation(RailType railtype, const GRFFile *grffile)
*/
void GetRailTypeResolver(ResolverObject *ro, uint index)
{
NewRailTypeResolver(ro, index, TCX_NORMAL);
/* There is no unique GRFFile for the tile. Multiple GRFs can define different parts of the railtype.
* However, currently the NewGRF Debug GUI does not display variables depending on the GRF (like 0x7F) anyway. */
NewRailTypeResolver(ro, index, TCX_NORMAL, NULL);
}

View File

@ -392,7 +392,10 @@ void MakeNewgameSettingsLive()
}
#endif /* ENABLE_AI */
/* Copy newgame settings to active settings.
* Also initialise old settings needed for savegame conversion. */
_settings_game = _settings_newgame;
_old_vds = _settings_client.company.vehicle;
#ifdef ENABLE_AI
for (CompanyID c = COMPANY_FIRST; c < MAX_COMPANIES; c++) {

View File

@ -232,6 +232,11 @@ struct RailtypeInfo {
*/
byte sorting_order;
/**
* NewGRF providing the Action3 for the railtype. NULL if not available.
*/
const GRFFile *grffile[RTSG_END];
/**
* Sprite groups for resolving sprites
*/

View File

@ -334,7 +334,7 @@ void AfterLoadVehicles(bool part_of_load)
if (IsSavegameVersionBefore(160)) {
/* In some old savegames there might be some "crap" stored. */
FOR_ALL_VEHICLES(v) {
if (!v->IsPrimaryVehicle()) {
if (!v->IsPrimaryVehicle() && v->type != VEH_DISASTER) {
v->current_order.Free();
v->unitnumber = 0;
}

View File

@ -92,6 +92,4 @@ bool SetSettingValue(uint index, int32 value, bool force_newgame = false);
bool SetSettingValue(uint index, const char *value, bool force_newgame = false);
void SetCompanySetting(uint index, int32 value);
extern VehicleDefaultSettings _old_vds;
#endif /* SETTINGS_INTERNAL_H */

View File

@ -452,6 +452,9 @@ extern GameSettings _settings_game;
/** The settings values that are used for new games and/or modified in config file. */
extern GameSettings _settings_newgame;
/** Old vehicle settings, which were game settings before, and are company settings now. (Needed for savegame conversion) */
extern VehicleDefaultSettings _old_vds;
/**
* Get the settings-object applicable for the current situation: the newgame settings
* when we're in the main menu and otherwise the settings of the current game.

View File

@ -105,6 +105,7 @@ static const RailtypeInfo _original_railtypes[] = {
0 << 4 | 7,
{ NULL },
{ NULL },
},
/** Electrified railway */
@ -197,6 +198,7 @@ static const RailtypeInfo _original_railtypes[] = {
1 << 4 | 7,
{ NULL },
{ NULL },
},
/** Monorail */
@ -285,6 +287,7 @@ static const RailtypeInfo _original_railtypes[] = {
2 << 4 | 7,
{ NULL },
{ NULL },
},
/** Maglev */
@ -373,6 +376,7 @@ static const RailtypeInfo _original_railtypes[] = {
3 << 4 | 7,
{ NULL },
{ NULL },
},
};