[Gcblue-commits] gcb_wx/src/sim tcControllableObject.cpp, 1.3, 1.4 tcLauncherState.cpp, 1.38, 1.39
Status: Alpha
Brought to you by:
ddcforge
From: Dewitt C. <ddc...@us...> - 2006-11-28 01:57:43
|
Update of /cvsroot/gcblue/gcb_wx/src/sim In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv10463/src/sim Modified Files: tcControllableObject.cpp tcLauncherState.cpp tcObjectControl.cpp tcSimState.cpp Log Message: Index: tcSimState.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcSimState.cpp,v retrieving revision 1.101 retrieving revision 1.102 diff -C2 -d -r1.101 -r1.102 *** tcSimState.cpp 20 Nov 2006 00:17:45 -0000 1.101 --- tcSimState.cpp 28 Nov 2006 01:57:37 -0000 1.102 *************** *** 2308,2315 **** { tcGameObject* obj = GetObject(id); - if (obj == 0) return false; // target not found // return truth data if own alliance ! if (alliance == obj->GetAlliance()) { tcKinematics *kin = &obj->mcKin; --- 2308,2314 ---- { tcGameObject* obj = GetObject(id); // return truth data if own alliance ! if ((obj != 0) && (alliance == obj->GetAlliance())) { tcKinematics *kin = &obj->mcKin; *************** *** 2326,2330 **** { tcSensorMapTrack *pTrack = ! mcSensorMap.GetSensorMapTrack(obj->mnID, alliance); if (pTrack) track = *pTrack; else return false; // track not found --- 2325,2329 ---- { tcSensorMapTrack *pTrack = ! mcSensorMap.GetSensorMapTrack(id, alliance); if (pTrack) track = *pTrack; else return false; // track not found *************** *** 2389,2395 **** } // if client time is too much ahead, pause the client ! if (dt < -1) { timeAcceleration = 0; } } --- 2388,2400 ---- } // if client time is too much ahead, pause the client ! double lagThresh = clientPause ? -0.25 : -1.0; ! if (dt < lagThresh) { timeAcceleration = 0; + clientPause = true; + } + else + { + clientPause = false; } } *************** *** 2615,2619 **** tcGameObject::SetClientMode(false); tcCommandObject::SetClientMode(false); ! tcControllableObject::SetSinglePlayerMode(true); if (tcOptions::Get()->OptionStringExists("UsePositionRegistry")) --- 2620,2624 ---- tcGameObject::SetClientMode(false); tcCommandObject::SetClientMode(false); ! tcControllableObject::SetBypassControlCheck(true); if (tcOptions::Get()->OptionStringExists("UsePositionRegistry")) *************** *** 2642,2646 **** tcGameObject::SetClientMode(true); tcCommandObject::SetClientMode(true); ! tcControllableObject::SetSinglePlayerMode(false); if (positionRegistry) --- 2647,2651 ---- tcGameObject::SetClientMode(true); tcCommandObject::SetClientMode(true); ! tcControllableObject::SetBypassControlCheck(false); if (positionRegistry) *************** *** 2661,2665 **** tcGameObject::SetClientMode(false); tcCommandObject::SetClientMode(false); ! tcControllableObject::SetSinglePlayerMode(false); if (tcOptions::Get()->OptionStringExists("UsePositionRegistry")) --- 2666,2670 ---- tcGameObject::SetClientMode(false); tcCommandObject::SetClientMode(false); ! tcControllableObject::SetBypassControlCheck(true); if (tcOptions::Get()->OptionStringExists("UsePositionRegistry")) *************** *** 2746,2750 **** mfLastTileAgeOut = 0; mnSensorPlatformCount = 0; ! objectNameMap.clear(); captiveObjectMap.clear(); --- 2751,2756 ---- mfLastTileAgeOut = 0; mnSensorPlatformCount = 0; ! clientPause = false; ! objectNameMap.clear(); captiveObjectMap.clear(); *************** *** 2758,2762 **** multiplayerMode(MM_OFF), timeAcceleration(0), ! positionRegistry(0) { --- 2764,2769 ---- multiplayerMode(MM_OFF), timeAcceleration(0), ! positionRegistry(0), ! clientPause(false) { Index: tcObjectControl.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcObjectControl.cpp,v retrieving revision 1.55 retrieving revision 1.56 diff -C2 -d -r1.55 -r1.56 *** tcObjectControl.cpp 27 Nov 2006 00:46:40 -0000 1.55 --- tcObjectControl.cpp 28 Nov 2006 01:57:37 -0000 1.56 *************** *** 1901,1915 **** wxASSERT(mpSS); if (mnHookID==NULL_INDEX) {mpHookedGameObj=NULL;return;} - bFound = mpSS->GetPlatformState(mnHookID,mpHookedGameObj); ! SetControlGameObject(mpHookedGameObj); ! if (!bFound) { mcAIPanel.SetAIData(0); - wxASSERT(false); return; } { tcPlatformObject *pPlatformObj = dynamic_cast<tcPlatformObject*> (mpHookedGameObj); --- 1901,1917 ---- wxASSERT(mpSS); if (mnHookID==NULL_INDEX) {mpHookedGameObj=NULL;return;} ! bFound = mpSS->GetPlatformState(mnHookID, mpHookedGameObj); ! if (!bFound) // hooked a sensor track in multiplayer client { mcAIPanel.SetAIData(0); return; } + SetControlGameObject(mpHookedGameObj); + + + { tcPlatformObject *pPlatformObj = dynamic_cast<tcPlatformObject*> (mpHookedGameObj); Index: tcLauncherState.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcLauncherState.cpp,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** tcLauncherState.cpp 20 Nov 2006 00:17:44 -0000 1.38 --- tcLauncherState.cpp 28 Nov 2006 01:57:37 -0000 1.39 *************** *** 324,328 **** double lon_rad, double lat_rad, float alt_m) { ! if (nLauncher > launchers.size()) { std::cerr << "Bad launcher index" << std::endl; --- 324,329 ---- double lon_rad, double lat_rad, float alt_m) { ! size_t nLaunchers = launchers.size(); ! if (nLauncher > nLaunchers) { std::cerr << "Bad launcher index" << std::endl; *************** *** 346,351 **** --- 347,355 ---- } + launchers[nLauncher]->SetDatum(lon_rad, lat_rad, alt_m); + commandObj.SetNewCommand(GetLauncherFlag(nLauncher)); + return true; } *************** *** 356,361 **** bool tcLauncherState::SetLauncherTarget(unsigned nLauncher, long targetID) { ! ! if (nLauncher > launchers.size()) { std::cerr << "Bad launcher index" << std::endl; --- 360,365 ---- bool tcLauncherState::SetLauncherTarget(unsigned nLauncher, long targetID) { ! size_t nLaunchers = launchers.size(); ! if (nLauncher > nLaunchers) { std::cerr << "Bad launcher index" << std::endl; *************** *** 365,372 **** tcLauncher* launcher = launchers[nLauncher]; launcher->mnTargetID = targetID; ! launcher->msDatum.Set(0, 0, 0); // clear datum launcher->ClearPendingLaunch(); commandObj.SetNewCommand(GetLauncherFlag(nLauncher)); return true; } --- 369,377 ---- tcLauncher* launcher = launchers[nLauncher]; launcher->mnTargetID = targetID; ! launcher->msDatum.Set(0, 0, 0); // clear datum launcher->ClearPendingLaunch(); commandObj.SetNewCommand(GetLauncherFlag(nLauncher)); + return true; } Index: tcControllableObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcControllableObject.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** tcControllableObject.cpp 23 Mar 2006 01:11:02 -0000 1.3 --- tcControllableObject.cpp 28 Nov 2006 01:57:37 -0000 1.4 *************** *** 35,39 **** #endif ! bool tcControllableObject::singlePlayerMode = true; tcUserInfo* tcControllableObject::userInfo = 0; --- 35,40 ---- #endif ! bool tcControllableObject::bypassControlCheck = true; ! tcUserInfo* tcControllableObject::userInfo = 0; *************** *** 43,49 **** } ! void tcControllableObject::SetSinglePlayerMode(bool state) { ! singlePlayerMode = state; } --- 44,50 ---- } ! void tcControllableObject::SetBypassControlCheck(bool state) { ! bypassControlCheck = true; } *************** *** 153,157 **** bool tcControllableObject::IsControlled() const { ! return singlePlayerMode || (controller == userInfo->GetUsername()); } --- 154,158 ---- bool tcControllableObject::IsControlled() const { ! return bypassControlCheck || (controller == userInfo->GetUsername()); } |