Changeset - r391:ee0c349e3a75
[Not reviewed]
master
0 1 0
darkvater - 20 years ago 2004-11-14 10:03:21
darkvater@openttd.org
(svn r583) -newgrf: Hopefully prevent GRF files introducing new bridges or townhouses to crash the game (pasky).
1 file changed with 22 insertions and 3 deletions:
0 comments (0 inline, 0 general)
grfspecial.c
Show inline comments
 
@@ -69,6 +69,8 @@ enum grfspec_feature {
 
	GSF_SHIP,
 
	GSF_AIRCRAFT,
 
	GSF_STATION,
 
	GSF_BRIDGE,
 
	GSF_TOWNHOUSE,
 
};
 

	
 

	
 
@@ -697,6 +699,11 @@ static bool StationChangeInfo(uint stid,
 
	/* This is one single huge TODO. It doesn't handle anything more than
 
	 * just waypoints for now. */
 

	
 
	/* TODO: Differentiate between railtypes. This is missing in the new
 
	 * GRF file specification yet, though, so I need to agree on this with
 
	 * patchman yet. We just assume all the station stuff is for railtype 0
 
	 * (railroad) for now. --pasky */
 

	
 
	//printf("sci %d %d [0x%02x]\n", stid, numinfo, prop);
 
	switch (prop) {
 
		case 0x08:
 
@@ -877,14 +884,16 @@ static void VehicleChangeInfo(byte *buf,
 
	 *                 vehicles/stations will be changed
 
	 * B property      what property to change, depends on the feature
 
	 * V new-info      new bytes of info (variable size; depends on properties) */
 
	/* TODO: Stations. */
 
	/* TODO: Bridges, town houses. */
 

	
 
	static const VCI_Handler handler[5] = {
 
	static const VCI_Handler handler[7] = {
 
		/* GSF_TRAIN */    RailVehicleChangeInfo,
 
		/* GSF_ROAD */     RoadVehicleChangeInfo,
 
		/* GSF_SHIP */     ShipVehicleChangeInfo,
 
		/* GSF_AIRCRAFT */ AircraftVehicleChangeInfo,
 
		/* GSF_STATION */  StationChangeInfo,
 
		/* GSF_BRIDGE */   NULL,
 
		/* GSF_TOWNHOUSE */NULL,
 
	};
 

	
 
	uint8 feature;
 
@@ -902,6 +911,11 @@ static void VehicleChangeInfo(byte *buf,
 
	DEBUG(grf, 6) ("VehicleChangeInfo: Feature %d, %d properties, to apply to %d+%d",
 
	               feature, numprops, engine, numinfo);
 

	
 
	if (feature > GSF_STATION) {
 
		grfmsg(GMS_WARN, "VehicleChangeInfo: Unsupported feature %d, skipping.", feature);
 
		return;
 
	}
 

	
 
	if (feature != GSF_STATION)
 
		ei = &_engine_info[engine + _vehshifts[feature]];
 

	
 
@@ -1137,7 +1151,7 @@ static void NewVehicle_SpriteGroupMappin
 
	 * B cargo-type    type of this cargo type (e.g. mail=2, wood=7, see below)
 
	 * W cid           cargo ID (sprite group ID) for this type of cargo
 
	 * W def-cid       default cargo ID (sprite group ID) */
 
	/* TODO: Only trains supported now. */
 
	/* TODO: Bridges, town houses. */
 
	/* TODO: Multiple cargo support could be useful even for trains/cars -
 
	 * cargo id 0xff is used for showing images in the build train list. */
 

	
 
@@ -1160,6 +1174,11 @@ static void NewVehicle_SpriteGroupMappin
 
	DEBUG(grf, 6) ("VehicleMapSpriteGroup: Feature %d, %d ids, %d cids, wagon override %d.",
 
			feature, idcount, cidcount, wagover);
 

	
 
	if (feature > GSF_STATION) {
 
		grfmsg(GMS_WARN, "VehicleMapSpriteGroup: Unsupported feature %d, skipping.", feature);
 
		return;
 
	}
 

	
 

	
 
	if (feature == GSF_STATION) {
 
		// We do things differently for stations.
0 comments (0 inline, 0 general)