mirror of https://github.com/OpenTTD/OpenTTD
(svn r13685) [0.6] -Backport from trunk:
- Fix: In the case that elrails and 'realistic' acceleration are disabled all electrified engines would have no power on load, until the vehicle got turned around, loaded or got into a depot [FS#2102] (r13681) - Fix: Saving TTD imported games in recession failed due to wrong (and unneeded) type conversions in the saveload code [FS#2131] (r13679) - Fix: Inactive companies from old (TTD) saves could be marked active in some cases, which then loads garbage in their statistics and such [FS#2126] (r13676) - Fix: Desync when building electrified trains on a dedicated server that was started with electrification disabled [FS#2122] (r13673) - Fix: Clear the memory for the new AI during the loading of a savegame so it does not try to execute commands generated in a different savegame, which could be resulting in the AI trying to give orders to stations that do not exist (r13505) - Fix: Loading of very old OpenTTD savegames was broken (r13373)release/0.6
parent
808f15e43f
commit
94ae5be42a
|
@ -2011,7 +2011,7 @@ static const SaveLoad _economy_desc[] = {
|
||||||
SLE_CONDVAR(Economy, max_loan_unround, SLE_FILE_I32 | SLE_VAR_I64, 0, 64),
|
SLE_CONDVAR(Economy, max_loan_unround, SLE_FILE_I32 | SLE_VAR_I64, 0, 64),
|
||||||
SLE_CONDVAR(Economy, max_loan_unround, SLE_INT64, 65, SL_MAX_VERSION),
|
SLE_CONDVAR(Economy, max_loan_unround, SLE_INT64, 65, SL_MAX_VERSION),
|
||||||
SLE_CONDVAR(Economy, max_loan_unround_fract, SLE_UINT16, 70, SL_MAX_VERSION),
|
SLE_CONDVAR(Economy, max_loan_unround_fract, SLE_UINT16, 70, SL_MAX_VERSION),
|
||||||
SLE_VAR(Economy, fluct, SLE_FILE_I16 | SLE_VAR_I32),
|
SLE_VAR(Economy, fluct, SLE_INT16),
|
||||||
SLE_VAR(Economy, interest_rate, SLE_UINT8),
|
SLE_VAR(Economy, interest_rate, SLE_UINT8),
|
||||||
SLE_VAR(Economy, infl_amount, SLE_UINT8),
|
SLE_VAR(Economy, infl_amount, SLE_UINT8),
|
||||||
SLE_VAR(Economy, infl_amount_pr, SLE_UINT8),
|
SLE_VAR(Economy, infl_amount_pr, SLE_UINT8),
|
||||||
|
|
|
@ -15,7 +15,7 @@ struct Economy {
|
||||||
Money max_loan; ///< Maximum possible loan
|
Money max_loan; ///< Maximum possible loan
|
||||||
Money max_loan_unround; ///< Economy fluctuation status
|
Money max_loan_unround; ///< Economy fluctuation status
|
||||||
uint16 max_loan_unround_fract; ///< Fraction of the unrounded max loan
|
uint16 max_loan_unround_fract; ///< Fraction of the unrounded max loan
|
||||||
int fluct;
|
int16 fluct;
|
||||||
byte interest_rate; ///< Interest
|
byte interest_rate; ///< Interest
|
||||||
byte infl_amount; ///< inflation amount
|
byte infl_amount; ///< inflation amount
|
||||||
byte infl_amount_pr; ///< "floating" portion of inflation
|
byte infl_amount_pr; ///< "floating" portion of inflation
|
||||||
|
|
|
@ -502,10 +502,13 @@ int32 SettingsDisableElrail(int32 p1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* setup total power for trains */
|
/* Fix the total power and acceleration for trains */
|
||||||
FOR_ALL_VEHICLES(v) {
|
FOR_ALL_VEHICLES(v) {
|
||||||
/* power is cached only for front engines */
|
/* power and acceleration is cached only for front engines */
|
||||||
if (v->type == VEH_TRAIN && IsFrontEngine(v)) TrainPowerChanged(v);
|
if (v->type == VEH_TRAIN && IsFrontEngine(v)) {
|
||||||
|
TrainPowerChanged(v);
|
||||||
|
UpdateTrainAcceleration(v);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FOR_ALL_PLAYERS(p) p->avail_railtypes = GetPlayerRailtypes(p->index);
|
FOR_ALL_PLAYERS(p) p->avail_railtypes = GetPlayerRailtypes(p->index);
|
||||||
|
|
|
@ -993,9 +993,13 @@ static bool LoadOldPlayer(LoadgameState *ls, int num)
|
||||||
|
|
||||||
if (!LoadChunk(ls, p, player_chunk)) return false;
|
if (!LoadChunk(ls, p, player_chunk)) return false;
|
||||||
|
|
||||||
|
if (_old_string_id == 0) {
|
||||||
|
p->is_active = false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
p->name_1 = RemapOldStringID(_old_string_id);
|
p->name_1 = RemapOldStringID(_old_string_id);
|
||||||
p->president_name_1 = RemapOldStringID(_old_string_id_2);
|
p->president_name_1 = RemapOldStringID(_old_string_id_2);
|
||||||
p->player_money = p->player_money;
|
|
||||||
_players_ai[_current_player_id].tick = ai_tick;
|
_players_ai[_current_player_id].tick = ai_tick;
|
||||||
|
|
||||||
if (num == 0) {
|
if (num == 0) {
|
||||||
|
@ -1540,7 +1544,7 @@ static const OldChunks main_chunk[] = {
|
||||||
|
|
||||||
OCL_VAR ( OC_FILE_U32 | OC_VAR_I64, 1, &_economy.max_loan ),
|
OCL_VAR ( OC_FILE_U32 | OC_VAR_I64, 1, &_economy.max_loan ),
|
||||||
OCL_VAR ( OC_FILE_U32 | OC_VAR_I64, 1, &_economy.max_loan_unround ),
|
OCL_VAR ( OC_FILE_U32 | OC_VAR_I64, 1, &_economy.max_loan_unround ),
|
||||||
OCL_VAR ( OC_FILE_U16 | OC_VAR_U32, 1, &_economy.fluct ),
|
OCL_VAR ( OC_INT16, 1, &_economy.fluct ),
|
||||||
|
|
||||||
OCL_VAR ( OC_UINT16, 1, &_disaster_delay ),
|
OCL_VAR ( OC_UINT16, 1, &_disaster_delay ),
|
||||||
|
|
||||||
|
|
|
@ -687,6 +687,8 @@ static void ShowScreenshotResult(bool b)
|
||||||
|
|
||||||
static void MakeNewGameDone()
|
static void MakeNewGameDone()
|
||||||
{
|
{
|
||||||
|
SettingsDisableElrail(_patches.disable_elrails);
|
||||||
|
|
||||||
/* In a dedicated server, the server does not play */
|
/* In a dedicated server, the server does not play */
|
||||||
if (_network_dedicated) {
|
if (_network_dedicated) {
|
||||||
SetLocalPlayer(PLAYER_SPECTATOR);
|
SetLocalPlayer(PLAYER_SPECTATOR);
|
||||||
|
@ -700,7 +702,6 @@ static void MakeNewGameDone()
|
||||||
_current_player = _local_player;
|
_current_player = _local_player;
|
||||||
DoCommandP(0, (_patches.autorenew << 15 ) | (_patches.autorenew_months << 16) | 4, _patches.autorenew_money, NULL, CMD_SET_AUTOREPLACE);
|
DoCommandP(0, (_patches.autorenew << 15 ) | (_patches.autorenew_months << 16) | 4, _patches.autorenew_money, NULL, CMD_SET_AUTOREPLACE);
|
||||||
|
|
||||||
SettingsDisableElrail(_patches.disable_elrails);
|
|
||||||
SetDefaultRailGui();
|
SetDefaultRailGui();
|
||||||
|
|
||||||
#ifdef ENABLE_NETWORK
|
#ifdef ENABLE_NETWORK
|
||||||
|
|
|
@ -1243,9 +1243,12 @@ static void Load_PLYR()
|
||||||
_player_colors[index] = p->player_color;
|
_player_colors[index] = p->player_color;
|
||||||
|
|
||||||
/* This is needed so an AI is attached to a loaded AI */
|
/* This is needed so an AI is attached to a loaded AI */
|
||||||
if (p->is_ai && (!_networking || _network_server) && _ai.enabled)
|
if (p->is_ai && (!_networking || _network_server) && _ai.enabled) {
|
||||||
|
/* Clear the memory of the new AI, otherwise we might be doing wrong things. */
|
||||||
|
memset(&_players_ainew[index], 0, sizeof(PlayerAiNew));
|
||||||
AI_StartNewAI(p->index);
|
AI_StartNewAI(p->index);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extern const ChunkHandler _player_chunk_handlers[] = {
|
extern const ChunkHandler _player_chunk_handlers[] = {
|
||||||
|
|
|
@ -620,10 +620,18 @@ void SlArray(void *array, uint length, VarType conv)
|
||||||
/* NOTICE - handle some buggy stuff, in really old versions everything was saved
|
/* NOTICE - handle some buggy stuff, in really old versions everything was saved
|
||||||
* as a byte-type. So detect this, and adjust array size accordingly */
|
* as a byte-type. So detect this, and adjust array size accordingly */
|
||||||
if (!_sl.save && _sl_version == 0) {
|
if (!_sl.save && _sl_version == 0) {
|
||||||
|
/* all arrays except difficulty settings */
|
||||||
if (conv == SLE_INT16 || conv == SLE_UINT16 || conv == SLE_STRINGID ||
|
if (conv == SLE_INT16 || conv == SLE_UINT16 || conv == SLE_STRINGID ||
|
||||||
conv == SLE_INT32 || conv == SLE_UINT32) {
|
conv == SLE_INT32 || conv == SLE_UINT32) {
|
||||||
length *= SlCalcConvFileLen(conv);
|
SlCopyBytes(array, length * SlCalcConvFileLen(conv));
|
||||||
conv = SLE_INT8;
|
return;
|
||||||
|
}
|
||||||
|
/* used for conversion of Money 32bit->64bit */
|
||||||
|
if (conv == (SLE_FILE_I32 | SLE_VAR_I64)) {
|
||||||
|
for (uint i = 0; i < length; i++) {
|
||||||
|
((int64*)array)[i] = (int32)BSWAP32(SlReadUint32());
|
||||||
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue