[Gcblue-commits] gcb_wx/src/scriptinterface tcPlatformInterface.cpp,1.13,1.14 tcScenarioInterface.cp
Status: Alpha
Brought to you by:
ddcforge
From: <ddc...@pr...> - 2004-01-31 04:41:33
|
Update of /cvsroot/gcblue/gcb_wx/src/scriptinterface In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4193/src/scriptinterface Modified Files: tcPlatformInterface.cpp tcScenarioInterface.cpp tcSimPythonInterface.cpp Log Message: Index: tcPlatformInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcPlatformInterface.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** tcPlatformInterface.cpp 8 Jan 2004 23:54:27 -0000 1.13 --- tcPlatformInterface.cpp 29 Jan 2004 00:05:23 -0000 1.14 *************** *** 38,41 **** --- 38,42 ---- #include "commandlist.h" #include "tcAeroAirObject.h" + #include "tcGenericDBObject.h" *************** *** 79,82 **** --- 80,108 ---- } + float tcPlatformInterface::GetMaxAltitude() + { + return mpPlatformObj->mpDBObject->mfMaxAltitude_m; + } + + float tcPlatformInterface::GetSpeed() + { + return mpPlatformObj->mcKin.mfSpeed_kts; + } + + float tcPlatformInterface::GetMaxSpeed() + { + return mpPlatformObj->mpDBObject->mfMaxSpeed_kts; + } + + float tcPlatformInterface::GetHeading() + { + return C_180OVERPI*mpPlatformObj->mcKin.mfHeading_rad; + } + + float tcPlatformInterface::GetHeadingRad() + { + return mpPlatformObj->mcKin.mfHeading_rad; + } + /** * Get landing state (gear up/down). *************** *** 194,197 **** --- 220,224 ---- track.mfSpeed_kts = pTargetKin->mfSpeed_kts; track.mnClassification = pGameObj->mpDBObject->mnType; + track.mnAffiliation = FRIENDLY; return true; } *************** *** 324,328 **** return false; } ! tsLData* pLauncherData = &mpPlatformObj->mcLauncherState.ma[anLauncher]; tcMissileDBObject *pMissileDBObj = dynamic_cast<tcMissileDBObject*>(pLauncherData->mpChildDBObj); --- 351,355 ---- return false; } ! tsLData* pLauncherData = &mpPlatformObj->mcLauncherState.launchers[anLauncher]; tcMissileDBObject *pMissileDBObj = dynamic_cast<tcMissileDBObject*>(pLauncherData->mpChildDBObj); *************** *** 365,369 **** return s; } ! tcDatabaseObject *pChildDBObj = mpPlatformObj->mcLauncherState.ma[anLauncher].mpChildDBObj; if (pChildDBObj == NULL) { s = "Error"; --- 392,396 ---- return s; } ! tcDatabaseObject *pChildDBObj = mpPlatformObj->mcLauncherState.launchers[anLauncher].mpChildDBObj; if (pChildDBObj == NULL) { s = "Error"; *************** *** 627,630 **** --- 654,658 ---- track.mnClassification = obj->mpDBObject->mnType; track.mnID = obj->mnID; + track.mnAffiliation = FRIENDLY; return track; } Index: tcScenarioInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcScenarioInterface.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** tcScenarioInterface.cpp 5 Jan 2004 02:48:03 -0000 1.8 --- tcScenarioInterface.cpp 29 Jan 2004 00:05:24 -0000 1.9 *************** *** 41,44 **** --- 41,45 ---- #include "tcCarrierObject.h" #include "tcAeroAirObject.h" + #include "tcGenericDBObject.h" using namespace std; *************** *** 120,123 **** --- 121,125 ---- .def_readwrite("heading",&tcScenarioUnit::heading) .def_readwrite("speed",&tcScenarioUnit::speed) + .def_readwrite("throttle",&tcScenarioUnit::throttle) .def("AddOrder",&tcScenarioUnit::AddOrder) .def("ClearOrders",&tcScenarioUnit::ClearOrders) *************** *** 194,200 **** gameObj->mcKin.mfPitch_rad = 0; gameObj->mcKin.mfRoll_rad = 0; - gameObj->mcKin.mfSpeed_kts = 0; if (unit.speed < 0) {unit.speed = 0;} ! else if (unit.speed > 1.0) {unit.speed = 1.0;} gameObj->mfDamageLevel = 0; gameObj->mnAlliance = alliance; --- 196,201 ---- gameObj->mcKin.mfPitch_rad = 0; gameObj->mcKin.mfRoll_rad = 0; if (unit.speed < 0) {unit.speed = 0;} ! gameObj->mcKin.mfSpeed_kts = unit.speed; gameObj->mfDamageLevel = 0; gameObj->mnAlliance = alliance; *************** *** 204,209 **** if (tcPlatformObject *platObj = dynamic_cast<tcPlatformObject*>(gameObj)) { ! float max_speed_kts = platObj->mpDBObject->mfMaxSpeed_kts; ! platObj->mcKin.mfSpeed_kts = unit.speed*max_speed_kts; platObj->SetSpeed(platObj->mcKin.mfSpeed_kts); int nOrders = (int)unit.orders.size(); --- 205,213 ---- if (tcPlatformObject *platObj = dynamic_cast<tcPlatformObject*>(gameObj)) { ! // limit speed to max ! if (platObj->mcKin.mfSpeed_kts > platObj->mpDBObject->mfMaxSpeed_kts) ! { ! platObj->mcKin.mfSpeed_kts = platObj->mpDBObject->mfMaxSpeed_kts; ! } platObj->SetSpeed(platObj->mcKin.mfSpeed_kts); int nOrders = (int)unit.orders.size(); *************** *** 213,221 **** } } ! // limit initial speed of aero objects for now, need something to calculate ! // steady state speed based on throttle and altitude. if (tcAeroAirObject *aeroAirObj = dynamic_cast<tcAeroAirObject*>(gameObj)) { ! if (aeroAirObj->mcKin.mfSpeed_kts > 690.0f) aeroAirObj->mcKin.mfSpeed_kts = 690.0f; } if (tcAirObject *airObj = dynamic_cast<tcAirObject*>(gameObj)) --- 217,224 ---- } } ! // need something to calculate steady state speed based on throttle and altitude. if (tcAeroAirObject *aeroAirObj = dynamic_cast<tcAeroAirObject*>(gameObj)) { ! aeroAirObj->SetThrottleFraction((unit.throttle >= 0) ? unit.throttle : 0); } if (tcAirObject *airObj = dynamic_cast<tcAirObject*>(gameObj)) *************** *** 287,290 **** --- 290,294 ---- unit.heading = 12; unit.speed = 0.5; + unit.throttle = 0.8; return unit; } Index: tcSimPythonInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcSimPythonInterface.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** tcSimPythonInterface.cpp 29 Dec 2003 01:10:25 -0000 1.10 --- tcSimPythonInterface.cpp 29 Jan 2004 00:05:26 -0000 1.11 *************** *** 350,354 **** /** ! * Calls the ProcessHotkey script in Menu.py with an argument based * on whether or not a unit is hooked and, if so, the type of unit * hooked (own-alliance or sensor track). Initially this will only --- 350,354 ---- /** ! * Calls the ProcessHotKey script in Menu.py with an argument based * on whether or not a unit is hooked and, if so, the type of unit * hooked (own-alliance or sensor track). Initially this will only *************** *** 367,370 **** --- 367,387 ---- } + /** + * Calls the ProcessSecondaryHook script in Menu.py with an argument based + * on whether or not a unit is hooked and, if so, the type of unit + * hooked (own-alliance or sensor track). Initially this will only + * support friendly / own-alliance hooks. Intended to be used for a quick + * mouse targeting feature. + */ + void tcSimPythonInterface::ProcessSecondaryHook(long id) + { + char zBuff[128]; + if (mpHookedObj == NULL) return; + if (!mpSimState->mpUserInfo->IsOwnAlliance(mpHookedObj->mnAlliance)) return; + + sprintf(zBuff,"Menu.ProcessSecondaryHook(HookedUnitInfo,%d)\n",id); + CallPython(zBuff,"Exception occured in ProcessSecondaryHook\n"); + } + /* writes error message in text out to console, if console is attached */ void tcSimPythonInterface::ReportError(const char* text) |