Fix some uninitialised variables

This commit is contained in:
Simon Robertshaw
2012-01-20 23:42:17 +00:00
parent 6a331fdaf8
commit fa201a7aeb
6 changed files with 15 additions and 6 deletions

View File

@@ -54,7 +54,7 @@ void GameController::DrawPoints(queue<ui::Point*> & pointQueue)
void GameController::Tick() void GameController::Tick()
{ {
gameModel->GetSimulation()->update_particles(); //gameModel->GetSimulation()->update_particles();
} }
void GameController::SetPaused(bool pauseState) void GameController::SetPaused(bool pauseState)

View File

@@ -5,7 +5,9 @@
#include "Renderer.h" #include "Renderer.h"
GameModel::GameModel(): GameModel::GameModel():
activeElement(1) activeElement(1),
sim(NULL),
ren(NULL)
{ {
sim = new Simulation(); sim = new Simulation();
ren = new Renderer(ui::Engine::Ref().g, sim); ren = new Renderer(ui::Engine::Ref().g, sim);

View File

@@ -21,6 +21,7 @@ Button::Button(Window* parent_state, std::string buttonText):
isMouseInside(false), isMouseInside(false),
isButtonDown(false), isButtonDown(false),
isTogglable(false), isTogglable(false),
toggle(false),
actionCallback(NULL), actionCallback(NULL),
textPosition(ui::Point(0, 0)), textPosition(ui::Point(0, 0)),
textVAlign(AlignMiddle), textVAlign(AlignMiddle),
@@ -35,6 +36,7 @@ Button::Button(Point position, Point size, std::string buttonText):
isMouseInside(false), isMouseInside(false),
isButtonDown(false), isButtonDown(false),
isTogglable(false), isTogglable(false),
toggle(false),
actionCallback(NULL), actionCallback(NULL),
textPosition(ui::Point(0, 0)), textPosition(ui::Point(0, 0)),
textVAlign(AlignMiddle), textVAlign(AlignMiddle),
@@ -49,6 +51,7 @@ Button::Button(std::string buttonText):
isMouseInside(false), isMouseInside(false),
isButtonDown(false), isButtonDown(false),
isTogglable(false), isTogglable(false),
toggle(false),
actionCallback(NULL), actionCallback(NULL),
textPosition(ui::Point(0, 0)), textPosition(ui::Point(0, 0)),
textVAlign(AlignMiddle), textVAlign(AlignMiddle),

View File

@@ -7,7 +7,8 @@ using namespace ui;
Window::Window(Point _position, Point _size): Window::Window(Point _position, Point _size):
Position(_position), Position(_position),
Size(_size), Size(_size),
focusedComponent_(NULL) focusedComponent_(NULL),
AllowExclusiveDrawing(true)
{ {
} }

View File

@@ -117,8 +117,8 @@ void Air::update_airh(void)
void Air::update_air(void) void Air::update_air(void)
{ {
int x, y, i, j; int x = 0, y = 0, i = 0, j = 0;
float dp, dx, dy, f, tx, ty; float dp = 0.0f, dx = 0.0f, dy = 0.0f, f = 0.0f, tx = 0.0f, ty = 0.0f;
for (y=0; y<YRES/CELL; y++) for (y=0; y<YRES/CELL; y++)
for (x=0; x<XRES/CELL; x++) for (x=0; x<XRES/CELL; x++)
@@ -294,7 +294,8 @@ void Air::update_air(void)
memcpy(pv, opv, sizeof(pv)); memcpy(pv, opv, sizeof(pv));
} }
} }
Air::Air() Air::Air():
airMode(0)
{ {
//Simulation should do this. //Simulation should do this.
make_kernel(); make_kernel();

View File

@@ -3222,6 +3222,8 @@ Simulation::Simulation()
pv = air->pv; pv = air->pv;
hv = air->hv; hv = air->hv;
signs = (sign*)calloc(MAXSIGNS, sizeof(sign));
//ptypes[0] = {"", PIXPACK(0x000000), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 1, 100, 0, R_TEMP+0.0f +273.15f, 251, "Erases particles.", ST_NONE, 0, NULL, NULL}; //ptypes[0] = {"", PIXPACK(0x000000), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 1, 100, 0, R_TEMP+0.0f +273.15f, 251, "Erases particles.", ST_NONE, 0, NULL, NULL};
//ptypes[1] = {"DUST", PIXPACK(0xFFE0A0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 10, 0, 0, 30, 1, 1, 85, 0, R_TEMP+0.0f +273.15f, 70, "Very light dust. Flammable.", ST_SOLID, TYPE_PART|PROP_LIFE_DEC|PROP_LIFE_KILL_DEC, NULL, &graphics_DUST}; //ptypes[1] = {"DUST", PIXPACK(0xFFE0A0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 10, 0, 0, 30, 1, 1, 85, 0, R_TEMP+0.0f +273.15f, 70, "Very light dust. Flammable.", ST_SOLID, TYPE_PART|PROP_LIFE_DEC|PROP_LIFE_KILL_DEC, NULL, &graphics_DUST};
//ptypes[2] = {"WATR", PIXPACK(0x2030D0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, 1, 30, 0, R_TEMP-2.0f +273.15f, 29, "Liquid. Conducts electricity. Freezes. Extinguishes fires.", ST_LIQUID, TYPE_LIQUID|PROP_CONDUCTS|PROP_LIFE_DEC|PROP_NEUTPENETRATE, &update_WATR, NULL}; //ptypes[2] = {"WATR", PIXPACK(0x2030D0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, 1, 30, 0, R_TEMP-2.0f +273.15f, 29, "Liquid. Conducts electricity. Freezes. Extinguishes fires.", ST_LIQUID, TYPE_LIQUID|PROP_CONDUCTS|PROP_LIFE_DEC|PROP_NEUTPENETRATE, &update_WATR, NULL};