ASSIGNMOB()

From: George (greerga@DRAGON.HAM.MUOHIO.EDU)
Date: 09/09/97


  if (real_mobile(mob) >= 0)
    mob_index[real_mobile(mob)].func = fname;

This is really redundant, it should be saved to a variable.  Now I realize
why the post months ago about real_* caching worked so well.

A patch for it (soon to be on my page):

diff -uprN ../stk/spec_assign.c ./spec_assign.c
--- ../stk/spec_assign.c        Thu Jun 19 00:58:38 1997
+++ ./spec_assign.c     Tue Sep  9 23:30:55 1997
@@ -26,8 +26,10 @@ extern struct index_data *obj_index;

 void ASSIGNMOB(int mob, SPECIAL(fname))
 {
-  if (real_mobile(mob) >= 0)
-    mob_index[real_mobile(mob)].func = fname;
+  int rnum;
+
+  if ((rnum = real_mobile(mob)) >= 0)
+    mob_index[rnum].func = fname;
   else if (!mini_mud) {
     sprintf(buf, "SYSERR: Attempt to assign spec to non-existant mob #%d",
            mob);

--
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/08/00 PST