[Gcblue-commits] gcb_wx/src/scriptinterface tcPlatformInterface.cpp,1.44,1.45 tcScenarioInterface.cp
Status: Alpha
Brought to you by:
ddcforge
|
From: Dewitt C. <ddc...@us...> - 2005-05-08 23:29:07
|
Update of /cvsroot/gcblue/gcb_wx/src/scriptinterface In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17986/src/scriptinterface Modified Files: tcPlatformInterface.cpp tcScenarioInterface.cpp tcSimPythonInterface.cpp Log Message: Landing bug fix, changed /gm create to require starting coords, added fuel to air update Index: tcPlatformInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcPlatformInterface.cpp,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** tcPlatformInterface.cpp 5 May 2005 02:14:53 -0000 1.44 --- tcPlatformInterface.cpp 8 May 2005 23:28:58 -0000 1.45 *************** *** 273,277 **** ** On client machine, only own-alliance objects exist in sim state */ ! if (pGameObj && (mpSimState->mpUserInfo->IsOwnAlliance(pGameObj->GetAlliance()))) { tcKinematics *pTargetKin = &pGameObj->mcKin; --- 273,278 ---- ** On client machine, only own-alliance objects exist in sim state */ ! bool isOwnAlliance = pGameObj && (pGameObj->GetAlliance() == mpPlatformObj->GetAlliance()); ! if (pGameObj && isOwnAlliance) { tcKinematics *pTargetKin = &pGameObj->mcKin; *************** *** 1162,1166 **** { tcGameObject* obj = mpSimState->GetObject(id); ! if ((obj == 0) || !mpSimState->mpUserInfo->IsOwnAlliance(obj->GetAlliance())) { return std::string(""); --- 1163,1169 ---- { tcGameObject* obj = mpSimState->GetObject(id); ! bool isOwnAlliance = mpPlatformObj->GetAlliance() == obj->GetAlliance(); ! ! if ((obj == 0) || !isOwnAlliance) { return std::string(""); *************** *** 1266,1270 **** { tcGameObject* obj = mpSimState->GetObject(id); ! if ((obj == 0) || !mpSimState->mpUserInfo->IsOwnAlliance(obj->GetAlliance())) { tcTrack data; --- 1269,1276 ---- { tcGameObject* obj = mpSimState->GetObject(id); ! ! bool isOwnAlliance = mpPlatformObj->GetAlliance() == obj->GetAlliance(); ! ! if ((obj == 0) || !isOwnAlliance) { tcTrack data; *************** *** 1285,1289 **** } ! tcFlightPortInterface tcPlatformInterface::GetFlightPortInfo(void) { tcFlightPortInterface fpi; --- 1291,1295 ---- } ! tcFlightPortInterface tcPlatformInterface::GetFlightPortInfo() { tcFlightPortInterface fpi; *************** *** 1297,1309 **** } ! void tcPlatformInterface::GetLocalObj(void) ! { ! wxASSERT(mpSimState); ! mpPlatformObj = mpStaticPlatformObj; ! GetSensorMap(); ! isPlatformOwnAlliance = (mpPlatformObj) ? ! (mpSimState->mpUserInfo->IsOwnAlliance(mpPlatformObj->GetAlliance()) != 0) : false; ! } /** --- 1303,1323 ---- } ! void tcPlatformInterface::GetLocalObj() ! { ! wxASSERT(mpSimState); ! mpPlatformObj = mpStaticPlatformObj; ! GetSensorMap(); ! ! if (mpSimState->IsMultiplayerServer()) ! { ! isPlatformOwnAlliance = mpPlatformObj != 0; ! } ! else ! { ! isPlatformOwnAlliance = (mpPlatformObj) ? ! (mpSimState->mpUserInfo->IsOwnAlliance(mpPlatformObj->GetAlliance()) != 0) : false; ! } ! } /** *************** *** 1316,1321 **** mpPlatformObj = obj; GetSensorMap(); ! isPlatformOwnAlliance = (mpPlatformObj) ? ! (mpSimState->mpUserInfo->IsOwnAlliance(mpPlatformObj->GetAlliance()) != 0) : false; } --- 1330,1343 ---- mpPlatformObj = obj; GetSensorMap(); ! ! if (mpSimState->IsMultiplayerServer()) ! { ! isPlatformOwnAlliance = mpPlatformObj != 0; ! } ! else ! { ! isPlatformOwnAlliance = (mpPlatformObj) ? ! (mpSimState->mpUserInfo->IsOwnAlliance(mpPlatformObj->GetAlliance()) != 0) : false; ! } } *************** *** 1339,1344 **** wxASSERT(mpSimState); ! isPlatformOwnAlliance = (mpPlatformObj) ? ! (mpSimState->mpUserInfo->IsOwnAlliance(mpPlatformObj->GetAlliance()) != 0) : false; mpSensorMap = mpSimState->mcSensorMap.GetMap(mpPlatformObj->GetAlliance()); --- 1361,1373 ---- wxASSERT(mpSimState); ! if (mpSimState->IsMultiplayerServer()) ! { ! isPlatformOwnAlliance = mpPlatformObj != 0; ! } ! else ! { ! isPlatformOwnAlliance = (mpPlatformObj) ? ! (mpSimState->mpUserInfo->IsOwnAlliance(mpPlatformObj->GetAlliance()) != 0) : false; ! } mpSensorMap = mpSimState->mcSensorMap.GetMap(mpPlatformObj->GetAlliance()); Index: tcSimPythonInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcSimPythonInterface.cpp,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** tcSimPythonInterface.cpp 6 May 2005 23:57:50 -0000 1.31 --- tcSimPythonInterface.cpp 8 May 2005 23:28:59 -0000 1.32 *************** *** 789,794 **** ! if (!mpSimState->IsMultiplayerClient()) { CallPython(command.c_str(), "Exception occured in ProcessCallbackString\n"); } --- 789,798 ---- ! if (mpSimState->IsMultiplayerServer()) { + #ifdef _DEBUG + fprintf(stdout, "Processed callback string:%s (%d ids)\n", command.c_str(), + id.size()); + #endif CallPython(command.c_str(), "Exception occured in ProcessCallbackString\n"); } *************** *** 876,889 **** void tcSimPythonInterface::SetMenuGroup(const std::vector<long>& unitIds) { ! // if any of the ids are invalid or not own-alliance, then return ! for (unsigned idx=0; idx<unitIds.size(); idx++) { ! tcGameObject* gameObj = mpSimState->GetObject(unitIds[idx]); ! if ((!gameObj) || ! (!mpSimState->mpUserInfo->IsOwnAlliance(gameObj->GetAlliance()))) { ! fprintf(stderr, "tcSimPythonInterface::SetMenuGroup - null or " ! " not own-alliance id\n"); ! return; } } --- 880,897 ---- void tcSimPythonInterface::SetMenuGroup(const std::vector<long>& unitIds) { ! // allow any units to be selected at multiplayer server, otherwise check ! if (!mpSimState->IsMultiplayerServer()) { ! // if any of the ids are invalid or not own-alliance, then return ! for (unsigned idx=0; idx<unitIds.size(); idx++) { ! tcGameObject* gameObj = mpSimState->GetObject(unitIds[idx]); ! if ((!gameObj) || ! (!mpSimState->mpUserInfo->IsOwnAlliance(gameObj->GetAlliance()))) ! { ! fprintf(stderr, "tcSimPythonInterface::SetMenuGroup - null or " ! " not own-alliance id\n"); ! return; ! } } } Index: tcScenarioInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcScenarioInterface.cpp,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** tcScenarioInterface.cpp 5 May 2005 02:14:53 -0000 1.25 --- tcScenarioInterface.cpp 8 May 2005 23:28:59 -0000 1.26 *************** *** 115,118 **** --- 115,123 ---- } + tcMapOverlay* tcScenarioInterface::GetMapOverlay() const + { + return overlay; + } + // Interface class management methods *************** *** 165,168 **** --- 170,174 ---- .def("SetScenarioLoaded",&tcScenarioInterface::SetScenarioLoaded) .def("SetScenarioName",&tcScenarioInterface::SetScenarioName) + .def("SetStartTheater", &tcScenarioInterface::SetStartTheater) .def("SetUserAlliance",&tcScenarioInterface::SetUserAlliance) // time/mode events *************** *** 495,498 **** --- 501,510 ---- } + void tcScenarioInterface::GetStartTheater(double& lon_deg, double& lat_deg) const + { + lon_deg = lon_theater_deg; + lat_deg = lat_theater_deg; + } + /** * Copies and sets root goal for alliance *************** *** 527,530 **** --- 539,550 ---- } + void tcScenarioInterface::SetStartTheater(double lon_deg, double lat_deg) + { + lon_theater_deg = lon_deg; + lat_theater_deg = lat_deg; + + ChangeMapTheater(lon_deg, lat_deg); + } + void tcScenarioInterface::SetUserAlliance(int alliance) { *************** *** 776,779 **** --- 796,809 ---- } + tcScenarioInterface::tcScenarioInterface() + : lon_theater_deg(0), + lat_theater_deg(0) + { + } + + tcScenarioInterface::~tcScenarioInterface() + { + } + } |