]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Vehicles: rename registry globals
authorTimePath <andrew.hardaker1995@gmail.com>
Tue, 6 Oct 2015 09:50:37 +0000 (20:50 +1100)
committerTimePath <andrew.hardaker1995@gmail.com>
Tue, 6 Oct 2015 09:50:37 +0000 (20:50 +1100)
qcsrc/common/vehicles/all.qc
qcsrc/common/vehicles/all.qh

index b071cf5a769395d79cd153d25ac25430283d5009..72d72d29d19d14a1cd7de16ce51a8399c1347d74 100644 (file)
@@ -23,13 +23,6 @@ STATIC_INIT(vehicles_common_initialize)
 }
 #endif
 
-entity get_vehicleinfo(int id)
-{
-       if (id < VEH_FIRST || id > VEH_LAST) return VEH_Null;
-       entity m = vehicle_info[id];
-       return m ? m : VEH_Null;
-}
-
 #if defined(SVQC)
        #include "sv_vehicles.qc"
 #elif defined(CSQC)
index 351c267a2a124a7c69b31042e0ff5bf4ddde05d0..706585597ffa8060ef1ac318df5ed57ce125c047 100644 (file)
@@ -3,16 +3,13 @@
 
 #include "vehicle.qh"
 
-void RegisterVehicles();
-const int VEH_MAXCOUNT = 24;
-entity vehicle_info[VEH_MAXCOUNT], vehicle_info_first, vehicle_info_last;
-Vehicle get_vehicleinfo(int id);
-int VEH_COUNT;
+REGISTRY(Vehicles, 24)
+REGISTER_REGISTRY(RegisterVehicles)
 const int VEH_FIRST = 1;
-#define VEH_LAST (VEH_FIRST + VEH_COUNT - 1)
+#define VEH_LAST (Vehicles_COUNT - 1)
+
 /** If you register a new vehicle, make sure to add it to all.inc */
-#define REGISTER_VEHICLE(id, inst) REGISTER(RegisterVehicles, VEH, vehicle_info, VEH_COUNT, id, vehicleid, inst)
-REGISTER_REGISTRY(RegisterVehicles)
+#define REGISTER_VEHICLE(id, inst) REGISTER(RegisterVehicles, VEH, Vehicles, Vehicles_COUNT, id, vehicleid, inst)
 
 #if defined(SVQC)
        #include "sv_vehicles.qh"
@@ -22,6 +19,15 @@ REGISTER_REGISTRY(RegisterVehicles)
 
 REGISTER_VEHICLE(Null, NEW(Vehicle));
 
+Vehicle get_vehicleinfo(int id)
+{
+       if (id >= VEH_FIRST && id <= VEH_LAST) {
+               Vehicle v = Vehicles[id];
+               if (v) return v;
+       }
+       return VEH_Null;
+}
+
 #include "all.inc"
 
 #endif