mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-14 10:37:41 -04:00
Fix string usage that was broken from enabling the Max plugin build
This commit is contained in:
@ -174,7 +174,7 @@ plKey cyAvatar::IFindArmatureModKey(plKey avKey)
|
||||
// PURPOSE : oneShot Avatar (must already be there)
|
||||
//
|
||||
void cyAvatar::OneShot(pyKey &seekKey, float duration, hsBool usePhysics,
|
||||
const char *animName, hsBool drivable, hsBool reversible)
|
||||
const plString &animName, hsBool drivable, hsBool reversible)
|
||||
{
|
||||
if ( fRecvr.Count() > 0 )
|
||||
{
|
||||
@ -185,7 +185,7 @@ void cyAvatar::OneShot(pyKey &seekKey, float duration, hsBool usePhysics,
|
||||
seekKey.getKey(), // Mark D told me to do it ...paulg
|
||||
duration,
|
||||
usePhysics,
|
||||
animName, // Constructor will do a copy. -mf- hsStrcpy(animName),
|
||||
animName,
|
||||
drivable,
|
||||
reversible);
|
||||
|
||||
@ -1586,7 +1586,7 @@ void cyAvatar::ExitSubWorld()
|
||||
//
|
||||
// PURPOSE : Place the Avatar into the subworld of the sceneobject specified
|
||||
//
|
||||
void cyAvatar::PlaySimpleAnimation(const char* animName)
|
||||
void cyAvatar::PlaySimpleAnimation(const plString& animName)
|
||||
{
|
||||
// make sure that there is atleast one avatar scene object attached (should be)
|
||||
if ( fRecvr.Count() > 0)
|
||||
|
@ -103,7 +103,7 @@ public:
|
||||
|
||||
// oneShot Avatar (must already be there)
|
||||
virtual void OneShot(pyKey &seekKey, float duration, hsBool usePhysics,
|
||||
const char *animName, hsBool drivable, hsBool reversible);
|
||||
const plString &animName, hsBool drivable, hsBool reversible);
|
||||
|
||||
// oneShot Avatar
|
||||
virtual void RunBehavior(pyKey &behKey, hsBool netForce, hsBool netProp);
|
||||
@ -412,7 +412,7 @@ public:
|
||||
//
|
||||
virtual void ExitSubWorld();
|
||||
|
||||
virtual void PlaySimpleAnimation(const char* animName);
|
||||
virtual void PlaySimpleAnimation(const plString& animName);
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
@ -89,8 +89,7 @@ PYTHON_METHOD_DEFINITION(ptAvatar, oneShot, args)
|
||||
}
|
||||
|
||||
pyKey* key = pyKey::ConvertFrom(keyObj);
|
||||
std::string animNameStr = animName; // convert to string (for safety)
|
||||
self->fThis->OneShot(*key, duration, usePhysics != 0, animNameStr.c_str(), drivable != 0, reversable != 0);
|
||||
self->fThis->OneShot(*key, duration, usePhysics != 0, plString::FromUtf8(animName), drivable != 0, reversable != 0);
|
||||
PYTHON_RETURN_NONE;
|
||||
}
|
||||
|
||||
@ -592,8 +591,7 @@ PYTHON_METHOD_DEFINITION(ptAvatar, playSimpleAnimation, args)
|
||||
PYTHON_RETURN_ERROR;
|
||||
}
|
||||
|
||||
std::string animNameStr = animName; // convert to a string (for safety)
|
||||
self->fThis->PlaySimpleAnimation(animNameStr.c_str());
|
||||
self->fThis->PlaySimpleAnimation(plString::FromUtf8(animName));
|
||||
PYTHON_RETURN_NONE;
|
||||
}
|
||||
|
||||
|
@ -629,23 +629,23 @@ void plPythonFileMod::AddTarget(plSceneObject* sobj)
|
||||
NamedComponent comp;
|
||||
comp.isActivator = (isNamedAttr == 1);
|
||||
comp.id = parameter.fID;
|
||||
comp.name = plString::FromUtf8(parameter.datarecord.fString);
|
||||
comp.name = parameter.fString;
|
||||
|
||||
fNamedCompQueue.Append(comp);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (isNamedAttr == 1)
|
||||
IFindActivatorAndAdd(plString::FromUtf8(parameter.datarecord.fString), parameter.fID);
|
||||
IFindActivatorAndAdd(parameter.fString, parameter.fID);
|
||||
else
|
||||
IFindResponderAndAdd(plString::FromUtf8(parameter.datarecord.fString), parameter.fID);
|
||||
IFindResponderAndAdd(parameter.fString, parameter.fID);
|
||||
}
|
||||
}
|
||||
}
|
||||
// if it wasn't a named string then must be normal string type
|
||||
if ( isNamedAttr == 0 )
|
||||
if ( parameter.datarecord.fString != nil )
|
||||
value = PyString_FromString(parameter.datarecord.fString);
|
||||
if ( !parameter.fString.IsNull() )
|
||||
value = PyString_FromString(parameter.fString.c_str());
|
||||
break;
|
||||
case plPythonParameter::kSceneObject:
|
||||
case plPythonParameter::kSceneObjectList:
|
||||
|
@ -94,17 +94,16 @@ public:
|
||||
// the data of the value
|
||||
union
|
||||
{
|
||||
int32_t fIntNumber;
|
||||
int32_t fIntNumber;
|
||||
|
||||
float fFloatNumber;
|
||||
float fFloatNumber;
|
||||
|
||||
hsBool fBool;
|
||||
|
||||
char* fString;
|
||||
|
||||
} datarecord;
|
||||
|
||||
plKey fObjectKey; // the plKey of the scene object (should be part of the union, but unions don't allow complex types)
|
||||
plString fString;
|
||||
|
||||
|
||||
plPythonParameter()
|
||||
@ -147,7 +146,7 @@ public:
|
||||
SetTobool(other.datarecord.fBool);
|
||||
break;
|
||||
case kString:
|
||||
SetToString(other.datarecord.fString);
|
||||
SetToString(other.fString);
|
||||
break;
|
||||
case kSceneObject:
|
||||
SetToSceneObject(other.fObjectKey);
|
||||
@ -174,7 +173,7 @@ public:
|
||||
SetToAnimation(other.fObjectKey);
|
||||
break;
|
||||
case kAnimationName:
|
||||
SetToAnimationName(other.datarecord.fString);
|
||||
SetToAnimationName(other.fString);
|
||||
break;
|
||||
case kBehavior:
|
||||
SetToBehavior(other.fObjectKey);
|
||||
@ -214,10 +213,6 @@ public:
|
||||
|
||||
void SetToNone()
|
||||
{
|
||||
// remove the string if one was created
|
||||
if ( fValueType == kString || fValueType == kAnimationName )
|
||||
delete [] datarecord.fString;
|
||||
|
||||
fValueType = kNone;
|
||||
}
|
||||
|
||||
@ -239,11 +234,11 @@ public:
|
||||
fValueType = kbool;
|
||||
datarecord.fBool = state;
|
||||
}
|
||||
void SetToString(const char* string)
|
||||
void SetToString(const plString& string)
|
||||
{
|
||||
SetToNone();
|
||||
fValueType = kString;
|
||||
datarecord.fString = hsStrcpy(string);
|
||||
fString = string;
|
||||
}
|
||||
void SetToSceneObject(plKey key, hsBool list=false)
|
||||
{
|
||||
@ -302,11 +297,11 @@ public:
|
||||
fValueType = kAnimation;
|
||||
fObjectKey = key;
|
||||
}
|
||||
void SetToAnimationName(const char* string)
|
||||
void SetToAnimationName(const plString& string)
|
||||
{
|
||||
SetToNone();
|
||||
fValueType = kAnimationName;
|
||||
datarecord.fString = hsStrcpy(string);
|
||||
fString = string;
|
||||
}
|
||||
void SetToBehavior(plKey key)
|
||||
{
|
||||
@ -380,11 +375,13 @@ public:
|
||||
count = stream->ReadLE32();
|
||||
if ( count != 0 )
|
||||
{
|
||||
datarecord.fString = new char[count+1];
|
||||
stream->ReadLE(count,datarecord.fString);
|
||||
char *buffer = new char[count];
|
||||
stream->ReadLE(count, buffer);
|
||||
buffer[count-1] = 0;
|
||||
fString = plString::Steal(buffer, count);
|
||||
}
|
||||
else
|
||||
datarecord.fString = nil;
|
||||
fString = plString::Null;
|
||||
break;
|
||||
|
||||
case kSceneObject:
|
||||
@ -430,13 +427,13 @@ public:
|
||||
|
||||
case kString:
|
||||
case kAnimationName:
|
||||
if ( datarecord.fString != nil )
|
||||
count = hsStrlen(datarecord.fString)+1;
|
||||
if ( !fString.IsNull() )
|
||||
count = fString.GetSize()+1;
|
||||
else
|
||||
count = 0;
|
||||
stream->WriteLE(count);
|
||||
if ( count != 0 )
|
||||
stream->WriteLE(count,datarecord.fString);
|
||||
stream->WriteLE(count, fString.c_str());
|
||||
break;
|
||||
|
||||
case kSceneObject:
|
||||
|
@ -109,24 +109,24 @@ std::string pyCritterBrain::BehaviorName(int behavior) const
|
||||
return fBrain->BehaviorName(behavior);
|
||||
}
|
||||
|
||||
std::string pyCritterBrain::AnimationName(int behavior) const
|
||||
plString pyCritterBrain::AnimationName(int behavior) const
|
||||
{
|
||||
if (!fBrain)
|
||||
return false;
|
||||
return plString::Null;
|
||||
return fBrain->AnimationName(behavior);
|
||||
}
|
||||
|
||||
int pyCritterBrain::CurBehavior() const
|
||||
{
|
||||
if (!fBrain)
|
||||
return false;
|
||||
return 0;
|
||||
return fBrain->CurBehavior();
|
||||
}
|
||||
|
||||
int pyCritterBrain::NextBehavior() const
|
||||
{
|
||||
if (!fBrain)
|
||||
return false;
|
||||
return 0;
|
||||
return fBrain->NextBehavior();
|
||||
}
|
||||
|
||||
|
@ -92,7 +92,7 @@ public:
|
||||
bool RunningBehavior(const std::string& behaviorName) const;
|
||||
|
||||
std::string BehaviorName(int behavior) const;
|
||||
std::string AnimationName(int behavior) const;
|
||||
plString AnimationName(int behavior) const;
|
||||
int CurBehavior() const;
|
||||
int NextBehavior() const;
|
||||
|
||||
|
Reference in New Issue
Block a user