From: PatR Date: Sat, 7 Nov 2015 02:03:13 +0000 (-0800) Subject: yet more src reformatting X-Git-Tag: NetHack-3.6.0_RC01~80 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e322623210600b3d2d4353d572a4c2fbff543529;p=nethack yet more src reformatting Last of the suspicious block comments, plus the usual miscellaneous stuff in files that hadn't been subjected to it before. --- diff --git a/src/potion.c b/src/potion.c index 90bad15ee..7484d29d2 100644 --- a/src/potion.c +++ b/src/potion.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 potion.c $NHDT-Date: 1446603164 2015/11/04 02:12:44 $ $NHDT-Branch: master $:$NHDT-Revision: 1.120 $ */ +/* NetHack 3.6 potion.c $NHDT-Date: 1446861768 2015/11/07 02:02:48 $ $NHDT-Branch: master $:$NHDT-Revision: 1.121 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -623,7 +623,7 @@ register struct obj *otmp; exercise(A_CON, TRUE); if (u.ulycn >= LOW_PM) you_unwere(TRUE); /* "Purified" */ - /* make_confused(0L,TRUE); */ + /* make_confused(0L, TRUE); */ } else { if (u.ualign.type == A_LAWFUL) { pline("This burns like acid!"); diff --git a/src/role.c b/src/role.c index 2eb9c7e62..7be577b7f 100644 --- a/src/role.c +++ b/src/role.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 role.c $NHDT-Date: 1445906861 2015/10/27 00:47:41 $ $NHDT-Branch: master $:$NHDT-Revision: 1.33 $ */ +/* NetHack 3.6 role.c $NHDT-Date: 1446861770 2015/11/07 02:02:50 $ $NHDT-Branch: master $:$NHDT-Revision: 1.34 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985-1999. */ /* NetHack may be freely redistributed. See license for details. */ @@ -34,9 +34,7 @@ const struct Role roles[] = { { "Speleologist", 0 }, { "Collector", 0 }, { "Curator", 0 } }, - "Quetzalcoatl", - "Camaxtli", - "Huhetotl", /* Central American */ + "Quetzalcoatl", "Camaxtli", "Huhetotl", /* Central American */ "Arc", "the College of Archeology", "the Tomb of the Toltec Kings", @@ -78,9 +76,7 @@ const struct Role roles[] = { { "Slayer", 0 }, { "Chieftain", "Chieftainess" }, { "Conqueror", "Conqueress" } }, - "Mitra", - "Crom", - "Set", /* Hyborian */ + "Mitra", "Crom", "Set", /* Hyborian */ "Bar", "the Camp of the Duali Tribe", "the Duali Oasis", @@ -122,9 +118,7 @@ const struct Role roles[] = { { "Nomad", 0 }, { "Rover", 0 }, { "Pioneer", 0 } }, - "Anu", - "_Ishtar", - "Anshar", /* Babylonian */ + "Anu", "_Ishtar", "Anshar", /* Babylonian */ "Cav", "the Caves of the Ancestors", "the Dragon's Lair", @@ -166,9 +160,7 @@ const struct Role roles[] = { { "Magister", "Magistra" }, { "Physician", 0 }, { "Chirurgeon", 0 } }, - "_Athena", - "Hermes", - "Poseidon", /* Greek */ + "_Athena", "Hermes", "Poseidon", /* Greek */ "Hea", "the Temple of Epidaurus", "the Temple of Coeus", @@ -209,9 +201,7 @@ const struct Role roles[] = { { "Chevalier", "Chevaliere" }, { "Seignieur", "Dame" }, { "Paladin", 0 } }, - "Lugh", - "_Brigit", - "Manannan Mac Lir", /* Celtic */ + "Lugh", "_Brigit", "Manannan Mac Lir", /* Celtic */ "Kni", "Camelot Castle", "the Isle of Glass", @@ -252,9 +242,7 @@ const struct Role roles[] = { { "Student of Winds", 0 }, { "Student of Fire", 0 }, { "Master", 0 } }, - "Shan Lai Ching", - "Chih Sung-tzu", - "Huan Ti", /* Chinese */ + "Shan Lai Ching", "Chih Sung-tzu", "Huan Ti", /* Chinese */ "Mon", "the Monastery of Chan-Sune", "the Monastery of the Earth-Lord", @@ -296,9 +284,7 @@ const struct Role roles[] = { { "Lama", 0 }, { "Patriarch", "Matriarch" }, { "High Priest", "High Priestess" } }, - 0, - 0, - 0, /* chosen randomly from among the other roles */ + 0, 0, 0, /* deities from a randomly chosen other role will be used */ "Pri", "the Great Temple", "the Temple of Nalzok", @@ -342,9 +328,7 @@ const struct Role roles[] = { { "Filcher", 0 }, { "Magsman", "Magswoman" }, { "Thief", 0 } }, - "Issek", - "Mog", - "Kos", /* Nehwon */ + "Issek", "Mog", "Kos", /* Nehwon */ "Rog", "the Thieves' Guild Hall", "the Assassins' Guild Hall", @@ -378,31 +362,28 @@ const struct Role roles[] = { { { "Ranger", 0 }, { #if 0 /* OBSOLETE */ - {"Edhel", "Elleth"}, - {"Edhel", "Elleth"}, /* elf-maid */ - {"Ohtar", "Ohtie"}, /* warrior */ - {"Kano", /* commander (Q.) ['a] */ - "Kanie"}, /* educated guess, until further research- SAC */ - {"Arandur", /* king's servant, minister (Q.) - guess */ - "Aranduriel"}, /* educated guess */ - {"Hir", "Hiril"}, /* lord, lady (S.) ['ir] */ - {"Aredhel", "Arwen"}, /* noble elf, maiden (S.) */ - {"Ernil", "Elentariel"}, /* prince (S.), elf-maiden (Q.) */ - {"Elentar", "Elentari"}, /* Star-king, -queen (Q.) */ - "Solonor Thelandira", "Aerdrie Faenya", "Lolth", /* Elven */ + {"Edhel", "Elleth"}, + {"Edhel", "Elleth"}, /* elf-maid */ + {"Ohtar", "Ohtie"}, /* warrior */ + {"Kano", "Kanie"}, /* commander (Q.) ['a] educated guess, + until further research- SAC */ + {"Arandur"," Aranduriel"}, /* king's servant, minister (Q.) - guess */ + {"Hir", "Hiril"}, /* lord, lady (S.) ['ir] */ + {"Aredhel", "Arwen"}, /* noble elf, maiden (S.) */ + {"Ernil", "Elentariel"}, /* prince (S.), elf-maiden (Q.) */ + {"Elentar", "Elentari"}, /* Star-king, -queen (Q.) */ + "Solonor Thelandira", "Aerdrie Faenya", "Lolth", /* Elven */ #endif - { "Tenderfoot", 0 }, - { "Lookout", 0 }, - { "Trailblazer", 0 }, - { "Reconnoiterer", "Reconnoiteress" }, - { "Scout", 0 }, - { "Arbalester", 0 }, /* One skilled at crossbows */ - { "Archer", 0 }, - { "Sharpshooter", 0 }, - { "Marksman", "Markswoman" } }, - "Mercury", - "_Venus", - "Mars", /* Roman/planets */ + { "Tenderfoot", 0 }, + { "Lookout", 0 }, + { "Trailblazer", 0 }, + { "Reconnoiterer", "Reconnoiteress" }, + { "Scout", 0 }, + { "Arbalester", 0 }, /* One skilled at crossbows */ + { "Archer", 0 }, + { "Sharpshooter", 0 }, + { "Marksman", "Markswoman" } }, + "Mercury", "_Venus", "Mars", /* Roman/planets */ "Ran", "Orion's camp", "the cave of the wumpus", @@ -444,9 +425,7 @@ const struct Role roles[] = { { "Daimyo", 0 }, /* a samurai lord */ { "Kuge", 0 }, /* Noble of the Court */ { "Shogun", 0 } }, /* supreme commander, warlord */ - "_Amaterasu Omikami", - "Raijin", - "Susanowo", /* Japanese */ + "_Amaterasu Omikami", "Raijin", "Susanowo", /* Japanese */ "Sam", "the Castle of the Taro Clan", "the Shogun's Castle", @@ -487,9 +466,7 @@ const struct Role roles[] = { { "Voyager", 0 }, { "Explorer", 0 }, { "Adventurer", 0 } }, - "Blind Io", - "_The Lady", - "Offler", /* Discworld */ + "Blind Io", "_The Lady", "Offler", /* Discworld */ "Tou", "Ankh-Morpork", "the Thieves' Guild Hall", @@ -530,9 +507,7 @@ const struct Role roles[] = { { "Hero", "Heroine" }, { "Champion", 0 }, { "Lord", "Lady" } }, - "Tyr", - "Odin", - "Loki", /* Norse */ + "Tyr", "Odin", "Loki", /* Norse */ "Val", "the Shrine of Destiny", "the cave of Surtur", @@ -573,9 +548,7 @@ const struct Role roles[] = { { "Necromancer", 0 }, { "Wizard", 0 }, { "Mage", 0 } }, - "Ptah", - "Thoth", - "Anhur", /* Egyptian */ + "Ptah", "Thoth", "Anhur", /* Egyptian */ "Wiz", "the Lonely Tower", "the Tower of Darkness", @@ -1787,7 +1760,7 @@ winid where; a = 1; /* aligns[neutral] */ else if ((allowmask & ROLE_ALIGNMASK) == AM_CHAOTIC) a = 2; /* alings[chaotic] */ - /* [c never forces gender] */ + /* [c never forces gender] */ } /* [g and a don't constrain anything sufficiently to narrow something done to a single choice] */ @@ -1979,18 +1952,19 @@ winid where; } /* - * Special setup modifications here: + * Special setup modifications here: * - * Unfortunately, this is going to have to be done - * on each newgame or restore, because you lose the permonst mods - * across a save/restore. :-) + * Unfortunately, this is going to have to be done + * on each newgame or restore, because you lose the permonst mods + * across a save/restore. :-) * - * 1 - The Rogue Leader is the Tourist Nemesis. - * 2 - Priests start with a random alignment - convert the leader and - * guardians here. - * 3 - Elves can have one of two different leaders, but can't work it - * out here because it requires hacking the level file data (see - * sp_lev.c). + * 1 - The Rogue Leader is the Tourist Nemesis. + * 2 - Priests start with a random alignment - convert the leader and + * guardians here. + * 3 - Priests also get their of deities from a randomly chosen role. + * 4 - [obsolete] Elves can have one of two different leaders, + * but can't work it out here because it requires hacking the + * level file data (see sp_lev.c). * * This code also replaces quest_init(). */ @@ -2074,10 +2048,8 @@ role_init() pm->mflags3 |= M3_WANTSARTI | M3_WAITFORU; /* if gender is random, we choose it now instead of waiting until the nemesis monster is created */ - quest_status.nemgend = - is_neuter(pm) ? 2 : is_female(pm) ? 1 : is_male(pm) - ? 0 - : (rn2(100) < 50); + quest_status.nemgend = is_neuter(pm) ? 2 : is_female(pm) ? 1 + : is_male(pm) ? 0 : (rn2(100) < 50); } /* Fix up the god names */ diff --git a/src/timeout.c b/src/timeout.c index 7be55f7f8..e50ae39b2 100644 --- a/src/timeout.c +++ b/src/timeout.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 timeout.c $NHDT-Date: 1440120659 2015/08/21 01:30:59 $ $NHDT-Branch: master $:$NHDT-Revision: 1.60 $ */ +/* NetHack 3.6 timeout.c $NHDT-Date: 1446861771 2015/11/07 02:02:51 $ $NHDT-Branch: master $:$NHDT-Revision: 1.63 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -43,8 +43,8 @@ stoned_dialogue() nomul(0); break; case 4: /* limbs stiffening */ - /* just one move left to save oneself so quit fiddling around; - don't stop attempt to eat tin--might be lizard or acidic */ + /* just one move left to save oneself so quit fiddling around; + don't stop attempt to eat tin--might be lizard or acidic */ if (!Popeye(STONED)) stop_occupation(); if (multi > 0) @@ -451,8 +451,8 @@ boolean wakeup_msg; } /* Attach an egg hatch timeout to the given egg. - * when = Time to hatch, usually only passed if re-creating an - * existing hatch timer. Pass 0L for random hatch time. + * when = Time to hatch, usually only passed if re-creating an + * existing hatch timer. Pass 0L for random hatch time. */ void attach_egg_hatch_timeout(egg, when) @@ -546,33 +546,28 @@ long timeout; hatchcount -= i; egg->quan -= (long) hatchcount; } - } #if 0 - /* - * We could possibly hatch while migrating, but the code isn't - * set up for it... - */ - else if (obj->where == OBJ_MIGRATING) { - /* - We can do several things. The first ones that come to - mind are: - - + Create the hatched monster then place it on the migrating - mons list. This is tough because all makemon() is made - to place the monster as well. Makemon() also doesn't - lend itself well to splitting off a "not yet placed" - subroutine. - - + Mark the egg as hatched, then place the monster when we - place the migrating objects. - - + Or just kill any egg which gets sent to another level. - Falling is the usual reason such transportation occurs. - */ - cansee_hatchspot = FALSE; - mon = ??? - } + /* + * We could possibly hatch while migrating, but the code isn't + * set up for it... + */ + } else if (obj->where == OBJ_MIGRATING) { + /* + * We can do several things. The first ones that come to + * mind are: + * + Create the hatched monster then place it on the migrating + * mons list. This is tough because all makemon() is made + * to place the monster as well. Makemon() also doesn't lend + * itself well to splitting off a "not yet placed" subroutine. + * + Mark the egg as hatched, then place the monster when we + * place the migrating objects. + * + Or just kill any egg which gets sent to another level. + * Falling is the usual reason such transportation occurs. + */ + cansee_hatchspot = FALSE; + mon = ???; #endif + } if (mon) { char monnambuf[BUFSZ], carriedby[BUFSZ]; @@ -630,8 +625,8 @@ long timeout; } break; #if 0 - case OBJ_MIGRATING: - break; + case OBJ_MIGRATING: + break; #endif default: impossible("egg hatched where? (%d)", (int) egg->where); @@ -703,17 +698,16 @@ slip_or_trip() otmp = 0; if (otmp && on_foot) { /* trip over something in particular */ - /* - If there is only one item, it will have just been named - during the move, so refer to by via pronoun; otherwise, - if the top item has been or can be seen, refer to it by - name; if not, look for rocks to trip over; trip over - anonymous "something" if there aren't any rocks. - */ - what = - (iflags.last_msg == PLNMSG_ONE_ITEM_HERE) - ? ((otmp->quan == 1L) ? "it" : Hallucination ? "they" - : "them") + /* + If there is only one item, it will have just been named + during the move, so refer to by via pronoun; otherwise, + if the top item has been or can be seen, refer to it by + name; if not, look for rocks to trip over; trip over + anonymous "something" if there aren't any rocks. + */ + what = (iflags.last_msg == PLNMSG_ONE_ITEM_HERE) + ? ((otmp->quan == 1L) ? "it" + : Hallucination ? "they" : "them") : (otmp->dknown || !Blind) ? doname(otmp) : ((otmp2 = sobj_at(ROCK, u.ux, u.uy)) == 0 @@ -1100,17 +1094,15 @@ long timeout; * a timer. * * Burn rules: - * potions of oil, lamps & candles: - * age = # of turns of fuel left - * spe = - * - * magic lamps: - * age = - * spe = 0 not lightable, 1 lightable forever - * - * candelabrum: - * age = # of turns of fuel left - * spe = # of candles + * potions of oil, lamps & candles: + * age = # of turns of fuel left + * spe = + * magic lamps: + * age = + * spe = 0 not lightable, 1 lightable forever + * candelabrum: + * age = # of turns of fuel left + * spe = # of candles * * Once the burn begins, the age will be set to the amount of fuel * remaining _once_the_burn_finishes_. If the burn is terminated @@ -1314,56 +1306,55 @@ do_storms() * Interface: * * General: - * boolean start_timer(long timeout,short kind,short func_index, - * anything *arg) - * Start a timer of kind 'kind' that will expire at time - * monstermoves+'timeout'. Call the function at 'func_index' - * in the timeout table using argument 'arg'. Return TRUE if - * a timer was started. This places the timer on a list ordered - * "sooner" to "later". If an object, increment the object's - * timer count. - * - * long stop_timer(short func_index, anything *arg) - * Stop a timer specified by the (func_index, arg) pair. This - * assumes that such a pair is unique. Return the time the - * timer would have gone off. If no timer is found, return 0. - * If an object, decrement the object's timer count. + * boolean start_timer(long timeout,short kind,short func_index, + * anything *arg) + * Start a timer of kind 'kind' that will expire at time + * monstermoves+'timeout'. Call the function at 'func_index' + * in the timeout table using argument 'arg'. Return TRUE if + * a timer was started. This places the timer on a list ordered + * "sooner" to "later". If an object, increment the object's + * timer count. * - * long peek_timer(short func_index, anything *arg) - * Return time specified timer will go off (0 if no such timer). + * long stop_timer(short func_index, anything *arg) + * Stop a timer specified by the (func_index, arg) pair. This + * assumes that such a pair is unique. Return the time the + * timer would have gone off. If no timer is found, return 0. + * If an object, decrement the object's timer count. * - * void run_timers(void) - * Call timers that have timed out. + * long peek_timer(short func_index, anything *arg) + * Return time specified timer will go off (0 if no such timer). * + * void run_timers(void) + * Call timers that have timed out. * * Save/Restore: - * void save_timers(int fd, int mode, int range) - * Save all timers of range 'range'. Range is either global - * or local. Global timers follow game play, local timers - * are saved with a level. Object and monster timers are - * saved using their respective id's instead of pointers. + * void save_timers(int fd, int mode, int range) + * Save all timers of range 'range'. Range is either global + * or local. Global timers follow game play, local timers + * are saved with a level. Object and monster timers are + * saved using their respective id's instead of pointers. * - * void restore_timers(int fd, int range, boolean ghostly, long adjust) - * Restore timers of range 'range'. If from a ghost pile, - * adjust the timeout by 'adjust'. The object and monster - * ids are not restored until later. + * void restore_timers(int fd, int range, boolean ghostly, long adjust) + * Restore timers of range 'range'. If from a ghost pile, + * adjust the timeout by 'adjust'. The object and monster + * ids are not restored until later. * - * void relink_timers(boolean ghostly) - * Relink all object and monster timers that had been saved - * using their object's or monster's id number. + * void relink_timers(boolean ghostly) + * Relink all object and monster timers that had been saved + * using their object's or monster's id number. * * Object Specific: - * void obj_move_timers(struct obj *src, struct obj *dest) - * Reassign all timers from src to dest. + * void obj_move_timers(struct obj *src, struct obj *dest) + * Reassign all timers from src to dest. * - * void obj_split_timers(struct obj *src, struct obj *dest) - * Duplicate all timers assigned to src and attach them to dest. + * void obj_split_timers(struct obj *src, struct obj *dest) + * Duplicate all timers assigned to src and attach them to dest. * - * void obj_stop_timers(struct obj *obj) - * Stop all timers attached to obj. + * void obj_stop_timers(struct obj *obj) + * Stop all timers attached to obj. * - * boolean obj_has_timer(struct obj *object, short timer_type) - * Check whether object has a timer of type timer_type. + * boolean obj_has_timer(struct obj *object, short timer_type) + * Check whether object has a timer of type timer_type. */ STATIC_DCL const char *FDECL(kind_name, (SHORT_P)); @@ -1672,7 +1663,7 @@ short timer_type; { long timeout = peek_timer(timer_type, obj_to_any(object)); - return (boolean)(timeout != 0L); + return (boolean) (timeout != 0L); } /* @@ -1933,12 +1924,12 @@ boolean write_it; * timers. * * Global range: - * + timeouts that follow the hero (global) - * + timeouts that follow obj & monst that are migrating + * + timeouts that follow the hero (global) + * + timeouts that follow obj & monst that are migrating * * Level range: - * + timeouts that are level specific (e.g. storms) - * + timeouts that stay with the level (obj & monst) + * + timeouts that are level specific (e.g. storms) + * + timeouts that stay with the level (obj & monst) */ void save_timers(fd, mode, range) diff --git a/src/u_init.c b/src/u_init.c index b10628e2c..beca86829 100644 --- a/src/u_init.c +++ b/src/u_init.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 u_init.c $NHDT-Date: 1432512766 2015/05/25 00:12:46 $ $NHDT-Branch: master $:$NHDT-Revision: 1.34 $ */ +/* NetHack 3.6 u_init.c $NHDT-Date: 1446861772 2015/11/07 02:02:52 $ $NHDT-Branch: master $:$NHDT-Revision: 1.35 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -22,7 +22,7 @@ STATIC_DCL boolean FDECL(restricted_spell_discipline, (int)); #define UNDEF_BLESS 2 /* - * Initial inventory for the various roles. + * Initial inventory for the various roles. */ static struct trobj Archeologist[] = { @@ -170,7 +170,7 @@ static struct trobj Wizard[] = { }; /* - * Optional extra inventory items. + * Optional extra inventory items. */ static struct trobj Tinopener[] = { { TIN_OPENER, 0, TOOL_CLASS, 1, 0 }, @@ -184,8 +184,7 @@ static struct trobj Blindfold[] = { { BLINDFOLD, 0, TOOL_CLASS, 1, 0 }, { 0, 0, 0, 0, 0 } }; static struct trobj Instrument[] = { { WOODEN_FLUTE, 0, TOOL_CLASS, 1, 0 }, { 0, 0, 0, 0, 0 } }; -static struct trobj Xtra_food[] = { { UNDEF_TYP, UNDEF_SPE, FOOD_CLASS, 2, - 0 }, +static struct trobj Xtra_food[] = { { UNDEF_TYP, UNDEF_SPE, FOOD_CLASS, 2, 0 }, { 0, 0, 0, 0, 0 } }; static struct trobj Leash[] = { { LEASH, 0, TOOL_CLASS, 1, 0 }, { 0, 0, 0, 0, 0 } }; @@ -207,7 +206,7 @@ static struct inv_sub { { PM_ELF, BOW, ELVEN_BOW }, { PM_ELF, ARROW, ELVEN_ARROW }, { PM_ELF, HELMET, ELVEN_LEATHER_HELM }, - /* { PM_ELF, SMALL_SHIELD, ELVEN_SHIELD }, */ + /* { PM_ELF, SMALL_SHIELD, ELVEN_SHIELD }, */ { PM_ELF, CLOAK_OF_DISPLACEMENT, ELVEN_CLOAK }, { PM_ELF, CRAM_RATION, LEMBAS_WAFER }, { PM_ORC, DAGGER, ORCISH_DAGGER }, @@ -222,103 +221,104 @@ static struct inv_sub { { PM_DWARF, SPEAR, DWARVISH_SPEAR }, { PM_DWARF, SHORT_SWORD, DWARVISH_SHORT_SWORD }, { PM_DWARF, HELMET, DWARVISH_IRON_HELM }, - /* { PM_DWARF, SMALL_SHIELD, DWARVISH_ROUNDSHIELD }, */ - /* { PM_DWARF, PICK_AXE, DWARVISH_MATTOCK }, */ + /* { PM_DWARF, SMALL_SHIELD, DWARVISH_ROUNDSHIELD }, */ + /* { PM_DWARF, PICK_AXE, DWARVISH_MATTOCK }, */ { PM_GNOME, BOW, CROSSBOW }, { PM_GNOME, ARROW, CROSSBOW_BOLT }, { NON_PM, STRANGE_OBJECT, STRANGE_OBJECT } }; -static const struct def_skill Skill_A[] = { { P_DAGGER, P_BASIC }, - { P_KNIFE, P_BASIC }, - { P_PICK_AXE, P_EXPERT }, - { P_SHORT_SWORD, P_BASIC }, - { P_SCIMITAR, P_SKILLED }, - { P_SABER, P_EXPERT }, - { P_CLUB, P_SKILLED }, - { P_QUARTERSTAFF, P_SKILLED }, - { P_SLING, P_SKILLED }, - { P_DART, P_BASIC }, - { P_BOOMERANG, P_EXPERT }, - { P_WHIP, P_EXPERT }, - { P_UNICORN_HORN, P_SKILLED }, - { P_ATTACK_SPELL, P_BASIC }, - { P_HEALING_SPELL, P_BASIC }, - { P_DIVINATION_SPELL, P_EXPERT }, - { P_MATTER_SPELL, P_BASIC }, - { P_RIDING, P_BASIC }, - { P_TWO_WEAPON_COMBAT, P_BASIC }, - { P_BARE_HANDED_COMBAT, - P_EXPERT }, - { P_NONE, 0 } }; - -static const struct def_skill Skill_B[] = { { P_DAGGER, P_BASIC }, - { P_AXE, P_EXPERT }, - { P_PICK_AXE, P_SKILLED }, - { P_SHORT_SWORD, P_EXPERT }, - { P_BROAD_SWORD, P_SKILLED }, - { P_LONG_SWORD, P_SKILLED }, - { P_TWO_HANDED_SWORD, P_EXPERT }, - { P_SCIMITAR, P_SKILLED }, - { P_SABER, P_BASIC }, - { P_CLUB, P_SKILLED }, - { P_MACE, P_SKILLED }, - { P_MORNING_STAR, P_SKILLED }, - { P_FLAIL, P_BASIC }, - { P_HAMMER, P_EXPERT }, - { P_QUARTERSTAFF, P_BASIC }, - { P_SPEAR, P_SKILLED }, - { P_TRIDENT, P_SKILLED }, - { P_BOW, P_BASIC }, - { P_ATTACK_SPELL, P_SKILLED }, - { P_RIDING, P_BASIC }, - { P_TWO_WEAPON_COMBAT, P_BASIC }, - { P_BARE_HANDED_COMBAT, - P_MASTER }, - { P_NONE, 0 } }; - -static const struct def_skill Skill_C[] = { { P_DAGGER, P_BASIC }, - { P_KNIFE, P_SKILLED }, - { P_AXE, P_SKILLED }, - { P_PICK_AXE, P_BASIC }, - { P_CLUB, P_EXPERT }, - { P_MACE, P_EXPERT }, - { P_MORNING_STAR, P_BASIC }, - { P_FLAIL, P_SKILLED }, - { P_HAMMER, P_SKILLED }, - { P_QUARTERSTAFF, P_EXPERT }, - { P_POLEARMS, P_SKILLED }, - { P_SPEAR, P_EXPERT }, - { P_TRIDENT, P_SKILLED }, - { P_BOW, P_SKILLED }, - { P_SLING, P_EXPERT }, - { P_ATTACK_SPELL, P_BASIC }, - { P_MATTER_SPELL, P_SKILLED }, - { P_BOOMERANG, P_EXPERT }, - { P_UNICORN_HORN, P_BASIC }, - { P_BARE_HANDED_COMBAT, - P_MASTER }, - { P_NONE, 0 } }; - -static const struct def_skill Skill_H[] = { { P_DAGGER, P_SKILLED }, - { P_KNIFE, P_EXPERT }, - { P_SHORT_SWORD, P_SKILLED }, - { P_SCIMITAR, P_BASIC }, - { P_SABER, P_BASIC }, - { P_CLUB, P_SKILLED }, - { P_MACE, P_BASIC }, - { P_QUARTERSTAFF, P_EXPERT }, - { P_POLEARMS, P_BASIC }, - { P_SPEAR, P_BASIC }, - { P_TRIDENT, P_BASIC }, - { P_SLING, P_SKILLED }, - { P_DART, P_EXPERT }, - { P_SHURIKEN, P_SKILLED }, - { P_UNICORN_HORN, P_EXPERT }, - { P_HEALING_SPELL, P_EXPERT }, - { P_BARE_HANDED_COMBAT, P_BASIC }, - { P_NONE, 0 } }; - +static const struct def_skill Skill_A[] = { + { P_DAGGER, P_BASIC }, + { P_KNIFE, P_BASIC }, + { P_PICK_AXE, P_EXPERT }, + { P_SHORT_SWORD, P_BASIC }, + { P_SCIMITAR, P_SKILLED }, + { P_SABER, P_EXPERT }, + { P_CLUB, P_SKILLED }, + { P_QUARTERSTAFF, P_SKILLED }, + { P_SLING, P_SKILLED }, + { P_DART, P_BASIC }, + { P_BOOMERANG, P_EXPERT }, + { P_WHIP, P_EXPERT }, + { P_UNICORN_HORN, P_SKILLED }, + { P_ATTACK_SPELL, P_BASIC }, + { P_HEALING_SPELL, P_BASIC }, + { P_DIVINATION_SPELL, P_EXPERT }, + { P_MATTER_SPELL, P_BASIC }, + { P_RIDING, P_BASIC }, + { P_TWO_WEAPON_COMBAT, P_BASIC }, + { P_BARE_HANDED_COMBAT, P_EXPERT }, + { P_NONE, 0 } +}; +static const struct def_skill Skill_B[] = { + { P_DAGGER, P_BASIC }, + { P_AXE, P_EXPERT }, + { P_PICK_AXE, P_SKILLED }, + { P_SHORT_SWORD, P_EXPERT }, + { P_BROAD_SWORD, P_SKILLED }, + { P_LONG_SWORD, P_SKILLED }, + { P_TWO_HANDED_SWORD, P_EXPERT }, + { P_SCIMITAR, P_SKILLED }, + { P_SABER, P_BASIC }, + { P_CLUB, P_SKILLED }, + { P_MACE, P_SKILLED }, + { P_MORNING_STAR, P_SKILLED }, + { P_FLAIL, P_BASIC }, + { P_HAMMER, P_EXPERT }, + { P_QUARTERSTAFF, P_BASIC }, + { P_SPEAR, P_SKILLED }, + { P_TRIDENT, P_SKILLED }, + { P_BOW, P_BASIC }, + { P_ATTACK_SPELL, P_SKILLED }, + { P_RIDING, P_BASIC }, + { P_TWO_WEAPON_COMBAT, P_BASIC }, + { P_BARE_HANDED_COMBAT, P_MASTER }, + { P_NONE, 0 } +}; +static const struct def_skill Skill_C[] = { + { P_DAGGER, P_BASIC }, + { P_KNIFE, P_SKILLED }, + { P_AXE, P_SKILLED }, + { P_PICK_AXE, P_BASIC }, + { P_CLUB, P_EXPERT }, + { P_MACE, P_EXPERT }, + { P_MORNING_STAR, P_BASIC }, + { P_FLAIL, P_SKILLED }, + { P_HAMMER, P_SKILLED }, + { P_QUARTERSTAFF, P_EXPERT }, + { P_POLEARMS, P_SKILLED }, + { P_SPEAR, P_EXPERT }, + { P_TRIDENT, P_SKILLED }, + { P_BOW, P_SKILLED }, + { P_SLING, P_EXPERT }, + { P_ATTACK_SPELL, P_BASIC }, + { P_MATTER_SPELL, P_SKILLED }, + { P_BOOMERANG, P_EXPERT }, + { P_UNICORN_HORN, P_BASIC }, + { P_BARE_HANDED_COMBAT, P_MASTER }, + { P_NONE, 0 } +}; +static const struct def_skill Skill_H[] = { + { P_DAGGER, P_SKILLED }, + { P_KNIFE, P_EXPERT }, + { P_SHORT_SWORD, P_SKILLED }, + { P_SCIMITAR, P_BASIC }, + { P_SABER, P_BASIC }, + { P_CLUB, P_SKILLED }, + { P_MACE, P_BASIC }, + { P_QUARTERSTAFF, P_EXPERT }, + { P_POLEARMS, P_BASIC }, + { P_SPEAR, P_BASIC }, + { P_TRIDENT, P_BASIC }, + { P_SLING, P_SKILLED }, + { P_DART, P_EXPERT }, + { P_SHURIKEN, P_SKILLED }, + { P_UNICORN_HORN, P_EXPERT }, + { P_HEALING_SPELL, P_EXPERT }, + { P_BARE_HANDED_COMBAT, P_BASIC }, + { P_NONE, 0 } +}; static const struct def_skill Skill_K[] = { { P_DAGGER, P_BASIC }, { P_KNIFE, P_BASIC }, @@ -349,7 +349,6 @@ static const struct def_skill Skill_K[] = { { P_BARE_HANDED_COMBAT, P_EXPERT }, { P_NONE, 0 } }; - static const struct def_skill Skill_Mon[] = { { P_QUARTERSTAFF, P_BASIC }, { P_SPEAR, P_BASIC }, @@ -365,57 +364,57 @@ static const struct def_skill Skill_Mon[] = { { P_MARTIAL_ARTS, P_GRAND_MASTER }, { P_NONE, 0 } }; - -static const struct def_skill Skill_P[] = { { P_CLUB, P_EXPERT }, - { P_MACE, P_EXPERT }, - { P_MORNING_STAR, P_EXPERT }, - { P_FLAIL, P_EXPERT }, - { P_HAMMER, P_EXPERT }, - { P_QUARTERSTAFF, P_EXPERT }, - { P_POLEARMS, P_SKILLED }, - { P_SPEAR, P_SKILLED }, - { P_TRIDENT, P_SKILLED }, - { P_LANCE, P_BASIC }, - { P_BOW, P_BASIC }, - { P_SLING, P_BASIC }, - { P_CROSSBOW, P_BASIC }, - { P_DART, P_BASIC }, - { P_SHURIKEN, P_BASIC }, - { P_BOOMERANG, P_BASIC }, - { P_UNICORN_HORN, P_SKILLED }, - { P_HEALING_SPELL, P_EXPERT }, - { P_DIVINATION_SPELL, P_EXPERT }, - { P_CLERIC_SPELL, P_EXPERT }, - { P_BARE_HANDED_COMBAT, P_BASIC }, - { P_NONE, 0 } }; - -static const struct def_skill Skill_R[] = { { P_DAGGER, P_EXPERT }, - { P_KNIFE, P_EXPERT }, - { P_SHORT_SWORD, P_EXPERT }, - { P_BROAD_SWORD, P_SKILLED }, - { P_LONG_SWORD, P_SKILLED }, - { P_TWO_HANDED_SWORD, P_BASIC }, - { P_SCIMITAR, P_SKILLED }, - { P_SABER, P_SKILLED }, - { P_CLUB, P_SKILLED }, - { P_MACE, P_SKILLED }, - { P_MORNING_STAR, P_BASIC }, - { P_FLAIL, P_BASIC }, - { P_HAMMER, P_BASIC }, - { P_POLEARMS, P_BASIC }, - { P_SPEAR, P_BASIC }, - { P_CROSSBOW, P_EXPERT }, - { P_DART, P_EXPERT }, - { P_SHURIKEN, P_SKILLED }, - { P_DIVINATION_SPELL, P_SKILLED }, - { P_ESCAPE_SPELL, P_SKILLED }, - { P_MATTER_SPELL, P_SKILLED }, - { P_RIDING, P_BASIC }, - { P_TWO_WEAPON_COMBAT, P_EXPERT }, - { P_BARE_HANDED_COMBAT, - P_EXPERT }, - { P_NONE, 0 } }; - +static const struct def_skill Skill_P[] = { + { P_CLUB, P_EXPERT }, + { P_MACE, P_EXPERT }, + { P_MORNING_STAR, P_EXPERT }, + { P_FLAIL, P_EXPERT }, + { P_HAMMER, P_EXPERT }, + { P_QUARTERSTAFF, P_EXPERT }, + { P_POLEARMS, P_SKILLED }, + { P_SPEAR, P_SKILLED }, + { P_TRIDENT, P_SKILLED }, + { P_LANCE, P_BASIC }, + { P_BOW, P_BASIC }, + { P_SLING, P_BASIC }, + { P_CROSSBOW, P_BASIC }, + { P_DART, P_BASIC }, + { P_SHURIKEN, P_BASIC }, + { P_BOOMERANG, P_BASIC }, + { P_UNICORN_HORN, P_SKILLED }, + { P_HEALING_SPELL, P_EXPERT }, + { P_DIVINATION_SPELL, P_EXPERT }, + { P_CLERIC_SPELL, P_EXPERT }, + { P_BARE_HANDED_COMBAT, P_BASIC }, + { P_NONE, 0 } +}; +static const struct def_skill Skill_R[] = { + { P_DAGGER, P_EXPERT }, + { P_KNIFE, P_EXPERT }, + { P_SHORT_SWORD, P_EXPERT }, + { P_BROAD_SWORD, P_SKILLED }, + { P_LONG_SWORD, P_SKILLED }, + { P_TWO_HANDED_SWORD, P_BASIC }, + { P_SCIMITAR, P_SKILLED }, + { P_SABER, P_SKILLED }, + { P_CLUB, P_SKILLED }, + { P_MACE, P_SKILLED }, + { P_MORNING_STAR, P_BASIC }, + { P_FLAIL, P_BASIC }, + { P_HAMMER, P_BASIC }, + { P_POLEARMS, P_BASIC }, + { P_SPEAR, P_BASIC }, + { P_CROSSBOW, P_EXPERT }, + { P_DART, P_EXPERT }, + { P_SHURIKEN, P_SKILLED }, + { P_DIVINATION_SPELL, P_SKILLED }, + { P_ESCAPE_SPELL, P_SKILLED }, + { P_MATTER_SPELL, P_SKILLED }, + { P_RIDING, P_BASIC }, + { P_TWO_WEAPON_COMBAT, P_EXPERT }, + { P_BARE_HANDED_COMBAT, P_EXPERT }, + { P_NONE, 0 } +}; static const struct def_skill Skill_Ran[] = { { P_DAGGER, P_EXPERT }, { P_KNIFE, P_SKILLED }, @@ -443,29 +442,29 @@ static const struct def_skill Skill_Ran[] = { { P_BARE_HANDED_COMBAT, P_BASIC }, { P_NONE, 0 } }; - -static const struct def_skill Skill_S[] = { { P_DAGGER, P_BASIC }, - { P_KNIFE, P_SKILLED }, - { P_SHORT_SWORD, P_EXPERT }, - { P_BROAD_SWORD, P_SKILLED }, - { P_LONG_SWORD, P_EXPERT }, - { P_TWO_HANDED_SWORD, P_EXPERT }, - { P_SCIMITAR, P_BASIC }, - { P_SABER, P_BASIC }, - { P_FLAIL, P_SKILLED }, - { P_QUARTERSTAFF, P_BASIC }, - { P_POLEARMS, P_SKILLED }, - { P_SPEAR, P_SKILLED }, - { P_LANCE, P_SKILLED }, - { P_BOW, P_EXPERT }, - { P_SHURIKEN, P_EXPERT }, - { P_ATTACK_SPELL, P_SKILLED }, - { P_CLERIC_SPELL, P_SKILLED }, - { P_RIDING, P_SKILLED }, - { P_TWO_WEAPON_COMBAT, P_EXPERT }, - { P_MARTIAL_ARTS, P_MASTER }, - { P_NONE, 0 } }; - +static const struct def_skill Skill_S[] = { + { P_DAGGER, P_BASIC }, + { P_KNIFE, P_SKILLED }, + { P_SHORT_SWORD, P_EXPERT }, + { P_BROAD_SWORD, P_SKILLED }, + { P_LONG_SWORD, P_EXPERT }, + { P_TWO_HANDED_SWORD, P_EXPERT }, + { P_SCIMITAR, P_BASIC }, + { P_SABER, P_BASIC }, + { P_FLAIL, P_SKILLED }, + { P_QUARTERSTAFF, P_BASIC }, + { P_POLEARMS, P_SKILLED }, + { P_SPEAR, P_SKILLED }, + { P_LANCE, P_SKILLED }, + { P_BOW, P_EXPERT }, + { P_SHURIKEN, P_EXPERT }, + { P_ATTACK_SPELL, P_SKILLED }, + { P_CLERIC_SPELL, P_SKILLED }, + { P_RIDING, P_SKILLED }, + { P_TWO_WEAPON_COMBAT, P_EXPERT }, + { P_MARTIAL_ARTS, P_MASTER }, + { P_NONE, 0 } +}; static const struct def_skill Skill_T[] = { { P_DAGGER, P_EXPERT }, { P_KNIFE, P_SKILLED }, @@ -502,7 +501,6 @@ static const struct def_skill Skill_T[] = { { P_BARE_HANDED_COMBAT, P_SKILLED }, { P_NONE, 0 } }; - static const struct def_skill Skill_V[] = { { P_DAGGER, P_EXPERT }, { P_AXE, P_EXPERT }, @@ -527,31 +525,31 @@ static const struct def_skill Skill_V[] = { { P_BARE_HANDED_COMBAT, P_EXPERT }, { P_NONE, 0 } }; - -static const struct def_skill Skill_W[] = { { P_DAGGER, P_EXPERT }, - { P_KNIFE, P_SKILLED }, - { P_AXE, P_SKILLED }, - { P_SHORT_SWORD, P_BASIC }, - { P_CLUB, P_SKILLED }, - { P_MACE, P_BASIC }, - { P_QUARTERSTAFF, P_EXPERT }, - { P_POLEARMS, P_SKILLED }, - { P_SPEAR, P_BASIC }, - { P_TRIDENT, P_BASIC }, - { P_SLING, P_SKILLED }, - { P_DART, P_EXPERT }, - { P_SHURIKEN, P_BASIC }, - { P_ATTACK_SPELL, P_EXPERT }, - { P_HEALING_SPELL, P_SKILLED }, - { P_DIVINATION_SPELL, P_EXPERT }, - { P_ENCHANTMENT_SPELL, - P_SKILLED }, - { P_CLERIC_SPELL, P_SKILLED }, - { P_ESCAPE_SPELL, P_EXPERT }, - { P_MATTER_SPELL, P_EXPERT }, - { P_RIDING, P_BASIC }, - { P_BARE_HANDED_COMBAT, P_BASIC }, - { P_NONE, 0 } }; +static const struct def_skill Skill_W[] = { + { P_DAGGER, P_EXPERT }, + { P_KNIFE, P_SKILLED }, + { P_AXE, P_SKILLED }, + { P_SHORT_SWORD, P_BASIC }, + { P_CLUB, P_SKILLED }, + { P_MACE, P_BASIC }, + { P_QUARTERSTAFF, P_EXPERT }, + { P_POLEARMS, P_SKILLED }, + { P_SPEAR, P_BASIC }, + { P_TRIDENT, P_BASIC }, + { P_SLING, P_SKILLED }, + { P_DART, P_EXPERT }, + { P_SHURIKEN, P_BASIC }, + { P_ATTACK_SPELL, P_EXPERT }, + { P_HEALING_SPELL, P_SKILLED }, + { P_DIVINATION_SPELL, P_EXPERT }, + { P_ENCHANTMENT_SPELL, P_SKILLED }, + { P_CLERIC_SPELL, P_SKILLED }, + { P_ESCAPE_SPELL, P_EXPERT }, + { P_MATTER_SPELL, P_EXPERT }, + { P_RIDING, P_BASIC }, + { P_BARE_HANDED_COMBAT, P_BASIC }, + { P_NONE, 0 } +}; STATIC_OVL void knows_object(obj) @@ -578,8 +576,7 @@ void u_init() { register int i; - struct u_roleplay tmpuroleplay = - u.uroleplay; /* these set by rcfile options */ + struct u_roleplay tmpuroleplay = u.uroleplay; /* set by rcfile options */ flags.female = flags.initgend; flags.beginner = 1; @@ -594,24 +591,24 @@ u_init() u.uroleplay = tmpuroleplay; /* restore options set via rcfile */ #if 0 /* documentation of more zero values as desirable */ - u.usick_cause[0] = 0; - u.uluck = u.moreluck = 0; - uarmu = 0; - uarm = uarmc = uarmh = uarms = uarmg = uarmf = 0; - uwep = uball = uchain = uleft = uright = 0; - uswapwep = uquiver = 0; - u.twoweap = 0; - u.ublessed = 0; /* not worthy yet */ - u.ugangr = 0; /* gods not angry */ - u.ugifts = 0; /* no divine gifts bestowed */ - u.uevent.uhand_of_elbereth = 0; - u.uevent.uheard_tune = 0; - u.uevent.uopened_dbridge = 0; - u.uevent.udemigod = 0; /* not a demi-god yet... */ - u.udg_cnt = 0; - u.mh = u.mhmax = u.mtimedone = 0; - u.uz.dnum = u.uz0.dnum = 0; - u.utotype = 0; + u.usick_cause[0] = 0; + u.uluck = u.moreluck = 0; + uarmu = 0; + uarm = uarmc = uarmh = uarms = uarmg = uarmf = 0; + uwep = uball = uchain = uleft = uright = 0; + uswapwep = uquiver = 0; + u.twoweap = 0; + u.ublessed = 0; /* not worthy yet */ + u.ugangr = 0; /* gods not angry */ + u.ugifts = 0; /* no divine gifts bestowed */ + u.uevent.uhand_of_elbereth = 0; + u.uevent.uheard_tune = 0; + u.uevent.uopened_dbridge = 0; + u.uevent.udemigod = 0; /* not a demi-god yet... */ + u.udg_cnt = 0; + u.mh = u.mhmax = u.mtimedone = 0; + u.uz.dnum = u.uz0.dnum = 0; + u.utotype = 0; #endif /* 0 */ u.uz.dlevel = 1; @@ -884,12 +881,13 @@ u_init() find_ac(); /* get initial ac value */ init_attr(75); /* init attribute values */ max_rank_sz(); /* set max str size for class ranks */ - /* - * Do we really need this? - */ + /* + * Do we really need this? + */ for (i = 0; i < A_MAX; i++) if (!rn2(20)) { register int xd = rn2(7) - 2; /* biased variation */ + (void) adjattrib(i, xd, TRUE); if (ABASE(i) < AMAX(i)) AMAX(i) = ABASE(i); @@ -957,8 +955,8 @@ int otyp; skills = Skill_W; break; default: - skills = 0; - break; /* lint suppression */ + skills = 0; /* lint suppression */ + break; } while (skills->skill != P_NONE) { diff --git a/src/vision.c b/src/vision.c index c3e072ab2..702cbacd2 100644 --- a/src/vision.c +++ b/src/vision.c @@ -1,6 +1,6 @@ -/* NetHack 3.6 vision.c $NHDT-Date: 1432512763 2015/05/25 00:12:43 $ $NHDT-Branch: master $:$NHDT-Revision: 1.23 $ */ -/* Copyright (c) Dean Luick, with acknowledgements to Dave Cohrs, 1990. */ -/* NetHack may be freely redistributed. See license for details. */ +/* NetHack 3.6 vision.c $NHDT-Date: 1446861773 2015/11/07 02:02:53 $ $NHDT-Branch: master $:$NHDT-Revision: 1.26 $ */ +/* Copyright (c) Dean Luick, with acknowledgements to Dave Cohrs, 1990. */ +/* NetHack may be freely redistributed. See license for details. */ #include "hack.h" @@ -16,11 +16,11 @@ * offset on the same row as the source *is* included so we don't have to * make an extra check. For example, a circle of radius 4 has offsets: * - * XXX +2 - * ...X +3 - * ....X +4 - * ....X +4 - * @...X +4 + * XXX +2 + * ...X +3 + * ....X +4 + * ....X +4 + * @...X +4 * */ char circle_data[] = { @@ -39,8 +39,7 @@ char circle_data[] = { /* 90*/ 13, 13, 13, 13, 12, 12, 12, 11, 10, 10, 9, 7, 6, 3, /*104*/ 14, 14, 14, 14, 13, 13, 13, 12, 12, 11, 10, 9, 8, 6, 3, /*119*/ 15, 15, 15, 15, 14, 14, 14, 13, 13, 12, 11, 10, 9, 8, 6, 3, - /*135*/ 16 /* should be MAX_RADIUS+1; used to terminate range loops -dlc - */ + /*135*/ 16 /* MAX_RADIUS+1; used to terminate range loops -dlc */ }; /* @@ -74,10 +73,10 @@ char circle_start[] = { #if 0 /* (moved to decl.c) */ /* True if we need to run a full vision recalculation. */ -boolean vision_full_recalc = 0; +boolean vision_full_recalc = 0; /* Pointers to the current vision array. */ -char **viz_array; +char **viz_array; #endif char *viz_rmin, *viz_rmax; /* current vision cs bounds */ @@ -289,8 +288,8 @@ char **rmin, **rmax; * Set the "could see" and in sight bits so vision acts just like the old * rogue game: * - * + If in a room, the hero can see to the room boundaries. - * + The hero can always see adjacent squares. + * + If in a room, the hero can see to the room boundaries. + * + The hero can always see adjacent squares. * * We set the in_sight bit here as well to escape a bug that shows up * due to the one-sided lit wall hack. @@ -367,17 +366,17 @@ STATIC_DCL int FDECL(new_angle, (struct rm *, unsigned char *, int, int)); * see, then we want to extend a spine of the T to connect with the wall * that is beyond. Example: * - * Correct, but ugly Extend T spine + * Correct, but ugly Extend T spine * - * | ... | ... - * | ... <-- wall beyond & floor --> | ... - * | ... | ... - * Unseen --> ... | ... - * spine +-... <-- trwall & doorway --> +-... - * | ... | ... + * | ... | ... + * | ... <-- wall beyond & floor --> | ... + * | ... | ... + * Unseen --> ... | ... + * spine +-... <-- trwall & doorway --> +-... + * | ... | ... * * - * @ <-- hero --> @ + * @ <-- hero --> @ * * * We fake the above check by only checking if the horizontal & @@ -385,17 +384,17 @@ STATIC_DCL int FDECL(new_angle, (struct rm *, unsigned char *, int, int)); * unblocked. Then, _in general_ we can see beyond. Generally, * this is good enough. * - * + When this function is called we don't have all of the seen - * information (we're doing a top down scan in vision_recalc). - * We would need to scan once to set all IN_SIGHT and COULD_SEE - * bits, then again to correctly set the seenv bits. - * + I'm trying to make this as cheap as possible. The display & - * vision eat up too much CPU time. + * + When this function is called we don't have all of the seen + * information (we're doing a top down scan in vision_recalc). + * We would need to scan once to set all IN_SIGHT and COULD_SEE + * bits, then again to correctly set the seenv bits. + * + I'm trying to make this as cheap as possible. The display & + * vision eat up too much CPU time. * * * Note: Even as I write this, I'm still not convinced. There are too - * many exceptions. I may have to bite the bullet and do more - * checks. - Dean 2/11/93 + * many exceptions. I may have to bite the bullet and do more + * checks. - Dean 2/11/93 */ STATIC_OVL int new_angle(lev, sv, row, col) @@ -471,32 +470,32 @@ int row, col; * can see. (1) and (2) call this routine for synchronization purposes, (3) * calls this routine so it can operate correctly. * - * + After the monster move, before input from the player. [moveloop()] - * + At end of moveloop. [moveloop() ??? not sure why this is here] - * + Right before something is printed. [pline()] - * + Right before we do a vision based operation. [do_clear_area()] - * + screen redraw, so we can renew all positions in sight. [docrt()] - * + When toggling temporary blindness, in case additional events - * impacted by vision occur during the same move [make_blinded()] + * + After the monster move, before input from the player. [moveloop()] + * + At end of moveloop. [moveloop() ??? not sure why this is here] + * + Right before something is printed. [pline()] + * + Right before we do a vision based operation. [do_clear_area()] + * + screen redraw, so we can renew all positions in sight. [docrt()] + * + When toggling temporary blindness, in case additional events + * impacted by vision occur during the same move [make_blinded()] * * Control flag = 1. An adjacent vision recalculation. The hero has moved * one square. Knowing this, it might be possible to optimize the vision * recalculation using the current knowledge. This is presently unimplemented * and is treated as a control = 0 call. * - * + Right after the hero moves. [domove()] + * + Right after the hero moves. [domove()] * * Control flag = 2. Turn off the vision system. Nothing new will be * displayed, since nothing is seen. This is usually done when you need * a newsym() run on all locations in sight, or on some locations but you * don't know which ones. * - * + Before a screen redraw, so all positions are renewed. [docrt()] - * + Right before the hero arrives on a new level. [goto_level()] - * + Right after a scroll of light is read. [litroom()] - * + After an option has changed that affects vision [parseoptions()] - * + Right after the hero is swallowed. [gulpmu()] - * + Just before bubbles are moved. [movebubbles()] + * + Before a screen redraw, so all positions are renewed. [docrt()] + * + Right before the hero arrives on a new level. [goto_level()] + * + Right after a scroll of light is read. [litroom()] + * + After an option has changed that affects vision [parseoptions()] + * + Right after the hero is swallowed. [gulpmu()] + * + Just before bubbles are moved. [movebubbles()] */ void vision_recalc(control) @@ -542,10 +541,10 @@ int control; * can see you, even if you can't see them. Note that the current * setup allows: * - * + Monsters to see with the "new" vision, even on the rogue - * level. + * + Monsters to see with the "new" vision, even on the rogue + * level. * - * + Monsters can see you even when you're in a pit. + * + Monsters can see you even when you're in a pit. */ view_from(u.uy, u.ux, next_array, next_rmin, next_rmax, 0, (void FDECL((*), (int, int, genericptr_t))) 0, @@ -702,8 +701,8 @@ int control; /* * The main update loop. Here we do two things: * - * + Set the IN_SIGHT bit for places that we could see and are lit. - * + Reset changed places. + * + Set the IN_SIGHT bit for places that we could see and are lit. + * + Reset changed places. * * There is one thing that make deciding what the hero can see * difficult: @@ -712,8 +711,8 @@ int control; * The worst offenders are doors. Suppose a door to a lit room * is closed. It is lit on one side, but not on the other. How * do you know? You have to check the closest adjacent position. - * Even so, that is not entirely correct. But it seems close - * enough for now. + * Even so, that is not entirely correct. But it seems close + * enough for now. */ colbump[u.ux] = colbump[u.ux + 1] = 1; for (row = 0; row < ROWNO; row++) { @@ -880,21 +879,19 @@ int x, y; } /*===========================================================================*\ - | | - | Everything below this line uses (y,x) instead of (x,y) --- the | - | algorithms are faster if they are less recursive and can scan | - | on a row longer. | - | | + | | + | Everything below this line uses (y,x) instead of (x,y) --- the | + | algorithms are faster if they are less recursive and can scan | + | on a row longer. | + | | \*===========================================================================*/ -/* ========================================================================= -*\ +/* ======================================================================== *\ Left and Right Pointer Updates -\* ========================================================================= -*/ +\* ======================================================================== */ /* - * LEFT and RIGHT pointer rules + * LEFT and RIGHT pointer rules * * * **NOTE** The rules changed on 4/4/90. This comment reflects the @@ -1117,12 +1114,12 @@ static genericptr_t varg; /* * Both Algorithms C and D use the following macros. * - * good_row(z) - Return TRUE if the argument is a legal row. + * good_row(z) - Return TRUE if the argument is a legal row. * set_cs(rowp,col) - Set the local could see array. - * set_min(z) - Save the min value of the argument and the current - * row minimum. - * set_max(z) - Save the max value of the argument and the current - * row maximum. + * set_min(z) - Save the min value of the argument and the current + * row minimum. + * set_max(z) - Save the max value of the argument and the current + * row maximum. * * The last three macros depend on having local pointers row_min, row_max, * and rowp being set correctly. @@ -1131,19 +1128,19 @@ static genericptr_t varg; #define good_row(z) ((z) >= 0 && (z) < ROWNO) #define set_min(z) \ if (*row_min > (z)) \ - *row_min = (z) + *row_min = (z) #define set_max(z) \ if (*row_max < (z)) \ - *row_max = (z) + *row_max = (z) #define is_clear(row, col) viz_clear_rows[row][col] /* - * clear_path() expanded into 4 macros/functions: + * clear_path() expanded into 4 macros/functions: * - * q1_path() - * q2_path() - * q3_path() - * q4_path() + * q1_path() + * q2_path() + * q3_path() + * q4_path() * * "Draw" a line from the start to the given location. Stop if we hit * something that blocks light. The start and finish points themselves are @@ -1567,9 +1564,9 @@ int scol, srow, y2, x2; /* * Use vision tables to determine if there is a clear path from * (col1,row1) to (col2,row2). This is used by: - * m_cansee() - * m_canseeu() - * do_light_sources() + * m_cansee() + * m_canseeu() + * do_light_sources() */ boolean clear_path(col1, row1, col2, row2) @@ -1595,7 +1592,7 @@ int col1, row1, col2, row2; #ifdef MACRO_CPATH cleardone: #endif - return ((boolean) result); + return (boolean) result; } #ifdef VISION_TABLES @@ -1854,12 +1851,12 @@ char *limits; /* points at range limit for current row, or NULL */ if (!viz_clear_rows[row][left]) { hit_stone = 1; /* use stone on this row as close block */ - /* - * We can see all of the wall until the next open spot or the - * start of the shadow caused by the far block (right). - * - * Can't see stone beyond the right mark. - */ + /* + * We can see all of the wall until the next open spot or the + * start of the shadow caused by the far block (right). + * + * Can't see stone beyond the right mark. + */ if (loc_right > right_mark) loc_right = right_mark; @@ -2415,7 +2412,7 @@ char *limits; /* points at range limit for current row, or NULL */ * Check for boundary conditions. We *need* check (2) to break * an infinite loop where: * - * left == right_edge == right_mark == lim_max. + * left == right_edge == right_mark == lim_max. * */ if (left > lim_max) diff --git a/src/wield.c b/src/wield.c index 236367ab6..9d4e2f706 100644 --- a/src/wield.c +++ b/src/wield.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 wield.c $NHDT-Date: 1445126432 2015/10/18 00:00:32 $ $NHDT-Branch: master $:$NHDT-Revision: 1.45 $ */ +/* NetHack 3.6 wield.c $NHDT-Date: 1446861774 2015/11/07 02:02:54 $ $NHDT-Branch: master $:$NHDT-Revision: 1.46 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -87,9 +87,9 @@ register struct obj *obj; if (obj == uwep) return; /* necessary to not set unweapon */ - /* This message isn't printed in the caller because it happens - * *whenever* Sunsword is unwielded, from whatever cause. - */ + /* This message isn't printed in the caller because it happens + * *whenever* Sunsword is unwielded, from whatever cause. + */ setworn(obj, W_WEP); if (uwep == obj && artifact_light(olduwep) && olduwep->lamplit) { end_burn(olduwep, FALSE); @@ -211,7 +211,7 @@ struct obj *wep; } } } - return (res); + return res; } void @@ -249,35 +249,35 @@ dowield() multi = 0; if (cantwield(youmonst.data)) { pline("Don't be ridiculous!"); - return (0); + return 0; } /* Prompt for a new weapon */ if (!(wep = getobj(wield_objs, "wield"))) /* Cancelled */ - return (0); + return 0; else if (wep == uwep) { You("are already wielding that!"); if (is_weptool(wep) || is_wet_towel(wep)) unweapon = FALSE; /* [see setuwep()] */ - return (0); + return 0; } else if (welded(uwep)) { weldmsg(uwep); /* previously interrupted armor removal mustn't be resumed */ reset_remarm(); - return (0); + return 0; } /* Handle no object, or object in other slot */ if (wep == &zeroobj) wep = (struct obj *) 0; else if (wep == uswapwep) - return (doswapweapon()); + return doswapweapon(); else if (wep == uquiver) setuqwep((struct obj *) 0); else if (wep->owornmask & (W_ARMOR | W_ACCESSORY | W_SADDLE)) { You("cannot wield that!"); - return (0); + return 0; } /* Set your new primary weapon */ @@ -287,7 +287,7 @@ dowield() setuswapwep(oldwep); untwoweapon(); - return (result); + return result; } int @@ -300,11 +300,11 @@ doswapweapon() multi = 0; if (cantwield(youmonst.data)) { pline("Don't be ridiculous!"); - return (0); + return 0; } if (welded(uwep)) { weldmsg(uwep); - return (0); + return 0; } /* Unwield your current secondary weapon */ @@ -330,7 +330,7 @@ doswapweapon() if (u.twoweap && !can_twoweapon()) untwoweapon(); - return (result); + return result; } int @@ -350,7 +350,7 @@ dowieldquiver() /* Prompt for a new quiver */ if (!(newquiver = getobj(quivee_types, "ready"))) /* Cancelled */ - return (0); + return 0; /* Handle no object, or object in other slot */ /* Any type is okay, since we give no intrinsics anyways */ @@ -361,19 +361,19 @@ dowieldquiver() setuqwep(newquiver = (struct obj *) 0); } else { You("already have no ammunition readied!"); - return (0); + return 0; } } else if (newquiver == uquiver) { pline("That ammunition is already readied!"); - return (0); + return 0; } else if (newquiver == uwep) { /* Prevent accidentally readying the main weapon */ pline("%s already being used as a weapon!", !is_plural(uwep) ? "That is" : "They are"); - return (0); + return 0; } else if (newquiver->owornmask & (W_ARMOR | W_ACCESSORY | W_SADDLE)) { You("cannot ready that!"); - return (0); + return 0; } else { long dummy; @@ -393,7 +393,7 @@ dowieldquiver() /* Finally, place it in the quiver */ setuqwep(newquiver); /* Take no time since this is a convenience slot */ - return (0); + return 0; } /* used for #rub and for applying pick-axe, whip, grappling hook or polearm */ @@ -507,8 +507,8 @@ can_twoweapon() uswapwep->bknown = TRUE; drop_uswapwep(); } else - return (TRUE); - return (FALSE); + return TRUE; + return FALSE; } void @@ -531,7 +531,7 @@ dotwoweapon() You("switch to your primary weapon."); u.twoweap = 0; update_inventory(); - return (0); + return 0; } /* May we use two weapons? */ @@ -542,7 +542,7 @@ dotwoweapon() update_inventory(); return (rnd(20) > ACURR(A_DEX)); } - return (0); + return 0; } /*** Functions to empty a given slot ***/ @@ -612,7 +612,7 @@ register int amount; (amount >= 0) ? "twitch" : "itch"); strange_feeling(otmp, buf); exercise(A_DEX, (boolean)(amount >= 0)); - return (0); + return 0; } if (otmp && otmp->oclass == SCROLL_CLASS) @@ -663,7 +663,7 @@ register int amount; if (amount < 0 && uwep->oartifact && restrict_name(uwep, wepname)) { if (!Blind) pline("%s %s.", Yobjnam2(uwep, "faintly glow"), color); - return (1); + return 1; } /* there is a (soft) upper and lower limit to uwep->spe */ if (((uwep->spe > 5 && amount >= 0) || (uwep->spe < -5 && amount < 0)) @@ -676,7 +676,7 @@ register int amount; pline("%s.", Yobjnam2(uwep, "evaporate")); useupall(uwep); /* let all of them disappear */ - return (1); + return 1; } if (!Blind) { xtime = (amount * amount == 1) ? "moment" : "while"; @@ -714,7 +714,7 @@ register int amount; && (is_elven_weapon(uwep) || uwep->oartifact || !rn2(7))) pline("%s unexpectedly.", Yobjnam2(uwep, "suddenly vibrate")); - return (1); + return 1; } int diff --git a/src/zap.c b/src/zap.c index f05ec6cb8..62ea81ce3 100644 --- a/src/zap.c +++ b/src/zap.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 zap.c $NHDT-Date: 1446713647 2015/11/05 08:54:07 $ $NHDT-Branch: master $:$NHDT-Revision: 1.231 $ */ +/* NetHack 3.6 zap.c $NHDT-Date: 1446861775 2015/11/07 02:02:55 $ $NHDT-Branch: master $:$NHDT-Revision: 1.232 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -344,8 +344,8 @@ struct obj *otmp; } break; case WAN_SLEEP: /* (broken wand) */ - /* [wakeup() doesn't rouse victims of temporary sleep, - so it's okay to leave `wake' set to TRUE here] */ + /* [wakeup() doesn't rouse victims of temporary sleep, + so it's okay to leave `wake' set to TRUE here] */ reveal_invis = TRUE; if (sleep_monst(mtmp, d(1 + otmp->spe, 12), WAND_CLASS)) slept_monst(mtmp); @@ -355,6 +355,7 @@ struct obj *otmp; case SPE_STONE_TO_FLESH: if (monsndx(mtmp->data) == PM_STONE_GOLEM) { char *name = Monnam(mtmp); + /* turn into flesh golem */ if (newcham(mtmp, &mons[PM_FLESH_GOLEM], FALSE, FALSE)) { if (canseemon(mtmp)) @@ -1669,7 +1670,7 @@ struct obj *obj; smell = TRUE; break; case WEAPON_CLASS: /* crysknife */ - /* fall through */ + /*FALLTHRU*/ default: res = 0; break; @@ -2320,7 +2321,7 @@ boolean ordinary; You_feel("%sbetter.", obj->otyp == SPE_EXTRA_HEALING ? "much " : ""); break; case WAN_LIGHT: /* (broken wand) */ - /* assert( !ordinary ); */ + /* assert( !ordinary ); */ damage = d(obj->spe, 25); case EXPENSIVE_CAMERA: if (!damage)