Browse Source

Merge pull request #428 from Hoikas/cov

Trickle of Coverity
Michael Hansen 11 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];
va_list args;
va_start(args, fmt);
vsnprintf(msg, sizeof(msg), fmt, args);
vsnprintf(msg, arrsize(msg), fmt, args);
#ifdef HS_DEBUGGING
if (s_GuiAsserts)
{
@ -163,7 +163,7 @@ void DebugMsg(const char* fmt, ...)
char msg[1024];
va_list args;
va_start(args, fmt);
vsnprintf(msg, sizeof(msg), fmt, args);
vsnprintf(msg, arrsize(msg), fmt, args);
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)
{
// 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
if ( plOneShotMod::ConvertNoRef(behKey.getKey()->GetObjectPtr()) != nil )
if (plOneShotMod::ConvertNoRef(behKey.getKey()->GetObjectPtr()))
{
// create a message OneShotMessage
plOneShotMsg* pMsg = new plOneShotMsg;
// check if this needs to be network forced to all clients
if (netProp)
{
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->SetBCastFlag(plMessage::kNetPropagate, netProp || netForce);
pMsg->SetBCastFlag(plMessage::kNetForce, netForce);
pMsg->SetSender(fSender);
pMsg->AddReceiver(behKey.getKey());
int i;
for ( i=0; i<fRecvr.Count(); i++ )
{
for (int i = 0; i < fRecvr.Count(); i++) {
// make sure there is an avatar to set
if ( fRecvr[i] != nil )
{
pMsg->fPlayerKey = (plKey)fRecvr[i];
plgDispatch::MsgSend( pMsg ); // send off command for each valid avatar we find
// ... really, should only be one... though
if (fRecvr[i]) {
pMsg->fPlayerKey = fRecvr[i];
pMsg->SendAndKeep(); // gotta keep the message so we can keep sending it
// there should really only be one avatar, though...
}
}
pMsg->UnRef(); // done with our reference
}
// else if it is a Multistage guy
else if ( plMultistageBehMod::ConvertNoRef(behKey.getKey()->GetObjectPtr()) != nil )

Loading…
Cancel
Save