mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-11 13:10:45 +00:00
(svn r21171) -Change: Reset industry build data at game start or load.
This commit is contained in:
parent
701fb1907f
commit
40d69ce604
@ -151,6 +151,8 @@ struct IndustryTypeBuildData {
|
|||||||
uint16 max_wait; ///< Starting number of turns to wait (copied to #wait_count).
|
uint16 max_wait; ///< Starting number of turns to wait (copied to #wait_count).
|
||||||
uint16 wait_count; ///< Number of turns to wait before trying to build again.
|
uint16 wait_count; ///< Number of turns to wait before trying to build again.
|
||||||
|
|
||||||
|
void Reset();
|
||||||
|
|
||||||
void GetIndustryTypeData(IndustryType it);
|
void GetIndustryTypeData(IndustryType it);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -161,6 +163,8 @@ struct IndustryBuildData {
|
|||||||
IndustryTypeBuildData builddata[NUM_INDUSTRYTYPES]; ///< Industry build data for every industry type.
|
IndustryTypeBuildData builddata[NUM_INDUSTRYTYPES]; ///< Industry build data for every industry type.
|
||||||
uint32 wanted_inds; ///< Number of wanted industries (bits 31-16), and a fraction (bits 15-0).
|
uint32 wanted_inds; ///< Number of wanted industries (bits 31-16), and a fraction (bits 15-0).
|
||||||
|
|
||||||
|
void Reset();
|
||||||
|
|
||||||
void SetupTargetCount();
|
void SetupTargetCount();
|
||||||
void TryBuildNewIndustry();
|
void TryBuildNewIndustry();
|
||||||
};
|
};
|
||||||
|
@ -1955,6 +1955,22 @@ static void PlaceInitialIndustry(IndustryType type, bool try_hard)
|
|||||||
cur_company.Restore();
|
cur_company.Restore();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** Reset the entry. */
|
||||||
|
void IndustryTypeBuildData::Reset()
|
||||||
|
{
|
||||||
|
this->probability = 0;
|
||||||
|
this->target_count = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Completely reset the industry build data. */
|
||||||
|
void IndustryBuildData::Reset()
|
||||||
|
{
|
||||||
|
for (IndustryType it = 0; it < NUM_INDUSTRYTYPES; it++) {
|
||||||
|
this->builddata[it].Reset();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function will create random industries during game creation.
|
* This function will create random industries during game creation.
|
||||||
* It will scale the amount of industries by mapsize and difficulty level.
|
* It will scale the amount of industries by mapsize and difficulty level.
|
||||||
@ -2005,6 +2021,7 @@ void GenerateIndustries()
|
|||||||
assert(industry_probs[it] > 0);
|
assert(industry_probs[it] > 0);
|
||||||
PlaceInitialIndustry(it, false);
|
PlaceInitialIndustry(it, false);
|
||||||
}
|
}
|
||||||
|
_industry_builder.Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -2541,6 +2558,8 @@ void InitializeIndustries()
|
|||||||
|
|
||||||
Industry::ResetIndustryCounts();
|
Industry::ResetIndustryCounts();
|
||||||
_industry_sound_tile = 0;
|
_industry_sound_tile = 0;
|
||||||
|
|
||||||
|
_industry_builder.Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IndustrySpec::IsRawIndustry() const
|
bool IndustrySpec::IsRawIndustry() const
|
||||||
|
@ -2319,8 +2319,9 @@ bool AfterLoadGame()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (CheckSavegameVersion(152)) {
|
if (CheckSavegameVersion(152)) {
|
||||||
|
_industry_builder.Reset(); // Initialize industry build data.
|
||||||
|
|
||||||
/* The moment vehicles go from hidden to visible changed. This means
|
/* The moment vehicles go from hidden to visible changed. This means
|
||||||
* that vehicles don't always get visible anymore causing things to
|
* that vehicles don't always get visible anymore causing things to
|
||||||
* get messed up just after loading the savegame. This fixes that. */
|
* get messed up just after loading the savegame. This fixes that. */
|
||||||
|
@ -214,8 +214,9 @@
|
|||||||
* 149 20832
|
* 149 20832
|
||||||
* 150 20857
|
* 150 20857
|
||||||
* 151 20918
|
* 151 20918
|
||||||
|
* 152 21171
|
||||||
*/
|
*/
|
||||||
extern const uint16 SAVEGAME_VERSION = 151; ///< current savegame version of OpenTTD
|
extern const uint16 SAVEGAME_VERSION = 152; ///< Current savegame version of OpenTTD.
|
||||||
|
|
||||||
SavegameType _savegame_type; ///< type of savegame we are loading
|
SavegameType _savegame_type; ///< type of savegame we are loading
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user