mirror of https://github.com/OpenTTD/OpenTTD
(svn r22918) -Fix: [NewGRF] Properties for feature 0x05 were not zeroed for each NewGRF, thus waterfeatures could glitch when the properties were set by a previous NewGRF and the NewGRF assumed the properties to be unmodified
parent
bc52aa11a6
commit
3b70f697e1
|
@ -1650,15 +1650,15 @@ static ChangeInfoResult CanalChangeInfo(uint id, int numinfo, int prop, ByteRead
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < numinfo; i++) {
|
for (int i = 0; i < numinfo; i++) {
|
||||||
WaterFeature *wf = &_water_feature[id + i];
|
CanalProperties *cp = &_cur.grffile->canal_local_properties[id + i];
|
||||||
|
|
||||||
switch (prop) {
|
switch (prop) {
|
||||||
case 0x08:
|
case 0x08:
|
||||||
wf->callback_mask = buf->ReadByte();
|
cp->callback_mask = buf->ReadByte();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x09:
|
case 0x09:
|
||||||
wf->flags = buf->ReadByte();
|
cp->flags = buf->ReadByte();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -7656,6 +7656,17 @@ static void CalculateRefitMasks()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Set to use the correct action0 properties for each canal feature */
|
||||||
|
static void FinaliseCanals()
|
||||||
|
{
|
||||||
|
for (uint i = 0; i < CF_END; i++) {
|
||||||
|
if (_water_feature[i].grffile != NULL) {
|
||||||
|
_water_feature[i].callback_mask = _water_feature[i].grffile->canal_local_properties[i].callback_mask;
|
||||||
|
_water_feature[i].flags = _water_feature[i].grffile->canal_local_properties[i].flags;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** Check for invalid engines */
|
/** Check for invalid engines */
|
||||||
static void FinaliseEngineArray()
|
static void FinaliseEngineArray()
|
||||||
{
|
{
|
||||||
|
@ -8348,6 +8359,9 @@ static void AfterLoadGRFs()
|
||||||
/* Polish engines */
|
/* Polish engines */
|
||||||
FinaliseEngineArray();
|
FinaliseEngineArray();
|
||||||
|
|
||||||
|
/* Set the actually used Canal properties */
|
||||||
|
FinaliseCanals();
|
||||||
|
|
||||||
/* Set the block size in the depot windows based on vehicle sprite sizes */
|
/* Set the block size in the depot windows based on vehicle sprite sizes */
|
||||||
InitDepotWindowBlockSizes();
|
InitDepotWindowBlockSizes();
|
||||||
|
|
||||||
|
|
23
src/newgrf.h
23
src/newgrf.h
|
@ -16,6 +16,27 @@
|
||||||
#include "rail_type.h"
|
#include "rail_type.h"
|
||||||
#include "fileio_type.h"
|
#include "fileio_type.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List of different canal 'features'.
|
||||||
|
* Each feature gets an entry in the canal spritegroup table
|
||||||
|
*/
|
||||||
|
enum CanalFeature {
|
||||||
|
CF_WATERSLOPE,
|
||||||
|
CF_LOCKS,
|
||||||
|
CF_DIKES,
|
||||||
|
CF_ICON,
|
||||||
|
CF_DOCKS,
|
||||||
|
CF_RIVER_SLOPE,
|
||||||
|
CF_RIVER_EDGE,
|
||||||
|
CF_END,
|
||||||
|
};
|
||||||
|
|
||||||
|
/** Canal properties local to the NewGRF */
|
||||||
|
struct CanalProperties {
|
||||||
|
uint8 callback_mask; ///< Bitmask of canal callbacks that have to be called.
|
||||||
|
uint8 flags; ///< Flags controlling display.
|
||||||
|
};
|
||||||
|
|
||||||
enum GrfLoadingStage {
|
enum GrfLoadingStage {
|
||||||
GLS_FILESCAN,
|
GLS_FILESCAN,
|
||||||
GLS_SAFETYSCAN,
|
GLS_SAFETYSCAN,
|
||||||
|
@ -104,6 +125,8 @@ struct GRFFile {
|
||||||
RailTypeLabel *railtype_list;
|
RailTypeLabel *railtype_list;
|
||||||
RailType railtype_map[RAILTYPE_END];
|
RailType railtype_map[RAILTYPE_END];
|
||||||
|
|
||||||
|
CanalProperties canal_local_properties[CF_END]; ///< Canal properties as set by this NewGRF
|
||||||
|
|
||||||
struct LanguageMap *language_map; ///< Mappings related to the languages.
|
struct LanguageMap *language_map; ///< Mappings related to the languages.
|
||||||
|
|
||||||
int traininfo_vehicle_pitch; ///< Vertical offset for draing train images in depot GUI and vehicle details
|
int traininfo_vehicle_pitch; ///< Vertical offset for draing train images in depot GUI and vehicle details
|
||||||
|
|
|
@ -16,21 +16,6 @@
|
||||||
#include "tile_type.h"
|
#include "tile_type.h"
|
||||||
#include "newgrf_generic.h"
|
#include "newgrf_generic.h"
|
||||||
|
|
||||||
/**
|
|
||||||
* List of different canal 'features'.
|
|
||||||
* Each feature gets an entry in the canal spritegroup table
|
|
||||||
*/
|
|
||||||
enum CanalFeature {
|
|
||||||
CF_WATERSLOPE,
|
|
||||||
CF_LOCKS,
|
|
||||||
CF_DIKES,
|
|
||||||
CF_ICON,
|
|
||||||
CF_DOCKS,
|
|
||||||
CF_RIVER_SLOPE,
|
|
||||||
CF_RIVER_EDGE,
|
|
||||||
CF_END,
|
|
||||||
};
|
|
||||||
|
|
||||||
/** Flags controlling the display of canals. */
|
/** Flags controlling the display of canals. */
|
||||||
enum CanalFeatureFlag {
|
enum CanalFeatureFlag {
|
||||||
CFF_HAS_FLAT_SPRITE = 0, ///< Additional flat ground sprite in the beginning.
|
CFF_HAS_FLAT_SPRITE = 0, ///< Additional flat ground sprite in the beginning.
|
||||||
|
|
Loading…
Reference in New Issue