Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - Umbrella Wizard

Pages: [1]
1
Dead Souls Support / Driver control flow before and after connect.c
« on: July 01, 2015, 11:22:56 pm »
Long story short, I'm working on a modification of connect.c to allow importing characters from file for admins. Character importing happens in-between a correct admin password being provided and the admin logging in. The imported players are not loaded until logging in as them.

I've gotten it all working with one caveat. If I take the server down after importing characters, but before logging into the them, they are genderless without a space in their name, among other issues. This is happening because whatever function the new player object is returned to is calling pointers to the capitalized name and gender, stored with CapNamen and Gendre in connect.c. If the server is still up, these remain in memory and the correct values are written to the player save file. Other fields such as race are unaffected.

The last line that's executed in connect.c prior to successful world entry is

Code: [Select]
call_out( (: destruct(this_object()) :), 10);
As a debug example, by destructing a newly created Player object after execing to it like so:

Code: [Select]
CapNamen = "First Last";
Gendre = "Male";
Player->SetCapName(CapNamen);
Player->SetGender(Gendre);

static private void eventEnterGame() {
if(!exec(Player, this_object()))
...
destruct(Player);
call_out( (: destruct(this_object()) :), 10);}

And checking the playersave file created, you'll find:

Code: [Select]
CapName "Firstlast"
Gender "Neuter"

So it's definitely something called after connect.c that dumps the pointer data to the player save. According to http://lpmuds.net/smf/index.php?topic=584.0 the driver calls master object (master.c) to ultimately call connect.c, but the details of what, when, and how the driver executes everything from start to master and then from there are very vague. I know that when an object is first loaded, the create function in it is first called...but then what? The create function simply initializes variables and performs other base state setup, but it doesn't make function calls itself. The object calling it generally calls a function to execute within, but when the previous object is flat out destructed, where does the flow of control go?

Pages: [1]