From: terencehill Date: Tue, 29 Jan 2019 21:12:20 +0000 (+0100) Subject: Label some field pointers with the const attribute X-Git-Tag: xonotic-v0.8.5~1630 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=8d21c71d2a5d6eb9a30b2e981a216382eef4ce59;p=xonotic%2Fxonotic-data.pk3dir.git Label some field pointers with the const attribute --- diff --git a/qcsrc/common/items/item.qh b/qcsrc/common/items/item.qh index 030b4db1c..cf4e288ba 100644 --- a/qcsrc/common/items/item.qh +++ b/qcsrc/common/items/item.qh @@ -48,8 +48,8 @@ const int IT_UNLIMITED_AMMO = IT_UNLIMITED_WEAPON_AMMO | IT_UNLIMITE const int IT_PICKUPMASK = IT_UNLIMITED_AMMO | IT_JETPACK | IT_FUEL_REGEN; // strength and invincible are handled separately #ifdef SVQC -.float strength_finished = _STAT(STRENGTH_FINISHED); -.float invincible_finished = _STAT(INVINCIBLE_FINISHED); +const .float strength_finished = _STAT(STRENGTH_FINISHED); +const .float invincible_finished = _STAT(INVINCIBLE_FINISHED); #define spawnfunc_body(item) \ if (!Item_IsDefinitionAllowed(item)) \ diff --git a/qcsrc/common/items/item/ammo.qh b/qcsrc/common/items/item/ammo.qh index 3249f07bc..51480b453 100644 --- a/qcsrc/common/items/item/ammo.qh +++ b/qcsrc/common/items/item/ammo.qh @@ -14,8 +14,8 @@ .int ammo_rockets; .int ammo_cells; #ifdef SVQC -.int ammo_plasma = _STAT(PLASMA); -.int ammo_fuel = _STAT(FUEL); +const .int ammo_plasma = _STAT(PLASMA); +const .int ammo_fuel = _STAT(FUEL); #else .int ammo_plasma; .int ammo_fuel; diff --git a/qcsrc/common/vehicles/sv_vehicles.qh b/qcsrc/common/vehicles/sv_vehicles.qh index a1f23c1df..6c2074f4a 100644 --- a/qcsrc/common/vehicles/sv_vehicles.qh +++ b/qcsrc/common/vehicles/sv_vehicles.qh @@ -45,14 +45,14 @@ float autocvar_g_vehicles_weapon_damagerate = 2; .entity gunner1; .entity gunner2; -.float vehicle_health = _STAT(VEHICLESTAT_HEALTH); /// If ent is player this is 0..100 indicating precentage of health left on vehicle. Vehicle's value is the health resource -.float vehicle_energy = _STAT(VEHICLESTAT_ENERGY); /// If ent is player this is 0..100 indicating precentage of energy left on vehicle. If ent is vehicle, this is the real energy value. -.float vehicle_shield = _STAT(VEHICLESTAT_SHIELD); /// If ent is player this is 0..100 indicating precentage of shield left on vehicle. If ent is vehicle, this is the real shield value. - -.float vehicle_ammo1 = _STAT(VEHICLESTAT_AMMO1); /// If ent is player this is 0..100 indicating percentage of primary ammo left UNLESS value is already stored in vehicle_energy. If ent is vehicle, this is the real ammo1 value. -.float vehicle_reload1 = _STAT(VEHICLESTAT_RELOAD1); /// If ent is player this is 0..100 indicating percentage of primary reload status. If ent is vehicle, this is the real reload1 value. -.float vehicle_ammo2 = _STAT(VEHICLESTAT_AMMO2); /// If ent is player this is 0..100 indicating percentage of secondary ammo left. If ent is vehicle, this is the real ammo2 value. -.float vehicle_reload2 = _STAT(VEHICLESTAT_RELOAD2); /// If ent is player this is 0..100 indicating percentage of secondary reload status. If ent is vehicle, this is the real reload2 value. +const .float vehicle_health = _STAT(VEHICLESTAT_HEALTH); /// If ent is player this is 0..100 indicating precentage of health left on vehicle. Vehicle's value is the health resource +const .float vehicle_energy = _STAT(VEHICLESTAT_ENERGY); /// If ent is player this is 0..100 indicating precentage of energy left on vehicle. If ent is vehicle, this is the real energy value. +const .float vehicle_shield = _STAT(VEHICLESTAT_SHIELD); /// If ent is player this is 0..100 indicating precentage of shield left on vehicle. If ent is vehicle, this is the real shield value. + +const .float vehicle_ammo1 = _STAT(VEHICLESTAT_AMMO1); /// If ent is player this is 0..100 indicating percentage of primary ammo left UNLESS value is already stored in vehicle_energy. If ent is vehicle, this is the real ammo1 value. +const .float vehicle_reload1 = _STAT(VEHICLESTAT_RELOAD1); /// If ent is player this is 0..100 indicating percentage of primary reload status. If ent is vehicle, this is the real reload1 value. +const .float vehicle_ammo2 = _STAT(VEHICLESTAT_AMMO2); /// If ent is player this is 0..100 indicating percentage of secondary ammo left. If ent is vehicle, this is the real ammo2 value. +const .float vehicle_reload2 = _STAT(VEHICLESTAT_RELOAD2); /// If ent is player this is 0..100 indicating percentage of secondary reload status. If ent is vehicle, this is the real reload2 value. .float sound_nexttime; const float VOL_VEHICLEENGINE = 1; diff --git a/qcsrc/server/defs.qh b/qcsrc/server/defs.qh index 5b5d8a66b..c66ad28fe 100644 --- a/qcsrc/server/defs.qh +++ b/qcsrc/server/defs.qh @@ -50,7 +50,7 @@ float server_is_dedicated; .float pain_frame; //" .float crouch; // Crouching or not? -.float superweapons_finished = _STAT(SUPERWEAPONS_FINISHED); +const .float superweapons_finished = _STAT(SUPERWEAPONS_FINISHED); .float cnt; // used in too many places .float count;