The changes were fairly easy, and I was actually able to find and fix an
out-of-sequence bug: The destructors for the AccountManager and the
CharacterManager were using SQL code after the call to SQLite3_close_v2(),
so I added and called UnloadAll() for both of them.
This required that I switch from using a char array for the packet buffers
to using malloc() and free(). They make more sense anyway, and I've
learned (or relearned) something about casting.
There is some missing character creation/unloading code, and there are a
few other issues highlighted by TODO tags, see below.
In general, 'mapIndex' has been renamed to 'roomIndex'. Multiple rooms
have not been fully implemented yet, but I'm working on it.
Other issues:
* FileFormat needs to be changed to MapLoader
* Server's character movement is still slaved to the clients
The client does not build.
I've created a separate branch for this because it's gonna be a bitch to
get compiled, and then I'll still have to ensure that the client & server
are work together correctly.
This build does not compile.
It seems that the serialization code has a bug in it. I was expecting
something like this. When the server tries to send the region content, it
exits. I'll try and find the cause of the error, but I'm committing my
changes anyway.
I've also added in some debug code to the map classes, because I was
hunting down a std::bad_alloc beingthrown. Turns out I forgot to set the
map sizes in the client's InWorld constructor. I'm committing the fix, and
the debug code.
I've added lua hooks for both pager functor classes. Hopefully, I haven't
missed any corner cases, because it took me a while to hunt everything
down. One issue is that the map's save directory needs to be set in the
Format class, but it'll do for now. I'll review this again when I've got
more than one map running at one time.
There should be enough here for a lua-driven map generator to be
implemented, even if it's a bit rough. I think I'll test this out in the
editor eventually, but getting the base branch's network map code going
comes first.
The current process is extremely convulted, so I need to document
everything that I've done so far, including C++ and lua functions.
Conflicts:
server/server_application.cpp (resolved)
After completing the serialization code, I'm merging it into the server's
development branch. This means that although the connection and
disconnection functionality work, I still need to test the player systems
from the new server with the new serialization code.
Immediately following this commit, I'll be merging the minor tweaks to the
editor from the master branch into this one.
I've dummied out the player code, so only the client connection code is
working. Otherwise the protocol hasn't changed.
I've also made a few other tweaks as I went along, but nothing really
major.
Cause:
server/server_application.cpp: line 93
The last argument to std::pair was simply a call to WorldRoom's
contructor. This created a temporary object that fufilled this line, but
after the new std::pair object was added to worldRoomMap, this WorldRoom
object went out of scope.
server/server_application.cpp: line 96
When OpenRoom() was called using an object that was out of scope, the
entire server simply failed.
Solution:
Changed worldRoomMap to hold a pointer to a WorldRoom object, rather than the
object itself. The new and delete operators should be used to create and
delete WorldRoom objects respectfully.
For some reason, when trying to initiate the room thread, the entire
server simply fails. There is no crash, no error message, or anything. I
have no idea what's wrong.