* Update for the cargo being loaded on this tile. * * When a CargoPacket is created, it is moved to a station. But at that * moment in time it is not known yet at which tile the cargo will be * picked up. As this tile is used for payment information, we delay * setting the source_xy till first pickup, getting a better idea where * a cargo started from. * * Further more, we keep tra
| 109 | * @param tile Tile the cargo is being picked up from. |
| 110 | */ |
| 111 | void UpdateLoadingTile(TileIndex tile) |
| 112 | { |
| 113 | if (this->source_xy == INVALID_TILE) { |
| 114 | this->source_xy = tile; |
| 115 | } |
| 116 | |
| 117 | #ifdef WITH_ASSERT |
| 118 | assert(!this->in_vehicle); |
| 119 | this->in_vehicle = true; |
| 120 | #endif /* WITH_ASSERT */ |
| 121 | |
| 122 | /* We want to calculate the vector from tile-unload to tile-load. As |
| 123 | * we currently only know the latter, add it. When we know where we unload, |
| 124 | * we subtract is, giving us our vector (unload - load). */ |
| 125 | this->travelled.x += TileX(tile); |
| 126 | this->travelled.y += TileY(tile); |
| 127 | } |
| 128 | |
| 129 | /** |
| 130 | * Update for the cargo being unloaded on this tile. |
no test coverage detected