32 template <
typename Tspec,
typename T
id, T
id Tmax>
36 classes[0].global_id =
'DFLT';
37 classes[0].name = STR_STATION_CLASS_DFLT;
38 classes[0].Insert(NULL);
40 classes[1].global_id =
'WAYP';
41 classes[1].name = STR_STATION_CLASS_WAYP;
42 classes[1].Insert(NULL);
45 template <
typename Tspec,
typename T
id, T
id Tmax>
65 default: NOT_REACHED();
112 Swap(platforms, length);
121 SB(retval, 0, 4, y & 0xF);
122 SB(retval, 4, 4, x & 0xF);
124 SB(retval, 0, 4,
min(15, y));
125 SB(retval, 4, 4,
min(15, length - y - 1));
126 SB(retval, 8, 4,
min(15, x));
127 SB(retval, 12, 4,
min(15, platforms - x - 1));
129 SB(retval, 16, 4,
min(15, length));
130 SB(retval, 20, 4,
min(15, platforms));
131 SB(retval, 24, 4, tile);
168 static uint32 GetPlatformInfoHelper(
TileIndex tile,
bool check_type,
bool check_axis,
bool centred)
170 int tx =
TileX(tile);
171 int ty =
TileY(tile);
184 static uint32 GetRailContinuationInfo(
TileIndex tile)
203 for (i = 0; i <
lengthof(x_dir); i++, dir++, diagdir++) {
267 if (t == NULL)
return NULL;
275 if (this->
st == NULL) {
282 case 0x49:
return 0x2110000;
289 if (parameter != 0) tile =
GetNearbyTile(parameter, tile,
true, this->axis);
292 bool swap = (this->axis ==
AXIS_Y &&
HasBit(tileh, CORNER_W) !=
HasBit(tileh, CORNER_E));
308 if (!
HasBit(
_svc.valid, 0)) {
_svc.v40 = GetPlatformInfoHelper(this->tile,
false,
false,
false);
SetBit(
_svc.valid, 0); }
312 if (!
HasBit(
_svc.valid, 1)) {
_svc.v41 = GetPlatformInfoHelper(this->tile,
true,
false,
false);
SetBit(
_svc.valid, 1); }
323 if (!
HasBit(
_svc.valid, 3)) {
_svc.v46 = GetPlatformInfoHelper(this->tile,
false,
false,
true);
SetBit(
_svc.valid, 3); }
327 if (!
HasBit(
_svc.valid, 4)) {
_svc.v47 = GetPlatformInfoHelper(this->tile,
true,
false,
true);
SetBit(
_svc.valid, 4); }
331 if (!
HasBit(
_svc.valid, 5)) {
_svc.v49 = GetPlatformInfoHelper(this->tile,
false,
true,
false);
SetBit(
_svc.valid, 5); }
364 uint32 res =
GB(
GetStationGfx(nearby_tile), 1, 2) << 12 | !!perpendicular << 11 | !!same_station << 10;
374 case 0x82:
return 50;
384 uint32 Station::GetNewGRFVariable(
const ResolverObject &
object, byte variable, byte parameter,
bool *available)
const
391 for (cargo_type = 0; cargo_type <
NUM_CARGO; cargo_type++) {
397 case 0x8A:
return this->had_vehicle_of_type;
406 if ((variable >= 0x60 && variable <= 0x65) || variable == 0x69) {
411 case 0x62:
return 0xFFFFFFFF;
412 case 0x64:
return 0xFF00;
435 if (variable >= 0x8C && variable <= 0xEC) {
437 switch (
GB(variable - 0x8C, 0, 3)) {
449 DEBUG(grf, 1,
"Unhandled station variable 0x%X", variable);
468 if (variable >= 0x60 && variable <= 0x65) {
473 if (variable >= 0x8C && variable <= 0xEC) {
474 switch (
GB(variable - 0x8C, 0, 3)) {
475 case 3:
return INITIAL_STATION_RATING;
476 case 4:
return INVALID_STATION;
481 DEBUG(grf, 1,
"Unhandled station variable 0x%X", variable);
515 cargo =
min(0xfff, cargo);
525 return group->
loaded[
set];
542 CallbackID callback, uint32 callback_param1, uint32 callback_param2)
543 :
ResolverObject(statspec->grf_prop.grffile, callback, callback_param1, callback_param2),
544 station_scope(*this, statspec, st, tile), town_scope(NULL)
558 FOR_ALL_CARGOSPECS(cs) {
576 StationResolverObject::~StationResolverObject()
593 if (group == NULL || group->type != SGT_RESULT)
return 0;
594 return group->GetResult() - 0x42D;
612 if (group == NULL || group->type != SGT_RESULT)
return 0;
622 return object.ResolveCallback();
643 object.station_scope.axis = axis;
645 uint16 cb_res =
object.ResolveCallback();
667 if (statspec == NULL || st == NULL)
return 0;
673 if (i == NUM_STATIONSSPECS_PER_STATION) {
680 if (st->
speclist[i].spec == statspec)
return i;
719 if (specindex == 0)
return;
730 st->
speclist[specindex].spec = NULL;
771 if (statspec == NULL)
return false;
779 uint32 relocation = 0;
780 uint32 ground_relocation = 0;
785 sprites = GetStationTileLayout(STATION_RAIL, tile + axis);
787 layout = &statspec->
renderdata[(tile < statspec->
tiles) ? tile + axis : (uint)axis];
794 if (layout != NULL) {
805 sprites = &tmp_rail_layout;
822 DrawSprite(ground + overlay_offset, PAL_NONE, x, y);
853 const StationSpec *statspec = GetStationSpec(tile);
866 const StationSpec *statspec = GetStationSpec(tile);
869 return statspec != NULL ?
HasBit(statspec->
pylons, gfx) : gfx < 4;
880 const StationSpec *statspec = GetStationSpec(tile);
887 return GetStationCallback(callback, param1, param2, statspec, st, tile);
902 if (ss == NULL)
return;
910 static const TriggerArea tas[] = {
911 TA_TILE, TA_WHOLE, TA_WHOLE, TA_PLATFORM, TA_PLATFORM, TA_PLATFORM, TA_WHOLE
921 uint16 random_bits = Random();
951 static const TriggerArea tas[] = {
952 TA_WHOLE, TA_WHOLE, TA_PLATFORM, TA_PLATFORM, TA_PLATFORM, TA_PLATFORM
963 uint32 whole_reseed = 0;
966 uint32 empty_mask = 0;
978 uint32 used_triggers = 0;
984 if (ss == NULL)
continue;
997 if (group == NULL)
continue;
999 used_triggers |=
object.used_triggers;
1001 uint32 reseed =
object.GetReseedSum();
1003 whole_reseed |= reseed;
1008 random_bits &= ~reseed;
1009 random_bits |= Random() & reseed;
1020 if ((whole_reseed & 0xFFFF) != 0) {
1037 for (uint i = 0; i < st->
num_specs; i++) {