station_cmd.c
changeset 438 79b5df3f394a
parent 433 00c1c7a58672
child 445 0e3fa3da3899
equal deleted inserted replaced
437:b66c60ebaa8c 438:79b5df3f394a
   965 
   965 
   966 void SetCustomStation(byte local_stid, struct StationSpec *spec)
   966 void SetCustomStation(byte local_stid, struct StationSpec *spec)
   967 {
   967 {
   968 	int stid = -1;
   968 	int stid = -1;
   969 
   969 
   970 	assert(spec->classid == 'WAYP');
   970 	assert(spec->sclass == STAT_CLASS_WAYP);
   971 
   971 
   972 	if (spec->localidx != 0) {
   972 	if (spec->localidx != 0) {
   973 		/* Already allocated, try to resolve to global stid */
   973 		/* Already allocated, try to resolve to global stid */
   974 		int i;
   974 		int i;
   975 
   975 
   996 	}
   996 	}
   997 
   997 
   998 	memcpy(&_waypoint_data[stid], spec, sizeof(*spec));
   998 	memcpy(&_waypoint_data[stid], spec, sizeof(*spec));
   999 }
   999 }
  1000 
  1000 
  1001 struct StationSpec *GetCustomStation(uint32 classid, byte stid)
  1001 struct StationSpec *GetCustomStation(enum StationClass sclass, byte stid)
  1002 {
  1002 {
  1003 	assert(classid == 'WAYP');
  1003 	assert(sclass == STAT_CLASS_WAYP);
  1004 	if (stid > _waypoint_highest_id)
  1004 	if (stid > _waypoint_highest_id)
  1005 		return NULL;
  1005 		return NULL;
  1006 	return &_waypoint_data[stid];
  1006 	return &_waypoint_data[stid];
  1007 }
  1007 }
  1008 
  1008 
  1090 
  1090 
  1091 uint32 GetCustomStationRelocation(struct StationSpec *spec, struct Station *stat, byte ctype)
  1091 uint32 GetCustomStationRelocation(struct StationSpec *spec, struct Station *stat, byte ctype)
  1092 {
  1092 {
  1093 	struct RealSpriteGroup *rsg;
  1093 	struct RealSpriteGroup *rsg;
  1094 
  1094 
  1095 	assert(spec->classid == 'WAYP');
  1095 	assert(spec->sclass == STAT_CLASS_WAYP);
  1096 
  1096 
  1097 	rsg = ResolveStationSpriteGroup(&spec->spritegroup[ctype], stat);
  1097 	rsg = ResolveStationSpriteGroup(&spec->spritegroup[ctype], stat);
  1098 
  1098 
  1099 	if (rsg->sprites_per_set != 0) {
  1099 	if (rsg->sprites_per_set != 0) {
  1100 		if (rsg->loading_count != 0) {
  1100 		if (rsg->loading_count != 0) {
  1110 	 * so it's probably kinda "default offset". Try to use it as
  1110 	 * so it's probably kinda "default offset". Try to use it as
  1111 	 * emergency measure. */
  1111 	 * emergency measure. */
  1112 	return 0x42D;
  1112 	return 0x42D;
  1113 }
  1113 }
  1114 
  1114 
  1115 int GetCustomStationsCount(uint32 classid)
  1115 int GetCustomStationsCount(enum StationClass sclass)
  1116 {
  1116 {
  1117 	assert(classid == 'WAYP');
  1117 	assert(sclass == STAT_CLASS_WAYP);
  1118 	return _waypoint_highest_id + 1;
  1118 	return _waypoint_highest_id + 1;
  1119 }
  1119 }
  1120 
  1120 
  1121 
  1121 
  1122 static int32 RemoveRailroadStation(Station *st, TileIndex tile, uint32 flags)
  1122 static int32 RemoveRailroadStation(Station *st, TileIndex tile, uint32 flags)