Jump to content
  • Advertisement
Sign in to follow this  
  • entries
  • comments
  • views

Code tidy

Sign in to follow this  
Evil Steve


Well, that went fairly nicely. About 3 hours to move the code for character selection / creation / deletion into the login server, add some code to let me abort DB requests, and I restructured the code for the DB so it'll always allocate the buffer (that way it can free it if you abort). So, to request a user from the DB looks like this now:

CDatabase::Result theResult;
HANDLE h = CDatabase::Get().RequestUser("Steve");

if(theResult.nErrorCode != 0)
// Handle MySQL error

User* pUser = (User*)theResult.pBuffer;
// Do stuff to pUser here

If you call CDatabase::Abort(), the database looks through it's list of pending events, and if it's there, just removes the event so the worker thread never picks it up. If it's not still to be processed, it checks if it's already been processed and removes it if it is. Otherwise, the worker thread is processing it, so it records the event handle as needing rechecked, and in CDatabase::OperationComplete(), if there's an event to be checked, it'll see if that event has been processed, and if it has, it'll remove it from the output queue.
It works perfectly, despite sounding horrible [smile]

I also did a bit of testing and removed a couple of bugs. I still need to do some proper bug testing though; most of it'll require me asking people to try and exploit my code (cause buffer overruns, try to do something when the server isn't ready [E.g. ask for a character list before the user is logged in] and the like).
I also still need to check if the user is already logged in when they try to log on, and kick the connected one if they are. I'll probably leave that till after the test, since that means I don't need to have unique users for everything, and testers can use a few characters.

Tomorrow is my last day at PC World. Yay! Nothing that special actually, since I still need to go back in to return my uniform, and it's the closest PC shop, so I'll still go for getting blank CDs / DVDs, ink cartriges, etc.
I'd like to get set up TEH MMORPG!!1 for user testing tomorrow evening, and have it ready to go on Friday / weekend, but I don't know if I'll have time. I need an early night, since I have to be up at 9am instead of 1pm, which I've done for the past couple of days (Working 2 - 8).

Anyway, South Park, then bed.
Sign in to follow this  


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!