]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
more uninitialized local use fixes
authorRudolf Polzer <divverent@xonotic.org>
Thu, 26 Apr 2012 11:37:39 +0000 (13:37 +0200)
committerRudolf Polzer <divverent@xonotic.org>
Thu, 26 Apr 2012 11:37:39 +0000 (13:37 +0200)
14 files changed:
qcsrc/server/cl_player.qc
qcsrc/server/command/vote.qc
qcsrc/server/g_damage.qc
qcsrc/server/g_world.qc
qcsrc/server/miscfunctions.qc
qcsrc/server/mutators/gamemode_nexball.qc
qcsrc/server/mutators/mutator_dodging.qc
qcsrc/server/mutators/sandbox.qc
qcsrc/server/runematch.qc
qcsrc/server/scores.qc
qcsrc/server/t_items.qc
qcsrc/server/teamplay.qc
qcsrc/server/w_seeker.qc
qcsrc/server/w_tuba.qc

index db2707fb9e828ae10ce2d437c6dc07fe92f8feea..05ce2f9e43da8ecc49c901940716db6b70ab4a8e 100644 (file)
@@ -610,6 +610,8 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, float deatht
                        awep = DEATH_WEAPONOF(deathtype);
                valid_damage_for_weaponstats = 1;
        }
+       else
+               awep = 0;
 
        if(valid_damage_for_weaponstats)
        {
@@ -822,7 +824,10 @@ float Say(entity source, float teamsay, entity privatesay, string msgin, float f
        else if(teamplay)
                colorstr = Team_ColorCode(source.team);
        else
+       {
+               colorstr = "";
                teamsay = FALSE;
+       }
 
        if(intermission_running)
                teamsay = FALSE;
@@ -881,6 +886,7 @@ float Say(entity source, float teamsay, entity privatesay, string msgin, float f
 
        // FLOOD CONTROL
        flood = 0;
+       flood_field = floodcontrol_chat;
        if(floodcontrol)
        {
                float flood_spl;
index 1e43564001d58957a7fafb6c278a8672e7af067d..c55eee9acc9187327f1b921c6fece0dfa3b5113a 100644 (file)
@@ -194,9 +194,9 @@ void VoteCount(float first_count)
                                || ((autocvar_sv_vote_nospectators == 1) && (inWarmupStage || gameover))
                                || (autocvar_sv_vote_nospectators == 0));
                                
-       float vote_player_count, is_player, notvoters;
-       float vote_real_player_count, vote_real_accept_count;
-       float vote_real_reject_count, vote_real_abstain_count;
+       float vote_player_count = 0, is_player, notvoters = 0;
+       float vote_real_player_count = 0, vote_real_accept_count = 0;
+       float vote_real_reject_count = 0, vote_real_abstain_count = 0;
        float vote_needed_of_voted, final_needed_votes;
        float vote_factor_overall, vote_factor_of_voted;
        
@@ -404,7 +404,7 @@ void ReadyCount()
 {
        entity tmp_player;
        float ready_needed_factor, ready_needed_count;
-       float t_ready, t_players;
+       float t_ready = 0, t_players = 0;
 
        FOR_EACH_REALPLAYER(tmp_player)
        {
@@ -635,7 +635,7 @@ void VoteCommand_call(float request, entity caller, float argc, string vote_comm
                                || ((autocvar_sv_vote_nospectators == 1) && inWarmupStage) 
                                || (autocvar_sv_vote_nospectators == 0));
                                
-                       float tmp_playercount;
+                       float tmp_playercount = 0;
                        entity tmp_player;
                        
                        vote_command = VoteCommand_extractcommand(vote_command, 2, argc);
index dcf1ad86993f6f208c594ffe50eb7f398a28934d..9c686a0115d7e33eb76dda469d4b8c468e6227cf 100644 (file)
@@ -231,10 +231,10 @@ void GiveFrags (entity attacker, entity targ, float f, float deathtype)
 
 string Obituary_ExtraFragInfo(entity player) // Extra fragmessage information
 {
-       string health_output;
-       string ping_output;
-       string handicap_output;
-       string output;
+       string health_output = string_null;
+       string ping_output = string_null;
+       string handicap_output = string_null;
+       string output = string_null;
 
        if(autocvar_sv_fraginfo && ((autocvar_sv_fraginfo == 2) || inWarmupStage))
        {
@@ -352,6 +352,8 @@ void Obituary (entity attacker, entity inflictor, entity targ, float deathtype)
                {
                        if (deathtype == DEATH_TEAMCHANGE || deathtype == DEATH_AUTOTEAMCHANGE)
                                msg = ColoredTeamName(targ.team); // TODO: check if needed?
+                       else
+                               msg = "";
             if(!g_cts) // no "killed your own dumb self" message in CTS
                 Send_CSQC_KillCenterprint(targ, msg, "", deathtype, MSG_SUICIDE);
 
@@ -363,6 +365,8 @@ void Obituary (entity attacker, entity inflictor, entity targ, float deathtype)
 
                        if (targ.killcount > 2)
                                msg = ftos(targ.killcount);
+                       else
+                               msg = "";
                        if(teamplay && deathtype == DEATH_MIRRORDAMAGE)
                        {
                                if(attacker.team == COLOR_TEAM1)
@@ -386,9 +390,10 @@ void Obituary (entity attacker, entity inflictor, entity targ, float deathtype)
 
                                Send_CSQC_KillCenterprint(attacker, s, "", type, MSG_KILL);
 
-                               if (targ.killcount > 2) {
+                               if (targ.killcount > 2)
                                        msg = ftos(targ.killcount);
-                               }
+                               else
+                                       msg = "";
 
                                if (attacker.killcount > 2) {
                                        msg = ftos(attacker.killcount);
index 0f28806a0b2a9595b2d233060930072689d076a5..e126e4cb3894a45b9bff9362397e341d3a2f1f9d 100644 (file)
@@ -2365,6 +2365,7 @@ void MapVote_AddVotable(string nextMap, float isSuggestion)
        mapvote_maps[mapvote_count] = strzone(nextMap);
        mapvote_maps_suggested[mapvote_count] = isSuggestion;
 
+       pakfile = string_null;
        for(i = 0; i < mapvote_screenshot_dirs_count; ++i)
        {
                mapfile = strcat(mapvote_screenshot_dirs[i], "/", mapvote_maps[i]);
index 996d217ed9fd25ae4d9714e3606bb0e963a1d659..b913e0645ac2d28d68701489ccf3390f03853293 100644 (file)
@@ -1766,6 +1766,7 @@ void InitializeEntity(entity e, void(void) func, float order)
     e.initialize_entity_order = order;
 
     cur = initialize_entity_first;
+    prev = world;
     for (;;)
     {
         if (!cur || cur.initialize_entity_order > order)
@@ -2178,6 +2179,8 @@ float MoveToRandomMapLocation(entity e, float goodcontents, float badcontents, f
     org = world.mins;
     delta = world.maxs - world.mins;
 
+    start = org;
+
     for (i = 0; i < attempts; ++i)
     {
         start_x = org_x + random() * delta_x;
index 85d0efefbc400ddfefdc580e1304332af5a52c96..fe60241864171fd786fd935f6a1ffdf57f0f9072 100644 (file)
@@ -323,6 +323,8 @@ void GoalTouch(void)
 
        if(nb_teams == 2)
                otherteam = OtherTeam(ball.team);
+       else
+               otherteam = 0;
 
        if((isclient = ball.pusher.flags & FL_CLIENT))
                pname = ball.pusher.netname;
index 3b193c163c9d61ea0cce471f7df999bdd0139323..2d2334c563e2a05480e8f27e0fb898f645fe0f61 100644 (file)
@@ -255,7 +255,7 @@ MUTATOR_HOOKFUNCTION(dodging_GetPressedKeys) {
                self.dodging_direction_y = tap_direction_y;
 
                // normalize the dodging_direction vector.. (unlike UT99) XD
-               length = length + self.dodging_direction_x * self.dodging_direction_x;
+               length =          self.dodging_direction_x * self.dodging_direction_x;
                length = length + self.dodging_direction_y * self.dodging_direction_y;
                length = sqrt(length);
 
index 31a1a4e8546d7256018798902e5da0d174bbdec8..ce66b233f33289b2439349216bf4e3e5bca2af6d 100644 (file)
@@ -744,13 +744,16 @@ MUTATOR_HOOKFUNCTION(sandbox_PlayerCommand)
                                                        print_to(self, strcat("^2SANDBOX - INFO: ^7Object is owned by \"^7", e.netname, "^7\", created \"^3", e.message, "^7\", last edited \"^3", e.message2, "^7\""));
                                                        return TRUE;
                                                case "mesh":
+                                                       s = "";
                                                        FOR_EACH_TAG(e)
                                                                s = strcat(s, "^7\"^5", gettaginfo_name, "^7\", ");
                                                        print_to(self, strcat("^2SANDBOX - INFO: ^7Object mesh is \"^3", e.model, "^7\" at animation frame ^3", ftos(e.frame), " ^7containing the following tags: ", s));
                                                        return TRUE;
                                                case "attachments":
                                                        // this should show the same info as 'mesh' but for attachments
+                                                       s = "";
                                                        entity head;
+                                                       i = 0;
                                                        for(head = world; (head = find(head, classname, "object")); )
                                                        {
                                                                if(head.owner == e)
index 8f5e005a425811016052ba7b63882c9cab3f83bb..c3a9a7390fc45fa4bd2d32bfdeb939221ce55f47 100644 (file)
@@ -133,7 +133,8 @@ string RuneName(float r)
 
 vector RuneColormod(float r)
 {
-       vector _color;
+       vector _color = '255 0 255';
+
        if(r == RUNE_STRENGTH)
                _color = '255 0 0';
        if(r == RUNE_DEFENSE)
@@ -178,6 +179,7 @@ void RuneCarriedThink()
        // count runes my owner holds
        rcount = 0;
        rune = find(world, classname, "rune");
+       rnum = -1;
        while(rune)
        {
                if(rune.owner == self.owner)
@@ -588,6 +590,7 @@ float RunematchHandleFrags(entity attacker, entity targ, float f)
        if(!arunes && !trunes)
                return f - 1 + autocvar_g_runematch_frags_norune; // don't give points to players when no runes are involved.
 
+       newfrags = 0;
        if(arunes)
        {       // got a kill while holding runes
                newfrags = newfrags + autocvar_g_runematch_frags_killedby_runeholder;//5;
index 10f5d12fcdd76b47fb0efeb139f42ff7baf60875..102dd6a33ef326af860bdd8d66c0ba537f5f8a89 100644 (file)
@@ -127,7 +127,7 @@ float TeamScore_Compare(entity t1, entity t2)
 {
        if(!t1 || !t2) return (!t2) - !t1;
 
-       vector result;
+       vector result = '0 0 0';
        float i;
        for(i = 0; i < MAX_TEAMSCORE; ++i)
        {
@@ -356,7 +356,7 @@ float PlayerScore_Compare(entity t1, entity t2)
 {
        if(!t1 || !t2) return (!t2) - !t1;
 
-       vector result;
+       vector result = '0 0 0';
        float i;
        for(i = 0; i < MAX_SCORE; ++i)
        {
index 76a7838f2f20f09066194f07dece515c1ea06275..40f52695dc1f5e5c3b8e05274b9ad1b1372e7090 100644 (file)
@@ -209,7 +209,7 @@ void Item_RespawnCountdown (void)
                if(self.count == 1)
                {
                        string name;
-                       vector rgb;
+                       vector rgb = '1 0 1';
                        name = string_null;
                        if(g_minstagib)
                        {
index f37d3071fe69852a6bb00ba1b6e1677f97a51982..db01a8f5887d76f1438bc357c5dddd05570ba389 100644 (file)
@@ -905,7 +905,7 @@ void SV_ChangeTeam(float _color)
                        scount = c2;
                else if(steam == 3)//scolor == COLOR_TEAM3 - 1)
                        scount = c3;
-               else if(steam == 4)//scolor == COLOR_TEAM4 - 1)
+               else // if(steam == 4)//scolor == COLOR_TEAM4 - 1)
                        scount = c4;
 
                if(scount) // started at a valid, nonempty team
@@ -980,7 +980,7 @@ void ShufflePlayerOutOfTeam (float source_team)
                steam = COLOR_TEAM2;
        else if(source_team == 3)
                steam = COLOR_TEAM3;
-       else if(source_team == 4)
+       else // if(source_team == 4)
                steam = COLOR_TEAM4;
 
        lowest_bot = world;
index be58650dc0aa4fdba7f05dfd531af0417ab09ec6..f5a3e3b1678fe5e4092700003e838c0c7856e1e2 100644 (file)
@@ -78,6 +78,8 @@ void Seeker_Missile_Think()
                newdir = normalize(olddir + desireddir * turnrate); // take the average of the 2 directions; not the best method but simple & easy
                self.velocity = newdir * spd; // make me fly in the new direction at my flight speed
        }
+       else
+               dist = 0;
 
        // Proxy
        if (autocvar_g_balance_seeker_missile_proxy)
@@ -308,6 +310,7 @@ void Seeker_Attack()
 {
        entity tracker, closest_target;
        
+       closest_target = world;
        for(tracker = world; (tracker = find(tracker, classname, "tag_tracker")); ) if (tracker.realowner == self)
        {
                if (closest_target)
index a02061e8b80f741a27e419a786940dc157f9b1c3..f19a50208293073f1507fc4bf2beec258456fa13 100644 (file)
@@ -160,6 +160,7 @@ float Tuba_GetNote(entity pl, float hittype)
                case 2: note = -5; break; // G
                case 3: note = -4; break; // G#
                case 4: note = +5; break; // e#
+               default:
                case 5: note =  0; break; // c
                case 6: note = +2; break; // d
                case 7: note = +3; break; // eb