[Gcblue-commits] gcb_wx/src/scriptinterface tcPlatformInterface.cpp, 1.66, 1.67 tcScenarioInterface
Status: Alpha
Brought to you by:
ddcforge
From: Dewitt C. <ddc...@us...> - 2006-11-20 00:18:18
|
Update of /cvsroot/gcblue/gcb_wx/src/scriptinterface In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv29807/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.66 retrieving revision 1.67 diff -C2 -d -r1.66 -r1.67 *** tcPlatformInterface.cpp 24 Oct 2006 01:34:05 -0000 1.66 --- tcPlatformInterface.cpp 20 Nov 2006 00:17:43 -0000 1.67 *************** *** 44,49 **** #include "tcFlightOpsObject.h" #include "tcHeloObject.h" #include "tcBallisticDBObject.h" ! #include "tcGenericDBObject.h" #include "tcSonarDBObject.h" #include "tcTorpedoDBObject.h" --- 44,50 ---- #include "tcFlightOpsObject.h" #include "tcHeloObject.h" + #include "tcAirDBObject.h" #include "tcBallisticDBObject.h" ! #include "tcPlatformDBObject.h" #include "tcSonarDBObject.h" #include "tcTorpedoDBObject.h" *************** *** 106,115 **** float tcPlatformInterface::GetFuel() const { ! return mpPlatformObj->fuel_kg / mpPlatformObj->mpDBObject->mfFuelCapacity_kg; } float tcPlatformInterface::GetMaxAltitude() { ! return mpPlatformObj->mpDBObject->mfMaxAltitude_m; } --- 107,123 ---- float tcPlatformInterface::GetFuel() const { ! return mpPlatformObj->fuel_kg / mpPlatformObj->GetFuelCapacity(); } float tcPlatformInterface::GetMaxAltitude() { ! if (tcAirObject* air = dynamic_cast<tcAirObject*>(mpPlatformObj)) ! { ! return air->mpDBObject->maxAltitude_m; ! } ! else ! { ! return 0; ! } } *************** *** 781,792 **** int tcPlatformInterface::GetMagazineQuantity(std::string item) { ! int quantity = 0; ! unsigned int nMagazines = mpPlatformObj->GetMagazineCount(); ! for (unsigned int n=0; n<nMagazines; n++) ! { ! tcStores* mag = mpPlatformObj->GetMagazine(n); ! quantity += mag->CurrentItemQuantity(item); ! } ! return quantity; } --- 789,793 ---- int tcPlatformInterface::GetMagazineQuantity(std::string item) { ! return (int)mpPlatformObj->GetMagazineQuantity(item); } *************** *** 807,817 **** if (!launcher->IsItemCompatible(item)) return; unsigned int nMagazines = mpPlatformObj->GetMagazineCount(); for (unsigned int n=0; n<nMagazines; n++) { tcStores* mag = mpPlatformObj->GetMagazine(n); ! if (mag->CurrentItemQuantity(item)) { ! mag->LoadLauncher(anLauncher, item); return; } --- 808,819 ---- if (!launcher->IsItemCompatible(item)) return; + std::string exactItem; unsigned int nMagazines = mpPlatformObj->GetMagazineCount(); for (unsigned int n=0; n<nMagazines; n++) { tcStores* mag = mpPlatformObj->GetMagazine(n); ! if (mag->CurrentItemQuantity(item, exactItem)) { ! mag->LoadLauncher(anLauncher, exactItem); return; } *************** *** 826,836 **** if (!mpPlatformObj->IsControlled()) return; size_t nMagazines = mpPlatformObj->GetMagazineCount(); for (size_t n=0; n<nMagazines; n++) { tcStores* mag = mpPlatformObj->GetMagazine(n); ! if (mag->CurrentItemQuantity(item)) { ! mag->LoadOther(item, mpPlatformObj); return; } --- 828,839 ---- if (!mpPlatformObj->IsControlled()) return; + std::string exactItem; size_t nMagazines = mpPlatformObj->GetMagazineCount(); for (size_t n=0; n<nMagazines; n++) { tcStores* mag = mpPlatformObj->GetMagazine(n); ! if (mag->CurrentItemQuantity(item, exactItem)) { ! mag->LoadOther(exactItem, mpPlatformObj); return; } *************** *** 843,849 **** { tcStores* mag = parent->GetMagazine(n); ! if (mag->CurrentItemQuantity(item)) { ! mag->LoadOther(item, mpPlatformObj); return; } --- 846,852 ---- { tcStores* mag = parent->GetMagazine(n); ! if (mag->CurrentItemQuantity(item, exactItem)) { ! mag->LoadOther(exactItem, mpPlatformObj); return; } *************** *** 1188,1194 **** } ! bool thisPlatformIsHelo = (dynamic_cast<tcHeloObject*>(mpPlatformObj) != 0); ! bool carrierCompatible = mpPlatformObj->mpDBObject->IsCarrierCompatible(); if (findAirbases) // find friendly flight objs within maxRange_km --- 1191,1199 ---- } + tcAirObject* air = dynamic_cast<tcAirObject*>(mpPlatformObj); + tcAirObject* helo = dynamic_cast<tcHeloObject*>(air); ! bool thisPlatformIsHelo = (helo != 0); ! bool carrierCompatible = (air != 0) && (air->mpDBObject->IsCarrierCompatible()); if (findAirbases) // find friendly flight objs within maxRange_km *************** *** 1591,1595 **** if (tcSurfaceObject* surface = dynamic_cast<tcSurfaceObject*>(obj)) { ! if (!mpPlatformObj->mpDBObject->IsCarrierCompatible()) { tcTrack data; --- 1596,1601 ---- if (tcSurfaceObject* surface = dynamic_cast<tcSurfaceObject*>(obj)) { ! tcAirObject* air = dynamic_cast<tcAirObject*>(mpPlatformObj); ! if ((air == 0) || !air->mpDBObject->IsCarrierCompatible()) { tcTrack data; Index: tcSimPythonInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcSimPythonInterface.cpp,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** tcSimPythonInterface.cpp 24 Sep 2006 19:50:20 -0000 1.44 --- tcSimPythonInterface.cpp 20 Nov 2006 00:17:43 -0000 1.45 *************** *** 553,557 **** --- 553,563 ---- wxASSERT(overlay); + // start with clear state for new scenario mpSimState->Clear(); + + // clear db if using dynamic load so that only units from scenario are in memory + tcDatabase* database = tcDatabase::Get(); + if (database->IsUsingDynamicLoad()) database->Clear(); + director->ClearEvents(); overlay->ClearMapObjects(); Index: tcScenarioInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcScenarioInterface.cpp,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** tcScenarioInterface.cpp 27 Aug 2006 21:28:54 -0000 1.44 --- tcScenarioInterface.cpp 20 Nov 2006 00:17:43 -0000 1.45 *************** *** 34,38 **** #include "tcDirector.h" #include "tcDirectorEvent.h" ! #include "tcGenericDBObject.h" #include "tcGoal.h" #include "tcGoalTracker.h" --- 34,38 ---- #include "tcDirector.h" #include "tcDirectorEvent.h" ! #include "tcPlatformDBObject.h" #include "tcGoal.h" #include "tcGoalTracker.h" |