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();
  3.     exits &= exits_viable;
  4.     shops &= exits_viable;
  5. }
  6.  
  7. /**
  8.  * Prevent people from wandering out of the park.
  9.  * @return exits Exits from the current tile that stay or lead into the park in
  10.  * the low nibble.
  11.  */
  12. uint8 Person::HandleParkExits()
  13. {
  14.     uint8 exits = 0xF;
  15.     for (TileEdge exit_edge = EDGE_BEGIN; exit_edge != EDGE_COUNT; exit_edge++) {
  16.         Point16 dxy = _tile_dxy[exit_edge];
  17.  
  18.         if (this->x_vox + dxy.x < 0 || this->x_vox + dxy.x >=
  19.         _world.GetXSize()) continue;
  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) {
  23.             SB(exits, exit_edge, 1, 0);
  24.         }
  25.     }
  26.  
  27.     return exits;
  28. }

Version history

Revision # Author Created at
przx0mp7j sgtbigman 07 Dec 2014, 19:38:55 UTC Diff

Comments