more uninitialised values
authornemo
Fri, 23 Nov 2018 16:20:55 -0500
changeset 14284 a3531b520efb
parent 14283 9548edd9ebcf
child 14285 a7810074c20d
more uninitialised values
hedgewars/uCursor.pas
hedgewars/uGearsHandlersMess.pas
hedgewars/uLand.pas
hedgewars/uScript.pas
--- a/hedgewars/uCursor.pas	Fri Nov 23 16:03:10 2018 -0500
+++ b/hedgewars/uCursor.pas	Fri Nov 23 16:20:55 2018 -0500
@@ -33,6 +33,8 @@
 procedure updatePosition;
 var x, y: LongInt;
 begin
+	x:= cScreenWidth div 2;
+	y:= cScreenHeight div 2;
     if GameType <> gmtRecord then
         SDL_GetMouseState(@x, @y);
 
--- a/hedgewars/uGearsHandlersMess.pas	Fri Nov 23 16:03:10 2018 -0500
+++ b/hedgewars/uGearsHandlersMess.pas	Fri Nov 23 16:20:55 2018 -0500
@@ -1443,6 +1443,7 @@
 procedure CreateBubblesForBullet(Gear: PGear);
 var i, iInit: LongWord;
 begin
+iInit:= 0;
 if ((Gear^.State and gstDrowning) <> 0) and (Gear^.Health > 0) then
     begin
     // draw bubbles
@@ -2067,6 +2068,7 @@
     isUnderwater: Boolean;
     sparkle: PVisualGear;
 begin
+	targ:= nil;
 	if (Gear^.State and gstFrozen) <> 0 then
 		begin
 		if Gear^.Damage > 0 then
@@ -6630,6 +6632,7 @@
     tX, tY: hwFloat;
     vg: PVisualGear;
 begin
+	targ:= nil;
     doStepFallingGear(Gear);
 	if (Gear^.State and gstFrozen) <> 0 then
 		begin
--- a/hedgewars/uLand.pas	Fri Nov 23 16:03:10 2018 -0500
+++ b/hedgewars/uLand.pas	Fri Nov 23 16:20:55 2018 -0500
@@ -300,10 +300,11 @@
 function SelectTemplate: LongInt;
 var l: LongInt;
 begin
+	SelectTemplate:= 0;
     if (cReducedQuality and rqLowRes) <> 0 then
         SelectTemplate:= SmallTemplates[getrandom(Succ(High(SmallTemplates)))]
     else
-    begin
+		begin
         if cTemplateFilter = 0 then
             begin
             l:= getRandom(GroupedTemplatesCount);
@@ -311,22 +312,23 @@
                 inc(cTemplateFilter);
                 dec(l, TemplateCounts[cTemplateFilter]);
             until l < 0;
-            end else getRandom(1);
+            end
+			else getRandom(1);
 
-        case cTemplateFilter of
-        0: OutError('Error selecting TemplateFilter. Ask unC0Rr about what you did wrong', true);
-        1: SelectTemplate:= SmallTemplates[getrandom(TemplateCounts[cTemplateFilter])];
-        2: SelectTemplate:= MediumTemplates[getrandom(TemplateCounts[cTemplateFilter])];
-        3: SelectTemplate:= LargeTemplates[getrandom(TemplateCounts[cTemplateFilter])];
-        4: SelectTemplate:= CavernTemplates[getrandom(TemplateCounts[cTemplateFilter])];
-        5: SelectTemplate:= WackyTemplates[getrandom(TemplateCounts[cTemplateFilter])];
-// For lua only!
-        6: begin
-           SelectTemplate:= min(LuaTemplateNumber,High(EdgeTemplates));
-           GetRandom(2) // burn 1
-           end
-        end
-    end;
+			case cTemplateFilter of
+			0: OutError('Error selecting TemplateFilter. Ask unC0Rr about what you did wrong', true);
+			1: SelectTemplate:= SmallTemplates[getrandom(TemplateCounts[cTemplateFilter])];
+			2: SelectTemplate:= MediumTemplates[getrandom(TemplateCounts[cTemplateFilter])];
+			3: SelectTemplate:= LargeTemplates[getrandom(TemplateCounts[cTemplateFilter])];
+			4: SelectTemplate:= CavernTemplates[getrandom(TemplateCounts[cTemplateFilter])];
+			5: SelectTemplate:= WackyTemplates[getrandom(TemplateCounts[cTemplateFilter])];
+	// For lua only!
+			6: begin
+			   SelectTemplate:= min(LuaTemplateNumber,High(EdgeTemplates));
+			   GetRandom(2) // burn 1
+			   end
+			end
+		end;
 
     WriteLnToConsole('Selected template #'+inttostr(SelectTemplate)+' using filter #'+inttostr(cTemplateFilter));
 end;
--- a/hedgewars/uScript.pas	Fri Nov 23 16:03:10 2018 -0500
+++ b/hedgewars/uScript.pas	Fri Nov 23 16:20:55 2018 -0500
@@ -2677,6 +2677,7 @@
     call = 'GetAmmo';
     params = 'ammoType';
 begin
+	lc_getammo:= 0
     if CheckLuaParamCount(L, 1, call, params) then
         begin
         at:= LuaToAmmoTypeOrd(L, 1, call, params);
@@ -2700,8 +2701,6 @@
             lua_pushnumber(L, Ammoz[TAmmoType(at)].NumberInCase);
             lc_getammo:= 4
             end
-        else
-            lc_getammo:= 0
         end;
 end;