Re: DRINKCON aliases

From: Mike Breuer (mbreuer@new.rr.com)
Date: 07/27/01


From: "Kras Kresh" <kras_kresh@HOTMAIL.COM>

> struct obj_data *Obj_from_store(struct obj_file_elem object, int *location)
>
> if (GET_OBJ_TYPE(obj) == ITEM_DRINKCON) {
>
>       GET_OBJ_VAL(obj, 1) = object.value[1];    // how filled
>       if (!GET_OBJ_VAL(obj, 1)) {               // kill if empty
>         name_from_drinkcon(obj);
>         GET_OBJ_VAL(obj, 2) = 0;
>       } else if (GET_OBJ_VAL(obj, 2) != object.value[2]) {

I'm not sure what the above line is testing for exactly.  The two values
should always be equal, since you should be setting them equal explicitly.

I ran into the same thing a while back, and stuck the following lines of code
in the same function (Obj_from_store in objsave.c):

+    /* Set proper name for drink containers */
+    if (GET_OBJ_TYPE(obj) == ITEM_DRINKCON) {
+      name_from_drinkcon(obj);
+      if (GET_OBJ_VAL(obj, 1) > 0)
+        name_to_drinkcon(obj, GET_OBJ_VAL(obj, 2));
+    }
     return (obj);
   } else
     return NULL;
 }

This solution has been working fine for me.

Mike

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/06/01 PST