Taking the code example above (not intended as criticism, only to have some work basis):
Why is it one time health, and then is it HP? For me there is only one base name, and if I choose health for it, then my other variable would be var vOldHealth. I would drop newHP completely, as it only reads the entity value one time and is used directly afterwards. Also I would use a less generic function name, like checkSkinChangeOnHit().
Re: Real Programmers...
[Re: FBL]
#318674 04/09/1006:3304/09/1006:33
void STATEMGR_execute(STATEMGR* psState)
{
/* check whether atate machine is ready */
if ( (LIST_items(psState->psActions) > 0) && (LIST_items(psState->psTransitions) > 0) )
{
/* first check, if transition has to be done */
STATEMGR__checkTransitions(psState);
/* now execute cyclic action callback */
if (psState->pfAction != NULL)
{
STATEMGR__pfCallback = psState->pfAction;
STATEMGR__pfCallback();
}
}
}
An interface function of my state handler module.
The corresponding header file part looks like this:
Code:
/*! Execute cyclical actions and transition checks for State Machine.
* Must be called cyclically.
* \param psState Pointer to affected STATEMGR
*/
void STATEMGR_execute(STATEMGR* psState);
This is nice and ok in C. You provide doxy info how to use the function and in addition you comment scopes and important calls. In C++ function names would be much easier to read and as such the function wouldn't need this much inner commenting.
I also use prefabs, I used to not do them, but when I learned how much of a time saver they were I started doing them. Generally If I would give that out to the public, I would do what you did, give a readme.
Of course, this still proves I don't comment alot lol I'm a butt-end of the joke.