Old revision #przx0mp7j | New revision #p0laqcito | ||
---|---|---|---|
1 | if (this->activity == GA_WANDER || this->activity == GA_QUEUING) { // Prevent wandering and queuing guests from walking out the park. | 1 | if (this->activity == GA_WANDER || this->activity == GA_QUEUING) { // Prevent wandering and queuing guests from walking out the park. |
2 | uint8 exits_viable = this->Person::HandleParkExits(); | 2 | uint8 exits_viable = this->Person::HandleParkExits(); |
3 | exits &= exits_viable; | 3 | exits &= exits_viable; |
4 | shops &= exits_viable; | 4 | shops &= exits_viable; |
5 | } | 5 | } |
6 | 6 | ||
7 | /** | 7 | /** |
8 | * Prevent people from wandering out of the park. | 8 | * Prevent people from wandering out of the park. |
9 | * @return exits Possible exits at the tile. | 9 | * @return exits Exits from the current tile that stay or lead into the park in |
10 | * the low nibble. | ||
10 | */ | 11 | */ |
11 | 11 | uint8 Person::HandleParkExits() | |
12 | { | 13 | { |
13 | uint8 exits = 0xF; | 14 | uint8 exits = 0xF; |
14 | for (TileEdge exit_edge = EDGE_BEGIN; exit_edge != EDGE_COUNT; exit_edge++) { | 15 | for (TileEdge exit_edge = EDGE_BEGIN; exit_edge != EDGE_COUNT; exit_edge++) { |
15 | Point16 dxy = _tile_dxy[exit_edge]; | 16 | Point16 dxy = _tile_dxy[exit_edge]; |
16 | 17 | ||
17 | if (this->x_vox + dxy.x < 0 || this->x_vox + dxy.x >= _world.GetXSize() * 256 || | 18 | if (this->x_vox + dxy.x < 0 || this->x_vox + dxy.x >= |
18 | this->y_vox + dxy.y < 0 || this->y_vox + dxy.y >= _world.GetYSize() * 256 || | 19 | _world.GetXSize()) continue; |
19 | _world.GetTileOwner(this->x_vox + dxy.x, this->y_vox + dxy.y) != OWN_PARK) { | 20 | if (this->y_vox + dxy.y < 0 || this->y_vox + dxy.y >= |
21 | _world.GetYSize()) continue; | ||
22 | if (_world.GetTileOwner(this->x_vox + dxy.x, this->y_vox + dxy.y) != OWN_PARK) { | ||
20 | SB(exits, exit_edge, 1, 0); | 23 | SB(exits, exit_edge, 1, 0); |
21 | } | 24 | } |
22 | } | 25 | } |