changeset 57:334cf83fd576

Initialize some uninitialized variables.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 26 Sep 2011 07:00:05 +0300
parents 2898afb3c9a0
children d554e443475d
files src/infobar.cc src/objinfo.cc
diffstat 2 files changed, 15 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/infobar.cc	Mon Sep 26 06:05:23 2011 +0300
+++ b/src/infobar.cc	Mon Sep 26 07:00:05 2011 +0300
@@ -69,6 +69,9 @@
     grid_step = -1;
     grid_step_disp = -1;
     flags = 0;
+
+    pointer_x = pointer_y = 0;
+    pointer_x_disp = pointer_y_disp = 0;
 }
 
 
@@ -104,7 +107,7 @@
 
     set_colour(WINFG);
 
-// The name of the file being edited.
+    // The name of the file being edited.
     {
         int chars;
         if (!file_name)
@@ -128,7 +131,7 @@
         file_name_disp = file_name;
     }
 
-// The name of the level being edited.
+    // The name of the level being edited.
     {
         int chars;
         if (!level_name)
@@ -148,7 +151,7 @@
         level_name_disp = level_name;
     }
 
-// Type of objects being edited.
+    // Type of objects being edited.
     if (redraw_from_scratch || obj_type_disp != obj_type)
     {
         DrawScreenText(x, text_y0, "%s", GetEditModeName(obj_type));
@@ -156,7 +159,7 @@
     }
     x += 10 * FONTW;
 
-// Any changes made ?
+    // Any changes made ?
     if (redraw_from_scratch || changes_disp != changes)
     {
         DrawScreenText(x, text_y0, changes > 1 ? "**" : (changes ? "*" : ""));
@@ -164,7 +167,7 @@
     }
     x += 4 * FONTW;
 
-// scale
+    // scale
     if (redraw_from_scratch || scale_disp != scale)
     {
 #ifdef OLD
@@ -180,7 +183,7 @@
     }
     x += 13 * FONTW;
 
-// grid_step
+    // grid_step
     if (redraw_from_scratch || grid_step_disp != grid_step)
     {
         DrawScreenText(x, text_y0, "Grid: %d", grid_step);
@@ -188,7 +191,7 @@
     }
     x += 11 * FONTW;
 
-// grid_step_locked
+    // grid_step_locked
     if (redraw_from_scratch || grid_step_locked_disp != grid_step_locked)
     {
         DrawScreenText(x, text_y0, "%s", grid_step_locked ? "Lock" : "Auto");
@@ -196,7 +199,7 @@
     }
     x += 6 * FONTW;
 
-// grid_snap
+    // grid_snap
     if (redraw_from_scratch || grid_snap_disp != grid_snap)
     {
         DrawScreenText(x, text_y0, "%s", grid_snap ? "Snap" : "Free");
@@ -204,7 +207,7 @@
     }
     x += 6 * FONTW;
 
-// The current pointer coordinates.
+    // The current pointer coordinates.
     if (((flags & pointer_disp_set) && !(flags & pointer_set))
         || pointer_x_disp != pointer_x || pointer_y_disp != pointer_y)
     {
@@ -212,6 +215,7 @@
         DrawScreenBox(x, text_y0, x + 14 * FONTW - 1, text_y1);
         flags &= ~pointer_disp_set;
     }
+
     if (((flags & pointer_set) && !(flags & pointer_disp_set))
         || pointer_x_disp != pointer_x || pointer_y_disp != pointer_y)
     {
--- a/src/objinfo.cc	Mon Sep 26 06:05:23 2011 +0300
+++ b/src/objinfo.cc	Mon Sep 26 07:00:05 2011 +0300
@@ -90,6 +90,8 @@
     obj_no_disp = OBJ_NO_NONE;
     prev_sector = OBJ_NO_NONE;
     out_y1 = 0;
+
+    obj_type = obj_type_disp = -1;
 }
 
 static void draw_sidedef_info(int sidedef, int sd, int sd2, int obj_no, int x0, int y0, int ix0, int iy0, int s1, int s2, int width, int height)