Registry: use BITS everywhere
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / vehicles / all.qh
1 #ifndef VEHICLES_ALL_H
2 #define VEHICLES_ALL_H
3
4 #include "vehicle.qh"
5
6 REGISTRY(Vehicles, BITS(3))
7 REGISTER_REGISTRY(RegisterVehicles)
8 const int VEH_FIRST = 1;
9 #define VEH_LAST (Vehicles_COUNT - 1)
10
11 /** If you register a new vehicle, make sure to add it to all.inc */
12 #define REGISTER_VEHICLE(id, inst) REGISTER(RegisterVehicles, VEH, Vehicles, id, vehicleid, inst)
13
14 #if defined(SVQC)
15         #include "sv_vehicles.qh"
16 #elif defined(CSQC)
17         #include "cl_vehicles.qh"
18 #endif
19
20 REGISTER_VEHICLE(Null, NEW(Vehicle));
21
22 Vehicle get_vehicleinfo(int id)
23 {
24         if (id >= VEH_FIRST && id <= VEH_LAST) {
25                 Vehicle v = Vehicles[id];
26                 if (v) return v;
27         }
28         return VEH_Null;
29 }
30
31 #include "all.inc"
32
33 #endif