Changeset - r15725:0c28e29aa5d4
[Not reviewed]
master
0 7 0
rubidium - 14 years ago 2010-08-07 21:10:57
rubidium@openttd.org
(svn r20402) -Codechange: rename the airport/station class id to something slightly more generic
7 files changed with 13 insertions and 13 deletions:
0 comments (0 inline, 0 general)
src/ai/api/ai_rail.cpp
Show inline comments
 
@@ -172,13 +172,13 @@
 
	if (res != CALLBACK_FAILED) {
 
		int index = 0;
 
		const StationSpec *spec = GetCustomStationSpecByGrf(file->grfid, res, &index);
 
		if (spec == NULL) {
 
			DEBUG(grf, 1, "%s returned an invalid station ID for 'AI construction/purchase selection (18)' callback", file->filename);
 
		} else {
 
			p2 |= spec->sclass | index << 8;
 
			p2 |= spec->cls_id | index << 8;
 
		}
 

	
 
	}
 
	return AIObject::DoCommand(tile, p1, p2, CMD_BUILD_RAIL_STATION);
 
}
 

	
src/newgrf.cpp
Show inline comments
 
@@ -1148,13 +1148,13 @@ static ChangeInfoResult StationChangeInf
 

	
 
				/* Property 0x08 is special; it is where the station is allocated */
 
				if (*spec == NULL) *spec = CallocT<StationSpec>(1);
 

	
 
				/* Swap classid because we read it in BE meaning WAYP or DFLT */
 
				uint32 classid = buf->ReadDWord();
 
				(*spec)->sclass = AllocateStationClass(BSWAP32(classid));
 
				(*spec)->cls_id = AllocateStationClass(BSWAP32(classid));
 
				break;
 
			}
 

	
 
			case 0x09: // Define sprite layout
 
				statspec->tiles = buf->ReadExtendedByte();
 
				statspec->renderdata = CallocT<DrawTileSprites>(statspec->tiles);
 
@@ -4267,14 +4267,14 @@ static void FeatureNewName(ByteReader *b
 
			default:
 
				switch (GB(id, 8, 8)) {
 
					case 0xC4: // Station class name
 
						if (_cur_grffile->stations == NULL || _cur_grffile->stations[GB(id, 0, 8)] == NULL) {
 
							grfmsg(1, "FeatureNewName: Attempt to name undefined station 0x%X, ignoring", GB(id, 0, 8));
 
						} else {
 
							StationClassID sclass = _cur_grffile->stations[GB(id, 0, 8)]->sclass;
 
							SetStationClassName(sclass, AddGRFString(_cur_grffile->grfid, id, lang, new_scheme, name, STR_UNDEFINED));
 
							StationClassID cls_id = _cur_grffile->stations[GB(id, 0, 8)]->cls_id;
 
							SetStationClassName(cls_id, AddGRFString(_cur_grffile->grfid, id, lang, new_scheme, name, STR_UNDEFINED));
 
						}
 
						break;
 

	
 
					case 0xC5: // Station name
 
						if (_cur_grffile->stations == NULL || _cur_grffile->stations[GB(id, 0, 8)] == NULL) {
 
							grfmsg(1, "FeatureNewName: Attempt to name undefined station 0x%X, ignoring", GB(id, 0, 8));
src/newgrf_airport.cpp
Show inline comments
 
@@ -150,14 +150,14 @@ uint GetNumAirportsInClass(AirportClassI
 
/**
 
 * Tie an airport spec to its airport class.
 
 * @param statspec The airport spec.
 
 */
 
static void BindAirportSpecToClass(AirportSpec *as)
 
{
 
	assert(as->aclass < APC_MAX);
 
	AirportClass *airport_class = &_airport_classes[as->aclass];
 
	assert(as->cls_id < APC_MAX);
 
	AirportClass *airport_class = &_airport_classes[as->cls_id];
 

	
 
	int i = airport_class->airports++;
 
	airport_class->spec = ReallocT(airport_class->spec, airport_class->airports);
 

	
 
	airport_class->spec[i] = as;
 
}
src/newgrf_airport.h
Show inline comments
 
@@ -69,13 +69,13 @@ struct AirportSpec {
 
	byte noise_level;                      ///< noise that this airport generates
 
	byte catchment;                        ///< catchment area of this airport
 
	Year min_year;                         ///< first year the airport is available
 
	Year max_year;                         ///< last year the airport is available
 
	StringID name;                         ///< name of this airport
 
	TTDPAirportType ttd_airport_type;      ///< ttdpatch airport type (Small/Large/Helipad/Oilrig)
 
	AirportClassID aclass;                 ///< the class to which this airport type belongs
 
	AirportClassID cls_id;                 ///< the class to which this airport type belongs
 
	SpriteID preview_sprite;               ///< preview sprite for this airport
 
	/* Newgrf data */
 
	bool enabled;                          ///< entity still avaible (by default true).newgrf can disable it, though
 
	struct GRFFileProps grf_prop;          ///< properties related the the grf file
 

	
 
	static const AirportSpec *Get(byte type);
src/newgrf_station.cpp
Show inline comments
 
@@ -173,14 +173,14 @@ void SetCustomStationSpec(StationSpec *s
 
	StationClass *station_class;
 
	int i;
 

	
 
	/* If the station has already been allocated, don't reallocate it. */
 
	if (statspec->allocated) return;
 

	
 
	assert(statspec->sclass < STAT_CLASS_MAX);
 
	station_class = &_station_classes[statspec->sclass];
 
	assert(statspec->cls_id < STAT_CLASS_MAX);
 
	station_class = &_station_classes[statspec->cls_id];
 

	
 
	i = station_class->stations++;
 
	station_class->spec = ReallocT(station_class->spec, station_class->stations);
 

	
 
	station_class->spec[i] = statspec;
 
	statspec->allocated = true;
 
@@ -603,13 +603,13 @@ static const SpriteGroup *StationResolve
 
	const StationSpec *statspec = object->u.station.statspec;
 
	uint set;
 

	
 
	uint cargo = 0;
 
	CargoID cargo_type = object->u.station.cargo_type;
 

	
 
	if (bst == NULL || statspec->sclass == STAT_CLASS_WAYP) {
 
	if (bst == NULL || statspec->cls_id == STAT_CLASS_WAYP) {
 
		return group->loading[0];
 
	}
 

	
 
	const Station *st = Station::From(bst);
 

	
 
	switch (cargo_type) {
src/newgrf_station.h
Show inline comments
 
@@ -48,14 +48,14 @@ typedef byte *StationLayout;
 
/** Station specification. */
 
struct StationSpec {
 
	GRFFilePropsBase grf_prop; ///< Properties related the the grf file
 

	
 
	bool allocated; ///< Flag whether this station has been added to a station class list
 

	
 
	StationClassID sclass; ///< The class to which this spec belongs.
 
	StringID name; ///< Name of this station.
 
	StationClassID cls_id;    ///< The class to which this spec belongs.
 
	StringID name;            ///< Name of this station.
 

	
 
	/**
 
	 * Bitmask of number of platforms available for the station.
 
	 * 0..6 correpsond to 1..7, while bit 7 corresponds to >7 platforms.
 
	 */
 
	byte disallowed_platforms;
src/station_cmd.cpp
Show inline comments
 
@@ -2798,13 +2798,13 @@ static void GetTileDesc_Station(TileInde
 
	td->build_date = BaseStation::GetByTile(tile)->build_date;
 

	
 
	if (HasStationTileRail(tile)) {
 
		const StationSpec *spec = GetStationSpec(tile);
 

	
 
		if (spec != NULL) {
 
			td->station_class = GetStationClassName(spec->sclass);
 
			td->station_class = GetStationClassName(spec->cls_id);
 
			td->station_name  = spec->name;
 

	
 
			if (spec->grf_prop.grffile != NULL) {
 
				const GRFConfig *gc = GetGRFConfig(spec->grf_prop.grffile->grfid);
 
				td->grf = gc->GetName();
 
			}
0 comments (0 inline, 0 general)