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++) {
274 if (t == NULL)
return NULL;
282 if (this->
st == NULL) {
289 case 0x49:
return 0x2110000;
296 if (parameter != 0) tile =
GetNearbyTile(parameter, tile,
true, this->axis);
299 bool swap = (this->axis ==
AXIS_Y &&
HasBit(tileh, CORNER_W) !=
HasBit(tileh, CORNER_E));
315 if (!
HasBit(
_svc.valid, 0)) {
_svc.v40 = GetPlatformInfoHelper(this->tile,
false,
false,
false);
SetBit(
_svc.valid, 0); }
319 if (!
HasBit(
_svc.valid, 1)) {
_svc.v41 = GetPlatformInfoHelper(this->tile,
true,
false,
false);
SetBit(
_svc.valid, 1); }
330 if (!
HasBit(
_svc.valid, 3)) {
_svc.v46 = GetPlatformInfoHelper(this->tile,
false,
false,
true);
SetBit(
_svc.valid, 3); }
334 if (!
HasBit(
_svc.valid, 4)) {
_svc.v47 = GetPlatformInfoHelper(this->tile,
true,
false,
true);
SetBit(
_svc.valid, 4); }
338 if (!
HasBit(
_svc.valid, 5)) {
_svc.v49 = GetPlatformInfoHelper(this->tile,
false,
true,
false);
SetBit(
_svc.valid, 5); }
371 uint32 res =
GB(
GetStationGfx(nearby_tile), 1, 2) << 12 | !!perpendicular << 11 | !!same_station << 10;
381 case 0x82:
return 50;
391 uint32 Station::GetNewGRFVariable(
const ResolverObject &
object, byte variable, byte parameter,
bool *available)
const
398 for (cargo_type = 0; cargo_type <
NUM_CARGO; cargo_type++) {
404 case 0x8A:
return this->had_vehicle_of_type;
413 if ((variable >= 0x60 && variable <= 0x65) || variable == 0x69) {
418 case 0x62:
return 0xFFFFFFFF;
419 case 0x64:
return 0xFF00;
442 if (variable >= 0x8C && variable <= 0xEC) {
444 switch (
GB(variable - 0x8C, 0, 3)) {
456 DEBUG(grf, 1,
"Unhandled station variable 0x%X", variable);
475 if (variable >= 0x60 && variable <= 0x65) {
480 if (variable >= 0x8C && variable <= 0xEC) {
481 switch (
GB(variable - 0x8C, 0, 3)) {
482 case 3:
return INITIAL_STATION_RATING;
483 case 4:
return INVALID_STATION;
488 DEBUG(grf, 1,
"Unhandled station variable 0x%X", variable);
522 cargo =
min(0xfff, cargo);
532 return group->
loaded[
set];
549 CallbackID callback, uint32 callback_param1, uint32 callback_param2)
550 :
ResolverObject(statspec->grf_prop.grffile, callback, callback_param1, callback_param2),
551 station_scope(*this, statspec, st, tile), town_scope(NULL)
565 FOR_ALL_CARGOSPECS(cs) {
583 StationResolverObject::~StationResolverObject()
617 if (group == NULL || group->type != SGT_RESULT)
return 0;
618 return group->GetResult() - 0x42D;
636 if (group == NULL || group->type != SGT_RESULT)
return 0;
646 return object.ResolveCallback();
667 object.station_scope.axis = axis;
669 uint16 cb_res =
object.ResolveCallback();
691 if (statspec == NULL || st == NULL)
return 0;
697 if (i == NUM_STATIONSSPECS_PER_STATION) {
704 if (st->
speclist[i].spec == statspec)
return i;
743 if (specindex == 0)
return;
754 st->
speclist[specindex].spec = NULL;
795 if (statspec == NULL)
return false;
803 uint32 relocation = 0;
804 uint32 ground_relocation = 0;
809 sprites = GetStationTileLayout(STATION_RAIL, tile + axis);
811 layout = &statspec->
renderdata[(tile < statspec->
tiles) ? tile + axis : (uint)axis];
818 if (layout != NULL) {
829 sprites = &tmp_rail_layout;
846 DrawSprite(ground + overlay_offset, PAL_NONE, x, y);
877 const StationSpec *statspec = GetStationSpec(tile);
890 const StationSpec *statspec = GetStationSpec(tile);
893 return statspec != NULL ?
HasBit(statspec->
pylons, gfx) : gfx < 4;
904 const StationSpec *statspec = GetStationSpec(tile);
911 return GetStationCallback(callback, param1, param2, statspec, st, tile);
926 if (ss == NULL)
return;
934 static const TriggerArea tas[] = {
935 TA_TILE, TA_WHOLE, TA_WHOLE, TA_PLATFORM, TA_PLATFORM, TA_PLATFORM, TA_WHOLE
945 uint16 random_bits = Random();
975 static const TriggerArea tas[] = {
976 TA_WHOLE, TA_WHOLE, TA_PLATFORM, TA_PLATFORM, TA_PLATFORM, TA_PLATFORM
987 uint32 whole_reseed = 0;
990 uint32 empty_mask = 0;
1001 uint8 trigger_bit = 1 << trigger;
1007 if (ss == NULL)
continue;
1017 object.trigger = trigger_bit;
1020 if (group == NULL)
continue;
1022 uint32 reseed =
object.GetReseedSum();
1024 whole_reseed |= reseed;
1029 random_bits &= ~reseed;
1030 random_bits |= Random() & reseed;
1040 if ((whole_reseed & 0xFFFF) != 0) {
1057 for (uint i = 0; i < st->
num_specs; i++) {