equal
deleted
inserted
replaced
437 |
437 |
438 /** Checks whether the given bay is free in this road stop */ |
438 /** Checks whether the given bay is free in this road stop */ |
439 bool RoadStop::IsFreeBay(uint nr) const |
439 bool RoadStop::IsFreeBay(uint nr) const |
440 { |
440 { |
441 assert(nr < MAX_BAY_COUNT); |
441 assert(nr < MAX_BAY_COUNT); |
442 return HASBIT(status, nr); |
442 return HasBit(status, nr); |
443 } |
443 } |
444 |
444 |
445 /** |
445 /** |
446 * Allocates a bay |
446 * Allocates a bay |
447 * @return the allocated bay number |
447 * @return the allocated bay number |
451 { |
451 { |
452 assert(HasFreeBay()); |
452 assert(HasFreeBay()); |
453 |
453 |
454 /* Find the first free bay. If the bit is set, the bay is free. */ |
454 /* Find the first free bay. If the bit is set, the bay is free. */ |
455 uint bay_nr = 0; |
455 uint bay_nr = 0; |
456 while (!HASBIT(status, bay_nr)) bay_nr++; |
456 while (!HasBit(status, bay_nr)) bay_nr++; |
457 |
457 |
458 CLRBIT(status, bay_nr); |
458 CLRBIT(status, bay_nr); |
459 return bay_nr; |
459 return bay_nr; |
460 } |
460 } |
461 |
461 |
481 |
481 |
482 |
482 |
483 /** Checks whether the entrance of the road stop is occupied by a vehicle */ |
483 /** Checks whether the entrance of the road stop is occupied by a vehicle */ |
484 bool RoadStop::IsEntranceBusy() const |
484 bool RoadStop::IsEntranceBusy() const |
485 { |
485 { |
486 return HASBIT(status, 7); |
486 return HasBit(status, 7); |
487 } |
487 } |
488 |
488 |
489 /** Makes an entrance occupied or free */ |
489 /** Makes an entrance occupied or free */ |
490 void RoadStop::SetEntranceBusy(bool busy) |
490 void RoadStop::SetEntranceBusy(bool busy) |
491 { |
491 { |