Dne Út, 01 prosinec 1998 jste napsal(a):
>Hello everybody ,
>
>I've just got a code of a certain MUD (CircleMUD based) , and I've been
>trying to compile it under my WIN95 MSVC5 system.
>
>It gives me this strange compiler error :
>
>error C2106: "-=" : left operand must be l-value
>
>in this line : GET_MANA(ch) -= 200;
>
>these kind of l-value errors accur during the whole compilation not only
>
>concerning the GET_MANA() macro.
>
>I checked out the GET_MANA macro and found this :
>
>#define GET_MANA(ch) (!IS_NPC(ch) ?
> ((ch)->player_specials->linking[0] ? \
> (ch)->player_specials->manalinked : \
> (ch)->points.mana): (ch)->points.mana)
>
>you see , all the l-value errors in the compilation is due to the
>? : statements , but the MSVC tells me that a ? : statement can
>be an l-vlaue.
>
>So , I don't know what is the problem : is the ? : statement incorrect ,
>
>is anything missing in the definition of the macro ? WHAT ??????
>
>I hope you guys could help me with it ...
>
>Yohay Etsion
>yohay_e@netvision.net.il
Reminds me of the CHECK_PLAYER_SPECIALS() macro.
Instead of "( (a) ? (b) : (c) )" use "( *( (a) ? &(b) : &(c) ))", i.e.
#define GET_MANA(ch) (*(!IS_NPC(ch) ?
((ch)->player_specials->linking[0] ? \
&((ch)->player_specials->manalinked) : \
&((ch)->points.mana)): &((ch)->points.mana)))
Uhm, hopefully it's correct ( copy&paste in KMail ).
L.Lunak
l.lunak@email.cz
+------------------------------------------------------------+
| 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