OpenTTD Source  14.0-beta1
newgrf_roadstop.cpp
1 /*
2  * This file is part of OpenTTD.
3  * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
4  * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
6  */
7 
10 #include "stdafx.h"
11 #include "debug.h"
12 #include "station_base.h"
13 #include "roadstop_base.h"
14 #include "newgrf_roadstop.h"
15 #include "newgrf_class_func.h"
16 #include "newgrf_cargo.h"
17 #include "newgrf_roadtype.h"
18 #include "gfx_type.h"
19 #include "company_func.h"
20 #include "road.h"
21 #include "window_type.h"
23 #include "town.h"
24 #include "viewport_func.h"
25 #include "newgrf_animation_base.h"
26 #include "newgrf_sound.h"
27 
28 #include "safeguards.h"
29 
30 template <typename Tspec, typename Tid, Tid Tmax>
32 {
33  /* Set up initial data */
34  RoadStopClass::Get(RoadStopClass::Allocate('DFLT'))->name = STR_STATION_CLASS_DFLT;
35  RoadStopClass::Get(RoadStopClass::Allocate('DFLT'))->Insert(nullptr);
36  RoadStopClass::Get(RoadStopClass::Allocate('WAYP'))->name = STR_STATION_CLASS_WAYP;
37  RoadStopClass::Get(RoadStopClass::Allocate('WAYP'))->Insert(nullptr);
38 }
39 
40 template <typename Tspec, typename Tid, Tid Tmax>
42 {
43  return true;
44 }
45 
47 
48 static const uint NUM_ROADSTOPSPECS_PER_STATION = 63;
49 
51 {
52  if (this->st == nullptr) return 0;
53 
54  uint32_t bits = this->st->random_bits;
55  if (this->tile != INVALID_TILE && Station::IsExpected(this->st)) {
56  bits |= Station::From(this->st)->GetRoadStopRandomBits(this->tile) << 16;
57  }
58  return bits;
59 }
60 
62 {
63  return this->st == nullptr ? 0 : this->st->waiting_triggers;
64 }
65 
66 uint32_t RoadStopScopeResolver::GetVariable(byte variable, [[maybe_unused]] uint32_t parameter, bool *available) const
67 {
68  auto get_road_type_variable = [&](RoadTramType rtt) -> uint32_t {
69  RoadType rt;
70  if (this->tile == INVALID_TILE) {
71  rt = (GetRoadTramType(this->roadtype) == rtt) ? this->roadtype : INVALID_ROADTYPE;
72  } else {
73  rt = GetRoadType(this->tile, rtt);
74  }
75  if (rt == INVALID_ROADTYPE) {
76  return 0xFFFFFFFF;
77  } else {
79  }
80  };
81 
82  switch (variable) {
83  /* View/rotation */
84  case 0x40: return this->view;
85 
86  /* Stop type: 0: bus, 1: truck, 2: waypoint */
87  case 0x41:
88  if (this->type == STATION_BUS) return 0;
89  if (this->type == STATION_TRUCK) return 1;
90  return 2;
91 
92  /* Terrain type */
93  case 0x42: return this->tile == INVALID_TILE ? 0 : (GetTileSlope(this->tile) << 8 | GetTerrainType(this->tile, TCX_NORMAL));
94 
95  /* Road type */
96  case 0x43: return get_road_type_variable(RTT_ROAD);
97 
98  /* Tram type */
99  case 0x44: return get_road_type_variable(RTT_TRAM);
100 
101  /* Town zone and Manhattan distance of closest town */
102  case 0x45: {
103  if (this->tile == INVALID_TILE) return HZB_TOWN_EDGE << 16;
104  const Town *t = (this->st == nullptr) ? ClosestTownFromTile(this->tile, UINT_MAX) : this->st->town;
105  return t != nullptr ? (GetTownRadiusGroup(t, this->tile) << 16 | ClampTo<uint16_t>(DistanceManhattan(this->tile, t->xy))) : HZB_TOWN_EDGE << 16;
106  }
107 
108  /* Get square of Euclidian distance of closest town */
109  case 0x46: {
110  if (this->tile == INVALID_TILE) return 0;
111  const Town *t = (this->st == nullptr) ? ClosestTownFromTile(this->tile, UINT_MAX) : this->st->town;
112  return t != nullptr ? DistanceSquare(this->tile, t->xy) : 0;
113  }
114 
115  /* Company information */
116  case 0x47: return GetCompanyInfo(this->st == nullptr ? _current_company : this->st->owner);
117 
118  /* Animation frame */
119  case 0x49: return this->tile == INVALID_TILE ? 0 : this->st->GetRoadStopAnimationFrame(this->tile);
120 
121  /* Variables which use the parameter */
122  /* Variables 0x60 to 0x65 and 0x69 are handled separately below */
123 
124  /* Animation frame of nearby tile */
125  case 0x66: {
126  if (this->tile == INVALID_TILE) return UINT_MAX;
127  TileIndex tile = this->tile;
128  if (parameter != 0) tile = GetNearbyTile(parameter, tile);
129  return (IsRoadStopTile(tile) && GetStationIndex(tile) == this->st->index) ? this->st->GetRoadStopAnimationFrame(tile) : UINT_MAX;
130  }
131 
132  /* Land info of nearby tile */
133  case 0x67: {
134  if (this->tile == INVALID_TILE) return 0;
135  TileIndex tile = this->tile;
136  if (parameter != 0) tile = GetNearbyTile(parameter, tile); // only perform if it is required
137  return GetNearbyTileInformation(tile, this->ro.grffile->grf_version >= 8);
138  }
139 
140  /* Road stop info of nearby tiles */
141  case 0x68: {
142  if (this->tile == INVALID_TILE) return 0xFFFFFFFF;
143  TileIndex nearby_tile = GetNearbyTile(parameter, this->tile);
144 
145  if (!IsRoadStopTile(nearby_tile)) return 0xFFFFFFFF;
146 
147  uint32_t grfid = this->st->roadstop_speclist[GetCustomRoadStopSpecIndex(this->tile)].grfid;
148  bool same_orientation = GetStationGfx(this->tile) == GetStationGfx(nearby_tile);
149  bool same_station = GetStationIndex(nearby_tile) == this->st->index;
150  uint32_t res = GetStationGfx(nearby_tile) << 12 | !same_orientation << 11 | !!same_station << 10;
151  StationType type = GetStationType(nearby_tile);
152  if (type == STATION_TRUCK) res |= (1 << 16);
153  if (type == this->type) SetBit(res, 20);
154 
155  if (IsCustomRoadStopSpecIndex(nearby_tile)) {
157  res |= 1 << (ssl.grfid != grfid ? 9 : 8) | ClampTo<uint8_t>(ssl.localidx);
158  }
159  return res;
160  }
161 
162  /* GRFID of nearby road stop tiles */
163  case 0x6A: {
164  if (this->tile == INVALID_TILE) return 0xFFFFFFFF;
165  TileIndex nearby_tile = GetNearbyTile(parameter, this->tile);
166 
167  if (!IsRoadStopTile(nearby_tile)) return 0xFFFFFFFF;
168  if (!IsCustomRoadStopSpecIndex(nearby_tile)) return 0;
169 
171  return ssl.grfid;
172  }
173 
174  /* 16 bit road stop ID of nearby tiles */
175  case 0x6B: {
176  TileIndex nearby_tile = GetNearbyTile(parameter, this->tile);
177 
178  if (!IsRoadStopTile(nearby_tile)) return 0xFFFFFFFF;
179  if (!IsCustomRoadStopSpecIndex(nearby_tile)) return 0xFFFE;
180 
181  uint32_t grfid = this->st->roadstop_speclist[GetCustomRoadStopSpecIndex(this->tile)].grfid;
182 
184  if (ssl.grfid == grfid) {
185  return ssl.localidx;
186  }
187 
188  return 0xFFFE;
189  }
190 
191  case 0xF0: return this->st == nullptr ? 0 : this->st->facilities; // facilities
192 
193  case 0xFA: return ClampTo<uint16_t>((this->st == nullptr ? TimerGameCalendar::date : this->st->build_date) - CalendarTime::DAYS_TILL_ORIGINAL_BASE_YEAR); // build date
194  }
195 
196  if (this->st != nullptr) return this->st->GetNewGRFVariable(this->ro, variable, parameter, available);
197 
198  *available = false;
199  return UINT_MAX;
200 }
201 
203 {
204  if (group == nullptr) return nullptr;
205 
206  return group->loading[0];
207 }
208 
209 RoadStopResolverObject::RoadStopResolverObject(const RoadStopSpec *roadstopspec, BaseStation *st, TileIndex tile, RoadType roadtype, StationType type, uint8_t view,
210  CallbackID callback, uint32_t param1, uint32_t param2)
211  : ResolverObject(roadstopspec->grf_prop.grffile, callback, param1, param2), roadstop_scope(*this, st, roadstopspec, tile, roadtype, type, view)
212  {
213 
214  this->town_scope = nullptr;
215 
217 
218  if (st == nullptr) {
219  /* No station, so we are in a purchase list */
221  } else if (Station::IsExpected(st)) {
222  const Station *station = Station::From(st);
223  /* Pick the first cargo that we have waiting */
224  for (const CargoSpec *cs : CargoSpec::Iterate()) {
225  if (roadstopspec->grf_prop.spritegroup[cs->Index()] != nullptr &&
226  station->goods[cs->Index()].cargo.TotalCount() > 0) {
227  ctype = cs->Index();
228  break;
229  }
230  }
231  }
232 
233  if (roadstopspec->grf_prop.spritegroup[ctype] == nullptr) {
235  }
236 
237  /* Remember the cargo type we've picked */
238  this->roadstop_scope.cargo_type = ctype;
239  this->root_spritegroup = roadstopspec->grf_prop.spritegroup[ctype];
240 }
241 
242 RoadStopResolverObject::~RoadStopResolverObject()
243 {
244  delete this->town_scope;
245 }
246 
247 TownScopeResolver *RoadStopResolverObject::GetTown()
248 {
249  if (this->town_scope == nullptr) {
250  Town *t;
251  if (this->roadstop_scope.st != nullptr) {
252  t = this->roadstop_scope.st->town;
253  } else {
254  t = ClosestTownFromTile(this->roadstop_scope.tile, UINT_MAX);
255  }
256  if (t == nullptr) return nullptr;
257  this->town_scope = new TownScopeResolver(*this, t, this->roadstop_scope.st == nullptr);
258  }
259  return this->town_scope;
260 }
261 
262 uint16_t GetRoadStopCallback(CallbackID callback, uint32_t param1, uint32_t param2, const RoadStopSpec *roadstopspec, BaseStation *st, TileIndex tile, RoadType roadtype, StationType type, uint8_t view)
263 {
264  RoadStopResolverObject object(roadstopspec, st, tile, roadtype, type, view, callback, param1, param2);
265  return object.ResolveCallback();
266 }
267 
277 void DrawRoadStopTile(int x, int y, RoadType roadtype, const RoadStopSpec *spec, StationType type, int view)
278 {
279  assert(roadtype != INVALID_ROADTYPE);
280  assert(spec != nullptr);
281 
282  const RoadTypeInfo *rti = GetRoadTypeInfo(roadtype);
283  RoadStopResolverObject object(spec, nullptr, INVALID_TILE, roadtype, type, view);
284  const SpriteGroup *group = object.Resolve();
285  if (group == nullptr || group->type != SGT_TILELAYOUT) return;
286  const DrawTileSprites *dts = ((const TileLayoutSpriteGroup *)group)->ProcessRegisters(nullptr);
287 
288  PaletteID palette = COMPANY_SPRITE_COLOUR(_local_company);
289 
290  SpriteID image = dts->ground.sprite;
291  PaletteID pal = dts->ground.pal;
292 
293  if (GB(image, 0, SPRITE_WIDTH) != 0) {
294  DrawSprite(image, GroundSpritePaletteTransform(image, pal, palette), x, y);
295  }
296 
297  if (view >= 4) {
298  /* Drive-through stop */
299  uint sprite_offset = 5 - view;
300 
301  /* Road underlay takes precedence over tram */
302  if (spec->draw_mode & ROADSTOP_DRAW_MODE_OVERLAY) {
303  if (rti->UsesOverlay()) {
305  DrawSprite(ground + sprite_offset, PAL_NONE, x, y);
306 
308  if (overlay) DrawSprite(overlay + sprite_offset, PAL_NONE, x, y);
309  } else if (RoadTypeIsTram(roadtype)) {
310  DrawSprite(SPR_TRAMWAY_TRAM + sprite_offset, PAL_NONE, x, y);
311  }
312  }
313  } else {
314  /* Bay stop */
315  if ((spec->draw_mode & ROADSTOP_DRAW_MODE_ROAD) && rti->UsesOverlay()) {
317  DrawSprite(ground + view, PAL_NONE, x, y);
318  }
319  }
320 
321  DrawCommonTileSeqInGUI(x, y, dts, 0, 0, palette, true);
322 }
323 
325 uint16_t GetAnimRoadStopCallback(CallbackID callback, uint32_t param1, uint32_t param2, const RoadStopSpec *roadstopspec, BaseStation *st, TileIndex tile, int)
326 {
327  return GetRoadStopCallback(callback, param1, param2, roadstopspec, st, tile, INVALID_ROADTYPE, GetStationType(tile), GetStationGfx(tile));
328 }
329 
331  static byte Get(BaseStation *st, TileIndex tile) { return st->GetRoadStopAnimationFrame(tile); }
332  static void Set(BaseStation *st, TileIndex tile, byte frame) { st->SetRoadStopAnimationFrame(tile, frame); }
333 };
334 
336 struct RoadStopAnimationBase : public AnimationBase<RoadStopAnimationBase, RoadStopSpec, BaseStation, int, GetAnimRoadStopCallback, RoadStopAnimationFrameAnimationHelper> {
337  static const CallbackID cb_animation_speed = CBID_STATION_ANIMATION_SPEED;
338  static const CallbackID cb_animation_next_frame = CBID_STATION_ANIM_NEXT_FRAME;
339 
340  static const RoadStopCallbackMask cbm_animation_speed = CBM_ROAD_STOP_ANIMATION_SPEED;
341  static const RoadStopCallbackMask cbm_animation_next_frame = CBM_ROAD_STOP_ANIMATION_NEXT_FRAME;
342 };
343 
344 void AnimateRoadStopTile(TileIndex tile)
345 {
346  const RoadStopSpec *ss = GetRoadStopSpec(tile);
347  if (ss == nullptr) return;
348 
350 }
351 
352 void TriggerRoadStopAnimation(BaseStation *st, TileIndex trigger_tile, StationAnimationTrigger trigger, CargoID cargo_type)
353 {
354  /* Get Station if it wasn't supplied */
355  if (st == nullptr) st = BaseStation::GetByTile(trigger_tile);
356 
357  /* Check the cached animation trigger bitmask to see if we need
358  * to bother with any further processing. */
359  if (!HasBit(st->cached_roadstop_anim_triggers, trigger)) return;
360 
361  uint16_t random_bits = Random();
362  auto process_tile = [&](TileIndex cur_tile) {
363  const RoadStopSpec *ss = GetRoadStopSpec(cur_tile);
364  if (ss != nullptr && HasBit(ss->animation.triggers, trigger)) {
365  CargoID cargo;
366  if (!IsValidCargoID(cargo_type)) {
367  cargo = INVALID_CARGO;
368  } else {
369  cargo = ss->grf_prop.grffile->cargo_map[cargo_type];
370  }
371  RoadStopAnimationBase::ChangeAnimationFrame(CBID_STATION_ANIM_START_STOP, ss, st, cur_tile, (random_bits << 16) | Random(), (uint8_t)trigger | (cargo << 8));
372  }
373  };
374 
375  if (trigger == SAT_NEW_CARGO || trigger == SAT_CARGO_TAKEN || trigger == SAT_250_TICKS) {
376  for (const RoadStopTileData &tile_data : st->custom_roadstop_tile_data) {
377  process_tile(tile_data.tile);
378  }
379  } else {
380  process_tile(trigger_tile);
381  }
382 }
383 
393 {
394  if (st == nullptr) st = Station::GetByTile(tile);
395 
396  /* Check the cached cargo trigger bitmask to see if we need
397  * to bother with any further processing. */
398  if (st->cached_roadstop_cargo_triggers == 0) return;
399  if (IsValidCargoID(cargo_type) && !HasBit(st->cached_roadstop_cargo_triggers, cargo_type)) return;
400 
401  SetBit(st->waiting_triggers, trigger);
402 
403  uint32_t whole_reseed = 0;
404 
405  /* Bitmask of completely empty cargo types to be matched. */
406  CargoTypes empty_mask = (trigger == RSRT_CARGO_TAKEN) ? GetEmptyMask(st) : 0;
407 
408  uint32_t used_triggers = 0;
409  auto process_tile = [&](TileIndex cur_tile) {
410  const RoadStopSpec *ss = GetRoadStopSpec(cur_tile);
411  if (ss == nullptr) return;
412 
413  /* Cargo taken "will only be triggered if all of those
414  * cargo types have no more cargo waiting." */
415  if (trigger == RSRT_CARGO_TAKEN) {
416  if ((ss->cargo_triggers & ~empty_mask) != 0) return;
417  }
418 
419  if (!IsValidCargoID(cargo_type) || HasBit(ss->cargo_triggers, cargo_type)) {
420  RoadStopResolverObject object(ss, st, cur_tile, INVALID_ROADTYPE, GetStationType(cur_tile), GetStationGfx(cur_tile));
421  object.waiting_triggers = st->waiting_triggers;
422 
423  const SpriteGroup *group = object.Resolve();
424  if (group == nullptr) return;
425 
426  used_triggers |= object.used_triggers;
427 
428  uint32_t reseed = object.GetReseedSum();
429  if (reseed != 0) {
430  whole_reseed |= reseed;
431  reseed >>= 16;
432 
433  /* Set individual tile random bits */
434  uint8_t random_bits = st->GetRoadStopRandomBits(cur_tile);
435  random_bits &= ~reseed;
436  random_bits |= Random() & reseed;
437  st->SetRoadStopRandomBits(cur_tile, random_bits);
438 
439  MarkTileDirtyByTile(cur_tile);
440  }
441  }
442  };
443  if (trigger == RSRT_NEW_CARGO || trigger == RSRT_CARGO_TAKEN) {
444  for (const RoadStopTileData &tile_data : st->custom_roadstop_tile_data) {
445  process_tile(tile_data.tile);
446  }
447  } else {
448  process_tile(tile);
449  }
450 
451  /* Update whole station random bits */
452  st->waiting_triggers &= ~used_triggers;
453  if ((whole_reseed & 0xFFFF) != 0) {
454  st->random_bits &= ~whole_reseed;
455  st->random_bits |= Random() & whole_reseed;
456  }
457 }
458 
466 {
467  if (!(RoadStopClass::GetClassCount() > 1 || RoadStopClass::Get(ROADSTOP_CLASS_DFLT)->GetSpecCount() > 1)) return false;
468  for (uint i = 0; i < RoadStopClass::GetClassCount(); i++) {
469  // We don't want to check the default or waypoint classes. These classes are always available.
470  if (i == ROADSTOP_CLASS_DFLT || i == ROADSTOP_CLASS_WAYP) continue;
471  RoadStopClass *roadstopclass = RoadStopClass::Get((RoadStopClassID)i);
472  if (GetIfClassHasNewStopsByType(roadstopclass, rs, roadtype)) return true;
473  }
474  return false;
475 }
476 
485 {
486  for (uint j = 0; j < roadstopclass->GetSpecCount(); j++) {
487  if (GetIfStopIsForType(roadstopclass->GetSpec(j), rs, roadtype)) return true;
488  }
489  return false;
490 }
491 
499 bool GetIfStopIsForType(const RoadStopSpec *roadstopspec, RoadStopType rs, RoadType roadtype)
500 {
501  // The roadstopspec is nullptr, must be the default station, always return true.
502  if (roadstopspec == nullptr) return true;
503 
504  if (HasBit(roadstopspec->flags, RSF_BUILD_MENU_ROAD_ONLY) && !RoadTypeIsRoad(roadtype)) return false;
505  if (HasBit(roadstopspec->flags, RSF_BUILD_MENU_TRAM_ONLY) && !RoadTypeIsTram(roadtype)) return false;
506 
507  if (roadstopspec->stop_type == ROADSTOPTYPE_ALL) return true;
508 
509  switch (rs) {
510  case ROADSTOP_BUS:
511  if (roadstopspec->stop_type == ROADSTOPTYPE_PASSENGER) return true;
512  break;
513 
514  case ROADSTOP_TRUCK:
515  if (roadstopspec->stop_type == ROADSTOPTYPE_FREIGHT) return true;
516  break;
517 
518  default:
519  NOT_REACHED();
520  }
521  return false;
522 }
523 
524 const RoadStopSpec *GetRoadStopSpec(TileIndex t)
525 {
526  if (!IsCustomRoadStopSpecIndex(t)) return nullptr;
527 
528  const BaseStation *st = BaseStation::GetByTile(t);
529  uint specindex = GetCustomRoadStopSpecIndex(t);
530  return specindex < st->roadstop_speclist.size() ? st->roadstop_speclist[specindex].spec : nullptr;
531 }
532 
533 int AllocateSpecToRoadStop(const RoadStopSpec *statspec, BaseStation *st, bool exec)
534 {
535  uint i;
536 
537  if (statspec == nullptr || st == nullptr) return 0;
538 
539  /* Try to find the same spec and return that one */
540  for (i = 1; i < st->roadstop_speclist.size() && i < NUM_ROADSTOPSPECS_PER_STATION; i++) {
541  if (st->roadstop_speclist[i].spec == statspec) return i;
542  }
543 
544  /* Try to find an unused spec slot */
545  for (i = 1; i < st->roadstop_speclist.size() && i < NUM_ROADSTOPSPECS_PER_STATION; i++) {
546  if (st->roadstop_speclist[i].spec == nullptr && st->roadstop_speclist[i].grfid == 0) break;
547  }
548 
549  if (i == NUM_ROADSTOPSPECS_PER_STATION) {
550  /* Full, give up */
551  return -1;
552  }
553 
554  if (exec) {
555  if (i >= st->roadstop_speclist.size()) st->roadstop_speclist.resize(i + 1);
556  st->roadstop_speclist[i].spec = statspec;
557  st->roadstop_speclist[i].grfid = statspec->grf_prop.grffile->grfid;
558  st->roadstop_speclist[i].localidx = statspec->grf_prop.local_id;
559 
561  }
562 
563  return i;
564 }
565 
566 void DeallocateSpecFromRoadStop(BaseStation *st, byte specindex)
567 {
568  /* specindex of 0 (default) is never freeable */
569  if (specindex == 0) return;
570 
571  /* Check custom road stop tiles if the specindex is still in use */
572  for (const RoadStopTileData &tile_data : st->custom_roadstop_tile_data) {
573  if (GetCustomRoadStopSpecIndex(tile_data.tile) == specindex) {
574  return;
575  }
576  }
577 
578  /* This specindex is no longer in use, so deallocate it */
579  st->roadstop_speclist[specindex].spec = nullptr;
580  st->roadstop_speclist[specindex].grfid = 0;
581  st->roadstop_speclist[specindex].localidx = 0;
582 
583  /* If this was the highest spec index, reallocate */
584  if (specindex == st->roadstop_speclist.size() - 1) {
585  size_t num_specs;
586  for (num_specs = st->roadstop_speclist.size() - 1; num_specs > 0; num_specs--) {
587  if (st->roadstop_speclist[num_specs].grfid != 0) break;
588  }
589 
590  if (num_specs > 0) {
591  st->roadstop_speclist.resize(num_specs + 1);
592  } else {
593  st->roadstop_speclist.clear();
596  return;
597  }
598  }
599 
601 }
602 
608 {
611 
612  /* Combine animation trigger bitmask for all road stop specs
613  * of this station. */
614  for (uint i = 0; i < st->roadstop_speclist.size(); i++) {
615  const RoadStopSpec *ss = st->roadstop_speclist[i].spec;
616  if (ss != nullptr) {
617  st->cached_roadstop_anim_triggers |= ss->animation.triggers;
619  }
620  }
621 }
RoadStopScopeResolver::st
struct BaseStation * st
Instance of the station.
Definition: newgrf_roadstop.h:77
BaseStation::facilities
StationFacility facilities
The facilities that this station has.
Definition: base_station_base.h:75
RoadTypeInfo
Definition: road.h:78
ROTSG_GROUND
@ ROTSG_GROUND
Required: Main group of ground images.
Definition: road.h:62
GroundSpritePaletteTransform
PaletteID GroundSpritePaletteTransform(SpriteID image, PaletteID pal, PaletteID default_pal)
Applies PALETTE_MODIFIER_COLOUR to a palette entry of a ground sprite.
Definition: sprite.h:168
Station::goods
GoodsEntry goods[NUM_CARGO]
Goods at this station.
Definition: station_base.h:471
ROADSTOPTYPE_ALL
@ ROADSTOPTYPE_ALL
This RoadStop is for both types of station road stops.
Definition: newgrf_roadstop.h:49
RSF_CB141_RANDOM_BITS
@ RSF_CB141_RANDOM_BITS
Callback 141 needs random bits.
Definition: newgrf_roadstop.h:66
SetBit
constexpr T SetBit(T &x, const uint8_t y)
Set a bit in a variable.
Definition: bitmath_func.hpp:121
BaseStation::cached_roadstop_cargo_triggers
CargoTypes cached_roadstop_cargo_triggers
NOSAVE: Combined cargo trigger bitmask for road stops.
Definition: base_station_base.h:87
TimerGameConst< struct Calendar >::DAYS_TILL_ORIGINAL_BASE_YEAR
static constexpr TimerGame< struct Calendar >::Date DAYS_TILL_ORIGINAL_BASE_YEAR
The date of the first day of the original base year.
Definition: timer_game_common.h:184
RoadStopType
RoadStopType
Types of RoadStops.
Definition: station_type.h:43
ROADSTOP_TRUCK
@ ROADSTOP_TRUCK
A standard stop for trucks.
Definition: station_type.h:45
BaseStation::roadstop_speclist
std::vector< RoadStopSpecList > roadstop_speclist
List of road stop specs of this station.
Definition: base_station_base.h:78
RoadStopSpec
Road stop specification.
Definition: newgrf_roadstop.h:122
ClosestTownFromTile
Town * ClosestTownFromTile(TileIndex tile, uint threshold)
Return the town closest (in distance or ownership) to a given tile, within a given threshold.
Definition: town_cmd.cpp:3744
SAT_250_TICKS
@ SAT_250_TICKS
Trigger station every 250 ticks.
Definition: newgrf_animation_type.h:33
BaseStation::waiting_triggers
byte waiting_triggers
Waiting triggers (NewGRF) for this station.
Definition: base_station_base.h:83
SPRITE_WIDTH
@ SPRITE_WIDTH
number of bits for the sprite number
Definition: sprites.h:1527
BaseStation::town
Town * town
The town this station is associated with.
Definition: base_station_base.h:73
timer_game_calendar.h
Station
Station data structure.
Definition: station_base.h:442
BaseStation::GetByTile
static BaseStation * GetByTile(TileIndex tile)
Get the base station belonging to a specific tile.
Definition: base_station_base.h:171
NewGRFClass::GetSpecCount
uint GetSpecCount() const
Get the number of allocated specs within the class.
Definition: newgrf_class.h:44
AnimationInfo::triggers
uint16_t triggers
The triggers that trigger animation.
Definition: newgrf_animation_type.h:22
SAT_NEW_CARGO
@ SAT_NEW_CARGO
Trigger station on new cargo arrival.
Definition: newgrf_animation_type.h:28
RSRT_CARGO_TAKEN
@ RSRT_CARGO_TAKEN
Trigger roadstop when cargo is completely taken.
Definition: newgrf_roadstop.h:36
ROADSTOPTYPE_FREIGHT
@ ROADSTOPTYPE_FREIGHT
This RoadStop is for freight (truck) stops.
Definition: newgrf_roadstop.h:48
GB
constexpr static debug_inline uint GB(const T x, const uint8_t s, const uint8_t n)
Fetch n bits from x, started at bit s.
Definition: bitmath_func.hpp:32
Pool::PoolItem::index
Tindex index
Index of this pool item.
Definition: pool_type.hpp:234
INSTANTIATE_NEWGRF_CLASS_METHODS
#define INSTANTIATE_NEWGRF_CLASS_METHODS(name, Tspec, Tid, Tmax)
Force instantiation of the methods so we don't get linker errors.
Definition: newgrf_class_func.h:212
window_type.h
PalSpriteID::sprite
SpriteID sprite
The 'real' sprite.
Definition: gfx_type.h:23
RoadStopScopeResolver::tile
TileIndex tile
Tile of the station.
Definition: newgrf_roadstop.h:76
ResolverObject
Interface for SpriteGroup-s to access the gamestate.
Definition: newgrf_spritegroup.h:307
SAT_CARGO_TAKEN
@ SAT_CARGO_TAKEN
Trigger station when cargo is completely taken.
Definition: newgrf_animation_type.h:29
INVALID_TILE
constexpr TileIndex INVALID_TILE
The very nice invalid tile marker.
Definition: tile_type.h:95
ResolverObject::grffile
const GRFFile * grffile
GRFFile the resolved SpriteGroup belongs to.
Definition: newgrf_spritegroup.h:335
newgrf_animation_base.h
RoadStopScopeResolver::roadtype
RoadType roadtype
Road type (used when no tile)
Definition: newgrf_roadstop.h:82
RoadStopCallbackMask
RoadStopCallbackMask
Callback masks for road stops.
Definition: newgrf_callbacks.h:320
CargoSpec::Iterate
static IterateWrapper Iterate(size_t from=0)
Returns an iterable ensemble of all valid CargoSpec.
Definition: cargotype.h:190
Town::xy
TileIndex xy
town center tile
Definition: town.h:51
CargoSpec
Specification of a cargo type.
Definition: cargotype.h:71
town.h
StrongType::Typedef< uint32_t, struct TileIndexTag, StrongType::Compare, StrongType::Integer, StrongType::Compatible< int32_t >, StrongType::Compatible< int64_t > >
GetIfNewStopsByType
bool GetIfNewStopsByType(RoadStopType rs, RoadType roadtype)
Checks if there's any new stations by a specific RoadStopType.
Definition: newgrf_roadstop.cpp:465
newgrf_class_func.h
GetTerrainType
uint32_t GetTerrainType(TileIndex tile, TileContext context)
Function used by houses (and soon industries) to get information on type of "terrain" the tile it is ...
Definition: newgrf_commons.cpp:331
DrawCommonTileSeqInGUI
void DrawCommonTileSeqInGUI(int x, int y, const DrawTileSprites *dts, int32_t orig_offset, uint32_t newgrf_offset, PaletteID default_palette, bool child_offset_is_unsigned)
Draws a tile sprite sequence in the GUI.
Definition: sprite.cpp:92
CallbackID
CallbackID
List of implemented NewGRF callbacks.
Definition: newgrf_callbacks.h:20
PaletteID
uint32_t PaletteID
The number of the palette.
Definition: gfx_type.h:18
ROADSTOP_DRAW_MODE_OVERLAY
@ ROADSTOP_DRAW_MODE_OVERLAY
Drive-through stops: Draw the road overlay, e.g. pavement.
Definition: newgrf_roadstop.h:61
TriggerRoadStopRandomisation
void TriggerRoadStopRandomisation(Station *st, TileIndex tile, RoadStopRandomTrigger trigger, CargoID cargo_type=INVALID_CARGO)
Trigger road stop randomisation.
Definition: newgrf_roadstop.cpp:392
BaseStation::owner
Owner owner
The owner of this station.
Definition: base_station_base.h:74
INVALID_ROADTYPE
@ INVALID_ROADTYPE
flag for invalid roadtype
Definition: road_type.h:30
GetReverseRoadTypeTranslation
uint8_t GetReverseRoadTypeTranslation(RoadType roadtype, const GRFFile *grffile)
Perform a reverse roadtype lookup to get the GRF internal ID.
Definition: newgrf_roadtype.cpp:153
StationCargoList::TotalCount
uint TotalCount() const
Returns total count of cargo at the station, including cargo which is already reserved for loading.
Definition: cargopacket.h:607
GetIfClassHasNewStopsByType
bool GetIfClassHasNewStopsByType(RoadStopClass *roadstopclass, RoadStopType rs, RoadType roadtype)
Checks if the given RoadStopClass has any specs assigned to it, compatible with the given RoadStopTyp...
Definition: newgrf_roadstop.cpp:484
IsCustomRoadStopSpecIndex
bool IsCustomRoadStopSpecIndex(Tile t)
Is there a custom road stop spec on this tile?
Definition: station_map.h:561
GetTownRadiusGroup
HouseZonesBits GetTownRadiusGroup(const Town *t, TileIndex tile)
Returns the bit corresponding to the town zone of the specified tile.
Definition: town_cmd.cpp:2386
DrawRoadStopTile
void DrawRoadStopTile(int x, int y, RoadType roadtype, const RoadStopSpec *spec, StationType type, int view)
Draw representation of a road stop tile for GUI purposes.
Definition: newgrf_roadstop.cpp:277
GoodsEntry::cargo
StationCargoList cargo
The cargo packets of cargo waiting in this station.
Definition: station_base.h:210
StationType
StationType
Station types.
Definition: station_type.h:31
DrawTileSprites::ground
PalSpriteID ground
Palette and sprite for the ground.
Definition: sprite.h:59
NewGRFClass::IsUIAvailable
bool IsUIAvailable(uint index) const
Check whether the spec will be available to the user at some point in time.
Definition: newgrf_airport.cpp:36
GetCustomRoadSprite
SpriteID GetCustomRoadSprite(const RoadTypeInfo *rti, TileIndex tile, RoadTypeSpriteGroup rtsg, TileContext context, uint *num_results)
Get the sprite to draw for the given tile.
Definition: newgrf_roadtype.cpp:101
RSF_BUILD_MENU_TRAM_ONLY
@ RSF_BUILD_MENU_TRAM_ONLY
Only show in the tram build menu (not road).
Definition: newgrf_roadstop.h:71
RealSpriteGroup::loading
std::vector< const SpriteGroup * > loading
List of loading groups (can be SpriteIDs or Callback results)
Definition: newgrf_spritegroup.h:90
DistanceManhattan
uint DistanceManhattan(TileIndex t0, TileIndex t1)
Gets the Manhattan distance between the two given tiles.
Definition: map.cpp:159
CBM_ROAD_STOP_ANIMATION_SPEED
@ CBM_ROAD_STOP_ANIMATION_SPEED
Customize the animation speed of the road stop.
Definition: newgrf_callbacks.h:323
GetStationGfx
StationGfx GetStationGfx(Tile t)
Get the station graphics of this tile.
Definition: station_map.h:68
RoadStopSpecList
Definition: base_station_base.h:28
CBM_ROAD_STOP_ANIMATION_NEXT_FRAME
@ CBM_ROAD_STOP_ANIMATION_NEXT_FRAME
Use a custom next frame callback.
Definition: newgrf_callbacks.h:322
RoadStopRandomTrigger
RoadStopRandomTrigger
Definition: newgrf_roadstop.h:34
GetCompanyInfo
uint32_t GetCompanyInfo(CompanyID owner, const Livery *l)
Returns company information like in vehicle var 43 or station var 43.
Definition: newgrf_commons.cpp:450
roadstop_base.h
RoadStopResolverObject
Road stop resolver.
Definition: newgrf_roadstop.h:96
ResolverObject::root_spritegroup
const SpriteGroup * root_spritegroup
Root SpriteGroup to use for resolving.
Definition: newgrf_spritegroup.h:336
SpecializedStation< Station, false >::IsExpected
static bool IsExpected(const BaseStation *st)
Helper for checking whether the given station is of this type.
Definition: base_station_base.h:240
SpriteGroupCargo::SG_DEFAULT
static constexpr CargoID SG_DEFAULT
Default type used when no more-specific cargo matches.
Definition: newgrf_cargo.h:23
NewGRFClass
Struct containing information relating to NewGRF classes for stations and airports.
Definition: newgrf_class.h:20
GetEmptyMask
CargoTypes GetEmptyMask(const Station *st)
Get a mask of the cargo types that are empty at the station.
Definition: station_cmd.cpp:512
GetNearbyTileInformation
uint32_t GetNearbyTileInformation(TileIndex tile, bool grf_version8)
Common part of station var 0x67, house var 0x62, indtile var 0x60, industry var 0x62.
Definition: newgrf_commons.cpp:429
_local_company
CompanyID _local_company
Company controlled by the human player at this client. Can also be COMPANY_SPECTATOR.
Definition: company_cmd.cpp:49
BaseStation::GetNewGRFVariable
virtual uint32_t GetNewGRFVariable(const struct ResolverObject &object, byte variable, byte parameter, bool *available) const =0
Helper function to get a NewGRF variable that isn't implemented by the base class.
safeguards.h
ROTSG_ROADSTOP
@ ROTSG_ROADSTOP
Required: Bay stop surface.
Definition: road.h:70
GetTileSlope
Slope GetTileSlope(TileIndex tile, int *h)
Return the slope of a given tile inside the map.
Definition: tile_map.cpp:59
DrawTileSprites
Ground palette sprite of a tile, together with its sprite layout.
Definition: sprite.h:58
TCX_NORMAL
@ TCX_NORMAL
Nothing special.
Definition: newgrf_commons.h:24
RoadStopSpec::grf_prop
GRFFilePropsBase< NUM_CARGO+3 > grf_prop
Properties related the the grf file.
Definition: newgrf_roadstop.h:129
DrawSprite
void DrawSprite(SpriteID img, PaletteID pal, int x, int y, const SubSprite *sub, ZoomLevel zoom)
Draw a sprite, not in a viewport.
Definition: gfx.cpp:1007
AnimationBase< RoadStopAnimationBase, RoadStopSpec, BaseStation, int, GetAnimRoadStopCallback, RoadStopAnimationFrameAnimationHelper >::ChangeAnimationFrame
static void ChangeAnimationFrame(CallbackID cb, const RoadStopSpec *spec, BaseStation *obj, TileIndex tile, uint32_t random_bits, uint32_t trigger, int extra_data=0)
Check a callback to determine what the next animation step is and execute that step.
Definition: newgrf_animation_base.h:124
road.h
TownScopeResolver
Scope resolver for a town.
Definition: newgrf_town.h:22
RoadStopTileData
Definition: base_station_base.h:34
newgrf_roadstop.h
SpecializedStation< Station, false >::From
static Station * From(BaseStation *st)
Converts a BaseStation to SpecializedStation with type checking.
Definition: base_station_base.h:288
GetCustomRoadStopSpecIndex
uint GetCustomRoadStopSpecIndex(Tile t)
Get the custom road stop spec for this tile.
Definition: station_map.h:585
CBID_STATION_ANIM_NEXT_FRAME
@ CBID_STATION_ANIM_NEXT_FRAME
Called to determine station tile next animation frame.
Definition: newgrf_callbacks.h:188
stdafx.h
SpriteID
uint32_t SpriteID
The number of a sprite, without mapping bits and colourtables.
Definition: gfx_type.h:17
NewGRFClass::InsertDefaults
static void InsertDefaults()
Initialise the defaults.
Definition: newgrf_airport.cpp:27
RoadStopResolverObject::town_scope
TownScopeResolver * town_scope
The town scope resolver (created on the first call).
Definition: newgrf_roadstop.h:98
viewport_func.h
GetStationType
StationType GetStationType(Tile t)
Get the station type of this tile.
Definition: station_map.h:44
RoadStopScopeResolver::GetVariable
uint32_t GetVariable(byte variable, [[maybe_unused]] uint32_t parameter, bool *available) const override
Get a variable value.
Definition: newgrf_roadstop.cpp:66
RoadStopScopeResolver::cargo_type
CargoID cargo_type
Type of cargo of the station.
Definition: newgrf_roadstop.h:79
GRFFilePropsBase::local_id
uint16_t local_id
id defined by the grf file for this entity
Definition: newgrf_commons.h:318
GetRoadTypeInfo
const RoadTypeInfo * GetRoadTypeInfo(RoadType roadtype)
Returns a pointer to the Roadtype information for a given roadtype.
Definition: road.h:227
DistanceSquare
uint DistanceSquare(TileIndex t0, TileIndex t1)
Gets the 'Square' distance between the two given tiles.
Definition: map.cpp:176
RoadStopSpecList::grfid
uint32_t grfid
GRF ID of this custom road stop.
Definition: base_station_base.h:30
ROADSTOP_CLASS_WAYP
@ ROADSTOP_CLASS_WAYP
Waypoint class (unimplemented: this is reserved for future use with road waypoints).
Definition: newgrf_roadstop.h:28
ROADSTOP_BUS
@ ROADSTOP_BUS
A standard stop for buses.
Definition: station_type.h:44
ROADSTOP_CLASS_DFLT
@ ROADSTOP_CLASS_DFLT
Default road stop class.
Definition: newgrf_roadstop.h:27
_current_company
CompanyID _current_company
Company currently doing an action.
Definition: company_cmd.cpp:50
station_base.h
newgrf_sound.h
GRFFilePropsBase::spritegroup
const struct SpriteGroup * spritegroup[Tcnt]
pointer to the different sprites of the entity
Definition: newgrf_commons.h:320
newgrf_roadtype.h
CBID_STATION_ANIM_START_STOP
@ CBID_STATION_ANIM_START_STOP
Called for periodically starting or stopping the animation.
Definition: newgrf_callbacks.h:185
GetStationIndex
StationID GetStationIndex(Tile t)
Get StationID from a tile.
Definition: station_map.h:28
ROADSTOP_DRAW_MODE_ROAD
@ ROADSTOP_DRAW_MODE_ROAD
Bay stops: Draw the road itself.
Definition: newgrf_roadstop.h:60
ROADSTOP_CLASS_MAX
@ ROADSTOP_CLASS_MAX
Maximum number of classes.
Definition: newgrf_roadstop.h:29
RoadStopScopeResolver::roadstopspec
const struct RoadStopSpec * roadstopspec
Station (type) specification.
Definition: newgrf_roadstop.h:78
RealSpriteGroup
Definition: newgrf_spritegroup.h:79
ROTSG_OVERLAY
@ ROTSG_OVERLAY
Optional: Images for overlaying track.
Definition: road.h:61
RSRT_NEW_CARGO
@ RSRT_NEW_CARGO
Trigger roadstop on arrival of new cargo.
Definition: newgrf_roadstop.h:35
StationAnimationTrigger
StationAnimationTrigger
Animation triggers for station.
Definition: newgrf_animation_type.h:26
MarkTileDirtyByTile
void MarkTileDirtyByTile(TileIndex tile, int bridge_level_offset, int tile_height_override)
Mark a tile given by its index dirty for repaint.
Definition: viewport.cpp:2051
SpriteGroupCargo::SG_PURCHASE
static constexpr CargoID SG_PURCHASE
Used in purchase lists before an item exists.
Definition: newgrf_cargo.h:24
SpecializedStation< Station, false >::GetByTile
static Station * GetByTile(TileIndex tile)
Get the station belonging to a specific tile.
Definition: base_station_base.h:278
NewGRFClass::name
StringID name
Name of this class.
Definition: newgrf_class.h:39
RoadType
RoadType
The different roadtypes we support.
Definition: road_type.h:25
CBID_STATION_ANIMATION_SPEED
@ CBID_STATION_ANIMATION_SPEED
Called to indicate how long the current animation frame should last.
Definition: newgrf_callbacks.h:191
BaseStation
Base class for all station-ish types.
Definition: base_station_base.h:64
company_func.h
RoadStopResolverObject::roadstop_scope
RoadStopScopeResolver roadstop_scope
The stop scope resolver.
Definition: newgrf_roadstop.h:97
RoadStopAnimationFrameAnimationHelper
Definition: newgrf_roadstop.cpp:330
AnimationBase< RoadStopAnimationBase, RoadStopSpec, BaseStation, int, GetAnimRoadStopCallback, RoadStopAnimationFrameAnimationHelper >::AnimateTile
static void AnimateTile(const RoadStopSpec *spec, BaseStation *obj, TileIndex tile, bool random_animation, int extra_data=0)
Animate a single tile.
Definition: newgrf_animation_base.h:45
RSF_BUILD_MENU_ROAD_ONLY
@ RSF_BUILD_MENU_ROAD_ONLY
Only show in the road build menu (not tram).
Definition: newgrf_roadstop.h:70
BaseStation::random_bits
uint16_t random_bits
Random bits assigned to this station.
Definition: base_station_base.h:82
RoadStopResolverObject::ResolveReal
const SpriteGroup * ResolveReal(const RealSpriteGroup *group) const override
Get the real sprites of the grf.
Definition: newgrf_roadstop.cpp:202
AnimationBase
Helper class for a unified approach to NewGRF animation.
Definition: newgrf_animation_base.h:36
SpriteGroup::Resolve
virtual const SpriteGroup * Resolve([[maybe_unused]] ResolverObject &object) const
Base sprite group resolver.
Definition: newgrf_spritegroup.h:61
BaseStation::cached_roadstop_anim_triggers
uint8_t cached_roadstop_anim_triggers
NOSAVE: Combined animation trigger bitmask for road stops, used to determine if trigger processing sh...
Definition: base_station_base.h:85
Town
Town data structure.
Definition: town.h:50
NewGRFClass::Get
static NewGRFClass * Get(Tid cls_id)
Get a particular class.
Definition: newgrf_class_func.h:98
CargoID
byte CargoID
Cargo slots to indicate a cargo type within a game.
Definition: cargo_type.h:20
GetNearbyTile
TileIndex GetNearbyTile(byte parameter, TileIndex tile, bool signed_offsets, Axis axis)
Get the tile at the given offset.
Definition: newgrf_commons.cpp:406
RoadStopSpecList::localidx
uint16_t localidx
Station ID within GRF of road stop.
Definition: base_station_base.h:31
SpriteGroupCargo::SG_DEFAULT_NA
static constexpr CargoID SG_DEFAULT_NA
Used only by stations and roads when no more-specific cargo matches.
Definition: newgrf_cargo.h:25
IsValidCargoID
bool IsValidCargoID(CargoID t)
Test whether cargo type is not INVALID_CARGO.
Definition: cargo_type.h:90
PalSpriteID::pal
PaletteID pal
The palette (use PAL_NONE) if not needed)
Definition: gfx_type.h:24
TimerGameCalendar::date
static Date date
Current date in days (day counter).
Definition: timer_game_calendar.h:34
RoadStopScopeResolver::GetRandomBits
uint32_t GetRandomBits() const override
Get a few random bits.
Definition: newgrf_roadstop.cpp:50
ScopeResolver::ro
ResolverObject & ro
Surrounding resolver object.
Definition: newgrf_spritegroup.h:289
RoadStopUpdateCachedTriggers
void RoadStopUpdateCachedTriggers(BaseStation *st)
Update the cached animation trigger bitmask for a station.
Definition: newgrf_roadstop.cpp:607
GRFFilePropsBase::grffile
const struct GRFFile * grffile
grf file that introduced this entity
Definition: newgrf_commons.h:319
IsRoadStopTile
bool IsRoadStopTile(Tile t)
Is tile t a road stop station?
Definition: station_map.h:213
RoadStopScopeResolver::GetTriggers
uint32_t GetTriggers() const override
Get the triggers.
Definition: newgrf_roadstop.cpp:61
gfx_type.h
RoadStopClassID
RoadStopClassID
Definition: newgrf_roadstop.h:25
RoadStopScopeResolver::view
uint8_t view
Station axis.
Definition: newgrf_roadstop.h:81
RoadStopAnimationBase
Helper class for animation control.
Definition: newgrf_roadstop.cpp:336
BaseStation::custom_roadstop_tile_data
std::vector< RoadStopTileData > custom_roadstop_tile_data
List of custom road stop tile data.
Definition: base_station_base.h:92
GetIfStopIsForType
bool GetIfStopIsForType(const RoadStopSpec *roadstopspec, RoadStopType rs, RoadType roadtype)
Checks if the given RoadStopSpec is compatible with the given RoadStopType.
Definition: newgrf_roadstop.cpp:499
GRFFile::cargo_map
std::array< uint8_t, NUM_CARGO > cargo_map
Inverse cargo translation table (CargoID -> local ID)
Definition: newgrf.h:130
newgrf_cargo.h
SpriteGroup
Definition: newgrf_spritegroup.h:57
RoadStopSpec::cargo_triggers
CargoTypes cargo_triggers
Bitmask of cargo types which cause trigger re-randomizing.
Definition: newgrf_roadstop.h:139
RoadStopScopeResolver::type
StationType type
Station type.
Definition: newgrf_roadstop.h:80
debug.h
TileLayoutSpriteGroup
Action 2 sprite layout for houses, industry tiles, objects and airport tiles.
Definition: newgrf_spritegroup.h:259
ROADSTOPTYPE_PASSENGER
@ ROADSTOPTYPE_PASSENGER
This RoadStop is for passenger (bus) stops.
Definition: newgrf_roadstop.h:47
BaseStation::build_date
TimerGameCalendar::Date build_date
Date of construction.
Definition: base_station_base.h:80
HasBit
constexpr debug_inline bool HasBit(const T x, const uint8_t y)
Checks if a bit in a value is set.
Definition: bitmath_func.hpp:103