projects
/
rocksndiamonds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
rnd-19981117-1
[rocksndiamonds.git]
/
src
/
editor.c
diff --git
a/src/editor.c
b/src/editor.c
index 3434b4c2219731c842b9c7eadc82276f21d7b07e..c17a4967ef27f6ecf69085bb0069b482169447ff 100644
(file)
--- a/
src/editor.c
+++ b/
src/editor.c
@@
-21,8
+21,8
@@
#define CHOICE_DELAY_VALUE 100
static int level_xpos,level_ypos;
#define CHOICE_DELAY_VALUE 100
static int level_xpos,level_ypos;
-static
BOOL
edit_mode;
-static
BOOL
name_typing;
+static
boolean
edit_mode;
+static
boolean
name_typing;
static int new_element1 = EL_MAUERWERK;
static int new_element2 = EL_LEERRAUM;
static int new_element3 = EL_ERDREICH;
static int new_element1 = EL_MAUERWERK;
static int new_element2 = EL_LEERRAUM;
static int new_element3 = EL_ERDREICH;
@@
-206,9
+206,9
@@
int editor_element[] =
EL_DRACHE,
EL_SONDE,
EL_DRACHE,
EL_SONDE,
- EL_
LEERRAUM
,
- EL_
LEERRAUM
,
- EL_
LEERRAUM
,
+ EL_
MAUER_X
,
+ EL_
MAUER_Y
,
+ EL_
MAUER_XY
,
EL_CHAR_A + ('S' - 'A'),
EL_CHAR_A + ('O' - 'A'),
EL_CHAR_A + ('S' - 'A'),
EL_CHAR_A + ('O' - 'A'),
@@
-610,24
+610,25
@@
void FloodFill(int from_x, int from_y, int fill_element)
static int check[4][2] = { {-1,0}, {0,-1}, {1,0}, {0,1} };
static int safety = 0;
static int check[4][2] = { {-1,0}, {0,-1}, {1,0}, {0,1} };
static int safety = 0;
+ /* check if starting field still has the desired content */
+ if (Feld[from_x][from_y] == fill_element)
+ return;
+
safety++;
safety++;
- if (safety>lev_fieldx*lev_fieldy)
- {
- fprintf(stderr,"Something went wrong in 'FloodFill()'. Please debug.\n");
- exit(-1);
- }
+ if (safety > lev_fieldx*lev_fieldy)
+ Error(ERR_EXIT, "Something went wrong in 'FloodFill()'. Please debug.");
old_element = Feld[from_x][from_y];
Feld[from_x][from_y] = fill_element;
for(i=0;i<4;i++)
{
old_element = Feld[from_x][from_y];
Feld[from_x][from_y] = fill_element;
for(i=0;i<4;i++)
{
- x = from_x
+
check[i][0];
- y = from_y
+
check[i][1];
+ x = from_x
+
check[i][0];
+ y = from_y
+
check[i][1];
- if (IN_LEV_FIELD(x,y) && Feld[x][y]
==
old_element)
- FloodFill(x,
y,
fill_element);
+ if (IN_LEV_FIELD(x,y) && Feld[x][y]
==
old_element)
+ FloodFill(x,
y,
fill_element);
}
safety--;
}
safety--;
@@
-637,7
+638,7
@@
void LevelEd(int mx, int my, int button)
{
static int last_button = 0;
static int in_field_pressed = FALSE;
{
static int last_button = 0;
static int in_field_pressed = FALSE;
- static
BOOL
use_floodfill = FALSE;
+ static
boolean
use_floodfill = FALSE;
int x = (mx-SX)/MINI_TILEX;
int y = (my-SY)/MINI_TILEY;
int x = (mx-SX)/MINI_TILEX;
int y = (my-SY)/MINI_TILEY;
@@
-745,7
+746,7
@@
void LevelEd(int mx, int my, int button)
edit_mode = FALSE;
break;
case ED_BUTTON_FILL:
edit_mode = FALSE;
break;
case ED_BUTTON_FILL:
-
AreYouSure("Caution ! Flood fill mode ! Choose area !",AYS
_OPEN);
+
Request("Caution ! Flood fill mode ! Choose area !",REQ
_OPEN);
use_floodfill = TRUE;
return;
break;
use_floodfill = TRUE;
return;
break;
@@
-1010,7
+1011,7
@@
void LevelEd(int mx, int my, int button)
edit_mode = TRUE;
break;
case ED_BUTTON_CLEAR:
edit_mode = TRUE;
break;
case ED_BUTTON_CLEAR:
- if (
AreYouSure("Are you sure to clear this level ?",AYS
_ASK))
+ if (
Request("Are you sure to clear this level ?",REQ
_ASK))
{
for(x=0;x<MAX_LEV_FIELDX;x++)
for(y=0;y<MAX_LEV_FIELDY;y++)
{
for(x=0;x<MAX_LEV_FIELDX;x++)
for(y=0;y<MAX_LEV_FIELDY;y++)
@@
-1020,7
+1021,7
@@
void LevelEd(int mx, int my, int button)
break;
case ED_BUTTON_UNDO:
if (leveldir[leveldir_nr].readonly ||
break;
case ED_BUTTON_UNDO:
if (leveldir[leveldir_nr].readonly ||
-
AreYouSure("Exit without saving ?",AYS_ASK | AYS
_STAY_OPEN))
+
Request("Exit without saving ?",REQ_ASK | REQ
_STAY_OPEN))
{
CloseDoor(DOOR_CLOSE_BOTH);
game_status=MAINMENU;
{
CloseDoor(DOOR_CLOSE_BOTH);
game_status=MAINMENU;
@@
-1038,7
+1039,7
@@
void LevelEd(int mx, int my, int button)
if (leveldir[leveldir_nr].readonly)
{
if (leveldir[leveldir_nr].readonly)
{
-
AreYouSure("This level is read only !",AYS
_CONFIRM);
+
Request("This level is read only !",REQ
_CONFIRM);
break;
}
break;
}
@@
-1048,12
+1049,12
@@
void LevelEd(int mx, int my, int button)
figur_vorhanden = TRUE;
if (!figur_vorhanden)
figur_vorhanden = TRUE;
if (!figur_vorhanden)
-
AreYouSure
("No Level without Gregor Mc Duffin please !",
-
AYS
_CONFIRM);
+
Request
("No Level without Gregor Mc Duffin please !",
+
REQ
_CONFIRM);
else
{
else
{
- if (
AreYouSure
("Save this level and kill the old ?",
-
AYS_ASK | AYS
_STAY_OPEN))
+ if (
Request
("Save this level and kill the old ?",
+
REQ_ASK | REQ
_STAY_OPEN))
{
for(x=0;x<lev_fieldx;x++)
for(y=0;y<lev_fieldy;y++)
{
for(x=0;x<lev_fieldx;x++)
for(y=0;y<lev_fieldy;y++)