1
0
Fork 0

(svn r13199) [0.6] -Backport from trunk (r12933, r12943, r12947, r12948, r12951, r12993, r12996):

- Fix: Debugging was not possible with MSVC 2008 (r12996)
- Fix: List used for sorting GRFs was not freed (r12993)
- Fix: Default difficulty settings were different to TTD's original settings [FS#1977] (r12951)
- Fix: All vehicles would be available when an original scenario would be played [FS#1982] (r12948)
- Fix: Keep only first 15 bits for non failed callback results (r12947)
- Fix: Reading/modifying invalid data under some circumstances (r12943)
- Fix: Minor errors related to industries accepted/produced cargo (r12933)
release/0.6
rubidium 2008-05-20 20:03:45 +00:00
parent f4d1d082ab
commit 966c2fe4b9
7 changed files with 56 additions and 11 deletions

View File

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioUserFile
ProjectType="Visual C++"
Version="9.00"
ShowAllFiles="false"
>
<Configurations>
<Configuration
Name="Release|Win32"
>
<DebugSettings
WorkingDirectory="..\bin"
/>
</Configuration>
<Configuration
Name="Debug|Win32"
>
<DebugSettings
WorkingDirectory="..\bin"
/>
</Configuration>
<Configuration
Name="Release|x64"
>
<DebugSettings
WorkingDirectory="..\bin"
/>
</Configuration>
<Configuration
Name="Debug|x64"
>
<DebugSettings
WorkingDirectory="..\bin"
/>
</Configuration>
</Configurations>
</VisualStudioUserFile>

View File

@ -315,7 +315,7 @@ FILE *FioFOpenFileSp(const char *filename, const char *mode, Searchpath sp, Subd
f = fopen(buf, mode);
#if !defined(WIN32)
if (f == NULL) {
strtolower(buf + strlen(_searchpaths[sp]) - 1);
strtolower(buf + ((subdir == NO_DIRECTORY) ? 0 : strlen(_searchpaths[sp]) - 1));
f = fopen(buf, mode);
}
#endif

View File

@ -1383,7 +1383,7 @@ static bool CheckIfFarEnoughFromIndustry(TileIndex tile, int type)
const IndustrySpec *indspec = GetIndustrySpec(type);
const Industry *i;
if (_patches.same_industry_close && indspec->accepts_cargo[0] == CT_INVALID)
if (_patches.same_industry_close && indspec->IsRawIndustry())
/* Allow primary industries to be placed close to any other industry */
return true;
@ -1393,7 +1393,7 @@ static bool CheckIfFarEnoughFromIndustry(TileIndex tile, int type)
/* check if an industry that accepts the same goods is nearby */
if (in_low_distance &&
indspec->accepts_cargo[0] != CT_INVALID && // not a primary industry?
!indspec->IsRawIndustry() && // not a primary industry?
indspec->accepts_cargo[0] == i->accepts_cargo[0] && (
/* at least one of those options must be true */
_game_mode != GM_EDITOR || // editor must not be stopped
@ -1896,7 +1896,8 @@ static void CanCargoServiceIndustry(CargoID cargo, Industry *ind, bool *c_accept
const IndustrySpec *indspec = GetIndustrySpec(ind->type);
/* Check for acceptance of cargo */
for (uint j = 0; j < lengthof(ind->accepts_cargo) && ind->accepts_cargo[j] != CT_INVALID; j++) {
for (byte j = 0; j < lengthof(ind->accepts_cargo); j++) {
if (ind->accepts_cargo[j] == CT_INVALID) continue;
if (cargo == ind->accepts_cargo[j]) {
if (HasBit(indspec->callback_flags, CBM_IND_REFUSE_CARGO)) {
uint16 res = GetIndustryCallback(CBID_INDUSTRY_REFUSE_CARGO,
@ -1910,7 +1911,8 @@ static void CanCargoServiceIndustry(CargoID cargo, Industry *ind, bool *c_accept
}
/* Check for produced cargo */
for (uint j = 0; j < lengthof(ind->produced_cargo) && ind->produced_cargo[j] != CT_INVALID; j++) {
for (byte j = 0; j < lengthof(ind->produced_cargo); j++) {
if (ind->produced_cargo[j] == CT_INVALID) continue;
if (cargo == ind->produced_cargo[j]) {
*c_produces = true;
break;
@ -2072,7 +2074,8 @@ static void ChangeIndustryProduction(Industry *i, bool monthly)
if (smooth_economy) {
closeit = true;
for (byte j = 0; j < 2 && i->produced_cargo[j] != CT_INVALID; j++){
for (byte j = 0; j < lengthof(i->produced_cargo); j++) {
if (i->produced_cargo[j] == CT_INVALID) continue;
uint32 r = Random();
int old_prod, new_prod, percent;
/* If over 60% is transported, mult is 1, else mult is -1. */

View File

@ -410,7 +410,6 @@ void ScanNewGRFFiles()
* For that we first have to make an array, the qsort and
* then remake the linked list. */
GRFConfig **to_sort = MallocT<GRFConfig*>(num);
if (to_sort == NULL) return; // No memory, then don't sort
uint i = 0;
for (GRFConfig *p = _all_grfs; p != NULL; p = p->next, i++) {
@ -426,6 +425,8 @@ void ScanNewGRFFiles()
}
to_sort[num - 1]->next = NULL;
_all_grfs = to_sort[0];
free(to_sort);
}

View File

@ -204,6 +204,7 @@ static inline const SpriteGroup *ResolveVariable(const SpriteGroup *group, Resol
if (group->g.determ.num_ranges == 0) {
/* nvar == 0 is a special case -- we turn our value into a callback result */
if (value != CALLBACK_FAILED) value = GB(value, 0, 15);
nvarzero.type = SGT_CALLBACK;
nvarzero.g.callback.result = value;
return &nvarzero;

View File

@ -897,6 +897,9 @@ void SwitchMode(int new_mode)
SetDParamStr(0, GetSaveLoadErrorString());
ShowErrorMessage(INVALID_STRING_ID, STR_012D, 0, 0);
} else {
if (_saveload_mode == SLD_LOAD_SCENARIO) {
StartupEngines();
}
/* Update the local player for a loaded game. It is either always
* player #1 (eg 0) or in the case of a dedicated server a spectator */
SetLocalPlayer(_network_dedicated ? PLAYER_SPECTATOR : PLAYER_FIRST);

View File

@ -422,7 +422,7 @@ static const GameSettingData _game_setting_info[] = {
/*
* A: competitors
* B: start time in months / 3
* C: town count (2 = high, 0 = very low)
* C: town count (3 = high, 0 = very low)
* D: industry count (4 = high, 0 = none)
* E: inital loan / 1000 (in GBP)
* F: interest rate
@ -441,9 +441,9 @@ static const GameSettingData _game_setting_info[] = {
*/
static const GDType _default_game_diff[3][GAME_DIFFICULTY_NUM] = { /*
A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R*/
{2, 2, 1, 4, 300, 2, 0, 2, 0, 1, 2, 0, 1, 0, 0, 0, 0, 0}, ///< easy
{4, 1, 1, 3, 150, 3, 1, 3, 1, 2, 1, 1, 2, 1, 1, 1, 1, 1}, ///< medium
{7, 0, 0, 2, 100, 4, 1, 3, 2, 2, 0, 2, 3, 2, 1, 1, 1, 2}, ///< hard
{2, 2, 2, 4, 300, 2, 0, 2, 0, 1, 2, 0, 1, 0, 0, 0, 0, 0}, ///< easy
{4, 1, 2, 3, 150, 3, 1, 3, 1, 2, 1, 1, 2, 1, 1, 1, 1, 1}, ///< medium
{7, 0, 3, 3, 100, 4, 1, 3, 2, 2, 0, 2, 3, 2, 1, 1, 1, 2}, ///< hard
};
void SetDifficultyLevel(int mode, GameOptions *gm_opt)