Water ... that adapts itself to the flow, that breaks everything like a sword
Legends of Grimrock
Get link
Facebook
X
Pinterest
Email
Other Apps
-
Today on IndeDB I found post about " Legends of Grimrock" and as in most case I don't write post about projects that I found on internet this time I will do exception because I think that this game is worth it :]
So like always start with problem description: I have some pool of command represented as enumerator. Each of command can have unique data that size can be different. I wanted to create system that allow me in easy way iterate over them and execute. After some time I created this implementation: template<ECommands::enum cmd> bool execCommandTemp(ECommands::ENUM a_cmd, void* a_data) { if (a_cmd == cmd) { SCommand<cmd>::execute((SCommand ::SData*)a_data); return false; } return execCommandTemp<(ECommands::ENUM)(cmd+1)>(a_cmd, a_data); } template<> bool execCommandTemp<ECommands::WRAP>(ECommands::ENUM a_cmd, void* a_data) { return true; } bool execCommand( ECommands::ENUM a_cmd, void* a_data ) { return execCommandTemp<(ECommands::ENUM)0>(a_cmd, a_data); } where SCommand look in example such a way: template <> st...
And as I said last time new preview is available: As you can see a lot has changed. Right now I mostly focus on gameplay so I do test of AI (some of them you can see on end of movie), changes in fight, items managing, fix some problem with physics and many other things. To say truth I don't remember them all :P So I'm going back to work and till next week.
If you try to find answer what good/bad code is, you won't find it in this post. I don't try to sell my beliefs and I'm sure you wouldn't like them anyway. To show you that, check this simple pieces of code: ////////////////////////////////////////////////////////////////////////// void CAnimationResource :: release ( void ) { SAFE_DELETE ( m_privateData ); } I use void when function don't use any arguments. I know this useless and do nothing but I just like look of it (Personal preference). Other example: ////////////////////////////////////////////////////////////////////////// CAnimationResource :: CAnimationResource ( const wrResourceID & a_id , IResourceManager * a_manager ) : CResource ( a_id ) , m_manager ( a_manager ) { } I using prefix a_ for arguments of functions and use this style of organizing initialization...
Comments
Post a Comment