Dehardcode minefill
Instead of hardcoding the minefill levels in the core, allow defining fill levels for a dungeon branch in the dungeon.lua
This commit is contained in:
@@ -167,6 +167,7 @@ dungeon = {
|
|||||||
range = 2,
|
range = 2,
|
||||||
alignment = "lawful",
|
alignment = "lawful",
|
||||||
flags = { "mazelike" },
|
flags = { "mazelike" },
|
||||||
|
lvlfill = "minefill",
|
||||||
levels = {
|
levels = {
|
||||||
{
|
{
|
||||||
name = "minetn",
|
name = "minetn",
|
||||||
|
|||||||
@@ -56,6 +56,7 @@ typedef struct dest_area { /* non-stairway level change identifier */
|
|||||||
typedef struct dungeon { /* basic dungeon identifier */
|
typedef struct dungeon { /* basic dungeon identifier */
|
||||||
char dname[24]; /* name of the dungeon (eg. "Hell") */
|
char dname[24]; /* name of the dungeon (eg. "Hell") */
|
||||||
char proto[15]; /* name of prototype file (eg. "tower") */
|
char proto[15]; /* name of prototype file (eg. "tower") */
|
||||||
|
char fill_lvl[15]; /* name of "fill" level protype file */
|
||||||
char boneid; /* character to id dungeon in bones files */
|
char boneid; /* character to id dungeon in bones files */
|
||||||
d_flags flags; /* dungeon flags */
|
d_flags flags; /* dungeon flags */
|
||||||
xchar entry_lev; /* entry level */
|
xchar entry_lev; /* entry level */
|
||||||
|
|||||||
@@ -832,7 +832,7 @@ init_dungeons()
|
|||||||
lua_pushnil(L); /* first key */
|
lua_pushnil(L); /* first key */
|
||||||
i = 0;
|
i = 0;
|
||||||
while (lua_next(L, tidx) != 0) {
|
while (lua_next(L, tidx) != 0) {
|
||||||
char *dgn_name, *dgn_bonetag, *dgn_protoname;
|
char *dgn_name, *dgn_bonetag, *dgn_protoname, *dgn_fill;
|
||||||
int dgn_base, dgn_range, dgn_align, dgn_entry, dgn_chance, dgn_flags;
|
int dgn_base, dgn_range, dgn_align, dgn_entry, dgn_chance, dgn_flags;
|
||||||
|
|
||||||
if (!lua_istable(L, -1))
|
if (!lua_istable(L, -1))
|
||||||
@@ -847,6 +847,7 @@ init_dungeons()
|
|||||||
dgn_entry = get_table_int_opt(L, "entry", 0);
|
dgn_entry = get_table_int_opt(L, "entry", 0);
|
||||||
dgn_chance = get_table_int_opt(L, "chance", 100);
|
dgn_chance = get_table_int_opt(L, "chance", 100);
|
||||||
dgn_flags = get_dgn_flags(L);
|
dgn_flags = get_dgn_flags(L);
|
||||||
|
dgn_fill = get_table_str_opt(L, "lvlfill", emptystr);
|
||||||
|
|
||||||
debugpline4("DUNGEON[%i]: %s, base=(%i,%i)", i, dgn_name, dgn_base, dgn_range);
|
debugpline4("DUNGEON[%i]: %s, base=(%i,%i)", i, dgn_name, dgn_base, dgn_range);
|
||||||
|
|
||||||
@@ -984,6 +985,7 @@ init_dungeons()
|
|||||||
pd.tmpdungeon[i].chance = dgn_chance;
|
pd.tmpdungeon[i].chance = dgn_chance;
|
||||||
pd.tmpdungeon[i].entry_lev = dgn_entry;
|
pd.tmpdungeon[i].entry_lev = dgn_entry;
|
||||||
|
|
||||||
|
Strcpy(g.dungeons[i].fill_lvl, dgn_fill); /* FIXME: fill_lvl len */
|
||||||
Strcpy(g.dungeons[i].dname, dgn_name); /* FIXME: dname length */
|
Strcpy(g.dungeons[i].dname, dgn_name); /* FIXME: dname length */
|
||||||
Strcpy(g.dungeons[i].proto, dgn_protoname); /* FIXME: proto length */
|
Strcpy(g.dungeons[i].proto, dgn_protoname); /* FIXME: proto length */
|
||||||
g.dungeons[i].boneid = *dgn_bonetag ? *dgn_bonetag : 0;
|
g.dungeons[i].boneid = *dgn_bonetag ? *dgn_bonetag : 0;
|
||||||
|
|||||||
@@ -685,8 +685,8 @@ makelevel()
|
|||||||
} else if (g.dungeons[u.uz.dnum].proto[0]) {
|
} else if (g.dungeons[u.uz.dnum].proto[0]) {
|
||||||
makemaz("");
|
makemaz("");
|
||||||
return;
|
return;
|
||||||
} else if (In_mines(&u.uz)) {
|
} else if (g.dungeons[u.uz.dnum].fill_lvl[0]) {
|
||||||
makemaz("minefill");
|
makemaz(g.dungeons[u.uz.dnum].fill_lvl);
|
||||||
return;
|
return;
|
||||||
} else if (In_quest(&u.uz)) {
|
} else if (In_quest(&u.uz)) {
|
||||||
char fillname[9];
|
char fillname[9];
|
||||||
|
|||||||
Reference in New Issue
Block a user