Re: [CODE] half_chops

From: Cj Stremick (stremick@ix.netcom.com)
Date: 12/03/98


>>       GET_QPOINTS(victim) == GET_QPOINTS(victim) + newquest;

... Means something TOTALLY different than ...

>GET_QPOINTS(victim) += newquest;

The "==" operator is for comparisons.  "=" is an assignment operator.

The top line will NOT change the value of GET_QPOINTS(victim).  Actually, it
doesn't have any affect at all.

-Cj



----- Original Message -----
From: Dan Egli <dan@ADSL60.SLKC.USWEST.NET>
To: <CIRCLE@post.queensu.ca>
Sent: Thursday, December 03, 1998 10:59 AM
Subject: Re:  [CODE] half_chops


>On Thu, 3 Dec 1998, Julian Buckley wrote:
>
>> Hi List...
>>
>>     if (newquest > 0) {
>>       GET_QPOINTS(victim) == GET_QPOINTS(victim) + newquest;
>
>>       GET_QPOINTS(victim) == GET_QPOINTS(victim) - newquest;
>
>Only things I see off hand, are these. I DOUBT that they will be your
>cause, but since this is C, let us use the shortest possible form.
>
>GET_QPOINTS(victim) += newquest;
>or
>GET_QPOINTS(victim) -= newquest;
>
>As I said, probably not your cause, but a nice little item :>
>
>One thing you may want to do is add debuging log statements througout the
>code.
>
>like just before the points are added/subtracted, call a log line, like:
>sprintf(buf1, "DEBUG: calling the GET_QPOINTS() macro to add %s points",
newpoints);
>log(buf1);
>
>then AFTER, do:
>log("DEBUG: call to GET_QPOINTS() complete.");
>
>That way you can make sure that the routines are actually getting called!
>I found a logic error that way.
>
>
>     +------------------------------------------------------------+
>     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
>     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
>     +------------------------------------------------------------+
>


     +------------------------------------------------------------+
     | 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