Unify lua setting wallprop
This commit is contained in:
41
src/sp_lev.c
41
src/sp_lev.c
@@ -92,6 +92,7 @@ static void FDECL(sel_set_feature, (int, int, genericptr_t));
|
|||||||
static int FDECL(get_coord, (lua_State *, int, int *, int *));
|
static int FDECL(get_coord, (lua_State *, int, int *, int *));
|
||||||
static int FDECL(get_table_region, (lua_State *, const char *,
|
static int FDECL(get_table_region, (lua_State *, const char *,
|
||||||
int *, int *, int *, int *, BOOLEAN_P));
|
int *, int *, int *, int *, BOOLEAN_P));
|
||||||
|
static void FDECL(set_wallprop_in_selection, (lua_State *, int));
|
||||||
|
|
||||||
/* lua_CFunction prototypes */
|
/* lua_CFunction prototypes */
|
||||||
int FDECL(lspo_altar, (lua_State *));
|
int FDECL(lspo_altar, (lua_State *));
|
||||||
@@ -5169,13 +5170,11 @@ lua_State *L;
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* non_diggable(selection); */
|
static void
|
||||||
/* non_diggable(); */
|
set_wallprop_in_selection(L, prop)
|
||||||
int
|
|
||||||
lspo_non_diggable(L)
|
|
||||||
lua_State *L;
|
lua_State *L;
|
||||||
|
int prop;
|
||||||
{
|
{
|
||||||
int prop = W_NONDIGGABLE;
|
|
||||||
int argc = lua_gettop(L);
|
int argc = lua_gettop(L);
|
||||||
boolean freesel = FALSE;
|
boolean freesel = FALSE;
|
||||||
struct selectionvar *sel = (struct selectionvar *) 0;
|
struct selectionvar *sel = (struct selectionvar *) 0;
|
||||||
@@ -5197,7 +5196,15 @@ lua_State *L;
|
|||||||
free(sel);
|
free(sel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* non_diggable(selection); */
|
||||||
|
/* non_diggable(); */
|
||||||
|
int
|
||||||
|
lspo_non_diggable(L)
|
||||||
|
lua_State *L;
|
||||||
|
{
|
||||||
|
set_wallprop_in_selection(L, W_NONDIGGABLE);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5207,29 +5214,7 @@ int
|
|||||||
lspo_non_passwall(L)
|
lspo_non_passwall(L)
|
||||||
lua_State *L;
|
lua_State *L;
|
||||||
{
|
{
|
||||||
int prop = W_NONPASSWALL;
|
set_wallprop_in_selection(L, W_NONPASSWALL);
|
||||||
int argc = lua_gettop(L);
|
|
||||||
boolean freesel = FALSE;
|
|
||||||
struct selectionvar *sel = (struct selectionvar *) 0;
|
|
||||||
|
|
||||||
create_des_coder();
|
|
||||||
|
|
||||||
if (argc == 1)
|
|
||||||
sel = l_selection_check(L, -1);
|
|
||||||
else if (argc == 0) {
|
|
||||||
freesel = TRUE;
|
|
||||||
sel = selection_new();
|
|
||||||
selection_not(sel);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sel) {
|
|
||||||
selection_iterate(sel, sel_set_wall_property, (genericptr_t) &prop);
|
|
||||||
if (freesel) {
|
|
||||||
selection_free(sel);
|
|
||||||
free(sel);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user