From: TimePath Date: Sat, 25 Apr 2015 06:17:02 +0000 (+1000) Subject: Declare more ints as ints X-Git-Tag: xonotic-v0.8.1~61^2~29 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=e72ae8623dbd67dc7d85ed16fa4a18dd75663629;p=xonotic%2Fxonotic-data.pk3dir.git Declare more ints as ints --- diff --git a/qcsrc/common/mapinfo.qh b/qcsrc/common/mapinfo.qh index 54255ec8d..fc7fdbb78 100644 --- a/qcsrc/common/mapinfo.qh +++ b/qcsrc/common/mapinfo.qh @@ -10,7 +10,7 @@ entity MapInfo_Type_last; .string netname; // game type name as in cvar (with g_ prefix) .string mdl; // game type short name .string message; // human readable name -.float team; // does this gametype support teamplay? +.int team; // does this gametype support teamplay? .string model2; // game type defaults .string gametype_description; // game type description diff --git a/qcsrc/common/notifications.qc b/qcsrc/common/notifications.qc index 7470cb888..a406df524 100644 --- a/qcsrc/common/notifications.qc +++ b/qcsrc/common/notifications.qc @@ -946,8 +946,7 @@ void Create_Notification_Entity( #ifdef SVQC void Notification_GetCvars(void) { - float i; - for(i = 0; i <= NOTIF_CHOICE_COUNT; ++i) + for(int i = 0; i <= NOTIF_CHOICE_COUNT; ++i) { GetCvars_handleFloat( get_cvars_s, @@ -1763,8 +1762,7 @@ void Net_Notification_Remove() )); #endif - float i; - for(i = 0; i < 4; ++i) { if(self.nent_strings[i]) { strunzone(self.nent_strings[i]); } } + for(int i = 0; i < 4; ++i) { if(self.nent_strings[i]) { strunzone(self.nent_strings[i]); } } remove(self); } @@ -1772,12 +1770,11 @@ float Net_Write_Notification(entity client, int sf) { if(Notification_ShouldSend(self.nent_broadcast, client, self.nent_client)) { - float i; WriteByte(MSG_ENTITY, ENT_CLIENT_NOTIFICATION); WriteByte(MSG_ENTITY, self.nent_net_type); WriteShort(MSG_ENTITY, self.nent_net_name); - for(i = 0; i < self.nent_stringcount; ++i) { WriteString(MSG_ENTITY, self.nent_strings[i]); } - for(i = 0; i < self.nent_floatcount; ++i) { WriteLong(MSG_ENTITY, self.nent_floats[i]); } + for(int i = 0; i < self.nent_stringcount; ++i) { WriteString(MSG_ENTITY, self.nent_strings[i]); } + for(int i = 0; i < self.nent_floatcount; ++i) { WriteLong(MSG_ENTITY, self.nent_floats[i]); } return true; } else { return false; } @@ -2098,10 +2095,9 @@ void Send_Notification( net_notif.nent_stringcount = notif.nent_stringcount; net_notif.nent_floatcount = notif.nent_floatcount; - float i; - for(i = 0; i < net_notif.nent_stringcount; ++i) + for(int i = 0; i < net_notif.nent_stringcount; ++i) { net_notif.nent_strings[i] = strzone(...(i, string)); } - for(i = 0; i < net_notif.nent_floatcount; ++i) + for(int i = 0; i < net_notif.nent_floatcount; ++i) { net_notif.nent_floats[i] = ...((net_notif.nent_stringcount + i), float); } net_notif.think = Net_Notification_Remove; diff --git a/qcsrc/server/antilag.qc b/qcsrc/server/antilag.qc index 6f8f0f487..f9829960d 100644 --- a/qcsrc/server/antilag.qc +++ b/qcsrc/server/antilag.qc @@ -65,10 +65,8 @@ vector lerpv(float t0, vector v0, float t1, vector v1, float t) vector antilag_takebackorigin(entity e, float t) { - float i0, i1; - - i0 = antilag_find(e, t); - if(i0 < 0) + int i0 = antilag_find(e, t); + if (i0 < 0) { // IN THE PRESENT if(e.antilag_takenback) @@ -76,8 +74,8 @@ vector antilag_takebackorigin(entity e, float t) else return e.origin; } - i1 = i0 + 1; - if(i1 >= ANTILAG_MAX_ORIGINS) + int i1 = i0 + 1; + if (i1 >= ANTILAG_MAX_ORIGINS) i1 = 0; return lerpv(e.(antilag_times[i0]), e.(antilag_origins[i0]), e.(antilag_times[i1]), e.(antilag_origins[i1]), t); @@ -127,10 +125,8 @@ void antilag_restore(entity e) void antilag_clear(entity e) { - float i; - antilag_restore(e); - for(i = 0; i < ANTILAG_MAX_ORIGINS; ++i) + for (int i = 0; i < ANTILAG_MAX_ORIGINS; ++i) { e.(antilag_times[i]) = -2342; e.(antilag_origins[i]) = e.origin; diff --git a/qcsrc/server/bot/havocbot/havocbot.qc b/qcsrc/server/bot/havocbot/havocbot.qc index 0ecafaf1e..347a85204 100644 --- a/qcsrc/server/bot/havocbot/havocbot.qc +++ b/qcsrc/server/bot/havocbot/havocbot.qc @@ -148,9 +148,6 @@ void havocbot_ai() // if the bot is not attacking, consider reloading weapons if (!(self.aistatus & AI_STATUS_ATTACKING)) { - float i; - entity e; - // we are currently holding a weapon that's not fully loaded, reload it if(skill >= 2) // bots can only reload the held weapon on purpose past this skill if(self.clip_load < self.clip_size) @@ -161,9 +158,9 @@ void havocbot_ai() if(skill >= 5) // bots can only look for unloaded weapons past this skill if(self.clip_load >= 0) // only if we're not reloading a weapon already { - for(i = WEP_FIRST; i <= WEP_LAST; ++i) + for (int i = WEP_FIRST; i <= WEP_LAST; ++i) { - e = get_weaponinfo(i); + entity e = get_weaponinfo(i); if ((self.weapons & WepSet_FromWeapon(i)) && (e.spawnflags & WEP_FLAG_RELOADABLE) && (self.weapon_load[i] < e.reloading_ammo)) self.switchweapon = i; } diff --git a/qcsrc/server/bot/scripting.qc b/qcsrc/server/bot/scripting.qc index ead8ceac9..c9a86d56a 100644 --- a/qcsrc/server/bot/scripting.qc +++ b/qcsrc/server/bot/scripting.qc @@ -1215,7 +1215,6 @@ void bot_setcurrentcommand() void bot_resetqueues() { entity cl; - float i; FOR_EACH_CLIENT(cl) if(cl.isbot) { @@ -1223,7 +1222,7 @@ void bot_resetqueues() bot_clearqueue(cl); // also, cancel all barriers cl.bot_barrier = 0; - for(i = 0; i < cl.bot_places_count; ++i) + for(int i = 0; i < cl.bot_places_count; ++i) { strunzone(cl.(bot_placenames[i])); cl.(bot_placenames[i]) = string_null; diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc index 222e02913..c0a8bde51 100644 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@ -409,7 +409,6 @@ void PutClientInServer (void) if(IS_PLAYER(self)) { entity spot, oldself; - float j; accuracy_resend(self); @@ -598,13 +597,13 @@ void PutClientInServer (void) target_voicescript_clear(self); // reset fields the weapons may use - for (j = WEP_FIRST; j <= WEP_LAST; ++j) + for (int j = WEP_FIRST; j <= WEP_LAST; ++j) { WEP_ACTION(j, WR_RESETPLAYER); // all weapons must be fully loaded when we spawn entity e = get_weaponinfo(j); - if(e.spawnflags & WEP_FLAG_RELOADABLE) // prevent accessing undefined cvars + if (e.spawnflags & WEP_FLAG_RELOADABLE) // prevent accessing undefined cvars self.(weapon_load[j]) = e.reloading_ammo; } diff --git a/qcsrc/server/command/radarmap.qc b/qcsrc/server/command/radarmap.qc index 73e510879..befbd1a8c 100644 --- a/qcsrc/server/command/radarmap.qc +++ b/qcsrc/server/command/radarmap.qc @@ -167,7 +167,7 @@ void sharpen_set(int x, float v) { sharpen_buffer[x + 2 * RADAR_WIDTH_MAX] = v; } -float sharpen_getpixel(float x, float y) +float sharpen_getpixel(int x, int y) { if(x < 0) return 0; diff --git a/qcsrc/server/command/sv_cmd.qc b/qcsrc/server/command/sv_cmd.qc index 7166ab7cf..64d98f127 100644 --- a/qcsrc/server/command/sv_cmd.qc +++ b/qcsrc/server/command/sv_cmd.qc @@ -1380,7 +1380,7 @@ void GameCommand_shuffleteams(float request) { entity tmp_player; int i; - float x, z, t_teams, t_players, team_color; + float x, t_teams, t_players, team_color; // count the total amount of players and total amount of teams t_players = 0; @@ -1417,7 +1417,7 @@ void GameCommand_shuffleteams(float request) } // finally, from the list made earlier, re-join the players in different order. - for(i = 1; i <= t_teams; ++i) + for (int i = 1; i <= t_teams; ++i) { // find out how many players to assign to this team x = (t_players / t_teams); @@ -1426,7 +1426,7 @@ void GameCommand_shuffleteams(float request) team_color = Team_NumberToTeam(i); // sort through the random list of players made earlier - for(z = 1; z <= maxclients; ++z) + for (int z = 1; z <= maxclients; ++z) { if (!(shuffleteams_teams[i] >= x)) { diff --git a/qcsrc/server/defs.qh b/qcsrc/server/defs.qh index eeb6e44b9..49e340c49 100644 --- a/qcsrc/server/defs.qh +++ b/qcsrc/server/defs.qh @@ -285,7 +285,7 @@ float default_weapon_alpha; .float version_nagtime; const int NUM_JUMPPADSUSED = 3; -.float jumppadcount; +.int jumppadcount; .entity jumppadsused[NUM_JUMPPADSUSED]; string gamemode_name; diff --git a/qcsrc/server/mutators/mutator_overkill.qc b/qcsrc/server/mutators/mutator_overkill.qc index a0198077d..b707fbee0 100644 --- a/qcsrc/server/mutators/mutator_overkill.qc +++ b/qcsrc/server/mutators/mutator_overkill.qc @@ -10,7 +10,7 @@ void ok_DecreaseCharge(entity ent, int wep) ent.ammo_charge[wep] -= max(0, cvar(sprintf("g_overkill_ammo_decharge_%s", wepent.netname))); } -void ok_IncreaseCharge(entity ent, float wep) +void ok_IncreaseCharge(entity ent, int wep) { entity wepent = get_weaponinfo(wep); @@ -22,7 +22,7 @@ void ok_IncreaseCharge(entity ent, float wep) ent.ammo_charge[wep] = min(autocvar_g_overkill_ammo_charge_limit, ent.ammo_charge[wep] + cvar(sprintf("g_overkill_ammo_charge_rate_%s", wepent.netname)) * frametime / W_TICSPERFRAME); } -float ok_CheckWeaponCharge(entity ent, float wep) +float ok_CheckWeaponCharge(entity ent, int wep) { if(!ent.ok_use_ammocharge) return true; @@ -183,9 +183,7 @@ MUTATOR_HOOKFUNCTION(ok_PlayerSpawn) { if(autocvar_g_overkill_ammo_charge) { - float i; - - for(i = WEP_FIRST; i <= WEP_LAST; ++i) + for(int i = WEP_FIRST; i <= WEP_LAST; ++i) self.ammo_charge[i] = autocvar_g_overkill_ammo_charge_limit; self.ok_use_ammocharge = 1; diff --git a/qcsrc/server/pathlib/expandnode.qc b/qcsrc/server/pathlib/expandnode.qc index 47f160244..4f9481650 100644 --- a/qcsrc/server/pathlib/expandnode.qc +++ b/qcsrc/server/pathlib/expandnode.qc @@ -5,7 +5,7 @@ float plib_fvals[8]; float pathlib_expandnode_starf(entity node, vector start, vector goal) { vector where,f,r,t; - float fc,fc2,c; + float fc,c; entity nap; where = node.origin; @@ -49,7 +49,7 @@ float pathlib_expandnode_starf(entity node, vector start, vector goal) plib_points2[0] = plib_points[0]; vector bp; bp = plib_points[0]; - fc2 = 0; + int fc2 = 0; for(int i = 0; i < 8; ++i) { c = 0; diff --git a/qcsrc/server/t_items.qc b/qcsrc/server/t_items.qc index 72e3b0961..723299cc1 100644 --- a/qcsrc/server/t_items.qc +++ b/qcsrc/server/t_items.qc @@ -811,7 +811,7 @@ float generic_pickupevalfunc(entity player, entity item) {return item.bot_pickup float weapon_pickupevalfunc(entity player, entity item) { - float c, j, position; + float c; // See if I have it already if(item.weapons & ~player.weapons) @@ -834,8 +834,8 @@ float weapon_pickupevalfunc(entity player, entity item) if( bot_custom_weapon && c ) { // Find the highest position on any range - position = -1; - for(j = 0; j < WEP_LAST ; ++j){ + int position = -1; + for (int j = 0; j < WEP_LAST ; ++j){ if( bot_weapons_far[j] == item.weapon || bot_weapons_mid[j] == item.weapon || diff --git a/qcsrc/server/weapons/throwing.qc b/qcsrc/server/weapons/throwing.qc index 6b47a8822..aecaafb18 100644 --- a/qcsrc/server/weapons/throwing.qc +++ b/qcsrc/server/weapons/throwing.qc @@ -40,7 +40,7 @@ string W_ThrowNewWeapon(entity own, float wpn, float doreduce, vector org, vecto entity oldself, wep; float thisammo, i; string s; - var .float ammotype = (get_weaponinfo(wpn)).ammo_field; + var .int ammotype = (get_weaponinfo(wpn)).ammo_field; wep = spawn();