mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-14 14:37:41 +00:00
Compare commits
19 Commits
OPENURU_BU
...
OPENURU_BU
Author | SHA1 | Date | |
---|---|---|---|
883495c35c | |||
e1306da736 | |||
8d1d813df5 | |||
65d50895bb | |||
6a41bdbee7 | |||
3dcf1c2f26 | |||
70449244f4 | |||
82abcb2f07 | |||
870d0534df | |||
1f09d6c48a | |||
66ce08ed67 | |||
1c1d3dd82e | |||
4924156ad4 | |||
13ea0a98de | |||
f9723462d7 | |||
7d3774a732 | |||
ea7e4b2ab5 | |||
5d5ba00f7d | |||
af38137822 |
@ -217,6 +217,8 @@ bool plResponderModifier::IIsLocalOnlyCmd(plMessage* cmd)
|
|||||||
return true;
|
return true;
|
||||||
if (plCameraMsg::ConvertNoRef(cmd)) // don't want to change our camera
|
if (plCameraMsg::ConvertNoRef(cmd)) // don't want to change our camera
|
||||||
return true;
|
return true;
|
||||||
|
if (plSubWorldMsg::ConvertNoRef(cmd)) // don't want to enter a subworld (changes the avatar SDL)
|
||||||
|
return true;
|
||||||
|
|
||||||
plSoundMsg *snd = plSoundMsg::ConvertNoRef( cmd );
|
plSoundMsg *snd = plSoundMsg::ConvertNoRef( cmd );
|
||||||
if( snd != nil && snd->Cmd( plSoundMsg::kIsLocalOnly ) )
|
if( snd != nil && snd->Cmd( plSoundMsg::kIsLocalOnly ) )
|
||||||
|
@ -211,7 +211,7 @@ void plNCAgeJoiner::Start () {
|
|||||||
|
|
||||||
plNetClientMgr * nc = plNetClientMgr::GetInstance();
|
plNetClientMgr * nc = plNetClientMgr::GetInstance();
|
||||||
nc->SetFlagsBit(plNetClientMgr::kPlayingGame, false);
|
nc->SetFlagsBit(plNetClientMgr::kPlayingGame, false);
|
||||||
nc->fServerTimeOffset = 0; // reset since we're connecting to a new server
|
nc->ResetServerTimeOffset();
|
||||||
nc->fRequiredNumInitialSDLStates = 0;
|
nc->fRequiredNumInitialSDLStates = 0;
|
||||||
nc->fNumInitialSDLStates = 0;
|
nc->fNumInitialSDLStates = 0;
|
||||||
nc->SetFlagsBit(plNetClientApp::kNeedInitialAgeStateCount);
|
nc->SetFlagsBit(plNetClientApp::kNeedInitialAgeStateCount);
|
||||||
|
@ -133,9 +133,7 @@ plNetClientMgr::plNetClientMgr() :
|
|||||||
// fProgressBar( nil ),
|
// fProgressBar( nil ),
|
||||||
fTaskProgBar( nil ),
|
fTaskProgBar( nil ),
|
||||||
fMsgRecorder(nil),
|
fMsgRecorder(nil),
|
||||||
fServerTimeOffset(0),
|
fLastLocalTime(),
|
||||||
fTimeSamples(0),
|
|
||||||
fLastTimeUpdate(0),
|
|
||||||
fListenListMode(kListenList_Distance),
|
fListenListMode(kListenList_Distance),
|
||||||
fAgeSDLObjectKey(nil),
|
fAgeSDLObjectKey(nil),
|
||||||
fExperimentalLevel(0),
|
fExperimentalLevel(0),
|
||||||
@ -480,34 +478,23 @@ void plNetClientMgr::StartLinkInFX()
|
|||||||
//
|
//
|
||||||
void plNetClientMgr::UpdateServerTimeOffset(plNetMessage* msg)
|
void plNetClientMgr::UpdateServerTimeOffset(plNetMessage* msg)
|
||||||
{
|
{
|
||||||
if ((hsTimer::GetSysSeconds() - fLastTimeUpdate) > 5)
|
if (!msg->GetHasTimeSent())
|
||||||
{
|
return;
|
||||||
fLastTimeUpdate = hsTimer::GetSysSeconds();
|
if (msg->GetTimeSent().AtEpoch())
|
||||||
|
return;
|
||||||
|
|
||||||
const plUnifiedTime& msgSentUT = msg->GetTimeSent();
|
double localTime = hsTimer::GetSeconds();
|
||||||
if (!msgSentUT.AtEpoch())
|
if (localTime - fLastLocalTime < 1.0)
|
||||||
{
|
return;
|
||||||
double diff = plUnifiedTime::GetTimeDifference(msgSentUT, plClientUnifiedTime::GetCurrentTime());
|
|
||||||
|
|
||||||
if (fServerTimeOffset == 0)
|
fLastServerTime = msg->GetTimeSent();
|
||||||
{
|
fLastLocalTime = localTime;
|
||||||
fServerTimeOffset = diff;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
fServerTimeOffset = fServerTimeOffset + ((diff - fServerTimeOffset) / ++fTimeSamples);
|
|
||||||
}
|
|
||||||
|
|
||||||
DebugMsg("Setting server time offset to %f", fServerTimeOffset);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void plNetClientMgr::ResetServerTimeOffset()
|
void plNetClientMgr::ResetServerTimeOffset()
|
||||||
{
|
{
|
||||||
fServerTimeOffset = 0;
|
fLastServerTime.ToEpoch();
|
||||||
fTimeSamples = 0;
|
fLastLocalTime = 0.0;
|
||||||
fLastTimeUpdate = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -515,14 +502,12 @@ void plNetClientMgr::ResetServerTimeOffset()
|
|||||||
//
|
//
|
||||||
plUnifiedTime plNetClientMgr::GetServerTime() const
|
plUnifiedTime plNetClientMgr::GetServerTime() const
|
||||||
{
|
{
|
||||||
if ( fServerTimeOffset==0 ) // offline mode or before connecting/calibrating to a server
|
if (fLastServerTime.AtEpoch()) {
|
||||||
|
WarningMsg("Someone asked for the server time, but we don't know it yet!");
|
||||||
return plUnifiedTime::GetCurrentTime();
|
return plUnifiedTime::GetCurrentTime();
|
||||||
|
}
|
||||||
|
|
||||||
plUnifiedTime serverUT;
|
return fLastServerTime + plUnifiedTime(hsTimer::GetSeconds() - fLastLocalTime);
|
||||||
if (fServerTimeOffset<0)
|
|
||||||
return plUnifiedTime::GetCurrentTime() - plUnifiedTime(fabs(fServerTimeOffset));
|
|
||||||
else
|
|
||||||
return plUnifiedTime::GetCurrentTime() + plUnifiedTime(fServerTimeOffset);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -166,9 +166,8 @@ private:
|
|||||||
std::string fSPDesiredPlayerName; // SP: the player we want to load from vault.
|
std::string fSPDesiredPlayerName; // SP: the player we want to load from vault.
|
||||||
|
|
||||||
// server info
|
// server info
|
||||||
double fServerTimeOffset; // diff between our unified time and server's unified time
|
plUnifiedTime fLastServerTime; // Last received time update from the server
|
||||||
UInt32 fTimeSamples;
|
double fLastLocalTime; // Last monotonic time (in seconds) when the above update was received
|
||||||
double fLastTimeUpdate;
|
|
||||||
|
|
||||||
UInt8 fJoinOrder; // returned by the server
|
UInt8 fJoinOrder; // returned by the server
|
||||||
|
|
||||||
|
@ -59,8 +59,10 @@ plRegistryKeyList::~plRegistryKeyList()
|
|||||||
for (int i = 0; i < fStaticKeys.size(); i++)
|
for (int i = 0; i < fStaticKeys.size(); i++)
|
||||||
{
|
{
|
||||||
plKeyImp* keyImp = fStaticKeys[i];
|
plKeyImp* keyImp = fStaticKeys[i];
|
||||||
if (!keyImp->ObjectIsLoaded())
|
if (keyImp && !keyImp->ObjectIsLoaded()) {
|
||||||
|
fStaticKeys[i] = nullptr;
|
||||||
delete keyImp;
|
delete keyImp;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -203,6 +203,7 @@ void plRegistryPageNode::UnloadKeys()
|
|||||||
for (; it != fKeyLists.end(); it++)
|
for (; it != fKeyLists.end(); it++)
|
||||||
{
|
{
|
||||||
plRegistryKeyList* keyList = it->second;
|
plRegistryKeyList* keyList = it->second;
|
||||||
|
it->second = nullptr;
|
||||||
delete keyList;
|
delete keyList;
|
||||||
}
|
}
|
||||||
fKeyLists.clear();
|
fKeyLists.clear();
|
||||||
|
@ -219,14 +219,20 @@ void plResManager::IShutdown()
|
|||||||
// Shut down the registry (finally!)
|
// Shut down the registry (finally!)
|
||||||
ILockPages();
|
ILockPages();
|
||||||
|
|
||||||
PageSet::const_iterator it;
|
// Unload all keys before actually deleting the pages.
|
||||||
for (it = fAllPages.begin(); it != fAllPages.end(); it++)
|
// When a key's refcount drops to zero, IKeyUnreffed looks up the key's page.
|
||||||
delete *it;
|
// If the page is already deleted at that point, this causes a use after free and potential crash.
|
||||||
fAllPages.clear();
|
for (PageSet::const_iterator it = fAllPages.begin(); it != fAllPages.end(); it++) {
|
||||||
|
(*it)->UnloadKeys();
|
||||||
|
}
|
||||||
fLoadedPages.clear();
|
fLoadedPages.clear();
|
||||||
|
fLastFoundPage = nil;
|
||||||
|
for (PageSet::const_iterator it = fAllPages.begin(); it != fAllPages.end(); it++) {
|
||||||
|
delete *it;
|
||||||
|
}
|
||||||
|
fAllPages.clear();
|
||||||
|
|
||||||
IUnlockPages();
|
IUnlockPages();
|
||||||
fLastFoundPage = nil;
|
|
||||||
|
|
||||||
// Now, kill off the Dispatcher
|
// Now, kill off the Dispatcher
|
||||||
hsRefCnt_SafeUnRef(fDispatch);
|
hsRefCnt_SafeUnRef(fDispatch);
|
||||||
|
Reference in New Issue
Block a user