projects
/
rocksndiamonds.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
787be88
)
extended level flood fill function for variable array sizes
author
Holger Schemel
<info@artsoft.org>
Tue, 7 Mar 2017 22:46:19 +0000
(23:46 +0100)
committer
Holger Schemel
<info@artsoft.org>
Fri, 23 Mar 2018 22:21:10 +0000
(23:21 +0100)
src/tools.c
patch
|
blob
|
history
src/tools.h
patch
|
blob
|
history
diff --git
a/src/tools.c
b/src/tools.c
index bfaad2acdd577f844c51428332857eed3b0a9b30..4f0206e36d8b86a21447332f2829f59295bdf67e 100644
(file)
--- a/
src/tools.c
+++ b/
src/tools.c
@@
-1377,9
+1377,10
@@
void SetBorderElement()
}
}
}
}
-void FloodFillLevel(int from_x, int from_y, int fill_element,
- short field[MAX_LEV_FIELDX][MAX_LEV_FIELDY],
- int max_fieldx, int max_fieldy)
+void FloodFillLevelExt(int from_x, int from_y, int fill_element,
+ int max_array_fieldx, int max_array_fieldy,
+ short field[max_array_fieldx][max_array_fieldy],
+ int max_fieldx, int max_fieldy)
{
int i,x,y;
int old_element;
{
int i,x,y;
int old_element;
@@
-1404,12
+1405,22
@@
void FloodFillLevel(int from_x, int from_y, int fill_element,
y = from_y + check[i][1];
if (IN_FIELD(x, y, max_fieldx, max_fieldy) && field[x][y] == old_element)
y = from_y + check[i][1];
if (IN_FIELD(x, y, max_fieldx, max_fieldy) && field[x][y] == old_element)
- FloodFillLevel(x, y, fill_element, field, max_fieldx, max_fieldy);
+ FloodFillLevelExt(x, y, fill_element, max_array_fieldx, max_array_fieldy,
+ field, max_fieldx, max_fieldy);
}
safety--;
}
}
safety--;
}
+void FloodFillLevel(int from_x, int from_y, int fill_element,
+ short field[MAX_LEV_FIELDX][MAX_LEV_FIELDY],
+ int max_fieldx, int max_fieldy)
+{
+ FloodFillLevelExt(from_x, from_y, fill_element,
+ MAX_LEV_FIELDX, MAX_LEV_FIELDY, field,
+ max_fieldx, max_fieldy);
+}
+
void SetRandomAnimationValue(int x, int y)
{
gfx.anim_random_frame = GfxRandom[x][y];
void SetRandomAnimationValue(int x, int y)
{
gfx.anim_random_frame = GfxRandom[x][y];
diff --git
a/src/tools.h
b/src/tools.h
index 4f26f72ef8f8e8aa22b4656a531d267539022d03..b1f674342c391647462dabec2ec356ea7e5f2c44 100644
(file)
--- a/
src/tools.h
+++ b/
src/tools.h
@@
-119,8
+119,8
@@
void RedrawGlobalBorder();
void MarkTileDirty(int, int);
void SetBorderElement();
void MarkTileDirty(int, int);
void SetBorderElement();
-void FloodFillLevel(int, int, int, short[
MAX_LEV_FIELDX][MAX_LEV_FIELDY],
-
int, int);
+void FloodFillLevel(int, int, int, short[
][MAX_LEV_FIELDY], int, int);
+
void FloodFillLevelExt(int, int, int, int, int y, short field[][y],
int, int);
void SetRandomAnimationValue(int, int);
int getGraphicAnimationFrame(int, int);
void SetRandomAnimationValue(int, int);
int getGraphicAnimationFrame(int, int);