From: Martin Read Date: Mon, 30 Sep 2013 22:35:13 +0000 (+0100) Subject: Dependency updates, much killing of magic numbers and boolification of booleans X-Git-Tag: printmsg-purged~57 X-Git-Url: http://git.blackswordsonics.com/?a=commitdiff_plain;h=d5132e08b01841d34e780d1ed56aecf6fc3e1631;p=victrix-abyssi Dependency updates, much killing of magic numbers and boolification of booleans --- diff --git a/Makefile b/Makefile index 81d0d66..a2f5d9a 100644 --- a/Makefile +++ b/Makefile @@ -30,30 +30,30 @@ archive: clean clean: -rm -f *.o $(GAME) victrix-abyssi.log victrix-abyssi.sav.gz *.tgz -display-nc.o: display-nc.cc victrix-abyssi.hh +display-nc.o: display-nc.cc victrix-abyssi.hh display.hh main.o: main.cc combat.hh victrix-abyssi.hh monsters.hh -combat.o: combat.cc combat.hh victrix-abyssi.hh +combat.o: combat.cc combat.hh victrix-abyssi.hh monsters.hh objects.hh -u.o: u.cc combat.hh victrix-abyssi.hh +u.o: u.cc combat.hh victrix-abyssi.hh monsters.hh objects.hh -permobj.o: permobj.cc victrix-abyssi.hh +permobj.o: permobj.cc victrix-abyssi.hh objects.hh map.o: map.cc victrix-abyssi.hh -permons.o: permons.cc victrix-abyssi.hh +permons.o: permons.cc victrix-abyssi.hh monsters.hh pmon2.o: pmon2.cc victrix-abyssi.hh monsters.hh -objects.o: objects.cc victrix-abyssi.hh +objects.o: objects.cc victrix-abyssi.hh objects.hh monsters.hh -monsters.o: monsters.cc victrix-abyssi.hh monsters.hh +monsters.o: monsters.cc victrix-abyssi.hh monsters.hh objects.hh -mon2.o: mon2.cc victrix-abyssi.hh sorcery.hh monsters.hh +mon2.o: mon2.cc victrix-abyssi.hh sorcery.hh monsters.hh objects.hh vector.o: vector.cc victrix-abyssi.hh -sorcery.o: sorcery.cc victrix-abyssi.hh sorcery.hh +sorcery.o: sorcery.cc victrix-abyssi.hh sorcery.hh objects.hh monsters.hh # vim:ts=8:sts=8:sw=8:noexpandtab diff --git a/combat.cc b/combat.cc index d8511da..d0eb1a0 100644 --- a/combat.cc +++ b/combat.cc @@ -324,8 +324,8 @@ int mshootu(int mon) /* dy, dx == trajectory of missile */ dy = u.y - y; dx = u.x - x; - sy = (dy > 0) ? 1 : ((dy < 0) ? -1 : 0); - sx = (dx > 0) ? 1 : ((dx < 0) ? -1 : 0); + sy = mysign(dy); + sx = mysign(dx); /* Don't get the bonus that applies to melee attacks. */ tohit = zero_die(mptr->rtohit); print_mon_name(mon, 3); diff --git a/display-nc.cc b/display-nc.cc index af0086b..a2ef8de 100644 --- a/display-nc.cc +++ b/display-nc.cc @@ -556,10 +556,10 @@ tryagain: } } -int select_dir(int *psy, int *psx) +Pass_fail select_dir(int *psy, int *psx) { int ch; - int done = 0; + bool done = false; print_msg("Select a direction with movement keys.\n[ESC or space to cancel].\n"); while (!done) { @@ -570,60 +570,60 @@ int select_dir(int *psy, int *psx) case '4': *psx = -1; *psy = 0; - done = 1; + done = true; break; case 'j': case '2': *psx = 0; *psy = 1; - done = 1; + done = true; break; case 'k': case '8': *psx = 0; *psy = -1; - done = 1; + done = true; break; case 'l': case '6': *psx = 1; *psy = 0; - done = 1; + done = true; break; case 'y': case '7': *psx = -1; *psy = -1; - done = 1; + done = true; break; case 'u': case '9': *psx = 1; *psy = -1; - done = 1; + done = true; break; case 'b': case '1': *psx = -1; *psy = 1; - done = 1; + done = true; break; case 'n': case '3': *psx = 1; *psy = 1; - done = 1; + done = true; break; case '\x1b': case ' ': - return -1; /* cancelled. */ + return You_fail; /* cancelled. */ default: print_msg("Bad direction (use movement keys).\n"); print_msg("[Press ESC or space to cancel.]\n"); break; } } - return 0; + return You_pass; } enum game_cmd get_command(void) diff --git a/display.hh b/display.hh index 05262f6..49cca87 100644 --- a/display.hh +++ b/display.hh @@ -39,7 +39,7 @@ extern void newsym(int y, int x); extern void touch_back_buffer(void); extern int inv_select(enum poclass_num filter, const char *action, int accept_blank); extern enum game_cmd get_command(void); -extern int select_dir(int *psy, int *psx); +extern Pass_fail select_dir(int *psy, int *psx); extern int getYN(const char *msg); extern int getyn(const char *msg); extern void press_enter(void); diff --git a/main.cc b/main.cc index 615113c..a6e45e4 100644 --- a/main.cc +++ b/main.cc @@ -193,6 +193,7 @@ Action_cost do_command(enum game_cmd cmd) { int i; int j; + Pass_fail pf; int slot; Action_cost cost; int sy, sx; @@ -216,8 +217,8 @@ Action_cost do_command(enum game_cmd cmd) return move_player(1, -1); case ATTACK: - i = select_dir(&sy, &sx); - if (i != -1) + pf = select_dir(&sy, &sx); + if (pf != You_fail) { return player_attack(sy, sx); } @@ -356,12 +357,7 @@ Action_cost do_command(enum game_cmd cmd) slot = inv_select(POCLASS_FOOD, "eat", 0); if (slot != SLOT_CANCEL) { - j = eat_food(u.inventory[slot]); - if (j == -1) - { - u.inventory[slot] = NO_OBJ; - } - return Cost_std; + return eat_food(u.inventory[slot]); } return Cost_none; @@ -369,12 +365,7 @@ Action_cost do_command(enum game_cmd cmd) slot = inv_select(POCLASS_POTION, "quaff", 0); if (slot != SLOT_CANCEL) { - j = quaff_potion(u.inventory[slot]); - if (j) - { - u.inventory[slot] = NO_OBJ; - } - return Cost_std; + return quaff_potion(u.inventory[slot]); } return Cost_none; @@ -382,8 +373,8 @@ Action_cost do_command(enum game_cmd cmd) slot = inv_select(POCLASS_FLASK, "throw", 0); if (slot != SLOT_CANCEL) { - j = select_dir(&sy, &sx); - if (j != -1) + pf = select_dir(&sy, &sx); + if (pf != You_fail) { return throw_flask(u.inventory[slot], sy, sx); } @@ -391,27 +382,26 @@ Action_cost do_command(enum game_cmd cmd) return Cost_none; case REMOVE_RING: + cost = Cost_none; if (u.ring == NO_OBJ) { print_msg("You have no ring to remove!\n"); - return Cost_none; } else if ((lvl.terrain[u.y][u.x] == LAVA) && (u.resistances[DT_FIRE] == RESIST_RING)) { print_msg("That ring is your only current source of fire resistance. Removing\nit here would incinerate you.\n"); - return Cost_none; } else if ((objects[u.ring].obj_id == PO_RING_FROST) && (lvl.terrain[u.y][u.x] == WATER)) { print_msg("Since nobody ever taught you to swim, removing that ring\nhere would result in your death by drowning.\n"); - return Cost_none; } else { print_msg("You remove your ring.\n"); u.ring = NO_OBJ; + cost = Cost_std; } - return Cost_std; + return cost; case PUT_ON_RING: cost = Cost_none; if (u.ring != NO_OBJ) @@ -468,9 +458,9 @@ Action_cost do_command(enum game_cmd cmd) } print_msg("100k rolls: 0 %d, 1 %d\n", odds, evens); } - print_msg("1d2-1: %d %d %d %d %d %d %d %d\n", zero_die(2), zero_die(2), zero_die(2), zero_die(2), zero_die(2), zero_die(2), zero_die(2), zero_die(2)); - print_msg("1d8-1: %d %d %d %d %d %d %d %d\n", zero_die(8), zero_die(8), zero_die(8), zero_die(8), zero_die(8), zero_die(8), zero_die(8), zero_die(8)); - print_msg("1d32-1: %d %d %d %d %d %d %d %d\n", zero_die(32), zero_die(32), zero_die(32), zero_die(32), zero_die(32), zero_die(32), zero_die(32), zero_die(32)); + print_msg(" 2: %d %d %d %d %d %d %d %d\n", zero_die(2), zero_die(2), zero_die(2), zero_die(2), zero_die(2), zero_die(2), zero_die(2), zero_die(2)); + print_msg(" 8: %d %d %d %d %d %d %d %d\n", zero_die(8), zero_die(8), zero_die(8), zero_die(8), zero_die(8), zero_die(8), zero_die(8), zero_die(8)); + print_msg("32: %d %d %d %d %d %d %d %d\n", zero_die(32), zero_die(32), zero_die(32), zero_die(32), zero_die(32), zero_die(32), zero_die(32), zero_die(32)); return Cost_none; case DROP_ITEM: cost = Cost_none; diff --git a/map.cc b/map.cc index 4936251..49309c7 100644 --- a/map.cc +++ b/map.cc @@ -33,7 +33,7 @@ level lvl; int depth = 1; -static int get_levgen_mon_floor(int *y, int *x); +static Pass_fail get_levgen_mon_floor(int *y, int *x); static void build_level_shrine(void); static void build_level_intrusions(void); static void build_level_classic(void); @@ -434,7 +434,7 @@ void build_level_intrusions(void) lvl.terrain[y][x] = STAIRS; } -int get_levgen_mon_floor(int *y, int *x) +Pass_fail get_levgen_mon_floor(int *y, int *x) { int cell_try; int ty, tx; @@ -453,28 +453,28 @@ int get_levgen_mon_floor(int *y, int *x) } if (ty == -1) { - return -1; + return You_fail; } *y = ty; *x = tx; - return 0; + return You_pass; } void populate_level(void) { int i; - int j; + Pass_fail pf; int y, x; int ic; /* Generate some random monsters */ for (i = 0; i < 10; i++) { - j = get_levgen_mon_floor(&y, &x); - if (j == -1) + pf = get_levgen_mon_floor(&y, &x); + if (pf == You_fail) { continue; } - create_mon(-1, y, x); + create_mon(NO_PMON, y, x); } ic = 3 + depth; if (ic > 40) @@ -485,12 +485,12 @@ void populate_level(void) /* Generate some random treasure */ for (i = 0; i < ic; i++) { - j = get_levgen_mon_floor(&y, &x); - if (j == -1) + pf = get_levgen_mon_floor(&y, &x); + if (pf == You_fail) { continue; } - create_obj(-1, 1, 0, y, x); + create_obj(NO_POBJ, 1, 0, y, x); } } diff --git a/mon2.cc b/mon2.cc index e3da689..8b37d16 100644 --- a/mon2.cc +++ b/mon2.cc @@ -122,26 +122,10 @@ static void get_chase_prefs(int mon, int *pref_y, int *pref_x) x = monsters[mon].x; dy = monsters[mon].ai_lasty - y; dx = monsters[mon].ai_lastx - x; - if (dy == 0) - { - sy = 0; - ady = 0; - } - else - { - sy = dy < 0 ? -1 : 1; - ady = dy < 0 ? -dy : dy; - } - if (dx == 0) - { - sx = 0; - adx = 0; - } - else - { - sx = dx < 0 ? -1 : 1; - adx = dx < 0 ? -dx : dx; - } + sy = mysign(dy); + ady = myabs(dy); + sx = mysign(dx); + adx = myabs(dx); if (mon_can_pass(mon, y + sy, x + sx)) { *pref_y = y + sy; @@ -263,8 +247,8 @@ static void get_seeking_prefs(int y, int x, int dy, int dx, int *pref_y, int *pr int tryct; *pref_y = y; *pref_x = x; - ady = dy > 0 ? dy : -dy; - adx = dx > 0 ? dx : -dx; + ady = myabs(dy); + adx = myabs(dx); build_ai_cells(ai_cells, y, x); for (i = 0; i < 8; i++) { @@ -328,26 +312,10 @@ static void get_naive_prefs(int y, int x, int dy, int dx, int *pref_y, int *pref { int sy, sx; int ady, adx; - if (dy == 0) - { - sy = 0; - ady = 0; - } - else - { - sy = dy < 0 ? -1 : 1; - ady = dy < 0 ? -dy : dy; - } - if (dx == 0) - { - sx = 0; - adx = dx < 0 ? -dx : dx; - } - else - { - sx = dx < 0 ? -1 : 1; - adx = dx < 0 ? -dx : dx; - } + sy = mysign(dy); + ady = myabs(dy); + sx = mysign(dx); + adx = myabs(dx); if (!sy) { /* We're on the horizontal; check the horizontally adjacent @@ -481,8 +449,8 @@ static void get_dodger_prefs(int y, int x, int dy, int dx, int *pref_y, int *pre int tryct; *pref_y = y; *pref_x = x; - ady = dy > 0 ? dy : -dy; - adx = dx > 0 ? dx : -dx; + ady = myabs(dy); + adx = myabs(dx); build_ai_cells(ai_cells, y, x); /* Build the local dx/dy arrays. */ for (i = 0; i < 8; i++) @@ -559,26 +527,10 @@ void select_space(int *py, int *px, int dy, int dx, int selection_mode) int ady, adx; int y, x; int sy, sx; - if (dy == 0) - { - sy = 0; - ady = 0; - } - else - { - sy = dy < 0 ? -1 : 1; - ady = dy < 0 ? -dy : dy; - } - if (dx == 0) - { - sx = 0; - adx = dx < 0 ? -dx : dx; - } - else - { - sx = dx < 0 ? -1 : 1; - adx = dx < 0 ? -dx : dx; - } + sy = mysign(dy); + ady = myabs(dy); + sx = mysign(dx); + adx = myabs(dx); switch (selection_mode) { case 0: @@ -735,8 +687,6 @@ void mon_acts(int mon) y = mptr->y; x = mptr->x; compute_directions(u.y, u.x, y, x, &dy, &dx, &sy, &sx, &meleerange, &oncardinal); - dy = u.y - mptr->y; - dx = u.x - mptr->x; if ((dy == 0) && (dx == 0)) { print_msg("Program disordered: monster in player's square.\n"); diff --git a/monsters.cc b/monsters.cc index 9f7b16d..1b0acd3 100644 --- a/monsters.cc +++ b/monsters.cc @@ -58,7 +58,7 @@ int summoning(int y, int x, int how_many) /* Never summon magicians! */ continue; } - mon = create_mon(-1, y + dy, x + dx); + mon = create_mon(NO_PMON, y + dy, x + dx); if (mon != NO_MON) { created++; @@ -128,15 +128,15 @@ int create_mon(int pm_idx, int y, int x) monsters[mon].mtohit = permons[pm_idx].mtohit + ood(permons[pm_idx].power, 3); monsters[mon].defence = permons[pm_idx].defence + ood(permons[pm_idx].power, 3); monsters[mon].mdam = permons[pm_idx].mdam + ood(permons[pm_idx].power, 5); - if (permons[pm_idx].rdam != NO_MON) + if (permons[pm_idx].rdam != NO_ATK) { monsters[mon].rtohit = permons[pm_idx].rtohit + ood(permons[pm_idx].power, 3); monsters[mon].rdam = permons[pm_idx].rdam + ood(permons[pm_idx].power, 5); } else { - monsters[mon].rtohit = -1; - monsters[mon].rdam = -1; + monsters[mon].rtohit = NO_ATK; + monsters[mon].rdam = NO_ATK; } monsters[mon].awake = false; lvl.mons[y][x] = mon; diff --git a/monsters.hh b/monsters.hh index d2f2380..3c7883c 100644 --- a/monsters.hh +++ b/monsters.hh @@ -82,6 +82,7 @@ struct permon { }; extern struct permon permons[NUM_OF_PERMONS]; +#define NO_ATK (-1) #define NO_PMON (-1) /* XXX struct mon */ diff --git a/objects.cc b/objects.cc index 98422a2..0d9b5e7 100644 --- a/objects.cc +++ b/objects.cc @@ -179,13 +179,13 @@ bool consume_obj(int obj) return false; } -int eat_food(int obj) +Action_cost eat_food(int obj) { Obj *optr = objects + obj; if (permobjs[optr->obj_id].poclass != POCLASS_FOOD) { print_msg("Error: attempt to eat non-food (%d)!\n", optr->obj_id); - return -1; + return Cost_none; } if (optr->obj_id == PO_DEVIL_SPLEEN) { @@ -210,10 +210,11 @@ int eat_food(int obj) u.food += 1500; status_updated = 1; display_update(); - return consume_obj(obj); + consume_obj(obj); + return Cost_std; } -int quaff_potion(int obj) +Action_cost quaff_potion(int obj) { Obj *optr = objects + obj; switch (optr->obj_id) @@ -263,9 +264,11 @@ int quaff_potion(int obj) break; default: print_msg("Impossible: quaffing non-potion\n"); - return 0; + return Cost_none; } - return consume_obj(obj); + consume_obj(obj); + return Cost_std; + } void flavours_init(void) diff --git a/objects.hh b/objects.hh index 5351d2b..e9e4dd2 100644 --- a/objects.hh +++ b/objects.hh @@ -124,6 +124,11 @@ extern int create_obj_random(int y, int x); extern Action_cost drop_obj(int inv_idx); extern Action_cost read_scroll(int obj); +extern Action_cost quaff_potion(int obj); +extern Action_cost eat_food(int obj); +extern Action_cost magic_ring(void); +extern Action_cost emanate_armour(void); +extern Action_cost zap_weapon(void); #endif diff --git a/permons.cc b/permons.cc index 825e758..073556a 100644 --- a/permons.cc +++ b/permons.cc @@ -33,50 +33,50 @@ */ struct permon permons[NUM_OF_PERMONS] = { { - "newt", "newts", 'n', Gcol_red, 20, 1, 3, 0, -1, 2, -1, DT_PHYS, "", 1, 1, 0, PMF_STUPID + "newt", "newts", 'n', Gcol_red, 20, 1, 3, 0, NO_ATK, 2, NO_ATK, DT_PHYS, "", 1, 1, 0, PMF_STUPID }, { - "rat", "rats", 'r', Gcol_brown, 15, 1, 4, 0, -1, 2, -1, DT_PHYS, "", 4, 2, 2, PMF_STUPID + "rat", "rats", 'r', Gcol_brown, 15, 1, 4, 0, NO_ATK, 2, NO_ATK, DT_PHYS, "", 4, 2, 2, PMF_STUPID }, { - "wolf", "wolves", 'c', Gcol_brown, 30, 6, 20, 8, -1, 10, -1, DT_PHYS, "", 6, 15, 2, 0 + "wolf", "wolves", 'c', Gcol_brown, 30, 6, 20, 8, NO_ATK, 10, NO_ATK, DT_PHYS, "", 6, 15, 2, 0 }, { /* Saps one Body on a really good hit */ - "snake", "snakes", 's', Gcol_red, 20, 6, 15, 10, -1, 3, -1, DT_PHYS, "", 9, 40, 2, PMF_STUPID + "snake", "snakes", 's', Gcol_red, 20, 6, 15, 10, NO_ATK, 3, NO_ATK, DT_PHYS, "", 9, 40, 2, PMF_STUPID }, { /* may drop a mace or leather armour */ - "thug", "thugs", 't', Gcol_brown, 30, 1, 8, 5, -1, 5, -1, DT_PHYS, "", 4, 5, 1, 0 + "thug", "thugs", 't', Gcol_brown, 30, 1, 8, 5, NO_ATK, 5, NO_ATK, DT_PHYS, "", 4, 5, 1, 0 }, { - "goon", "goons", 't', Gcol_yellow, 20, 3, 15, 6, -1, 7, -1, DT_PHYS, "", 8, 10, 1, 0 + "goon", "goons", 't', Gcol_yellow, 20, 3, 15, 6, NO_ATK, 7, NO_ATK, DT_PHYS, "", 8, 10, 1, 0 }, { /* Has a ranged attack - arrows */ "hunter", "hunters", 'h', Gcol_green, 30, 9, 40, 6, 20, 6, 10, DT_PHYS, "shoots an arrow", 10, 50, 1, PMF_ARCHER }, { - "duellist", "duellists", 'f', Gcol_red, 40, 12, 60, 30, -1, 15, -1, DT_PHYS, "", 15, 130, 1, PMF_SMART + "duellist", "duellists", 'f', Gcol_red, 40, 12, 60, 30, NO_ATK, 15, NO_ATK, DT_PHYS, "", 15, 130, 1, PMF_SMART }, { - "warlord", "warlords", 'f', Gcol_l_red, 30, 15, 80, 25, -1, 20, -1, DT_PHYS, "", 20, 400, 2, PMF_SMART + "warlord", "warlords", 'f', Gcol_l_red, 30, 15, 80, 25, NO_ATK, 20, NO_ATK, DT_PHYS, "", 20, 400, 2, PMF_SMART }, { /* may drop a dagger */ - "goblin", "goblins", 'g', Gcol_brown, 20, 1, 6, 1, -1, 3, -1, DT_PHYS, "", 3, 3, 1, 0 + "goblin", "goblins", 'g', Gcol_brown, 20, 1, 6, 1, NO_ATK, 3, NO_ATK, DT_PHYS, "", 3, 3, 1, 0 }, { - "bad elf", "bad elves", 'e', Gcol_l_grey, 40, 3, 15, 10, -1, 6, -1, DT_PHYS, "", 8, 15, 2, PMF_SMART + "bad elf", "bad elves", 'e', Gcol_l_grey, 40, 3, 15, 10, NO_ATK, 6, NO_ATK, DT_PHYS, "", 8, 15, 2, PMF_SMART }, { - "troll", "trolls", 'T', Gcol_green, 20, 12, 80, 15, -1, 15, -1, DT_PHYS, "", 13, 150, 1, PMF_STUPID + "troll", "trolls", 'T', Gcol_green, 20, 12, 80, 15, NO_ATK, 15, NO_ATK, DT_PHYS, "", 13, 150, 1, PMF_STUPID }, { - "giant", "giants", 'H', Gcol_brown, 20, 21, 80, 15, -1, 25, -1, DT_PHYS, "", 20, 500, 1, PMF_STUPID + "giant", "giants", 'H', Gcol_brown, 20, 21, 80, 15, NO_ATK, 25, NO_ATK, DT_PHYS, "", 20, 500, 1, PMF_STUPID }, { - "giant jarl", "giant jarls", 'H', Gcol_l_grey, 80, 25, 160, 20, -1, 30, -1, DT_PHYS, "", 22, 1000, 1, 0 + "giant jarl", "giant jarls", 'H', Gcol_l_grey, 80, 25, 160, 20, NO_ATK, 30, NO_ATK, DT_PHYS, "", 22, 1000, 1, 0 }, { /* Uses sorcery against you; see sorcery.c for details. */ @@ -87,10 +87,10 @@ struct permon permons[NUM_OF_PERMONS] = { "archmage", "archmagi", 'w', Gcol_l_blue, 80, 24, 80, 15, 30, 15, 15, DT_ELEC, "casts", 15, 1500, 1, PMF_SMART | PMF_MAGICIAN | PMF_RESIST_ELEC }, { - "zombie", "zombies", 'z', Gcol_l_grey, 25, 3, 30, 2, -1, 20, -1, DT_PHYS, "", 1, 7, 0, PMF_STUPID | PMF_UNDEAD | PMF_RESIST_COLD | PMF_RESIST_POIS | PMF_RESIST_NECR + "zombie", "zombies", 'z', Gcol_l_grey, 25, 3, 30, 2, NO_ATK, 20, NO_ATK, DT_PHYS, "", 1, 7, 0, PMF_STUPID | PMF_UNDEAD | PMF_RESIST_COLD | PMF_RESIST_POIS | PMF_RESIST_NECR }, { - "wraith", "wraiths", 'W', Gcol_white, 25, 12, 40, 25, -1, 5, -1, DT_PHYS, "", 5, 100, 0, PMF_SMART | PMF_UNDEAD | PMF_RESIST_COLD | PMF_RESIST_POIS | PMF_RESIST_NECR + "wraith", "wraiths", 'W', Gcol_white, 25, 12, 40, 25, NO_ATK, 5, NO_ATK, DT_PHYS, "", 5, 100, 0, PMF_SMART | PMF_UNDEAD | PMF_RESIST_COLD | PMF_RESIST_POIS | PMF_RESIST_NECR }, { /* Uses sorcery against you; see sorcery.c for details. */ @@ -103,19 +103,19 @@ struct permon permons[NUM_OF_PERMONS] = { }, { /* Vampires heal by hitting you. */ - "vampire", "vampires", 'V', Gcol_red, 55, 18, 70, 25, -1, 15, -1, DT_PHYS, "", 22, 750, 1, PMF_SMART | PMF_UNDEAD | PMF_RESIST_COLD | PMF_RESIST_POIS | PMF_RESIST_NECR + "vampire", "vampires", 'V', Gcol_red, 55, 18, 70, 25, NO_ATK, 15, NO_ATK, DT_PHYS, "", 22, 750, 1, PMF_SMART | PMF_UNDEAD | PMF_RESIST_COLD | PMF_RESIST_POIS | PMF_RESIST_NECR }, { /* Demons summon more demons if you don't kill them * quickly. */ - "demon", "demons", '&', Gcol_red, 60, 18, 40, 25, -1, 20, -1, DT_PHYS, "", 15, 500, 1, PMF_SMART | PMF_DEMONIC | PMF_RESIST_FIRE + "demon", "demons", '&', Gcol_red, 60, 18, 40, 25, NO_ATK, 20, NO_ATK, DT_PHYS, "", 15, 500, 1, PMF_SMART | PMF_DEMONIC | PMF_RESIST_FIRE }, { /* Defilers use sorcery (mostly curses) against you. */ "defiler", "defilers", '&', Gcol_l_green, 65, 27, 120, 30, 30, 20, 30, DT_FIRE, "", 25, 2000, 1, PMF_SMART | PMF_DEMONIC | PMF_RESIST_FIRE | PMF_MAGICIAN | PMF_RESIST_POIS }, { - "centaur", "centaurs", 'C', Gcol_brown, 30, 9, 40, 15, -1, 10, -1, DT_PHYS, "", 10, 50, 2, 0 + "centaur", "centaurs", 'C', Gcol_brown, 30, 9, 40, 15, NO_ATK, 10, NO_ATK, DT_PHYS, "", 10, 50, 2, 0 }, { /* Fires ice blasts. */ diff --git a/u.cc b/u.cc index 9b7d23a..a713fc9 100644 --- a/u.cc +++ b/u.cc @@ -482,13 +482,13 @@ void u_init(void) u.level = 1; u.food = 2000; memset(u.inventory, -1, sizeof u.inventory); - u.inventory[0] = create_obj(PO_DAGGER, 1, 1, -1, -1); + u.inventory[0] = create_obj(PO_DAGGER, 1, true, -1, -1); if (u.inventory[0] == NO_OBJ) { print_msg("Couldn't create dagger!\n"); } - u.inventory[1] = create_obj(PO_IRON_RATION, 1, 1, -1, -1); - u.inventory[2] = create_obj(PO_BATTLE_BALLGOWN, 1, 1, -1, -1); + u.inventory[1] = create_obj(PO_IRON_RATION, 1, true, -1, -1); + u.inventory[2] = create_obj(PO_BATTLE_BALLGOWN, 1, true, -1, -1); u.weapon = u.inventory[0]; u.ring = NO_OBJ; u.armour = u.inventory[2]; diff --git a/victrix-abyssi.hh b/victrix-abyssi.hh index ccf0dfc..0779fc2 100644 --- a/victrix-abyssi.hh +++ b/victrix-abyssi.hh @@ -176,15 +176,10 @@ extern int wizard_mode; /* XXX misc.c data and funcs */ extern const char *damtype_names[DT_COUNT]; -extern int quaff_potion(int obj); -extern int eat_food(int obj); extern void attempt_pickup(void); extern bool po_is_stackable(int po); extern void damage_obj(int obj); extern int evasion_penalty(int obj); -extern Action_cost magic_ring(void); -extern Action_cost emanate_armour(void); -extern Action_cost zap_weapon(void); /* XXX rng.c data and funcs */ #define RNG_MAX 0xFFFFFFFFu