In other news, I think my socket code is working. Actually, I'll rephrase that. My socket code is completely working now, and I'll fix bigs as they appear.
I found an interesting bug today, which I feel is worth sharing.
I have code a bit like this (Psuedocode, obviously):
void CSocket::Release(){ EnterSocketMutex(); NotifyThisSocketsThreadToRemoveIt(); SetSocketsOwnerThreadToNull(); LeaveSocketMutex();}void CSocketThread::ProcessEvents(){ if(theEvent.eEvent == EVENT_RemoveSocket) { RemoveSocketFromThisThreadsDataStructs(); CSocketManager::Get().KillSocket(blah); }}void CSocketThread::KillSocket(){ FreeSocket(socket.sock); FreeBuffers(socket); FreeMutex(socket.mutex); FreeSocket(socket);}
Looks all ok, yes? No. I had this annoying problem where I'd get random issues elsewhere in my code. The problem stems from me recycling mutexes (mutices?). When I call FreeMutex(), the mutex gets thrown into a pool of free mutexes, and those are used when I need to allocate one in future (when a new socket connects). What I found was happening was this:
So now, Thread x has the mutex, while Thread is still in it. I can't remember what the hell happened (I thought Thread 1 tried to enter it, but that can't be right - thread 1 would need to leave the mutex before it was able to enter it...), but it was a mess anyway.
So. Socket code is done. Server code is... Well, good enough. Tomorrow, I'll be doing stuff to the client. Such as fixing the rubbish scene manager so you don't have to keep adding everything you want to render each frame, causing the entire scene graph to be sorted each frame (Wtf was I thinking...). Basically, I want to do client stuff, because it's graphic-y and pretty.
I've done a bit of work on my Game Design Document, I'll put it up on GDNet when it's in a reasonable state, because unlike some pople (*cough* help wanted forum *cough*) I don't expect people to steal my idea, nor do I really care if they do, since they're likely to get even less far than me.
I decided to install the beta of Office 2007 for doing that, because Open Office was annoying me. And "Eww". It's... Horrible. Screenshot time:
First, where the shit are my menus? Point to me where "File" is, for instance. Second: it took me 10 minutes to find out why, when I tried to open a document, I only got one page, and it appeared to be as an image (I could select the page and move it around in the document, but not edit it). It turns out that dragging a file into office with no documents open actually creates a document and inserts the dropped file as an attachment. It used to open the document. Even worse, it doesn't tell you it did that, and it doesn't even use a little explorer-like icon for showint it as an attachment - it uses the first page of the document.
Next up - I like to be able to close documents without resorting to clicking through a bunch of menus. Where's the mini 'X' button for "close document" gone?
After that, the UI is very linux-like. You move the mouse up to the toolbars at the top (Because apparently normal menus aren't good enough), and scroll the mouse scrollwheel, and it cycles through the tabs in the toolbar. I don't know about you, but I like to throw my mouse out of the way before I start typing. Try that with Office 2007 (Beta), and you end up trying to scroll the document down via the toolbars...
The last two things are fairly minor, but it really doesn't fit in with the rest of my windows theme. The colours are close, but it still looks really out of place. I suppose it's designed for Vista though, so that's excusable. Also, I like my nice square (or nearly square) windows. That curved corner really annoys me for some completely unknown reason, since unlike MSN (Well, the non-Live version), you don't seem to get a choice about framing it in a normal square window.
And don't get me started on MSN Live - I installed it on my server, because I wanted to quickly say something to a friend and couldn't be bothered starting up my PC (Then realised I didn't have MSN installed on my server...). It's fucking ugly. Give me nice square windows and non-bluey-metallic colour schemes and I'll be happy. Yes, I know, I have no taste.
Right. I have to be up in 7 hours, and I'll be doing overtime for most of the next 2 weeks I expect, so bed.
-IV