#include <vehicle_base.h>
Public Member Functions | |
| FreeUnitIDGenerator (VehicleType type, CompanyID owner) | |
| Initializes the structure. | |
| UnitID | NextID () |
| Returns next free UnitID. | |
| ~FreeUnitIDGenerator () | |
| Releases allocated memory. | |
Data Fields | |
| bool * | cache |
| array of occupied unit id numbers | |
| UnitID | maxid |
| maximum ID at the moment of constructor call | |
| UnitID | curid |
| last ID returned ; 0 if none | |
Definition at line 672 of file vehicle_base.h.
| FreeUnitIDGenerator::FreeUnitIDGenerator | ( | VehicleType | type, | |
| CompanyID | owner | |||
| ) |
Initializes the structure.
Vehicle unit numbers are supposed not to change after struct initialization, except after each call to this->NextID() the returned value is assigned to a vehicle.
| type | type of vehicle | |
| owner | owner of vehicles |
Definition at line 1249 of file vehicle.cpp.
| UnitID FreeUnitIDGenerator::NextID | ( | ) |
Returns next free UnitID.
Supposes the last returned value was assigned to a vehicle.
Definition at line 1274 of file vehicle.cpp.
1.5.6