1
0
mirror of https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git synced 2025-07-17 10:52:46 +00:00

Convert plUoid's object name to a plString

This commit is contained in:
2012-01-28 16:24:20 -08:00
parent 442a733fbb
commit e34414889f
122 changed files with 810 additions and 842 deletions

View File

@ -241,7 +241,7 @@ hsBool plAGMasterMod::IEval(double secs, hsScalar del, UInt32 dirty)
// APPLYANIMATIONS
void plAGMasterMod::ApplyAnimations(double time, hsScalar elapsed)
{
plProfile_BeginLap(ApplyAnimation, this->GetKey()->GetUoid().GetObjectName());
plProfile_BeginLap(ApplyAnimation, this->GetKey()->GetUoid().GetObjectName().c_str());
// update any fades
for (int i = 0; i < fAnimInstances.size(); i++)
@ -251,7 +251,7 @@ void plAGMasterMod::ApplyAnimations(double time, hsScalar elapsed)
AdvanceAnimsToTime(time);
plProfile_EndLap(ApplyAnimation,this->GetKey()->GetUoid().GetObjectName());
plProfile_EndLap(ApplyAnimation,this->GetKey()->GetUoid().GetObjectName().c_str());
}
void plAGMasterMod::AdvanceAnimsToTime(double time)

View File

@ -57,10 +57,10 @@ char plAGMasterSDLModifier::AGMasterVarNames::kStrBlends[]="blends";
UInt32 plAGMasterSDLModifier::IApplyModFlags(UInt32 sendFlags)
{
// ugly hack so bug light animation state isn't stored on the server
if (stricmp(GetTarget()->GetKeyName(), "RTOmni-BugLightTest") == 0)
if (GetTarget()->GetKeyName().Compare("RTOmni-BugLightTest", plString::kCaseInsensitive) == 0)
return (sendFlags | plSynchedObject::kDontPersistOnServer | plSynchedObject::kIsAvatarState);
// ditto for the KI light
if (stricmp(GetTarget()->GetKeyName(), "RTOmniKILight") == 0)
if (GetTarget()->GetKeyName().Compare("RTOmniKILight", plString::kCaseInsensitive) == 0)
return (sendFlags | plSynchedObject::kDontPersistOnServer | plSynchedObject::kIsAvatarState);
return sendFlags;

View File

@ -809,11 +809,8 @@ int plArmatureMod::IFindSpawnOverride( void )
plAvatarMgr *mgr = plAvatarMgr::GetInstance();
for( i = 0; i < mgr->NumSpawnPoints(); i++ )
{
char str2[ 256 ];
strcpy(str2, mgr->GetSpawnPoint( i )->GetTarget(0)->GetKeyName());
strlwr(str2);
if (strstr(str2, fSpawnPointOverride) != nil)
const plString &name = mgr->GetSpawnPoint( i )->GetTarget(0)->GetKeyName();
if (name.Find(fSpawnPointOverride, plString::kCaseInsensitive) >= 0)
return i; // Found it!
}
return -1;
@ -1792,33 +1789,33 @@ void plArmatureMod::Read(hsStream * stream, hsResMgr *mgr)
if (gLoc.IsValid())
{
const plUoid &myUoid = GetKey()->GetUoid();
plUoid SOUoid(gLoc, plSceneObject::Index(), "FootstepSoundObject");
plUoid SOUoid(gLoc, plSceneObject::Index(), _TEMP_CONVERT_FROM_LITERAL("FootstepSoundObject"));
fFootSoundSOKey = mgr->FindKey(SOUoid);
if (fFootSoundSOKey)
{
// So it exists... but FindKey won't properly create our clone. So we do.
SOUoid.SetClone(myUoid.GetClonePlayerID(), myUoid.GetCloneID());
fFootSoundSOKey = mgr->ReRegister(nil, SOUoid);
fFootSoundSOKey = mgr->ReRegister(plString::Null, SOUoid);
}
// Add the effect to our effects manager
plUoid effectUoid(gLoc, plArmatureEffectFootSound::Index(), "FootstepSounds" );
plUoid effectUoid(gLoc, plArmatureEffectFootSound::Index(), _TEMP_CONVERT_FROM_LITERAL("FootstepSounds") );
plKey effectKey = mgr->FindKey(effectUoid);
if (effectKey)
{
effectUoid.SetClone(myUoid.GetClonePlayerID(), myUoid.GetCloneID());
effectKey = mgr->ReRegister(nil, effectUoid);
effectKey = mgr->ReRegister(plString::Null, effectUoid);
}
if (effectKey != nil)
mgr->AddViaNotify(effectKey, TRACKED_NEW plGenRefMsg(effectMgrKey, plRefMsg::kOnCreate, -1, -1), plRefFlags::kActiveRef);
// Get the linking sound
plUoid LinkUoid(gLoc, plSceneObject::Index(), "LinkSoundSource");
plUoid LinkUoid(gLoc, plSceneObject::Index(), _TEMP_CONVERT_FROM_LITERAL("LinkSoundSource"));
fLinkSoundSOKey = mgr->FindKey(LinkUoid);
if (fLinkSoundSOKey)
{
LinkUoid.SetClone(myUoid.GetClonePlayerID(), myUoid.GetCloneID());
fLinkSoundSOKey = mgr->ReRegister(nil, LinkUoid);
fLinkSoundSOKey = mgr->ReRegister(plString::Null, LinkUoid);
}
}
}
@ -2060,7 +2057,7 @@ hsBool plArmatureMod::ValidateMesh()
hsgResMgr::ResMgr()->SendRef(meshObj->GetKey(), refMsg, plRefFlags::kPassiveRef);
}
}
if (!strcmp(GetTarget(0)->GetKeyName(), "Yeesha"))
if (!GetTarget(0)->GetKeyName().Compare("Yeesha"))
ISetTransparentDrawOrder(true);
else
ISetTransparentDrawOrder(false);
@ -2704,7 +2701,7 @@ void plArmatureMod::DumpToDebugDisplay(int &x, int &y, int lineHeight, char *str
plKey world = nil;
if (fController)
world = fController->GetSubworld();
sprintf(strBuf, "In world: %s Frozen: %s", world ? world->GetName() : "nil", frozen);
sprintf(strBuf, "In world: %s Frozen: %s", world ? world->GetName().c_str() : "nil", frozen);
debugTxt.DrawString(x,y, strBuf);
y+= lineHeight;

View File

@ -276,13 +276,12 @@ void plClothingItem::Write(hsStream *s, hsResMgr *mgr)
plKey accessoryKey = nil;
if (fAccessoryName)
{
char strBuf[512];
sprintf(strBuf, "CItm_%s", fAccessoryName);
plString strBuf = plString::Format("CItm_%s", fAccessoryName);
accessoryKey = plKeyFinder::Instance().StupidSearch("GlobalClothing", nil, plClothingItem::Index(), strBuf);
if (accessoryKey == nil)
{
sprintf(strBuf, "Couldn't find accessory \"%s\". It won't show at runtime.", fAccessoryName);
hsMessageBox(strBuf, GetKeyName(), hsMessageBoxNormal);
strBuf = plString::Format("Couldn't find accessory \"%s\". It won't show at runtime.", fAccessoryName);
hsMessageBox(strBuf.c_str(), GetKeyName().c_str(), hsMessageBoxNormal);
}
}
mgr->WriteKey(s, accessoryKey);

View File

@ -134,10 +134,6 @@ void plAvatarMgr::IReset()
{
fSeekPoints.clear();
// Oneshots have copies of strings in their maps. I'm assuming the others should be the same, but until
// I hear otherwise...
for( plOneShotMap::iterator it = fOneShots.begin(); it != fOneShots.end(); it++ )
delete [] (char *)it->first;
fOneShots.clear();
fAvatars.clear();
fSpawnPoints.clear();
@ -203,9 +199,9 @@ plKey plAvatarMgr::LoadAvatar(const char *name, const char *accountName, bool is
const plLocation& loc = (globalLoc.IsValid() ? globalLoc : custLoc.IsValid() ? custLoc : maleLoc);
#endif
const char* theName = name;
plString theName = _TEMP_CONVERT_FROM_LITERAL(name);
if ( loc == maleLoc )
theName = "Male";
theName = _TEMP_CONVERT_FROM_LITERAL("Male");
if (loc.IsValid())
{
@ -561,15 +557,14 @@ void plAvatarMgr::AddSeekPoint(plSeekPointMod *seekPoint)
{
if(seekPoint)
{
const char *name = seekPoint->GetTarget(0)->GetKey()->GetName();
char *ourName = hsStrcpy(name);
plString name = seekPoint->GetTarget(0)->GetKey()->GetName();
plSeekPointMod *alreadyThere = FindSeekPoint(name);
/// hsAssert( ! alreadyThere, "Tried to add a seek point with duplicate name. Ignoring second seek point.");
if ( ! alreadyThere)
{
fSeekPoints[ourName] = seekPoint;
fSeekPoints[name] = seekPoint;
}
}
}
@ -579,21 +574,19 @@ void plAvatarMgr::RemoveSeekPoint(plSeekPointMod *seekPoint)
{
if(seekPoint)
{
const char *name = seekPoint->GetTarget(0)->GetKey()->GetName();
plString name = seekPoint->GetTarget(0)->GetKey()->GetName();
plSeekPointMap::iterator found = fSeekPoints.find(name);
if(found != fSeekPoints.end())
{
const char *oldName = (*found).first;
fSeekPoints.erase(found);
delete[] const_cast<char *>(oldName); // retarded language, this is...
}
}
}
// FINDSEEKPOINT
plSeekPointMod * plAvatarMgr::FindSeekPoint(const char *name)
plSeekPointMod * plAvatarMgr::FindSeekPoint(const plString &name)
{
plSeekPointMap::iterator found = fSeekPoints.find(name);
@ -610,8 +603,7 @@ void plAvatarMgr::AddOneShot(plOneShotMod *oneshot)
{
if(oneshot)
{
// allocate a copy of the target name to use as a key
char * name = hsStrcpy(oneshot->GetTarget(0)->GetKey()->GetName());
plString name = oneshot->GetTarget(0)->GetKey()->GetName();
plOneShotMod *alreadyThere = FindOneShot(name);
@ -619,8 +611,6 @@ void plAvatarMgr::AddOneShot(plOneShotMod *oneshot)
{
fOneShots[name] = oneshot;
}
else
delete [] name;
}
}
@ -631,14 +621,12 @@ void plAvatarMgr::RemoveOneShot(plOneShotMod *oneshot)
while (i != fOneShots.end())
{
char * name = (*i).first;
plString name = (*i).first;
plOneShotMod *thisOneshot = (*i).second;
if(oneshot == thisOneshot)
{
i = fOneShots.erase(i);
// destroy our copy of the target name
delete[] name;
} else {
i++;
}
@ -646,7 +634,7 @@ void plAvatarMgr::RemoveOneShot(plOneShotMod *oneshot)
}
// FINDONESHOT
plOneShotMod *plAvatarMgr::FindOneShot(char *name)
plOneShotMod *plAvatarMgr::FindOneShot(const plString &name)
{
plOneShotMap::iterator found = fOneShots.find(name);
@ -756,7 +744,7 @@ plArmatureMod *plAvatarMgr::FindAvatarByModelName(char *name)
for (it = fAvatars.begin(); it != fAvatars.end(); ++it)
{
plArmatureMod* armature = plArmatureMod::ConvertNoRef((*it)->ObjectIsLoaded());
if (armature && (!strcmp(armature->GetTarget(0)->GetKeyName(), name)))
if (armature && (!armature->GetTarget(0)->GetKeyName().Compare(name)))
return armature;
}
@ -769,7 +757,7 @@ void plAvatarMgr::FindAllAvatarsByModelName(const char* name, plArmatureModPtrVe
for (it = fAvatars.begin(); it != fAvatars.end(); ++it)
{
plArmatureMod* armature = plArmatureMod::ConvertNoRef((*it)->ObjectIsLoaded());
if (armature && (!strcmp(armature->GetTarget(0)->GetKeyName(), name)))
if (armature && (!armature->GetTarget(0)->GetKeyName().Compare(name)))
outVec.push_back(armature);
}
}
@ -807,8 +795,8 @@ int plAvatarMgr::FindSpawnPoint( const char *name ) const
for( i = 0; i < fSpawnPoints.size(); i++ )
{
if( fSpawnPoints[ i ] != nil &&
(strstr( fSpawnPoints[ i ]->GetKey()->GetUoid().GetObjectName(), name ) != nil ||
strstr( fSpawnPoints[i]->GetTarget(0)->GetKeyName(), name) != nil))
( fSpawnPoints[ i ]->GetKey()->GetUoid().GetObjectName().Find( name ) >= 0 ||
fSpawnPoints[ i ]->GetTarget(0)->GetKeyName().Find( name ) >= 0 ))
return i;
}

View File

@ -101,7 +101,7 @@ public:
do away with this bookeeping entirely. */
void AddSeekPoint(plSeekPointMod *seekpoint);
void RemoveSeekPoint(plSeekPointMod *seekpoint);
plSeekPointMod *FindSeekPoint(const char *name);
plSeekPointMod *FindSeekPoint(const plString &name);
// \}
// \{
@ -109,7 +109,7 @@ public:
scripting only. */
void AddOneShot(plOneShotMod *oneshot);
void RemoveOneShot(plOneShotMod *oneshot);
plOneShotMod *FindOneShot(char *name);
plOneShotMod *FindOneShot(const plString &name);
// \}
plKey LoadPlayer(const char* name, const char *account);
@ -200,10 +200,10 @@ protected:
static plAvatarMgr* fInstance; // the single instance of the avatar manager
typedef std::map<const char *, plSeekPointMod *, stringISorter> plSeekPointMap;
typedef std::map<plString, plSeekPointMod *, plString::less_i> plSeekPointMap;
plSeekPointMap fSeekPoints;
typedef std::map<char *, plOneShotMod *, stringISorter> plOneShotMap;
typedef std::map<plString, plOneShotMod *, plString::less_i> plOneShotMap;
plOneShotMap fOneShots;
typedef std::map<plKey, plMessage *> DeferredInits;

View File

@ -111,22 +111,14 @@ plCoopCoordinator::plCoopCoordinator(plKey host, plKey guest,
fGuestAccepted(false),
fGuestLinked(false)
{
const char * hostName = host->GetName();
const char * guestName = guest->GetName();
static int serial = 0;
int len = strlen(hostName) + strlen(guestName) + 3 /* serial num */ + 1;
char *newName = TRACKED_NEW char[len];
serial = serial % 999;
sprintf(newName, "%s%s%3i\x000", hostName, guestName, serial++);
plString newName = plString::Format("%s%s%3i\x000", host->GetName().c_str(), guest->GetName().c_str(), serial++);
plKey newKey = hsgResMgr::ResMgr()->NewKey(newName, this, host->GetUoid().GetLocation());
delete[] newName;
fSynchBone = hsStrcpy(synchBone);
plKey avMgrKey = plAvatarMgr::GetInstance()->GetKey();