Re: Nitpick

From: George (greerga@CIRCLEMUD.ORG)
Date: 03/18/98


On Mon, 16 Mar 1998, Edward Glamkowski wrote:

>>>  if (GET_CLASS(ch) != CLASS_WARRIOR)
>>>    send_to_char("But only true warriors can do this!", ch);
>
>Hm, does anybody else other than myself use the macros IS_WARRIOR,
>IS_CLERIC, etc.?  Any chance we can get all those
>GET_CLASS(ch) == CLASS_WHATEVER switch to IS_WHATEVER in stock?
>Obviously a very low priority ;)

How's this? (Sub-optimal in magic.c, but a reminder for later.)

diff -uprN -X .exclude stk/act.informative.c isclass/act.informative.c
--- stk/act.informative.c       Wed Oct 29 00:16:21 1997
+++ isclass/act.informative.c   Wed Mar 18 21:05:21 1998
@@ -183,7 +183,7 @@ void look_at_char(struct char_data * i,
        show_obj_to_char(GET_EQ(i, j), ch, 1);
       }
   }
-  if (ch != i && (GET_CLASS(ch) == CLASS_THIEF || GET_LEVEL(ch) >= LVL_IMMORT)) {
+  if (ch != i && (IS_THIEF(ch) || GET_LEVEL(ch) >= LVL_IMMORT)) {
     found = FALSE;
     act("\r\nYou attempt to peek at $s inventory:", FALSE, i, 0, ch, TO_VICT);
     for (tmp_obj = i->carrying; tmp_obj; tmp_obj = tmp_obj->next_content) {
diff -uprN -X .exclude stk/act.offensive.c isclass/act.offensive.c
--- stk/act.offensive.c Wed Oct 29 00:16:21 1997
+++ isclass/act.offensive.c     Wed Mar 18 21:11:56 1998
@@ -284,7 +284,7 @@ ACMD(do_bash)

   one_argument(argument, arg);

-  if (GET_CLASS(ch) != CLASS_WARRIOR) {
+  if (!IS_WARRIOR(ch)) {
     send_to_char("You'd better leave all the martial arts to fighters.\r\n", ch);
     return;
   }
@@ -348,7 +348,7 @@ ACMD(do_rescue)
     act("But nobody is fighting $M!", FALSE, ch, 0, vict, TO_CHAR);
     return;
   }
-  if (GET_CLASS(ch) != CLASS_WARRIOR)
+  if (!IS_WARRIOR(ch))
     send_to_char("But only true warriors can do this!", ch);
   else {
     percent = number(1, 101);  /* 101% is a complete failure */
@@ -384,7 +384,7 @@ ACMD(do_kick)
   struct char_data *vict;
   int percent, prob;

-  if (GET_CLASS(ch) != CLASS_WARRIOR) {
+  if (!IS_WARRIOR(ch)) {
     send_to_char("You'd better leave all the martial arts to fighters.\r\n", ch);
     return;
   }
diff -uprN -X .exclude stk/class.c isclass/class.c
--- stk/class.c Wed Oct 29 00:16:22 1997
+++ isclass/class.c     Wed Mar 18 21:06:17 1998
@@ -381,7 +381,7 @@ void advance_level(struct char_data * ch
   if (GET_LEVEL(ch) > 1)
     ch->points.max_mana += add_mana;

-  if (GET_CLASS(ch) == CLASS_MAGIC_USER || GET_CLASS(ch) == CLASS_CLERIC)
+  if (IS_MAGIC_USER(ch) || IS_CLERIC(ch))
     GET_PRACTICES(ch) += MAX(2, wis_app[GET_WIS(ch)].bonus);
   else
     GET_PRACTICES(ch) += MIN(2, MAX(1, wis_app[GET_WIS(ch)].bonus));
diff -uprN -X .exclude stk/limits.c isclass/limits.c
--- stk/limits.c        Wed Oct 29 00:16:27 1997
+++ isclass/limits.c    Wed Mar 18 21:07:05 1998
@@ -90,7 +90,7 @@ int mana_gain(struct char_data * ch)
       break;
     }

-    if ((GET_CLASS(ch) == CLASS_MAGIC_USER) || (GET_CLASS(ch) == CLASS_CLERIC))
+    if (IS_MAGIC_USER(ch) || IS_CLERIC(ch))
       gain <<= 1;
   }

@@ -134,7 +134,7 @@ int hit_gain(struct char_data * ch)
       break;
     }

-    if ((GET_CLASS(ch) == CLASS_MAGIC_USER) || (GET_CLASS(ch) == CLASS_CLERIC))
+    if (IS_MAGIC_USER(ch) || IS_CLERIC(ch))
       gain >>= 1;
   }

diff -uprN -X .exclude stk/magic.c isclass/magic.c
--- stk/magic.c Wed Oct 29 00:16:27 1997
+++ isclass/magic.c     Wed Mar 18 21:10:42 1998
@@ -301,8 +301,9 @@ void mag_damage(int level, struct char_d
   if (victim == NULL || ch == NULL)
     return;

-  is_mage = (GET_CLASS(ch) == CLASS_MAGIC_USER);
-  is_cleric = (GET_CLASS(ch) == CLASS_CLERIC);
+  /* Doh, this is dumb now. -gg 3/18/98 */
+  is_mage = IS_MAGIC_USER(ch);
+  is_cleric = IS_CLERIC(ch);

   switch (spellnum) {
     /* Mostly mages */
@@ -424,8 +425,9 @@ void mag_affects(int level, struct char_
   if (victim == NULL || ch == NULL)
     return;

-  is_mage = (GET_CLASS(ch) == CLASS_MAGIC_USER);
-  is_cleric = (GET_CLASS(ch) == CLASS_CLERIC);
+  /* Doh, this is dumb now. -gg 3/18/98 */
+  is_mage = IS_MAGIC_USER(ch);
+  is_cleric = IS_CLERIC(ch);

   for (i = 0; i < MAX_SPELL_AFFECTS; i++) {
     af[i].type = spellnum;

--
George Greer  -  Me@Null.net   | Genius may have its limitations, but stupidity
http://www.van.ml.org/~greerga | is not thus handicapped. -- Elbert Hubbard


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST