MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / SkipEmptyBuckets

Method SkipEmptyBuckets

src/vehicle.cpp:472–485  ·  view source on GitHub ↗

* Advance the internal state until we reach a non-empty bucket, or the end. */

Source from the content-addressed store, hash-verified

470 * Advance the internal state until we reach a non-empty bucket, or the end.
471 */
472void VehiclesNearTileXY::Iterator::SkipEmptyBuckets()
473{
474 while (this->current_veh == nullptr) {
475 if (this->hx != this->hxmax) {
476 this->hx = IncTileHash1D(this->hx);
477 } else if (this->hy != this->hymax) {
478 this->hx = this->hxmin;
479 this->hy = IncTileHash1D(this->hy);
480 } else {
481 return;
482 }
483 this->current_veh = _vehicle_tile_hash[ComposeTileHash(this->hx, this->hy)];
484 }
485}
486
487/**
488 * Advance the internal state until it reaches a vehicle within the search area.

Callers 2

IteratorMethod · 0.95
IncrementMethod · 0.95

Calls 2

IncTileHash1DFunction · 0.85
ComposeTileHashFunction · 0.85

Tested by

no test coverage detected