I asked a similar question here C++ delegate creation but I need to do this with a new restriction. I'll quickly restate the question
I was wondering if theres a way to mimic this delegate behaviour (from C#) in C++
new ModifyTargetingStatus("Reversal", "Reverses physical attacks back at the user", -1, new List<CALL_CONDITION>(){CALL_CONDITION.Targetted}, attemptChange: delegate(CharacterMove move, BattleCharacter[] users, ref BattleCharacter[] targets, BattleCharacter holder, BattleField field)
{
if (targets != null && targets.Length == 1 && targets[0] == holder &&
(move.MoveClass == MOVE_CLASS.MC_BASIC_ATTACK ||
move.MoveClass == MOVE_CLASS.MC_STACKED_ATTACK) &&
!move.MoveFlags.Contains(MOVE_FLAG.MF_UNREFLECTABLE))
{
targets = users;
move.Reflected = true;
return true;
}
return false;
})
I need to be able to do this without using C++0x as I'm stuck on a version of gcc the doesnt support C++0x lambdas. I have the boost library available but I'm jut getting into it so I can't figure out how to do this specifically.
Thanks in advance for the help