Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Tiberian Technologies / Blackhand Studios » Tiberian Technologies Forum » int Get_Team_Player_Count(int Team)
Re: int Get_Team_Player_Count(int Team) [message #340007 is a reply to message #339927] Wed, 09 July 2008 16:49 Go to previous message
StealthEye is currently offline  StealthEye
Messages: 2518
Registered: May 2006
Location: The Netherlands
Karma:
General (2 Stars)

PlayerType is only defined for smart game objects. You should use As_SmartGameObj to test whether you can call GetPlayerType on an object.

Hex's solution is cleaner though. Wink

[edit]
Oh, I see it already does As_SoldierGameObj... It's probably the As_SoldierGameObj call crashing. For TT it calls As_ScriptableGameObj prior to calling As_SoldierGameObj:

GameObject *As_SoldierGameObj(GameObject *obj)
{
	if (!Commands->Get_ID(obj) || !obj)
		return 0;
	ScriptableGameObj* o2 = ((BaseGameObj *)obj)->As_ScriptableGameObj();
	if (!o2)
		return 0;
	return (GameObject *)o2->As_SoldierGameObj();
}


For older versions it probably does not call As_ScriptableGameObj and therefore crash when calling As_SoldierGameObj on a nonscriptable game object.


BlackIntel admin/founder/coder
Please visit http://www.blackintel.org/

[Updated on: Wed, 09 July 2008 16:55]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Sooooo...
Next Topic: EA
Goto Forum:
  


Current Time: Sun Feb 02 10:08:30 MST 2025

Total time taken to generate the page: 0.00810 seconds