initialize some variables to fix -Werror=maybe-uninitialized warnings
most aren't actually bugs, but gcc isn't able to determine that the paths it can follow guarantee they are initialized
This commit is contained in:
parent
8e09edd188
commit
92244f78bb
@ -858,8 +858,8 @@ int luatpt_reset_spark(lua_State* l)
|
|||||||
int luatpt_set_property(lua_State* l)
|
int luatpt_set_property(lua_State* l)
|
||||||
{
|
{
|
||||||
const char *name;
|
const char *name;
|
||||||
int r, i, x, y, w, h, t, nx, ny, partsel = 0;
|
int r, i, x, y, w, h, t = 0, nx, ny, partsel = 0;
|
||||||
float f;
|
float f = 0;
|
||||||
int acount = lua_gettop(l);
|
int acount = lua_gettop(l);
|
||||||
const char* prop = luaL_optstring(l, 1, "");
|
const char* prop = luaL_optstring(l, 1, "");
|
||||||
|
|
||||||
@ -877,14 +877,14 @@ int luatpt_set_property(lua_State* l)
|
|||||||
return luaL_error(l, "Unrecognised element '%s'", name);
|
return luaL_error(l, "Unrecognised element '%s'", name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (lua_isnumber(l, 2))
|
if (lua_isnumber(l, 2) || format == CommandInterface::FormatElement)
|
||||||
{
|
{
|
||||||
if (format == CommandInterface::FormatFloat)
|
if (format == CommandInterface::FormatFloat)
|
||||||
f = luaL_optnumber(l, 2, 0);
|
f = luaL_optnumber(l, 2, 0);
|
||||||
else
|
else
|
||||||
t = luaL_optint(l, 2, 0);
|
t = luaL_optint(l, 2, 0);
|
||||||
|
|
||||||
if (!strcmp(prop,"type") && (t<0 || t>=PT_NUM || !luacon_sim->elements[t].Enabled))
|
if (!strcmp(prop, "type") && (t<0 || t>=PT_NUM || !luacon_sim->elements[t].Enabled))
|
||||||
return luaL_error(l, "Unrecognised element number '%d'", t);
|
return luaL_error(l, "Unrecognised element number '%d'", t);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1075,7 +1075,7 @@ void Simulation::ApplyDecorationPoint(int positionX, int positionY, int colR, in
|
|||||||
void Simulation::ApplyDecorationLine(int x1, int y1, int x2, int y2, int colR, int colG, int colB, int colA, int mode, Brush * cBrush)
|
void Simulation::ApplyDecorationLine(int x1, int y1, int x2, int y2, int colR, int colG, int colB, int colA, int mode, Brush * cBrush)
|
||||||
{
|
{
|
||||||
bool reverseXY = abs(y2-y1) > abs(x2-x1);
|
bool reverseXY = abs(y2-y1) > abs(x2-x1);
|
||||||
int x, y, dx, dy, sy, rx, ry;
|
int x, y, dx, dy, sy, rx = 0, ry = 0;
|
||||||
float e = 0.0f, de;
|
float e = 0.0f, de;
|
||||||
|
|
||||||
if(cBrush)
|
if(cBrush)
|
||||||
@ -2404,7 +2404,7 @@ int Simulation::eval_move(int pt, int nx, int ny, unsigned *rr)
|
|||||||
|
|
||||||
int Simulation::try_move(int i, int x, int y, int nx, int ny)
|
int Simulation::try_move(int i, int x, int y, int nx, int ny)
|
||||||
{
|
{
|
||||||
unsigned r, e;
|
unsigned r = 0, e;
|
||||||
|
|
||||||
if (x==nx && y==ny)
|
if (x==nx && y==ny)
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -97,7 +97,7 @@ int Element_TRON::update(UPDATE_FUNC_ARGS)
|
|||||||
}
|
}
|
||||||
if (parts[i].tmp&TRON_HEAD)
|
if (parts[i].tmp&TRON_HEAD)
|
||||||
{
|
{
|
||||||
int firstdircheck = 0,seconddir,seconddircheck = 0,lastdir,lastdircheck = 0;
|
int firstdircheck = 0, seconddir = 0, seconddircheck = 0, lastdir = 0, lastdircheck = 0;
|
||||||
int direction = (parts[i].tmp>>5 & 0x3);
|
int direction = (parts[i].tmp>>5 & 0x3);
|
||||||
int originaldir = direction;
|
int originaldir = direction;
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ Element_VIBR::Element_VIBR()
|
|||||||
|
|
||||||
//#TPT-Directive ElementHeader Element_VIBR static int update(UPDATE_FUNC_ARGS)
|
//#TPT-Directive ElementHeader Element_VIBR static int update(UPDATE_FUNC_ARGS)
|
||||||
int Element_VIBR::update(UPDATE_FUNC_ARGS) {
|
int Element_VIBR::update(UPDATE_FUNC_ARGS) {
|
||||||
int r, rx, ry, rndstore;
|
int r, rx, ry, rndstore = 0;
|
||||||
int trade, transfer;
|
int trade, transfer;
|
||||||
if (!parts[i].life) //if not exploding
|
if (!parts[i].life) //if not exploding
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user