Game Development Community

ConsoleMethod ActionMap::isActive()

by Shaderman · 06/13/2009 (2:20 am) · 4 comments

Just add these lines to engine/source/sim/actionMap.cc (TGB), engine/sim/actionMap.cc (TGE) or source/sim/actionMap.cpp (TGEA):

ConsoleMethod( ActionMap, isActive, bool, 2, 2, "() Use the isActive method to determine if an ActionMap is active.n"
																"@return Returns true if the ActionMap is active, false otherwise.n")
{
   SimSet* pActionMapSet = Sim::getActiveActionMapSet();

	SimSet::iterator iter;
	if ( (iter = find(pActionMapSet->begin(), pActionMapSet->end(), object)) == pActionMapSet->end() )
      return false;  // not found (not active)
	else
		return true;	// found (active)
}

The method returns either true or false.

#1
06/13/2009 (12:58 pm)
Thanks Stefan this is very usefull.
#2
06/15/2009 (7:21 am)
Thanks! This may help me out too... I have a lot of actionmaps in my project.
#3
07/30/2009 (9:41 am)
What this can be used for? :-)
#4
07/30/2009 (10:25 am)
Just in case you don't know what ActionMaps are:

Quote:Game action maps are arranged in a stack for processing - so individual parts of the game can define specific actions - for example when the player jumps into a vehicle it could push a vehicle action map and pop the default player action map.

(Quoted from TDN).

With this resource, you can check if an ActionMap is active (in use).

Hope this helps.