From a4be9baa7af0116b50c038d8efa00f216b1b41f9 Mon Sep 17 00:00:00 2001 From: David Lawrence Ramsey Date: Sun, 8 Nov 2009 17:10:37 -0600 Subject: Reorder the parameters in mgen_data::hostile_at() to be closer to the order used in mgen_data(), and allow the former to specify the base monster, as the latter does. --- crawl-ref/source/art-func.h | 2 +- crawl-ref/source/decks.cc | 2 +- crawl-ref/source/effects.cc | 2 +- crawl-ref/source/godwrath.cc | 27 ++++++++++++--------------- crawl-ref/source/it_use3.cc | 4 ++-- crawl-ref/source/monplace.h | 16 +++++++++------- crawl-ref/source/spl-mis.cc | 4 ++-- crawl-ref/source/wiz-fsim.cc | 2 +- crawl-ref/source/xom.cc | 4 ++-- 9 files changed, 31 insertions(+), 32 deletions(-) diff --git a/crawl-ref/source/art-func.h b/crawl-ref/source/art-func.h index 05691edf71..f4c076e478 100644 --- a/crawl-ref/source/art-func.h +++ b/crawl-ref/source/art-func.h @@ -73,7 +73,7 @@ static bool _evoke_sceptre_of_asmodeus() summon_any_demon(DEMON_COMMON)); const bool good_summon = create_monster( mgen_data::hostile_at(mon, - you.pos(), 6, 0, true)) != -1; + true, 6, 0, you.pos())) != -1; if (good_summon) { diff --git a/crawl-ref/source/decks.cc b/crawl-ref/source/decks.cc index f5605b1615..a3e0250f37 100644 --- a/crawl-ref/source/decks.cc +++ b/crawl-ref/source/decks.cc @@ -2374,7 +2374,7 @@ static bool _trowel_card(int power, deck_rarity_type rarity) if (create_monster( mgen_data::hostile_at( RANDOM_ELEMENT(statues), - you.pos(), 0, 0, true)) != -1) + true, 0, 0, you.pos())) != -1) { mpr("A menacing statue appears!"); num_made++; diff --git a/crawl-ref/source/effects.cc b/crawl-ref/source/effects.cc index c88216ee35..f2b0635406 100644 --- a/crawl-ref/source/effects.cc +++ b/crawl-ref/source/effects.cc @@ -2868,7 +2868,7 @@ static void _hell_effects() { create_monster( mgen_data::hostile_at(which_beastie, - you.pos(), 0, 0, true)); + true, 0, 0, you.pos())); } else { diff --git a/crawl-ref/source/godwrath.cc b/crawl-ref/source/godwrath.cc index 2164bdc394..60657bd513 100644 --- a/crawl-ref/source/godwrath.cc +++ b/crawl-ref/source/godwrath.cc @@ -56,11 +56,8 @@ static bool _yred_random_zombified_hostile() else z_type = skel ? MONS_SKELETON_SMALL : MONS_ZOMBIE_SMALL; - mgen_data mg(z_type, BEH_HOSTILE, - 0, 0, you.pos(), MHITYOU, 0, GOD_YREDELEMNUL, - z_base); - - return (create_monster(mg) != -1); + return (create_monster(mgen_data::hostile_at(z_type, true, + 0, 0, you.pos(), 0, GOD_YREDELEMNUL, z_base)) != -1); } static bool _okawaru_random_servant() @@ -82,7 +79,7 @@ static bool _okawaru_random_servant() return (create_monster( mgen_data::hostile_at(mon, - you.pos(), 0, 0, true, GOD_OKAWARU)) != -1); + true, 0, 0, you.pos(), 0, GOD_OKAWARU)) != -1); } static bool _tso_retribution() @@ -201,7 +198,7 @@ static bool _zin_retribution() if (mons_place( mgen_data::hostile_at(mon, - mon_pos, 0, 0, true, god)) != -1) + true, 0, 0, mon_pos, 0, god)) != -1) { success = true; } @@ -398,7 +395,7 @@ static bool _makhleb_retribution() mgen_data::hostile_at( static_cast( MONS_EXECUTIONER + random2(5)), - you.pos(), 0, 0, true, god)) != -1); + true, 0, 0, you.pos(), 0, god)) != -1); simple_god_message(success ? " sends a greater servant after you!" : "'s greater servant is unavoidably " @@ -415,7 +412,7 @@ static bool _makhleb_retribution() mgen_data::hostile_at( static_cast( MONS_NEQOXEC + random2(5)), - you.pos(), 0, 0, true, god)) != -1) + true, 0, 0, you.pos(), 0, god)) != -1) { count++; } @@ -443,7 +440,7 @@ static bool _kikubaaqudgha_retribution() { if (create_monster( mgen_data::hostile_at(MONS_REAPER, - you.pos(), 0, 0, true, god)) != -1) + true, 0, 0, you.pos(), 0, god)) != -1) { success = true; } @@ -669,7 +666,7 @@ static bool _beogh_retribution() int midx = create_monster( mgen_data::hostile_at(MONS_DANCING_WEAPON, - you.pos(), 0, 0, true, god)); + true, 0, 0, you.pos(), 0, god)); // Hand item information over to monster. if (midx != -1) @@ -736,7 +733,7 @@ static bool _beogh_retribution() int mons = create_monster( mgen_data::hostile_at(punisher, - you.pos(), 0, MG_PERMIT_BANDS, true, god)); + true, 0, 0, you.pos(), MG_PERMIT_BANDS, god)); // sometimes name band leader if (mons != -1 && one_chance_in(3)) @@ -847,7 +844,7 @@ static bool _lugonu_retribution() mgen_data::hostile_at( static_cast( MONS_GREEN_DEATH + random2(3)), - you.pos(), 0, 0, true, god)) != -1); + true, 0, 0, you.pos(), 0, god)) != -1); simple_god_message(success ? " sends a demon after you!" : "'s demon is unavoidably detained.", god); @@ -863,7 +860,7 @@ static bool _lugonu_retribution() mgen_data::hostile_at( static_cast( MONS_NEQOXEC + random2(5)), - you.pos(), 0, 0, true, god)) != -1) + true, 0, 0, you.pos(), 0, god)) != -1) { success = true; } @@ -989,7 +986,7 @@ static bool _jiyva_retribution() if (create_monster( mgen_data::hostile_at(static_cast(slime), - you.pos(), 0, 0, true, god)) != -1) + true, 0, 0, you.pos(), 0, god)) != -1) { success = true; } diff --git a/crawl-ref/source/it_use3.cc b/crawl-ref/source/it_use3.cc index 55ee0ec7c8..7adf5c5e50 100644 --- a/crawl-ref/source/it_use3.cc +++ b/crawl-ref/source/it_use3.cc @@ -337,7 +337,7 @@ static bool evoke_horn_of_geryon() mpr("You produce a hideous howling noise!", MSGCH_SOUND); create_monster( mgen_data::hostile_at(MONS_BEAST, - you.pos(), 4, 0, true)); + true, 4, 0, you.pos())); } return (rc); } @@ -530,7 +530,7 @@ void tome_of_power(int slot) { if (create_monster( mgen_data::hostile_at(MONS_ABOMINATION_SMALL, - you.pos(), 6, 0, true)) != -1) + true, 6, 0, you.pos())) != -1) { mpr("A horrible Thing appears!"); mpr("It doesn't look too friendly."); diff --git a/crawl-ref/source/monplace.h b/crawl-ref/source/monplace.h index 22947911df..7e35108863 100644 --- a/crawl-ref/source/monplace.h +++ b/crawl-ref/source/monplace.h @@ -233,17 +233,19 @@ struct mgen_data return mgen_data(what, BEH_SLEEP, 0, 0, where, MHITNOT, flags); } - static mgen_data hostile_at(monster_type what, - const coord_def &where, - int abj_deg = 0, - unsigned flags = 0, + static mgen_data hostile_at(monster_type mt, bool alert = false, + int abj = 0, + int st = 0, + const coord_def &p = coord_def(-1, -1), + unsigned monflags = 0, god_type god = GOD_NO_GOD, - int summon_type = 0) + monster_type base = MONS_NO_MONSTER) + { - return mgen_data(what, BEH_HOSTILE, abj_deg, summon_type, where, + return mgen_data(mt, BEH_HOSTILE, abj, st, p, alert ? MHITYOU : MHITNOT, - flags, god); + monflags, god, base); } }; diff --git a/crawl-ref/source/spl-mis.cc b/crawl-ref/source/spl-mis.cc index b7022461ec..96339da003 100644 --- a/crawl-ref/source/spl-mis.cc +++ b/crawl-ref/source/spl-mis.cc @@ -706,8 +706,8 @@ bool MiscastEffect::_create_monster(monster_type what, int abj_deg, (crawl_state.is_god_acting()) ? crawl_state.which_god_acting() : GOD_NO_GOD; - mgen_data data = mgen_data::hostile_at(what, target->pos(), - abj_deg, 0, alert, god); + mgen_data data = mgen_data::hostile_at(what, alert, + abj_deg, 0, target->pos(), 0, god); // hostile_at() assumes the monster is hostile to the player, // but should be hostile to the target monster unless the miscast diff --git a/crawl-ref/source/wiz-fsim.cc b/crawl-ref/source/wiz-fsim.cc index 846a441f75..4aa2b2bac7 100644 --- a/crawl-ref/source/wiz-fsim.cc +++ b/crawl-ref/source/wiz-fsim.cc @@ -32,7 +32,7 @@ static int _create_fsim_monster(int mtype, int hp) const int mi = create_monster( mgen_data::hostile_at( - static_cast(mtype), you.pos())); + static_cast(mtype), false, 0, 0, you.pos())); if (mi == -1) return (mi); diff --git a/crawl-ref/source/xom.cc b/crawl-ref/source/xom.cc index 87b4ff7ce6..513291e174 100644 --- a/crawl-ref/source/xom.cc +++ b/crawl-ref/source/xom.cc @@ -3214,8 +3214,8 @@ static int _xom_summon_hostiles(int sever, bool debug = false) if (create_monster( mgen_data::hostile_at( _xom_random_demon(sever), - you.pos(), 4, 0, true, GOD_XOM, - MON_SUMM_WRATH)) != -1) + true, 4, MON_SUMM_WRATH, you.pos(), 0, + GOD_XOM)) != -1) { num_summoned++; } -- cgit v1.2.3-54-g00ecf