mirror of https://github.com/OpenTTD/OpenTTD
(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
parent
a1826a043e
commit
a873aa3337
|
@ -459,7 +459,7 @@ public:
|
||||||
str = GetGRFStringID(indsp->grf_prop.grffile->grfid, 0xD000 + callback_res); // No. here's the new string
|
str = GetGRFStringID(indsp->grf_prop.grffile->grfid, 0xD000 + callback_res); // No. here's the new string
|
||||||
if (str != STR_UNDEFINED) {
|
if (str != STR_UNDEFINED) {
|
||||||
PrepareTextRefStackUsage(6);
|
PrepareTextRefStackUsage(6);
|
||||||
DrawStringMultiLine(left, right, y, bottom, str);
|
DrawStringMultiLine(left, right, y, bottom, str, TC_YELLOW);
|
||||||
StopTextRefStackUsage();
|
StopTextRefStackUsage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4490,6 +4490,7 @@ static void RailTypeMapSpriteGroup(ByteReader *buf, uint8 idcount)
|
||||||
if (railtypes[i] != INVALID_RAILTYPE) {
|
if (railtypes[i] != INVALID_RAILTYPE) {
|
||||||
RailtypeInfo *rti = &_railtypes[railtypes[i]];
|
RailtypeInfo *rti = &_railtypes[railtypes[i]];
|
||||||
|
|
||||||
|
rti->grffile[ctype] = _cur_grffile;
|
||||||
rti->group[ctype] = _cur_grffile->spritegroups[groupid];
|
rti->group[ctype] = _cur_grffile->spritegroups[groupid];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,7 +67,7 @@ static const SpriteGroup *RailTypeResolveReal(const ResolverObject *object, cons
|
||||||
return NULL;
|
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->GetRandomBits = &RailTypeGetRandomBits;
|
||||||
res->GetTriggers = &RailTypeGetTriggers;
|
res->GetTriggers = &RailTypeGetTriggers;
|
||||||
|
@ -85,6 +85,8 @@ static inline void NewRailTypeResolver(ResolverObject *res, TileIndex tile, Tile
|
||||||
res->trigger = 0;
|
res->trigger = 0;
|
||||||
res->reseed = 0;
|
res->reseed = 0;
|
||||||
res->count = 0;
|
res->count = 0;
|
||||||
|
|
||||||
|
res->grffile = grffile;
|
||||||
}
|
}
|
||||||
|
|
||||||
SpriteID GetCustomRailSprite(const RailtypeInfo *rti, TileIndex tile, RailTypeSpriteGroup rtsg, TileContext context)
|
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;
|
const SpriteGroup *group;
|
||||||
ResolverObject object;
|
ResolverObject object;
|
||||||
|
|
||||||
NewRailTypeResolver(&object, tile, context);
|
NewRailTypeResolver(&object, tile, context, rti->grffile[rtsg]);
|
||||||
|
|
||||||
group = SpriteGroup::Resolve(rti->group[rtsg], &object);
|
group = SpriteGroup::Resolve(rti->group[rtsg], &object);
|
||||||
if (group == NULL || group->GetNumResults() == 0) return 0;
|
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)
|
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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -392,7 +392,10 @@ void MakeNewgameSettingsLive()
|
||||||
}
|
}
|
||||||
#endif /* ENABLE_AI */
|
#endif /* ENABLE_AI */
|
||||||
|
|
||||||
|
/* Copy newgame settings to active settings.
|
||||||
|
* Also initialise old settings needed for savegame conversion. */
|
||||||
_settings_game = _settings_newgame;
|
_settings_game = _settings_newgame;
|
||||||
|
_old_vds = _settings_client.company.vehicle;
|
||||||
|
|
||||||
#ifdef ENABLE_AI
|
#ifdef ENABLE_AI
|
||||||
for (CompanyID c = COMPANY_FIRST; c < MAX_COMPANIES; c++) {
|
for (CompanyID c = COMPANY_FIRST; c < MAX_COMPANIES; c++) {
|
||||||
|
|
|
@ -232,6 +232,11 @@ struct RailtypeInfo {
|
||||||
*/
|
*/
|
||||||
byte sorting_order;
|
byte sorting_order;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* NewGRF providing the Action3 for the railtype. NULL if not available.
|
||||||
|
*/
|
||||||
|
const GRFFile *grffile[RTSG_END];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sprite groups for resolving sprites
|
* Sprite groups for resolving sprites
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -334,7 +334,7 @@ void AfterLoadVehicles(bool part_of_load)
|
||||||
if (IsSavegameVersionBefore(160)) {
|
if (IsSavegameVersionBefore(160)) {
|
||||||
/* In some old savegames there might be some "crap" stored. */
|
/* In some old savegames there might be some "crap" stored. */
|
||||||
FOR_ALL_VEHICLES(v) {
|
FOR_ALL_VEHICLES(v) {
|
||||||
if (!v->IsPrimaryVehicle()) {
|
if (!v->IsPrimaryVehicle() && v->type != VEH_DISASTER) {
|
||||||
v->current_order.Free();
|
v->current_order.Free();
|
||||||
v->unitnumber = 0;
|
v->unitnumber = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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);
|
bool SetSettingValue(uint index, const char *value, bool force_newgame = false);
|
||||||
void SetCompanySetting(uint index, int32 value);
|
void SetCompanySetting(uint index, int32 value);
|
||||||
|
|
||||||
extern VehicleDefaultSettings _old_vds;
|
|
||||||
|
|
||||||
#endif /* SETTINGS_INTERNAL_H */
|
#endif /* SETTINGS_INTERNAL_H */
|
||||||
|
|
|
@ -452,6 +452,9 @@ extern GameSettings _settings_game;
|
||||||
/** The settings values that are used for new games and/or modified in config file. */
|
/** The settings values that are used for new games and/or modified in config file. */
|
||||||
extern GameSettings _settings_newgame;
|
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
|
* 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.
|
* when we're in the main menu and otherwise the settings of the current game.
|
||||||
|
|
|
@ -105,6 +105,7 @@ static const RailtypeInfo _original_railtypes[] = {
|
||||||
0 << 4 | 7,
|
0 << 4 | 7,
|
||||||
|
|
||||||
{ NULL },
|
{ NULL },
|
||||||
|
{ NULL },
|
||||||
},
|
},
|
||||||
|
|
||||||
/** Electrified railway */
|
/** Electrified railway */
|
||||||
|
@ -197,6 +198,7 @@ static const RailtypeInfo _original_railtypes[] = {
|
||||||
1 << 4 | 7,
|
1 << 4 | 7,
|
||||||
|
|
||||||
{ NULL },
|
{ NULL },
|
||||||
|
{ NULL },
|
||||||
},
|
},
|
||||||
|
|
||||||
/** Monorail */
|
/** Monorail */
|
||||||
|
@ -285,6 +287,7 @@ static const RailtypeInfo _original_railtypes[] = {
|
||||||
2 << 4 | 7,
|
2 << 4 | 7,
|
||||||
|
|
||||||
{ NULL },
|
{ NULL },
|
||||||
|
{ NULL },
|
||||||
},
|
},
|
||||||
|
|
||||||
/** Maglev */
|
/** Maglev */
|
||||||
|
@ -373,6 +376,7 @@ static const RailtypeInfo _original_railtypes[] = {
|
||||||
3 << 4 | 7,
|
3 << 4 | 7,
|
||||||
|
|
||||||
{ NULL },
|
{ NULL },
|
||||||
|
{ NULL },
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue