mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r11938) -Codechange: support loading of canal/river properties (though still ignored)
This commit is contained in:
parent
0a6425926b
commit
ca1b3e7b4e
|
@ -1134,6 +1134,38 @@ static bool StationChangeInfo(uint stid, int numinfo, int prop, byte **bufp, int
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool CanalChangeInfo(uint id, int numinfo, int prop, byte **bufp, int len)
|
||||||
|
{
|
||||||
|
byte *buf = *bufp;
|
||||||
|
bool ret = false;
|
||||||
|
|
||||||
|
if (id + numinfo > CF_END) {
|
||||||
|
grfmsg(1, "CanalChangeInfo: Canal feature %u is invalid, max %u, ignoreing", id + numinfo, CF_END);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < numinfo; i++) {
|
||||||
|
WaterFeature *wf = &_water_feature[id + i];
|
||||||
|
|
||||||
|
switch (prop) {
|
||||||
|
case 0x08:
|
||||||
|
wf->callbackmask = grf_load_byte(&buf);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 0x09:
|
||||||
|
wf->flags = grf_load_byte(&buf);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
ret = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
*bufp = buf;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
static bool BridgeChangeInfo(uint brid, int numinfo, int prop, byte **bufp, int len)
|
static bool BridgeChangeInfo(uint brid, int numinfo, int prop, byte **bufp, int len)
|
||||||
{
|
{
|
||||||
byte *buf = *bufp;
|
byte *buf = *bufp;
|
||||||
|
@ -2128,7 +2160,7 @@ static void FeatureChangeInfo(byte *buf, int len)
|
||||||
/* GSF_SHIP */ ShipVehicleChangeInfo,
|
/* GSF_SHIP */ ShipVehicleChangeInfo,
|
||||||
/* GSF_AIRCRAFT */ AircraftVehicleChangeInfo,
|
/* GSF_AIRCRAFT */ AircraftVehicleChangeInfo,
|
||||||
/* GSF_STATION */ StationChangeInfo,
|
/* GSF_STATION */ StationChangeInfo,
|
||||||
/* GSF_CANAL */ NULL,
|
/* GSF_CANAL */ CanalChangeInfo,
|
||||||
/* GSF_BRIDGE */ BridgeChangeInfo,
|
/* GSF_BRIDGE */ BridgeChangeInfo,
|
||||||
/* GSF_TOWNHOUSE */ TownHouseChangeInfo,
|
/* GSF_TOWNHOUSE */ TownHouseChangeInfo,
|
||||||
/* GSF_GLOBALVAR */ NULL, /* Global variables are handled during reservation */
|
/* GSF_GLOBALVAR */ NULL, /* Global variables are handled during reservation */
|
||||||
|
@ -2876,7 +2908,7 @@ static void CanalMapSpriteGroup(byte *buf, uint8 idcount, uint8 cidcount)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
_canal_sg[cf] = _cur_grffile->spritegroups[groupid];
|
_water_feature[cf].group = _cur_grffile->spritegroups[groupid];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5037,8 +5069,8 @@ static void ResetNewGRFData()
|
||||||
ResetStationClasses();
|
ResetStationClasses();
|
||||||
ResetCustomStations();
|
ResetCustomStations();
|
||||||
|
|
||||||
/* Reset canal sprite groups */
|
/* Reset canal sprite groups and flags */
|
||||||
memset(_canal_sg, 0, sizeof(_canal_sg));
|
memset(_water_feature, 0, sizeof(_water_feature));
|
||||||
|
|
||||||
/* Reset the snowline table. */
|
/* Reset the snowline table. */
|
||||||
ClearSnowLine();
|
ClearSnowLine();
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
|
|
||||||
|
|
||||||
/** Table of canal 'feature' sprite groups */
|
/** Table of canal 'feature' sprite groups */
|
||||||
const SpriteGroup *_canal_sg[CF_END];
|
WaterFeature _water_feature[CF_END];
|
||||||
|
|
||||||
|
|
||||||
/* Random bits and triggers are not supported for canals, so the following
|
/* Random bits and triggers are not supported for canals, so the following
|
||||||
|
@ -94,7 +94,7 @@ SpriteID GetCanalSprite(CanalFeature feature, TileIndex tile)
|
||||||
|
|
||||||
NewCanalResolver(&object, tile);
|
NewCanalResolver(&object, tile);
|
||||||
|
|
||||||
group = Resolve(_canal_sg[feature], &object);
|
group = Resolve(_water_feature[feature].group, &object);
|
||||||
if (group == NULL || group->type != SGT_RESULT) return 0;
|
if (group == NULL || group->type != SGT_RESULT) return 0;
|
||||||
|
|
||||||
return group->g.result.sprite;
|
return group->g.result.sprite;
|
||||||
|
|
|
@ -17,8 +17,15 @@ enum CanalFeature {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
struct WaterFeature {
|
||||||
|
const SpriteGroup *group;
|
||||||
|
uint8 callbackmask;
|
||||||
|
uint8 flags;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/** Table of canal 'feature' sprite groups */
|
/** Table of canal 'feature' sprite groups */
|
||||||
extern const SpriteGroup *_canal_sg[CF_END];
|
extern WaterFeature _water_feature[CF_END];
|
||||||
|
|
||||||
|
|
||||||
/** Lookup the base sprite to use for a canal.
|
/** Lookup the base sprite to use for a canal.
|
||||||
|
|
Loading…
Reference in New Issue