Loading

Updated-ParkExits

  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(); // Handle guests trying to wander out.
  3.     exits &= exits_viable;
  4.     shops &= exits_viable;
  5. }
  6.  
  7. /**
  8.  * Prevent people from wandering out of the park.
  9.  * @return exits Possible exits at the tile.
  10.  */
  11. void Person::HandleParkExits()
  12. {
  13.     uint8 exits = 0xF;
  14.     for (TileEdge exit_edge = EDGE_BEGIN; exit_edge != EDGE_COUNT; exit_edge++) {
  15.         Point16 dxy = _tile_dxy[exit_edge];
  16.  
  17.         if (this->x_vox + dxy.x < 0 || this->x_vox + dxy.x >= _world.GetXSize() * 256 ||
  18.             this->y_vox + dxy.y < 0 || this->y_vox + dxy.y >= _world.GetYSize() * 256 ||
  19.             _world.GetTileOwner(this->x_vox + dxy.x, this->y_vox + dxy.y) != OWN_PARK) {
  20.             SB(exits, exit_edge, 1, 0);
  21.         }
  22.     }
  23.  
  24.     return exits;
  25. }

Comments