From: Rudolf Polzer Date: Thu, 26 Apr 2012 11:37:39 +0000 (+0200) Subject: more uninitialized local use fixes X-Git-Tag: xonotic-v0.7.0~326 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=e3695bc6eb3b32502d703dd520ec476c09bb78f4;p=xonotic%2Fxonotic-data.pk3dir.git more uninitialized local use fixes --- diff --git a/qcsrc/server/cl_player.qc b/qcsrc/server/cl_player.qc index db2707fb9..05ce2f9e4 100644 --- a/qcsrc/server/cl_player.qc +++ b/qcsrc/server/cl_player.qc @@ -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; diff --git a/qcsrc/server/command/vote.qc b/qcsrc/server/command/vote.qc index 1e4356400..c55eee9ac 100644 --- a/qcsrc/server/command/vote.qc +++ b/qcsrc/server/command/vote.qc @@ -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); diff --git a/qcsrc/server/g_damage.qc b/qcsrc/server/g_damage.qc index dcf1ad869..9c686a011 100644 --- a/qcsrc/server/g_damage.qc +++ b/qcsrc/server/g_damage.qc @@ -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); diff --git a/qcsrc/server/g_world.qc b/qcsrc/server/g_world.qc index 0f28806a0..e126e4cb3 100644 --- a/qcsrc/server/g_world.qc +++ b/qcsrc/server/g_world.qc @@ -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]); diff --git a/qcsrc/server/miscfunctions.qc b/qcsrc/server/miscfunctions.qc index 996d217ed..b913e0645 100644 --- a/qcsrc/server/miscfunctions.qc +++ b/qcsrc/server/miscfunctions.qc @@ -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; diff --git a/qcsrc/server/mutators/gamemode_nexball.qc b/qcsrc/server/mutators/gamemode_nexball.qc index 85d0efefb..fe6024186 100644 --- a/qcsrc/server/mutators/gamemode_nexball.qc +++ b/qcsrc/server/mutators/gamemode_nexball.qc @@ -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; diff --git a/qcsrc/server/mutators/mutator_dodging.qc b/qcsrc/server/mutators/mutator_dodging.qc index 3b193c163..2d2334c56 100644 --- a/qcsrc/server/mutators/mutator_dodging.qc +++ b/qcsrc/server/mutators/mutator_dodging.qc @@ -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); diff --git a/qcsrc/server/mutators/sandbox.qc b/qcsrc/server/mutators/sandbox.qc index 31a1a4e85..ce66b233f 100644 --- a/qcsrc/server/mutators/sandbox.qc +++ b/qcsrc/server/mutators/sandbox.qc @@ -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) diff --git a/qcsrc/server/runematch.qc b/qcsrc/server/runematch.qc index 8f5e005a4..c3a9a7390 100644 --- a/qcsrc/server/runematch.qc +++ b/qcsrc/server/runematch.qc @@ -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; diff --git a/qcsrc/server/scores.qc b/qcsrc/server/scores.qc index 10f5d12fc..102dd6a33 100644 --- a/qcsrc/server/scores.qc +++ b/qcsrc/server/scores.qc @@ -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) { diff --git a/qcsrc/server/t_items.qc b/qcsrc/server/t_items.qc index 76a7838f2..40f52695d 100644 --- a/qcsrc/server/t_items.qc +++ b/qcsrc/server/t_items.qc @@ -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) { diff --git a/qcsrc/server/teamplay.qc b/qcsrc/server/teamplay.qc index f37d3071f..db01a8f58 100644 --- a/qcsrc/server/teamplay.qc +++ b/qcsrc/server/teamplay.qc @@ -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; diff --git a/qcsrc/server/w_seeker.qc b/qcsrc/server/w_seeker.qc index be58650dc..f5a3e3b16 100644 --- a/qcsrc/server/w_seeker.qc +++ b/qcsrc/server/w_seeker.qc @@ -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) diff --git a/qcsrc/server/w_tuba.qc b/qcsrc/server/w_tuba.qc index a02061e8b..f19a50208 100644 --- a/qcsrc/server/w_tuba.qc +++ b/qcsrc/server/w_tuba.qc @@ -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