06 Feb, 2010, jurdendurden wrote in the 1st comment:
Votes: 0
I have created ships. They are essentially areas that don't move (when you board the ship, the ship remembers your location, and tries to transfer it to ch->ship->in_room.) This is where I have the problem. Which it actually worked earlier for a bit but now for some reason won't. I've run it through GDB getting this:

Program received signal SIGSEGV, Segmentation fault.
0x080ce9ea in do_boardship (ch=0xb7d43874, argument=0xbfe84f82 "testship") at ships.c:144
144 ch->ship->in_room = ch->in_room;


Here is the do_boardship function:

void do_boardship ( CHAR_DATA *ch, char *argument )
{

char buf[MAX_STRING_LENGTH];
AREA_DATA *area;
ROOM_INDEX_DATA *location;

if (ch->onBoard)
{
SEND("You're already on a boat!\r\n",ch);
return;
}

/*if (!ch->ship)
{
SEND("You don't even own a boat.\r\n",ch);
return;
}*/

if (!check_existing_ship(ch, argument))
{
SEND("That ship isn't here.\r\n",ch);
return;
}
area = get_ship_area (argument);
if (!area)
{
return;
}

sprintf (buf, "You board the %s.\r\n", area->name);
SEND (buf, ch);
if ((location = get_room_index (area->min_vnum)) != NULL) //This means the deck must ALWAYS be the first vnum in the ship's area file.
{
ch->ship->in_room = get_room_index(ch->in_room->vnum); //This is the line that errors in gdb.
//All i'm trying to do is have the ship 'remember' where the char currently is,
//so that I can then place the char on the ship, and still use the char to move,
//rather than moving the area (ship) itself.
char_to_room (ch, location);
ch->onBoard = TRUE;
}
return;

}


Any ideas?
06 Feb, 2010, Kline wrote in the 2nd comment:
Votes: 0
Well you commented your sanity check for ch->ship existing; does it exist? You should also be able to directly assign ch->ship->in_room to ch->in_room if both are ROOM_DATA pointers.
06 Feb, 2010, jurdendurden wrote in the 3rd comment:
Votes: 0
Well in the char_data struct it's defined as ROOM_INDEX_DATA, so I mirrored it there in SHIP_DATA. But I bet it is because it's NULL, let me check it out, be right back with you.
06 Feb, 2010, Kline wrote in the 4th comment:
Votes: 0
Yeah, ROOM_INDEX_DATA, sorry, my bad, twas what I meant :). Anyhow if they're both the same type you can assign directly without needing to check ch->in_room->vnum; just assign ch->ship->in_room = ch->in_room. Also make sure you are initializing (malloc :) ch->ship when you create players.
06 Feb, 2010, jurdendurden wrote in the 5th comment:
Votes: 0
Ok yeah, I had to set up some memory stuff in recycle.c (new_ship, free_ship, etc…). Once I did that and made a call to new_ship in load_char_obj (db2.c), everything worked fine. Thanks!
07 Feb, 2010, JohnnyStarr wrote in the 6th comment:
Votes: 0
So how are you planning on making the ships move? Are your vessels on a timer that move them from place to place?
I've always wanted to create a transport type system where you get on the train, or shuttle craft at a certain point in time,
board it, then it takes you to your next location.
07 Feb, 2010, jurdendurden wrote in the 7th comment:
Votes: 0
Ships are currently manual (ie sail west, sail east), which happens immediately (with normal move_char lag), but soon I will be implementing a timer system (once the initial bugs are ironed out), in which you will type sail east, and every timer update will try to move you east (if you run aground and destroy your hull that's on you for not paying attention to where you were going :D). Also wind will be a factor (if your sails are up), and you will move based on wind direction unless you have dropped anchor.
05 Apr, 2010, zonez wrote in the 8th comment:
Votes: 0
Hi, all!

I'm doing the ships too.
Could your mortals buy ships in a shipyard or you creating ships manually? (creating a room for ship, creating entrance to ship, etc.. ? )
I just cant imagine how to implement ship prototypes (allow to buy your own ships and how to allocate different vnums for new ships…)

sorry for bad english, learning. :redface:
05 Apr, 2010, jurdendurden wrote in the 9th comment:
Votes: 0
I'm doing them manually. For a good example of prototypes, you can look at the swfote codebase. Eventually I'd like to have an 'automatic' shipyard, but for now I'm just creating them by hand.
Random Picks
0.0/9