Problems with copyover function

Posted by Aqueus on Mon 15 Jan 2007 03:58 AM — 20 posts, 81,025 views.

USA #0
So I've run aground while trying to implement the copyover snippet, specifically Erwin's.

After all is said and done I get the following errors:

comm.c: In function `init_descriptor':
comm.c:757: structure has no member named `user'

It's caused by this line:

dnew->user = STRALLOC("unknown");

But when I comment that line out, I get the FOLLOWING errors:

comm.o(.text+0xfd4): In function `new_descriptor':
/home/mirage21/smaug/src/comm.c:874: undefined reference to `set_auth'
db.o(.text+0xf82): In function `boot_db':
/home/mirage21/smaug/src/db.c:685: undefined reference to `copyover_recover'
tables.o(.text+0x1292): In function `skill_function':
/home/mirage21/smaug/src/tables.c:231: undefined reference to `do_copyover'
tables.o(.text+0x4d33): In function `skill_name':
/home/mirage21/smaug/src/tables.c:871: undefined reference to `do_copyover'
collect2: ld returned 1 exit status
distcc[319] ERROR: compile (null) on localhost failed

And... well... my problem is that I have NO clue where to even approach these bugs. The .o files are the compiled files, right? How do I fix errors there.

Any help is welcome, I'm a newbie coder, though, so try and make any pointers idiot-proof. =)
USA #1
Any reason you're not using SmaugFUSS? I'd recommend it, plus it comes with hotboot.

Are you using stock Smaug?
USA #2
I'm not using stock SMAUG. =( I think I might convert to SMAUGFUSS, but I'm not the lead coder, so I'd need to discuss it with him first.

It's SMAUG, with a few tweaks. Nothing major, just things like skills, etc.
USA #3
Assuming that dnew is of type DESCRIPTOR_DATA, then something is wrong. Stock Smaug has the 'user' member in that struct.
USA #4
*sigh* No offense, but I KNOW something's wrong. I just don't know how to fix it. =(

Are the error logs not useful enough? Is there any other data I could collect to help you guys help me?
USA #5
Ah, here, I hope this helps:

The problem-function is this:

void init_descriptor( DESCRIPTOR_DATA *dnew, int desc)
{
dnew->next = NULL;
dnew->descriptor = desc;
dnew->connected = CON_GET_NAME;
dnew->outsize = 2000;
dnew->idle = 0;
dnew->lines = 0;
dnew->scrlen = 24;
dnew->user = STRALLOC("unknown");
dnew->newstate = 0;
dnew->prevcolor = 0x07;

CREATE( dnew->outbuf, char, dnew->outsize );
}

So yeah, dnew is a DESCRIPTOR_DATA type. Where could I find where DESCRIPTOR_DATA is enumerated?

USA #6
The line isn't that important, but I'd like to see why you're missing user. The struct can be found in mud.h.
USA #7
Zeno's point is that something bigger is wrong than what you're seeing. If your SMAUG code is significantly different from stock SMAUG, then trying a stock SMAUG copyover snippet won't be a copy-paste affair.

I think the structure you're looking for is defined in mud.h.

One thing you could try would be to comment out the line referring to user. But, you might want to figure out what version of SMAUG your code is based on, what version of SMAUG the snippet is for, and why your code does not have the user field.
USA #8
How disappointing. A little investigation shows that I AM missing the user part of that structure. What type of variable is it? char?
USA #9
Alright, I added the line:

char * user;

Fixed the first error, but the others still came right after:


comm.o(.text+0xfd4): In function `new_descriptor':
/home/mirage21/smaug/src/comm.c:874: undefined reference to `set_auth'
db.o(.text+0xf82): In function `boot_db':
/home/mirage21/smaug/src/db.c:685: undefined reference to `copyover_recover'
tables.o(.text+0x1292): In function `skill_function':
/home/mirage21/smaug/src/tables.c:231: undefined reference to `do_copyover'
tables.o(.text+0x4d33): In function `skill_name':
/home/mirage21/smaug/src/tables.c:871: undefined reference to `do_copyover'
collect2: ld returned 1 exit status
distcc[3206] ERROR: compile (null) on localhost failed

Any clues how I'd go about fixing them?

If you want I'll post the offending lines themselves...
USA #10
Did you remember to include the copyover definitions (do_copyover etc) in mud.h?

You could just look at how the FUSS code is done as well.
USA #11
Those are linker errors, not compiler errors. You might have forgotten to add a .o file to the Makefile.

Still, I'd strongly suggest looking into the differences between your SMAUG code and whatever code this snippet is expecting. Simply adding the user field as you did without understanding what exactly is going on is asking for trouble. (The memory leak you have created might be the least of your worries.)
USA #12
I'm looking over everything once more, from the beginning. The snippet is for SMAUG1.4, which is what our SMAUG is ORIGINALLY based off of, like I said, the only real difference is changing skills, etc, y'know, things that make a MUD 'unique'...

Aaaand... Away I go - looking for fixes...
USA #13
Well from what you've said, I don't see any reason the user field would be removed. It also means you removed all references to it in the code, and not just the data member.

Here's the original struct:
struct	descriptor_data
{
    DESCRIPTOR_DATA *	next;
    DESCRIPTOR_DATA *	prev;
    DESCRIPTOR_DATA *	snoop_by;
    CHAR_DATA *		character;
    CHAR_DATA *		original;
    char *		host;
    int			port;
    int			descriptor;
    sh_int		connected;
    sh_int		idle;
    sh_int		lines;
    sh_int		scrlen;
    bool		fcommand;
    char		inbuf		[MAX_INBUF_SIZE];
    char		incomm		[MAX_INPUT_LENGTH];
    char		inlast		[MAX_INPUT_LENGTH];
    int			repeat;
    char *		outbuf;
    unsigned long	outsize;
    int			outtop;
    char *		pagebuf;
    unsigned long	pagesize;
    int			pagetop;
    char *		pagepoint;
    char		pagecmd;
    char		pagecolor;
    char *		user;
    int			newstate;
    unsigned char	prevcolor;
};
USA #14
Yeah. Clearly something more has changed than what you think, or it's based off of a different SMAUG version, or something else very strange is going on. I don't know what to tell you. Zeno's right, there's no reason for this field to be simply missing. Have you talked to the head coder about any of this?
USA #15
If your code doesn't have the user field, then I'd just drop this line:

dnew->user = STRALLOC("unknown");

You don't appear to need it.

Your coder may have also removed the identd code which set_auth usually goes with. You can verify that by doing:

grep set_auth

from your command line while in the src directory. If you get nothing back other than the addition from the copyover code you should be able to get rid of that too.

That leaves the two spots in tables.c. It appears from your compiler log that you added the needed parts in tables.c, so you probably just need a DECLARE_DO_FUN( do_copyover ); in the right place in mud.h to make that work.

Still though. Zeno's original advice may be better. You might want to see what your header coder has to say about using SmaugFUSS. It comes with copyover installed already. But that probably depends on how much you guys have changed over time.
USA #16
*sigh* I haven't had a chance to talk to the Head, but I will soon, so... SMAUGFUSS good option? Where do I go about finding the codebase? Everywhere I go just has SMAUGFUSS forums...

In case it wasn't obvious I'm trying to find codebase alternatives. =)

Any CB's that you guys can suggest for a (don't cringe too much...) Dragonball Z-based MUD? I was thinking DBSaga, but I dunno...

SMAUGFUSS is also cool, it has all the SMAUG stuff I'm familiar with, I think, I also hear it has a bunch of bug fixes that address issues with Smaug1.4.

So yeah, any preferences, please lemme know.
USA #17
You can find SmaugFUSS at http://www.fussproject.org/index.php?a=files (on the forums site), it should even be the first file listed.

Don't know anything about DB* so couldn't tell you which codebase would serve best for that.

Yeah, the "FUSS" is to signify that it's the fixed up version, it's still not perfect, but it's got a bunch of enhancements and way fewer bugs.
USA #18
I would suggest not to start with a DB themed codebase. Start from scratch, or SMAUGFUSS (maybe even SocketMUD).
USA #19
The dbsc codebase is really pretty well kept, has hotboot in it, and has pretty much everything you need, with a few bugs. The project from what I remember shut down on dbsdevelop.com... But theres another one somewhere around... But if you want to take a look at the base I might still have my stock copy with android fixes.