Re: Transportation devices

From: Phillip A. Ames (kirk47@JUNO.COM)
Date: 08/15/98


>Ack. I realize that this code is probably auto-formatted by MSVC or
>whatever IDE/editor you use, however, it is *not* for us. It'd help a
>lot if you took the time out to format the code before sending it
>along
>the list. More people would be encouraged to actually look through it
>than skip your message because the code is unreadable.

Sorry 'bout that, it looks proper to my e-mail client, but then again, my
e-mail client isn't full window, it's really messed up...  Don't know
what to do about that :P

>Oh, my, you want "==". How you have it, this should always evaluate to
>false (should, anyway). Also, use some "else" statements. They're very
>convenient and will make your code more readable. This code block
>could
>be,

Well, as this is my first "real" adventure into the realm of CircleMUD
coding, I'm just going for the fact: "Does it work?" :)

>Is that a real num or virtual num? Also, you want to start off your
>spec-proc with "if (!cmd) return 0;" since it's not going to be doing
>anything if it's not called by a command. You want to "return 1;"
>whenever they fail to beam-up for some reason, so that the code
>doesn't continue past that point.

It's supposed to be vnum, I wanted to use that because all my vehicle
rooms are towards the end of the zone table, and if some builder was
working on their zone and created a new room, it would throw the object
values off.

>If problems persist, please repost the code in formatted form, so we
>can actually read it and perhaps see your problem.

I've just gotten some help from someone on the list, and am currently
working on implementing their help in the system.  I should be done
compiling in a few minutes, I'll save this message to send later if it
still doesn't work...

...  Several minutes later ...

OK, it didn't work...  I get new messages though! :)  The error messages
are below, with the spec proc after them...  For shortness' sake, I only
posted the areas of the code that I changed with a few lines for
reference

c:\Circle\src\vehicles.c(385) : error C2223: left of '->obj_flags' must
point to struct/union
c:\Circle\src\vehicles.c(385) : error C2198: 'find_vehicle_by_vnum' : too
few actual parameters
c:\Circle\src\vehicles.c(385) : warning C4047: '=' : 'int (__cdecl
*)(struct char_data *,void *,int ,char *)' differs in levels of
indirection from 'struct obj_data *'
c:\Circle\src\vehicles.c(385) : error C2106: '=' : left operand must be
l-value
c:\Circle\src\vehicles.c(390) : error C2223: left of '->obj_flags' must
point to struct/union
c:\Circle\src\vehicles.c(394) : error C2223: left of '->obj_flags' must
point to struct/union
c:\Circle\src\vehicles.c(399) : error C2223: left of '->obj_flags' must
point to struct/union
c:\Circle\src\vehicles.c(400) : error C2223: left of '->obj_flags' must
point to struct/union
c:\Circle\src\vehicles.c(401) : warning C4047: 'function' : 'struct
obj_data *' differs in levels of indirection from 'int (__cdecl *)(struct
char_data *,void *,int ,char *)'
c:\Circle\src\vehicles.c(401) : warning C4024: 'act' : different types
for formal and actual parameter 4
c:\Circle\src\vehicles.c(402) : warning C4047: 'function' : 'struct
obj_data *' differs in levels of indirection from 'int (__cdecl *)(struct
char_data *,void *,int ,char *)'
c:\Circle\src\vehicles.c(402) : warning C4024: 'act' : different types
for formal and actual parameter 4
c:\Circle\src\vehicles.c(406) : warning C4047: 'function' : 'int '
differs in levels of indirection from 'char [1]'
c:\Circle\src\vehicles.c(406) : warning C4024: 'do_look' : different
types for formal and actual parameter 3
Error executing cl.exe.

vehicles.obj - 7 error(s), 7 warning(s)


SPECIAL(comm_badge) {
int beamdown_room;
int beamup_room;
extern int top_of_world;
(struct obj_data*) me, * vehicle;

if (!CMD_IS("beamup"))
return 0;

[snipped find vehicle by vnum part]

if ( GET_OBJ_VAL(comm_badge, 2)  ==  0){
                beamdown_room += (GET_ROOM_VNUM(IN_ROOM(ch)));
        }

[snipped the failure messages part of beaming up]

        beamup_room = ( GET_OBJ_VAL(comm_badge, 1) );
        ( GET_OBJ_VAL(comm_badge, 2) += beamdown_room );
        act("$n beams up to $o", TRUE, ch, vehicle, 0, TO_ROOM);
        act("You beam up to $o.", TRUE, ch, vehicle, 0, TO_CHAR);
        char_from_room(ch);
        char_to_room(ch, beamup_room);
// Now show them the room
        do_look(ch, "", "", 0);
        return 1;
        }
}

Hopefully this is formatted correctly, if not, sorry.  If anyone knows
why these are happening, I'd be really grateful if you could tell me the
reason / a fix for them.  Thanks!!

-Phillip


Phillip Ames    | Treat friends in debt like family.
kirk47@juno.com | Exploit them.
ICQ: 8778335    | AOL IM: Grathol
http://members.xoom.com/Gowron/index.html

_____________________________________________________________________
You don't need to buy Internet access to use free Internet e-mail.
Get completely free e-mail from Juno at http://www.juno.com
Or call Juno at (800) 654-JUNO [654-5866]


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