Browse Source

Merge pull request #428 from Hoikas/cov

Trickle of Coverity
Michael Hansen 10 years ago
parent
commit
de88d89cff
  1. 4
      Sources/Plasma/CoreLib/HeadSpin.cpp
  2. 41
      Sources/Plasma/FeatureLib/pfPython/cyAvatar.cpp

4
Sources/Plasma/CoreLib/HeadSpin.cpp

@ -118,7 +118,7 @@ void ErrorAssert(int line, const char* file, const char* fmt, ...)
char msg[1024]; char msg[1024];
va_list args; va_list args;
va_start(args, fmt); va_start(args, fmt);
vsnprintf(msg, sizeof(msg), fmt, args); vsnprintf(msg, arrsize(msg), fmt, args);
#ifdef HS_DEBUGGING #ifdef HS_DEBUGGING
if (s_GuiAsserts) if (s_GuiAsserts)
{ {
@ -163,7 +163,7 @@ void DebugMsg(const char* fmt, ...)
char msg[1024]; char msg[1024];
va_list args; va_list args;
va_start(args, fmt); va_start(args, fmt);
vsnprintf(msg, sizeof(msg), fmt, args); vsnprintf(msg, arrsize(msg), fmt, args);
if (DebugIsDebuggerPresent()) if (DebugIsDebuggerPresent())
{ {

41
Sources/Plasma/FeatureLib/pfPython/cyAvatar.cpp

@ -215,47 +215,26 @@ void cyAvatar::OneShot(pyKey &seekKey, float duration, bool usePhysics,
void cyAvatar::RunBehavior(pyKey &behKey, bool netForce, bool netProp) void cyAvatar::RunBehavior(pyKey &behKey, bool netForce, bool netProp)
{ {
// first there is someone to send to and make sure that we an avatar to send this to // first there is someone to send to and make sure that we an avatar to send this to
if ( behKey.getKey() != nil && fRecvr.Count() > 0) if ( behKey.getKey() && fRecvr.Count() > 0)
{ {
// must determine if the behKey is pointing to Single or Multi Shot behavior // must determine if the behKey is pointing to Single or Multi Shot behavior
if ( plOneShotMod::ConvertNoRef(behKey.getKey()->GetObjectPtr()) != nil ) if (plOneShotMod::ConvertNoRef(behKey.getKey()->GetObjectPtr()))
{ {
// create a message OneShotMessage // create a message OneShotMessage
plOneShotMsg* pMsg = new plOneShotMsg; plOneShotMsg* pMsg = new plOneShotMsg;
// check if this needs to be network forced to all clients pMsg->SetBCastFlag(plMessage::kNetPropagate, netProp || netForce);
if (netProp) pMsg->SetBCastFlag(plMessage::kNetForce, netForce);
{
pMsg->SetBCastFlag(plMessage::kNetPropagate);
}
else
{
pMsg->SetBCastFlag(plMessage::kNetPropagate, false);
}
if (netForce)
{
// set the network propagate flag to make sure it gets to the other clients
pMsg->SetBCastFlag(plMessage::kNetPropagate);
pMsg->SetBCastFlag(plMessage::kNetForce);
}
else
{
pMsg->SetBCastFlag(plMessage::kNetForce, false);
}
pMsg->SetSender(fSender); pMsg->SetSender(fSender);
pMsg->AddReceiver(behKey.getKey()); pMsg->AddReceiver(behKey.getKey());
int i; for (int i = 0; i < fRecvr.Count(); i++) {
for ( i=0; i<fRecvr.Count(); i++ )
{
// make sure there is an avatar to set // make sure there is an avatar to set
if ( fRecvr[i] != nil ) if (fRecvr[i]) {
{ pMsg->fPlayerKey = fRecvr[i];
pMsg->fPlayerKey = (plKey)fRecvr[i]; pMsg->SendAndKeep(); // gotta keep the message so we can keep sending it
plgDispatch::MsgSend( pMsg ); // send off command for each valid avatar we find // there should really only be one avatar, though...
// ... really, should only be one... though
} }
} }
pMsg->UnRef(); // done with our reference
} }
// else if it is a Multistage guy // else if it is a Multistage guy
else if ( plMultistageBehMod::ConvertNoRef(behKey.getKey()->GetObjectPtr()) != nil ) else if ( plMultistageBehMod::ConvertNoRef(behKey.getKey()->GetObjectPtr()) != nil )

Loading…
Cancel
Save