PlaneShift
Development => Development Deliberation => Topic started by: player on December 12, 2006, 06:53:25 am
-
c:\development\planeshift\src\npcclient\npcbehave.cpp(837) : warning C4715: 'Behavior::ResumeScript' : not all control paths return a value
about warning C4715 of VC++2005
http://msdn2.microsoft.com/en-us/library/ms909205.aspx
-
Thank you for pointing that out!
I was trying to fix such warning but I have no details about the function characteristics, so I was waiting for the author to reply :-)
Maybe he will do it here ;)
-
Well, here's the function in question and my thoughts.
bool Behavior::ResumeScript(NPC *npc,EventManager *eventmgr)
{
npc->Printf("Resuming behavior %s at step %d.",name.GetData(),current_step);
if (current_step < sequence.Length())
{
if (sequence[current_step]->CompleteOperation(npc,eventmgr))
{
current_step++;
return RunScript(npc,eventmgr,false);
}
}
else
{
current_step=0;
return RunScript(npc,eventmgr,false);
}
}
You can see that there is case where no return value is sent ( ie the first if passes and nested if fails ). So the best way to solve this I think is to add a return true at the end. I am guessing true because RunScript() will return true if the behaviour is complete. So if there is nothing to do we can return true.