Advertisement

Suggestion for calling functions

Started by May 04, 2008 07:21 AM
0 comments, last by WitchLord 16 years, 6 months ago
If you define to many arguments with context->SetArg*() the function will just not be called. For example if someone who is making an npc for my game forgets to define all the arguments in the event like this:
bool OnWarpCollision(const string& level)
{
  PrintLine(level);
  return true;
}
When it should look like this:
bool OnWarpCollision(const string& level, float x, float y)
{
  PrintLine(level);
  return true;
}
The first one will not be called because i use: SetArgAddress(0, level); SetArgFloat(1, nextX); SetArgFloat(2, nextY); Maybe you could make it ignore the SetArg() if the argument isnt defined
I think that may be a bit drastic, not all applications may want to simply ignore it.

Instead I'll provide a way for you to determine the number of arguments and the argument types for a function. That way you can decide for yourself whether to call the SetArg function or not.

Regards,
Andreas

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

This topic is closed to new replies.

Advertisement