Re: [CODE] obj_index undefined?

From: dmodem (dmodem@CYBNETONLINE.COM)
Date: 11/24/97


At 10:30 PM 11/24/97 -0500, you wrote:
>On Mon, 24 Nov 1997, dmodem wrote:
>
>>fight.c(545) : error C2065: 'obj_index' : undeclared identifier
>>fight.c(545) : error C2109: subscript requires array or pointer type
>>fight.c(545) : error C2224: left of '.virtual' must have struct/union type
>
>>      if (GET_OBJ_VNUM(invobj) == GET_OBJ_VAL(weap_obj, 0)) {
>>as you can see obj_index (which I believe to be the root of all my
>>troubles) isn't on that line.  but it is in the define for GET_OBJ_VNUM().
>>#define GET_OBJ_VNUM(obj)       (GET_OBJ_RNUM(obj) >= 0 ? \
>
>Think of #deinfe as a substitution.  The compiler never sees
>GET_OBJ_VNUM(invobj), it sees 'obj_index[invobj]' or whatever else that
>line expands to.  So when you have an undefinied identifier on that line,
>some macro (maybe 5 levels down) uses that variable and you have to define
>it correctly.

Well I was just looking through it again and I got so mad at it I figured
"if you want the stupid thing I'll just give it to you!  even though you
had it last time I compiled you, you stupid piece of...code!"
or in other words I just added a line to utils.h
extern struct index_data *obj_index;
I also tried
extern struct index_data obj_index;
but the compiled puked all over that one...
So now its there with obj_index actually defined (which scares the hell out
of me because I just know it has to cause some problem somewhere sometime
in the future) and that eliminated all of my compiler errors...or almost
that is...
It then began to whine about something else:
fight.c(996) : error C2371: 'use_ammo' redefinition; different basic types
so what is 'use_ammo' ?  well it is a little (very little) function that is
called twice.  I searched every file in the entire source code and
'use_ammo' appears only 3 places.  once is the line that caused the error
and the other 2 times are when the function is called.  I tried moving the
function to a spot in the code above the places where it is called which
got the compiler to shut up...wasn't aware that that would be necessary (I
probably did something else wrong too...).
Well the compiler is happy with the code now and I get to start playing
around with my poorly coded "enhancements".  If you can see something that
will crash the MUD I would appreciate being informed.  Ah, the joys of
C...What ever did I do before I started my MUD?  oh...yeah...real life...I
remember now...
So how'd I do for my first large Circle coding project? :)


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