Update of /cvsroot/gcblue/gcb_wx/src/scriptinterface
In directory sc8-pr-cvs1:/tmp/cvs-serv12807/src/scriptinterface
Modified Files:
tcPlatformInterface.cpp tcPlatformInterfaceExtensionB.cpp
tcScenarioInterface.cpp
Log Message:
Index: tcPlatformInterface.cpp
===================================================================
RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcPlatformInterface.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** tcPlatformInterface.cpp 3 Jan 2004 00:45:13 -0000 1.11
--- tcPlatformInterface.cpp 5 Jan 2004 02:48:03 -0000 1.12
***************
*** 72,75 ****
--- 72,83 ----
/**
+ * @return fraction of fuel remaining
+ */
+ float tcPlatformInterface::GetFuel() const
+ {
+ return mpPlatformObj->fuel_kg / mpPlatformObj->mpDBObject->mfFuelCapacity_kg;
+ }
+
+ /**
* Get landing state (gear up/down).
* @return 1 gear down/ready to land, 0 otherwise or bad object
Index: tcPlatformInterfaceExtensionB.cpp
===================================================================
RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcPlatformInterfaceExtensionB.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** tcPlatformInterfaceExtensionB.cpp 8 Dec 2003 03:06:36 -0000 1.7
--- tcPlatformInterfaceExtensionB.cpp 5 Jan 2004 02:48:03 -0000 1.8
***************
*** 49,52 ****
--- 49,53 ----
// navigation related commands
.def("GetAlt", &tcPlatformInterface::GetAltitude)
+ .def("GetFuel", &tcPlatformInterface::GetFuel)
.def("GetMaxAlt", &tcPlatformInterface::GetMaxAltitude)
.def("GetSpeed",&tcPlatformInterface::GetSpeed)
Index: tcScenarioInterface.cpp
===================================================================
RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcScenarioInterface.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** tcScenarioInterface.cpp 1 Jan 2004 23:44:47 -0000 1.7
--- tcScenarioInterface.cpp 5 Jan 2004 02:48:03 -0000 1.8
***************
*** 39,42 ****
--- 39,44 ----
#include "tcGoalTracker.h"
#include "tcGoal.h"
+ #include "tcCarrierObject.h"
+ #include "tcAeroAirObject.h"
using namespace std;
***************
*** 126,129 ****
--- 128,132 ----
class_<tcScenarioInterface>("ScenarioInterface")
.def("AddUnitToAlliance",&tcScenarioInterface::AddUnitToAlliance)
+ .def("AddUnitToFlightDeck",&tcScenarioInterface::AddUnitToFlightDeck)
.def("CreateAlliance",&tcScenarioInterface::CreateAlliance)
.def("GetDefaultOrder",&tcScenarioInterface::GetDefaultOrder)
***************
*** 210,213 ****
--- 213,222 ----
}
}
+ // 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,220 ****
--- 226,262 ----
simState->AddPlatform(gameObj);
return true;
+ }
+
+ /**
+ * @param parentName unitname of parent carrier object
+ * @param className class of (air) unit to add
+ * @param unitName unitname of unit to add
+ * @param loc, HANGAR = 1, READY = 2, LAUNCH = 3
+ * @return true if successful, false otherwise
+ */
+ bool tcScenarioInterface::AddUnitToFlightDeck(std::string parentName,
+ std::string className,
+ std::string unitName, int locCode)
+ {
+ wxASSERT(simState);
+ tcGameObject* parentObj = simState->GetObjectByName(parentName);
+ if (tcCarrierObject* carrierObj = dynamic_cast<tcCarrierObject*>(parentObj))
+ {
+ teLocation loc;
+ if (locCode == 1) loc = HANGAR;
+ else if (locCode == 2) loc = READY;
+ else if (locCode == 3) loc = LAUNCH;
+ else
+ {
+ cerr << "Bad location code when adding to " << parentName << "\n";
+ return false;
+ }
+ return carrierObj->AddChildToFlightDeck(className, unitName, loc);
+ }
+ else
+ {
+ cerr << "Parent object not found: " << parentName << "\n";
+ return false;
+ }
}
|