From 7f72c37783571cc8a398b0c9d56a2727191c08c4 Mon Sep 17 00:00:00 2001 From: David Lawrence Ramsey Date: Tue, 29 Sep 2009 10:17:05 -0500 Subject: Simplify several random array selections by using RANDOM_ELEMENT(). --- crawl-ref/source/fight.cc | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'crawl-ref/source/fight.cc') diff --git a/crawl-ref/source/fight.cc b/crawl-ref/source/fight.cc index 12ab335741..6497ac8fe5 100644 --- a/crawl-ref/source/fight.cc +++ b/crawl-ref/source/fight.cc @@ -4282,12 +4282,9 @@ static const char *klown_attack[] = std::string melee_attack::mons_attack_verb(const mon_attack_def &attk) { if (attacker->id() == MONS_KILLER_KLOWN && attk.type == AT_HIT) - { - const int num_attacks = sizeof(klown_attack) / sizeof(*klown_attack); - return (klown_attack[random2(num_attacks)]); - } + return (RANDOM_ELEMENT(klown_attack)); - if (attacker->id() == MONS_KRAKEN_TENTACLE) + if (attacker->id() == MONS_KRAKEN_TENTACLE && attk.type == AT_TENTACLE_SLAP) return ("slap"); static const char *attack_types[] = -- cgit v1.2.3-54-g00ecf