remove unnecessary arguments to FloodINST. Fix random warning.

This commit is contained in:
jacob1 2019-12-23 00:34:21 -05:00
parent 5b4a0bf93b
commit 2576175762
4 changed files with 8 additions and 23 deletions

View File

@ -41,7 +41,7 @@ OptionsView::OptionsView():
Separator(ui::Point position, ui::Point size) : Component(position, size){} Separator(ui::Point position, ui::Point size) : Component(position, size){}
virtual ~Separator(){} virtual ~Separator(){}
void Draw(const ui::Point& screenPos) void Draw(const ui::Point& screenPos) override
{ {
GetGraphics()->drawrect(screenPos.X, screenPos.Y, Size.X, Size.Y, 255, 255, 255, 180); GetGraphics()->drawrect(screenPos.X, screenPos.Y, Size.X, Size.Y, 255, 255, 255, 180);
} }

View File

@ -730,27 +730,12 @@ SimulationSample Simulation::GetSample(int x, int y)
#define PMAP_CMP_CONDUCTIVE(pmap, t) (TYP(pmap)==(t) || (TYP(pmap)==PT_SPRK && parts[ID(pmap)].ctype==(t))) #define PMAP_CMP_CONDUCTIVE(pmap, t) (TYP(pmap)==(t) || (TYP(pmap)==PT_SPRK && parts[ID(pmap)].ctype==(t)))
int Simulation::FloodINST(int x, int y, int fullc, int cm) int Simulation::FloodINST(int x, int y)
{ {
int c = TYP(fullc); const int cm = PT_INST;
int x1, x2; int x1, x2;
int created_something = 0; int created_something = 0;
if (c>=PT_NUM)
return 0;
if (cm==-1)
{
if (c==0)
{
cm = TYP(pmap[y][x]);
if (!cm)
return 0;
}
else
cm = 0;
}
if (TYP(pmap[y][x]) != cm || parts[ID(pmap[y][x])].life != 0) if (TYP(pmap[y][x]) != cm || parts[ID(pmap[y][x])].life != 0)
return 1; return 1;
@ -786,7 +771,7 @@ int Simulation::FloodINST(int x, int y, int fullc, int cm)
// fill span // fill span
for (x=x1; x<=x2; x++) for (x=x1; x<=x2; x++)
{ {
if (create_part(-1, x, y, c, ID(fullc))>=0) if (create_part(-1, x, y, PT_SPRK)>=0)
created_something = 1; created_something = 1;
} }
@ -3141,7 +3126,7 @@ int Simulation::create_part(int p, int x, int y, int t, int v)
return -1; return -1;
if (p == -2 && type == PT_INST) if (p == -2 && type == PT_INST)
{ {
FloodINST(x, y, PT_SPRK, PT_INST); FloodINST(x, y);
return index; return index;
} }
parts[index].type = PT_SPRK; parts[index].type = PT_SPRK;

View File

@ -146,7 +146,7 @@ public:
bool FloodFillPmapCheck(int x, int y, int type); bool FloodFillPmapCheck(int x, int y, int type);
int flood_prop(int x, int y, size_t propoffset, PropertyValue propvalue, StructProperty::PropertyType proptype); int flood_prop(int x, int y, size_t propoffset, PropertyValue propvalue, StructProperty::PropertyType proptype);
bool flood_water(int x, int y, int i); bool flood_water(int x, int y, int i);
int FloodINST(int x, int y, int fullc, int cm); int FloodINST(int x, int y);
void detach(int i); void detach(int i);
bool part_change_type(int i, int x, int y, int t); bool part_change_type(int i, int x, int y, int t);
//int InCurrentBrush(int i, int j, int rx, int ry); //int InCurrentBrush(int i, int j, int rx, int ry);

View File

@ -336,7 +336,7 @@ int Element_SPRK::update(UPDATE_FUNC_ARGS)
else if (receiver==PT_INST) { else if (receiver==PT_INST) {
if (parts[ID(r)].life==0 && parts[i].life<4) if (parts[ID(r)].life==0 && parts[i].life<4)
{ {
sim->FloodINST(x+rx,y+ry,PT_SPRK,PT_INST);//spark the wire sim->FloodINST(x+rx,y+ry);//spark the wire
} }
} }
else if (parts[ID(r)].life==0 && parts[i].life<4) { else if (parts[ID(r)].life==0 && parts[i].life<4) {