The Dawn Of Time
The Official Forums for the Dawn Of Time Mud Codebase
 
Log in Register FAQ Memberlist Search The Dawn Of Time Forum Index Goto the Official Dawn Website

COMPARE_RESULT calc_compare( obj_data *obj1, obj_data *obj2)

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    The Dawn Of Time Forum Index » 1.69q fixes already included as part of 1.69r
View previous topic :: View next topic  
Author Message
grimnard



Joined: 28 Jul 2003
Posts: 189
Location: Indiana, usa

PostPosted: Sat Jan 17, 2004 6:24 pm    Post subject: COMPARE_RESULT calc_compare( obj_data *obj1, obj_data *obj2) Reply with quote

ok i was going threw act_info

and in this function i noticed something that just doesnt look right to me
im wondering if this is backwards and needs to be fixed or if im just wrong

here the bit of code
Code:
   assert(obj1);
   assert(obj2);

   int value1=0;
   int value2=0;
   switch ( obj1->item_type )
   {
   default:
      bug("display_compare(): How did we get here?");
      do_abort();
      break;
   case ITEM_ARMOR:
      value1 = obj1->value[0] + obj1->value[1] + obj1->value[2] + obj1->value[3];
      value2 = obj2->value[0] + obj2->value[1] + obj2->value[2] + obj2->value[3];
      break;
   case ITEM_WEAPON:
      value1 = (1 + obj1->value[2]) * obj1->value[1];
      value2 = (1 + obj2->value[2]) * obj2->value[1];
      break;
   }

   int r=value1-value2;
   if(r<-1){
      return COMPARE_WORSE;
   }else if (r>1){
      return COMPARE_ABOUT_SAME;
   }
   return COMPARE_BETTER;

now to me if the value of 1 minus 2 is a positive number it should be better
no about the same
is this correct in assuming or am i not reading this function right

just wondering

thanks
grimnard drand



_________________
See you all on the flip side...

telnet://play.awtw.net:5556/
http://www.awtw.net/
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Kalahn
Codebase Developer


Joined: 18 Jan 2003
Posts: 710
Location: New Zealand

PostPosted: Sun Jan 18, 2004 1:32 am    Post subject: Reply with quote

You are absolutely right, I have included the below fix into 1.69r.

Nicely spotted,

- Kal
Code:

   int r=value1-value2;
   if(r<-1){
      return COMPARE_WORSE;
   }else if (r>1){
      return COMPARE_BETTER;
   }
   // r is either -1, 0 or 1
   return COMPARE_ABOUT_SAME;


Back to top
View user's profile Send private message Visit poster's website
grimnard



Joined: 28 Jul 2003
Posts: 189
Location: Indiana, usa

PostPosted: Mon Jan 19, 2004 7:40 pm    Post subject: Reply with quote

thanks wasnt even in that part for that just happend upon it and was looking it over and it hit me int he face


grimnard



_________________
See you all on the flip side...

telnet://play.awtw.net:5556/
http://www.awtw.net/
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    The Dawn Of Time Forum Index » 1.69q fixes already included as part of 1.69r All times are GMT + 13 Hours
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001-2005 phpBB Group
Theme created by Vjacheslav Trushkin