]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Declare more ints as ints
authorTimePath <andrew.hardaker1995@gmail.com>
Sat, 25 Apr 2015 06:17:02 +0000 (16:17 +1000)
committerTimePath <andrew.hardaker1995@gmail.com>
Sun, 26 Apr 2015 08:04:40 +0000 (18:04 +1000)
13 files changed:
qcsrc/common/mapinfo.qh
qcsrc/common/notifications.qc
qcsrc/server/antilag.qc
qcsrc/server/bot/havocbot/havocbot.qc
qcsrc/server/bot/scripting.qc
qcsrc/server/cl_client.qc
qcsrc/server/command/radarmap.qc
qcsrc/server/command/sv_cmd.qc
qcsrc/server/defs.qh
qcsrc/server/mutators/mutator_overkill.qc
qcsrc/server/pathlib/expandnode.qc
qcsrc/server/t_items.qc
qcsrc/server/weapons/throwing.qc

index 54255ec8d2aa153abfb6da7242d08b3635c40423..fc7fdbb7845a4f42259d5704c4efba9b0edabc6a 100644 (file)
@@ -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
 
index 7470cb88802edbcfe862ef36665ff800a3408dcc..a406df52419dc71d1bdf985e7aa963e83b988fa1 100644 (file)
@@ -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;
index 6f8f0f487e0c7e811cd425d7ceb9da8dcc93ec63..f9829960d4b30213710a9408047c921838dc69d2 100644 (file)
@@ -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;
index 0ecafaf1e87c7aa62fda4892d2c38ef300e05683..347a85204c1c420a394a156538f42581e2f083fa 100644 (file)
@@ -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;
                        }
index ead8ceac9ec5c3adba637e35df67207f6abc6391..c9a86d56a54c78ea95076ef864fe71dc4328acfa 100644 (file)
@@ -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;
index 222e0291337ea9c52fdf357799a5ecb7ad99e577..c0a8bde5180fd2a0c81f6544fd74928c17e9b5a2 100644 (file)
@@ -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;
                }
 
index 73e5108795525bd072c60cc5bd86bcd58cc25da5..befbd1a8c58a7a358508c4d0c85cb712a059cfdf 100644 (file)
@@ -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;
index 7166ab7cfd1156b9377724ac6f2586e591f24872..64d98f127b6591a0a559ebeefe1f2377f21d8ab1 100644 (file)
@@ -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))
                                                {
index eeb6e44b95cb0a741690ac7dc253c9f4ed3ead2e..49e340c4970edff02b39fe1d3c208e57dbee47bd 100644 (file)
@@ -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;
index a0198077dd1290e0b462945ee777df93edc68cbe..b707fbee0cac7b78cb94ff84b6115430c4973b69 100644 (file)
@@ -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;
index 47f160244c1ac61d8680f034e590f86dfb9d5173..4f9481650ae4b161c7e39dead7c5463c9f71887d 100644 (file)
@@ -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;
index 72e3b09618538e218547b8d76a3dfbd4b5e53ce8..723299cc1609fbd4bf3e48ebedde5472cc8ef811 100644 (file)
@@ -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 ||
index 6b47a88227fb65a344588de7a96a3459e5e76c73..aecaafb1854111d7aa7b271f5c670ec2742b9069 100644 (file)
@@ -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();