diff options
author | haranp <haranp@c06c8d41-db1a-0410-9941-cceddc491573> | 2006-12-03 22:30:53 +0000 |
---|---|---|
committer | haranp <haranp@c06c8d41-db1a-0410-9941-cceddc491573> | 2006-12-03 22:30:53 +0000 |
commit | 61aa415257407644740dc5e91d30bd94cdbd5327 (patch) | |
tree | 478788b078a882729d4e02541f89295e65a6af29 /crawl-ref/source | |
parent | bcfca21ad67956a47a2ac5f616943567334f7c0b (diff) | |
download | crawl-ref-61aa415257407644740dc5e91d30bd94cdbd5327.tar.gz crawl-ref-61aa415257407644740dc5e91d30bd94cdbd5327.zip |
Miscellaneous minor fixes and cleanups (such as using player_can_smell()
more and mprf() rather than strcats.)
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@547 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source')
-rw-r--r-- | crawl-ref/source/acr.cc | 24 | ||||
-rw-r--r-- | crawl-ref/source/beam.cc | 12 | ||||
-rw-r--r-- | crawl-ref/source/decks.cc | 14 | ||||
-rw-r--r-- | crawl-ref/source/describe.cc | 10 | ||||
-rw-r--r-- | crawl-ref/source/direct.cc | 35 | ||||
-rw-r--r-- | crawl-ref/source/effects.cc | 3 | ||||
-rw-r--r-- | crawl-ref/source/item_use.cc | 3 | ||||
-rw-r--r-- | crawl-ref/source/items.cc | 5 | ||||
-rw-r--r-- | crawl-ref/source/spells2.cc | 2 |
9 files changed, 35 insertions, 73 deletions
diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc index c52a0724a2..66685465a1 100644 --- a/crawl-ref/source/acr.cc +++ b/crawl-ref/source/acr.cc @@ -148,22 +148,6 @@ const struct coord_def Compass[8] = { 0, 1 }, { -1, 1 }, { -1, 0 }, { -1, -1 }, }; -/* - - Functions needed: - New: - int player_speed(player you); - hit_player(damage, flavour, then last two ouch values, env); - - - Old: - wield(player you); - show_map - noisy() - losight - -*/ - // Functions in main module static void close_door(int move_x, int move_y); static void do_berserk_no_combat_penalty(void); @@ -1329,10 +1313,9 @@ void process_command( command_type cmd ) { strncpy(name_your, you.your_name, kNameLen); name_your[kNameLen] = 0; if (dump_char( name_your, false )) - strcpy(info, "Char dumped successfully."); + mpr("Char dumped successfully."); else - strcat(info, "Char dump unsuccessful! Sorry about that."); - mpr(info); + mpr("Char dump unsuccessful! Sorry about that."); break; #ifdef USE_MACROS @@ -2056,7 +2039,8 @@ static void decrement_durations() at some point. */ -static void world_reacts() { +static void world_reacts() +{ bool its_quiet; //jmf: for silence messages diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc index f87f644de4..cf946b4ff0 100644 --- a/crawl-ref/source/beam.cc +++ b/crawl-ref/source/beam.cc @@ -1916,14 +1916,10 @@ int mons_ench_f2(struct monsters *monster, struct bolt &pbolt) // don't worry about invisibility - you should be able to // see if something has fallen into the lava if (is_near) - { - strcpy(info, ptr_monam(monster, DESC_CAP_THE)); - strcat(info, " falls into the "); - strcat(info, (grd[monster->x][monster->y] == DNGN_LAVA) - ? "lava" : "water"); - strcat(info, "!"); - mpr(info); - } + mprf("%s falls into the %s!", + ptr_monam(monster, DESC_CAP_THE), + (grd[monster->x][monster->y] == DNGN_LAVA) ? "lava" : + "water"); switch (pbolt.thrower) { diff --git a/crawl-ref/source/decks.cc b/crawl-ref/source/decks.cc index 8755413256..06f05e9027 100644 --- a/crawl-ref/source/decks.cc +++ b/crawl-ref/source/decks.cc @@ -778,19 +778,17 @@ static void cards(unsigned char which_card) mpr("You have drawn the Symbol of Torment."); torment( TORMENT_CARDS, you.x_pos, you.y_pos ); break; - -// what about checking whether there are items there, too? {dlb} + case CARD_FOUNTAIN: + // what about checking whether there are items there, too? {dlb} mpr("You have drawn the Fountain."); if (grd[you.x_pos][you.y_pos] == DNGN_FLOOR) { - strcpy( info, "A beautiful fountain of clear blue water grows " - "from the floor " ); - - strcat( info, (you.species == SP_NAGA || you.species == SP_CENTAUR) - ? "before you!" : "at your feet!" ); - mpr(info); + mprf("A beautiful fountain of clear blue water grows from the " + "floor %s!", + (you.species == SP_NAGA || you.species == SP_CENTAUR) ? + "before you!" : "at your feet!" ); grd[you.x_pos][you.y_pos] = DNGN_BLUE_FOUNTAIN; } else diff --git a/crawl-ref/source/describe.cc b/crawl-ref/source/describe.cc index 0140b02222..70001528ec 100644 --- a/crawl-ref/source/describe.cc +++ b/crawl-ref/source/describe.cc @@ -615,7 +615,7 @@ static std::string describe_demon(void) description += "."; - switch (random2(40) + (you.species == SP_MUMMY ? 3 : 0)) + switch (random2(40) + (player_can_smell() ? 0 : 3)) { case 0: description += " It stinks of brimstone."; @@ -1580,7 +1580,7 @@ static std::string describe_armour( const item_def &item, bool verbose ) break; case ARM_SWAMP_DRAGON_HIDE: description += "The slimy"; - if (you.species != SP_MUMMY) + if (player_can_smell()) description += ", smelly"; description += " skin of a swamp-dwelling dragon. I suppose " "you could wear it if you really wanted to. "; @@ -4670,7 +4670,7 @@ void describe_monsters(int class_described, unsigned char which_mons) description += "A hideous decaying form."; if (you.species == SP_GHOUL) description += "$It smells great!"; - else if (you.species != SP_MUMMY) + else if (player_can_smell()) description += "$It stinks."; break; @@ -4977,7 +4977,7 @@ void describe_monsters(int class_described, unsigned char which_mons) case MONS_SWAMP_DRAKE: description += "A small and slimy dragon, covered in swamp muck. "; - if (you.species != SP_MUMMY) + if (player_can_smell()) description += "It smells horrible."; break; @@ -6165,7 +6165,7 @@ void describe_monsters(int class_described, unsigned char which_mons) case MONS_URUG: description += "A rude"; - if (you.species != SP_MUMMY) + if (player_can_smell()) description += ", smelly"; description += " orc."; break; diff --git a/crawl-ref/source/direct.cc b/crawl-ref/source/direct.cc index acbbc1ca0d..1c6266e80a 100644 --- a/crawl-ref/source/direct.cc +++ b/crawl-ref/source/direct.cc @@ -1366,8 +1366,8 @@ static void describe_cell(int mx, int my) if (menv[i].type != MONS_DANCING_WEAPON && mon_wep != NON_ITEM) { - snprintf( info, INFO_SIZE, "%s is wielding ", mons_pronoun( menv[i].type, - PRONOUN_CAP )); + snprintf( info, INFO_SIZE, "%s is wielding ", + mons_pronoun( menv[i].type, PRONOUN_CAP )); it_name(mon_wep, DESC_NOCAP_A, str_pass); strcat(info, str_pass); @@ -1435,20 +1435,13 @@ static void describe_cell(int mx, int my) // special case: batty monsters get set to BEH_WANDER as // part of their special behaviour. if (!testbits(menv[i].flags, MF_BATTY)) - { - strcpy(info, mons_pronoun(menv[i].type, PRONOUN_CAP)); - strcat(info, " doesn't appear to be interested in you."); - mpr(info); - } + mprf("%s doesn't appear to be interested in you.", + mons_pronoun(menv[i].type, PRONOUN_CAP)); } } if (menv[i].attitude == ATT_FRIENDLY) - { - strcpy(info, mons_pronoun(menv[i].type, PRONOUN_CAP)); - strcat(info, " is friendly."); - mpr(info); - } + mprf("%s is friendly.", mons_pronoun(menv[i].type, PRONOUN_CAP)); for (int p = 0; p < NUM_MON_ENCHANTS; p++) { @@ -1549,24 +1542,18 @@ static void describe_cell(int mx, int my) { // If a mimic is on this square, we pretend its the first item -- bwr if (mimic_item) - mpr("There is something else lying underneath."); + mpr("There is something else lying underneath.",MSGCH_FLOOR_ITEMS); else { if (mitm[ targ_item ].base_type == OBJ_GOLD) - { - mpr( "A pile of gold coins." ); - } + mprf( MSGCH_FLOOR_ITEMS, "A pile of gold coins." ); else - { - strcpy(info, "You see "); - it_name( targ_item, DESC_NOCAP_A, str_pass); - strcat(info, str_pass); - strcat(info, " here."); - mpr(info); - } + mprf( MSGCH_FLOOR_ITEMS, "You see %s here.", + it_name(targ_item, DESC_NOCAP_A, str_pass)); if (mitm[ targ_item ].link != NON_ITEM) - mpr("There is something else lying underneath."); + mprf( MSGCH_FLOOR_ITEMS, + "There is something else lying underneath."); } } diff --git a/crawl-ref/source/effects.cc b/crawl-ref/source/effects.cc index 7f7d2b70dd..81b9c915e7 100644 --- a/crawl-ref/source/effects.cc +++ b/crawl-ref/source/effects.cc @@ -414,8 +414,7 @@ void random_uselessness(unsigned char ru, unsigned char sc_read_2) break; case 4: - // josh declares mummies can't smell {dlb} - if (you.species != SP_MUMMY) + if (player_can_smell()) { strcpy(info, "You smell "); diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc index a6a65af1fd..bb7e7dec08 100644 --- a/crawl-ref/source/item_use.cc +++ b/crawl-ref/source/item_use.cc @@ -493,8 +493,7 @@ void wield_effects(int item_wield_2, bool showMsgs) break; case SPWPN_STAFF_OF_OLGREB: - // mummies cannot smell - if (you.species != SP_MUMMY) + if (player_can_smell()) mpr("You smell chlorine."); else mpr("The staff glows slightly green."); diff --git a/crawl-ref/source/items.cc b/crawl-ref/source/items.cc index 9a31ad7d79..a9b3a0789f 100644 --- a/crawl-ref/source/items.cc +++ b/crawl-ref/source/items.cc @@ -2396,9 +2396,8 @@ void handle_time( long time_delta ) (temp_rand == 7) ? "You feel a terrible foreboding..." : (temp_rand == 8) ? "You hear words spoken in a strange and terrible language..." : - (temp_rand == 9) ? ((you.species != SP_MUMMY) - ? "You smell brimstone." : "Brimstone rains from above.") : - + (temp_rand == 9) ? (player_can_smell()) ? "You smell brimstone." : + "Brimstone rains from above." : (temp_rand == 10) ? "Something frightening happens." : (temp_rand == 11) ? "You sense an ancient evil watching you..." : (temp_rand == 12) ? "You feel lost and a long, long way from home..." : diff --git a/crawl-ref/source/spells2.cc b/crawl-ref/source/spells2.cc index 8fbd11ac3d..3a50f82608 100644 --- a/crawl-ref/source/spells2.cc +++ b/crawl-ref/source/spells2.cc @@ -284,7 +284,7 @@ int corpse_rot(int power) } } - if (you.species != SP_MUMMY) // josh declares mummies cannot smell {dlb} + if (player_can_smell()) mpr("You smell decay."); // should make zombies decay into skeletons |