|
|
@ -619,9 +619,8 @@ void plNetClientMgr::ICheckPendingStateLoad(double secs) |
|
|
|
if ( !hsgResMgr::ResMgr()->FindKey( tmpUoid ) ) |
|
|
|
if ( !hsgResMgr::ResMgr()->FindKey( tmpUoid ) ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// discard the state if object not found in dataset.
|
|
|
|
// discard the state if object not found in dataset.
|
|
|
|
char tmp[256]; |
|
|
|
|
|
|
|
hsLogEntry( DebugMsg( "Failed to find object %s in dataset. Discarding pending state '%s'", |
|
|
|
hsLogEntry( DebugMsg( "Failed to find object %s in dataset. Discarding pending state '%s'", |
|
|
|
tmpUoid.StringIze(tmp), |
|
|
|
tmpUoid.StringIze().c_str(), |
|
|
|
pl->fSDRec->GetDescriptor()->GetName() ) ); |
|
|
|
pl->fSDRec->GetDescriptor()->GetName() ) ); |
|
|
|
delete pl; |
|
|
|
delete pl; |
|
|
|
it = fPendingLoads.erase(it); |
|
|
|
it = fPendingLoads.erase(it); |
|
|
@ -663,7 +662,6 @@ void plNetClientMgr::ICheckPendingStateLoad(double secs) |
|
|
|
double rawSecs = hsTimer::GetSeconds(); |
|
|
|
double rawSecs = hsTimer::GetSeconds(); |
|
|
|
if ((rawSecs - pl->fQueuedTime) > 60.f /*secs*/) |
|
|
|
if ((rawSecs - pl->fQueuedTime) > 60.f /*secs*/) |
|
|
|
{ |
|
|
|
{ |
|
|
|
char tmp[256], tmp2[256]; |
|
|
|
|
|
|
|
if (pl->fQueueTimeResets >= 5) |
|
|
|
if (pl->fQueueTimeResets >= 5) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// if this is our fifth time in here then we've been queued
|
|
|
|
// if this is our fifth time in here then we've been queued
|
|
|
@ -671,7 +669,7 @@ void plNetClientMgr::ICheckPendingStateLoad(double secs) |
|
|
|
|
|
|
|
|
|
|
|
WarningMsg( "Pending state '%s' for object [uoid:%s,key:%s] has been queued for about %f secs. Removing...", |
|
|
|
WarningMsg( "Pending state '%s' for object [uoid:%s,key:%s] has been queued for about %f secs. Removing...", |
|
|
|
pl->fSDRec && pl->fSDRec->GetDescriptor() ? pl->fSDRec->GetDescriptor()->GetName() : "?", |
|
|
|
pl->fSDRec && pl->fSDRec->GetDescriptor() ? pl->fSDRec->GetDescriptor()->GetName() : "?", |
|
|
|
pl->fUoid.StringIze(tmp2), pl->fKey ? pl->fKey->GetUoid().StringIze(tmp) : "?", |
|
|
|
pl->fUoid.StringIze().c_str(), pl->fKey ? pl->fKey->GetUoid().StringIze().c_str() : "?", |
|
|
|
( rawSecs - pl->fQueuedTime ) * pl->fQueueTimeResets); |
|
|
|
( rawSecs - pl->fQueuedTime ) * pl->fQueueTimeResets); |
|
|
|
|
|
|
|
|
|
|
|
delete pl; |
|
|
|
delete pl; |
|
|
@ -681,7 +679,7 @@ void plNetClientMgr::ICheckPendingStateLoad(double secs) |
|
|
|
|
|
|
|
|
|
|
|
WarningMsg( "Pending state '%s' for object [uoid:%s,key:%s] has been queued for about %f secs. %s", |
|
|
|
WarningMsg( "Pending state '%s' for object [uoid:%s,key:%s] has been queued for about %f secs. %s", |
|
|
|
pl->fSDRec && pl->fSDRec->GetDescriptor() ? pl->fSDRec->GetDescriptor()->GetName() : "?", |
|
|
|
pl->fSDRec && pl->fSDRec->GetDescriptor() ? pl->fSDRec->GetDescriptor()->GetName() : "?", |
|
|
|
pl->fUoid.StringIze(tmp2), pl->fKey ? pl->fKey->GetUoid().StringIze(tmp) : "?", |
|
|
|
pl->fUoid.StringIze().c_str(), pl->fKey ? pl->fKey->GetUoid().StringIze().c_str() : "?", |
|
|
|
( rawSecs - pl->fQueuedTime ) * pl->fQueueTimeResets, |
|
|
|
( rawSecs - pl->fQueuedTime ) * pl->fQueueTimeResets, |
|
|
|
so ? "(not loaded)" : "(not final)" ); |
|
|
|
so ? "(not loaded)" : "(not final)" ); |
|
|
|
// reset queue time so we don't spew too many log msgs.
|
|
|
|
// reset queue time so we don't spew too many log msgs.
|
|
|
@ -938,8 +936,7 @@ hsBool plNetClientMgr::MsgReceive( plMessage* msg ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
hsAssert(fAgeSDLObjectKey==nil, "already have a ref to age sdl hook"); |
|
|
|
hsAssert(fAgeSDLObjectKey==nil, "already have a ref to age sdl hook"); |
|
|
|
fAgeSDLObjectKey = ref->GetRef()->GetKey(); |
|
|
|
fAgeSDLObjectKey = ref->GetRef()->GetKey(); |
|
|
|
char tmp[256]; |
|
|
|
DebugMsg("Age SDL hook object created, uoid=%s", fAgeSDLObjectKey->GetUoid().StringIze().c_str()); |
|
|
|
DebugMsg("Age SDL hook object created, uoid=%s", fAgeSDLObjectKey->GetUoid().StringIze(tmp)); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
|
{ |
|
|
|
{ |
|
|
@ -1149,34 +1146,34 @@ bool plNetClientMgr::CanSendMsg(plNetMessage * msg) |
|
|
|
// Return the net client (account) name of the player whose avatar
|
|
|
|
// Return the net client (account) name of the player whose avatar
|
|
|
|
// key is provided. If avKey is nil, returns local client name.
|
|
|
|
// key is provided. If avKey is nil, returns local client name.
|
|
|
|
//
|
|
|
|
//
|
|
|
|
const char* plNetClientMgr::GetPlayerName(const plKey avKey) const |
|
|
|
plString plNetClientMgr::GetPlayerName(const plKey avKey) const |
|
|
|
{ |
|
|
|
{ |
|
|
|
// local case
|
|
|
|
// local case
|
|
|
|
if (!avKey || avKey==GetLocalPlayerKey()) |
|
|
|
if (!avKey || avKey==GetLocalPlayerKey()) |
|
|
|
return NetCommGetPlayer()->playerNameAnsi; |
|
|
|
return plString::FromIso8859_1(NetCommGetPlayer()->playerNameAnsi); |
|
|
|
|
|
|
|
|
|
|
|
plNetTransportMember* mbr=TransportMgr().GetMember(TransportMgr().FindMember(avKey)); |
|
|
|
plNetTransportMember* mbr=TransportMgr().GetMember(TransportMgr().FindMember(avKey)); |
|
|
|
return mbr ? mbr->GetPlayerName() : nil; |
|
|
|
return mbr ? mbr->GetPlayerName() : plString::Null; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const char * plNetClientMgr::GetPlayerNameById (unsigned playerId) const { |
|
|
|
plString plNetClientMgr::GetPlayerNameById (unsigned playerId) const { |
|
|
|
// local case
|
|
|
|
// local case
|
|
|
|
if (NetCommGetPlayer()->playerInt == playerId) |
|
|
|
if (NetCommGetPlayer()->playerInt == playerId) |
|
|
|
return NetCommGetPlayer()->playerNameAnsi; |
|
|
|
return plString::FromIso8859_1(NetCommGetPlayer()->playerNameAnsi); |
|
|
|
|
|
|
|
|
|
|
|
plNetTransportMember * mbr = TransportMgr().GetMember(TransportMgr().FindMember(playerId)); |
|
|
|
plNetTransportMember * mbr = TransportMgr().GetMember(TransportMgr().FindMember(playerId)); |
|
|
|
return mbr ? mbr->GetPlayerName() : nil; |
|
|
|
return mbr ? mbr->GetPlayerName() : plString::Null; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
unsigned plNetClientMgr::GetPlayerIdByName (const char name[]) const { |
|
|
|
unsigned plNetClientMgr::GetPlayerIdByName (const plString & name) const { |
|
|
|
// local case
|
|
|
|
// local case
|
|
|
|
if (0 == StrCmp(name, NetCommGetPlayer()->playerNameAnsi, (unsigned)-1)) |
|
|
|
if (0 == name.Compare(NetCommGetPlayer()->playerNameAnsi)) |
|
|
|
NetCommGetPlayer()->playerInt; |
|
|
|
NetCommGetPlayer()->playerInt; |
|
|
|
|
|
|
|
|
|
|
|
unsigned n = TransportMgr().GetNumMembers(); |
|
|
|
unsigned n = TransportMgr().GetNumMembers(); |
|
|
|
for (unsigned i = 0; i < n; ++i) |
|
|
|
for (unsigned i = 0; i < n; ++i) |
|
|
|
if (plNetTransportMember * member = TransportMgr().GetMember(i)) |
|
|
|
if (plNetTransportMember * member = TransportMgr().GetMember(i)) |
|
|
|
if (0 == StrCmp(name, member->GetPlayerName(), (unsigned)-1)) |
|
|
|
if (0 == name.Compare(member->GetPlayerName())) |
|
|
|
return member->GetPlayerID(); |
|
|
|
return member->GetPlayerID(); |
|
|
|
return 0; |
|
|
|
return 0; |
|
|
|
} |
|
|
|
} |
|
|
@ -1483,10 +1480,9 @@ void plNetClientMgr::AddPendingLoad(PendingLoad *pl) |
|
|
|
pl->fKey = hsgResMgr::ResMgr()->FindKey(pl->fUoid); |
|
|
|
pl->fKey = hsgResMgr::ResMgr()->FindKey(pl->fUoid); |
|
|
|
|
|
|
|
|
|
|
|
// check for age SDL state
|
|
|
|
// check for age SDL state
|
|
|
|
char tmp[256]; |
|
|
|
|
|
|
|
if (pl->fUoid.GetObjectName() && !strcmp(pl->fUoid.GetObjectName(), plSDL::kAgeSDLObjectName)) |
|
|
|
if (pl->fUoid.GetObjectName() && !strcmp(pl->fUoid.GetObjectName(), plSDL::kAgeSDLObjectName)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
DebugMsg("Recv SDL state for age hook object, uoid=%s", pl->fUoid.StringIze(tmp)); |
|
|
|
DebugMsg("Recv SDL state for age hook object, uoid=%s", pl->fUoid.StringIze().c_str()); |
|
|
|
if (!pl->fKey) |
|
|
|
if (!pl->fKey) |
|
|
|
WarningMsg("Can't find age hook object, nil key!"); |
|
|
|
WarningMsg("Can't find age hook object, nil key!"); |
|
|
|
else |
|
|
|
else |
|
|
@ -1499,12 +1495,12 @@ void plNetClientMgr::AddPendingLoad(PendingLoad *pl) |
|
|
|
if (!pl->fKey->ObjectIsLoaded()) |
|
|
|
if (!pl->fKey->ObjectIsLoaded()) |
|
|
|
{ |
|
|
|
{ |
|
|
|
WarningMsg("Object %s not loaded, withholding SDL state",
|
|
|
|
WarningMsg("Object %s not loaded, withholding SDL state",
|
|
|
|
pl->fKey->GetUoid().StringIze(tmp)); |
|
|
|
pl->fKey->GetUoid().StringIze().c_str()); |
|
|
|
} |
|
|
|
} |
|
|
|
else if (!pl->fKey->ObjectIsLoaded()->IsFinal()) |
|
|
|
else if (!pl->fKey->ObjectIsLoaded()->IsFinal()) |
|
|
|
{ |
|
|
|
{ |
|
|
|
WarningMsg("Object %s is not FINAL, withholding SDL state",
|
|
|
|
WarningMsg("Object %s is not FINAL, withholding SDL state",
|
|
|
|
pl->fKey->GetUoid().StringIze(tmp));
|
|
|
|
pl->fKey->GetUoid().StringIze().c_str()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|