[Gcblue-commits] gcb_wx/src/sim tcAeroAirObject.cpp,1.21,1.22 tcAirfieldObject.cpp,1.6,1.7 tcCarrier
Status: Alpha
Brought to you by:
ddcforge
Update of /cvsroot/gcblue/gcb_wx/src/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29814/src/sim Modified Files: tcAeroAirObject.cpp tcAirfieldObject.cpp tcCarrierObject.cpp tcGoal.cpp tcGoalTracker.cpp tcPlatformObject.cpp tcSimState.cpp tcStores.cpp Log Message: Updates to save goals to python scenario Index: tcGoal.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcGoal.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** tcGoal.cpp 26 Jul 2005 00:37:05 -0000 1.7 --- tcGoal.cpp 11 Dec 2005 00:34:28 -0000 1.8 *************** *** 24,33 **** #ifndef WX_PRECOMP #include "wx/wx.h" - #include "wx/msw/private.h" // for MS Windows specific definitions #endif #include "tcGoal.h" #include "tcSimState.h" ! /***** expose classes to boost python *****/ --- 24,32 ---- #ifndef WX_PRECOMP #include "wx/wx.h" #endif #include "tcGoal.h" #include "tcSimState.h" ! #include "tcScenarioLogger.h" /***** expose classes to boost python *****/ *************** *** 114,117 **** --- 113,120 ---- } + void tcGoal::SaveToPython(scriptinterface::tcScenarioLogger& logger) + { + } + /** * Checks to see if pass or fail timeouts have been *************** *** 153,156 **** --- 156,161 ---- /*** tcCompoundGoal ***/ + unsigned tcCompoundGoal::pythonWriteCount = 0; + /** * Copies and adds newGoal. *************** *** 168,171 **** --- 173,200 ---- } + void tcCompoundGoal::SaveToPython(scriptinterface::tcScenarioLogger& logger) + { + wxString s; + + unsigned sequenceId = pythonWriteCount++; + + for (size_t k=0; k<children.size(); k++) + { + children[k]->SaveToPython(logger); + s.Printf("goal_%d_%d = goal_temp\n", sequenceId, k); + logger.AddScenarioText(s.c_str()); + } + + s.Printf("goal_temp = SM.CompoundGoal(%d)", logicType); + logger.AddScenarioText(s.c_str()); + + for (size_t k=0; k<children.size(); k++) + { + s.Printf("goal_temp.AddGoal(goal_%d_%d)", sequenceId, k); + logger.AddScenarioText(s.c_str()); + } + logger.AddScenarioText(""); + } + void tcCompoundGoal::Update() *************** *** 281,284 **** --- 310,333 ---- } + void tcTimeGoal::SaveToPython(scriptinterface::tcScenarioLogger& logger) + { + wxString s; + + logger.AddScenarioText("goal_temp = SM.TimeGoal()"); + + if (passTimeout != DBL_MAX) + { + s.Printf("goal_temp.SetPassTimeout(%f)", passTimeout); + logger.AddScenarioText(s.c_str()); + } + + if (failTimeout != DBL_MAX) + { + s.Printf("goal_temp.SetFailTimeout(%f)", failTimeout); + logger.AddScenarioText(s.c_str()); + } + + } + void tcTimeGoal::Update() { *************** *** 350,353 **** --- 399,409 ---- } + void tcDestroyGoal::SaveToPython(scriptinterface::tcScenarioLogger& logger) + { + wxString s; + + s.Printf("goal_temp = SM.DestroyGoal('%s')", targetString.c_str()); + logger.AddScenarioText(s.c_str()); + } void tcDestroyGoal::Update() *************** *** 398,401 **** --- 454,465 ---- } + void tcProtectGoal::SaveToPython(scriptinterface::tcScenarioLogger& logger) + { + wxString s; + + s.Printf("goal_temp = SM.ProtectGoal('%s')", targetString.c_str()); + logger.AddScenarioText(s.c_str()); + } + void tcProtectGoal::Update() Index: tcPlatformObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcPlatformObject.cpp,v retrieving revision 1.56 retrieving revision 1.57 diff -C2 -d -r1.56 -r1.57 *** tcPlatformObject.cpp 27 Nov 2005 22:21:29 -0000 1.56 --- tcPlatformObject.cpp 11 Dec 2005 00:34:28 -0000 1.57 *************** *** 2,6 **** ** @file tcPlatformObject.cpp */ ! /* Copyright (C) 2003-2004 Dewitt Colclough (de...@tw...) ** All rights reserved. --- 2,6 ---- ** @file tcPlatformObject.cpp */ ! /* Copyright (C) 2003-2005 Dewitt Colclough (de...@gc...) ** All rights reserved. *************** *** 39,42 **** --- 39,43 ---- #include "common/tcObjStream.h" #include "ai/Brain.h" + #include "tcScenarioLogger.h" #ifdef _DEBUG *************** *** 682,685 **** --- 683,696 ---- } + void tcPlatformObject::SaveToPython(scriptinterface::tcScenarioLogger& logger) + { + tcGameObject::SaveToPython(logger); + + for (size_t k=0; k<magazines.size(); k++) + { + magazines[k]->SaveToPython(logger); + } + } + /** Index: tcAeroAirObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcAeroAirObject.cpp,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** tcAeroAirObject.cpp 10 Dec 2005 21:45:43 -0000 1.21 --- tcAeroAirObject.cpp 11 Dec 2005 00:34:28 -0000 1.22 *************** *** 134,137 **** --- 134,146 ---- } + void tcAeroAirObject::SaveToPython(scriptinterface::tcScenarioLogger& logger) + { + wxString s; + + tcGameObject::SaveToPython(logger); + + s.Printf("UI.SetThrottle(%f)", GetThrottleFraction()); + logger.AddScenarioText(s.c_str()); + } void tcAeroAirObject::SetThrottleFraction(float fract) Index: tcSimState.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcSimState.cpp,v retrieving revision 1.91 retrieving revision 1.92 diff -C2 -d -r1.91 -r1.92 *** tcSimState.cpp 10 Dec 2005 16:52:03 -0000 1.91 --- tcSimState.cpp 11 Dec 2005 00:34:28 -0000 1.92 *************** *** 2627,2630 **** --- 2627,2650 ---- } + // save goals + for (size_t k=0; k<alliances.size(); k++) + { + unsigned alliance = alliances[k]; + + logger.AddScenarioText("##############################"); + s.Printf("### Alliance %d goals", alliance); + logger.AddScenarioText(s.c_str()); + logger.AddScenarioText("##############################\n"); + + tcGoal* allianceGoal = goalTracker->GetAllianceGoal((int)alliance); + if (allianceGoal) + { + allianceGoal->SaveToPython(logger); + + s.Printf("SM.SetAllianceGoal(%d, goal_temp)\n", alliance); + logger.AddScenarioText(s.c_str()); + } + } + logger.WriteAll(); Index: tcGoalTracker.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcGoalTracker.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** tcGoalTracker.cpp 26 Jul 2005 00:37:05 -0000 1.8 --- tcGoalTracker.cpp 11 Dec 2005 00:34:28 -0000 1.9 *************** *** 224,227 **** --- 224,238 ---- } + tcGoal* tcGoalTracker::GetAllianceGoal(int alliance) + { + if ((alliance < 0)||(alliance >= MAX_ALLIANCES)) + { + wxMessageBox("Alliance out of range in tcGoalTracker::GetAllianceGoal"); + return 0; + } + + return allianceGoals[alliance]; + } + void tcGoalTracker::SetAllianceGoal(int alliance, tcGoal* goal) { Index: tcStores.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcStores.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** tcStores.cpp 30 Jun 2005 01:06:11 -0000 1.7 --- tcStores.cpp 11 Dec 2005 00:34:28 -0000 1.8 *************** *** 35,38 **** --- 35,39 ---- #include "tcFlightOpsObject.h" #include "tcFlightPort.h" + #include "tcScenarioLogger.h" #ifdef _DEBUG *************** *** 857,860 **** --- 858,873 ---- } + void tcStores::SaveToPython(scriptinterface::tcScenarioLogger& logger) + { + wxString s; + + for (size_t k=0; k<stores.size(); k++) + { + s.Printf("SM.AddToUnitMagazine('%s', '%s', %d)", parent->mzUnit.mz, + stores[k].className.c_str(), stores[k].quantity); + logger.AddScenarioText(s.c_str()); + } + } + /** * Index: tcCarrierObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcCarrierObject.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** tcCarrierObject.cpp 10 Dec 2005 16:52:03 -0000 1.12 --- tcCarrierObject.cpp 11 Dec 2005 00:34:28 -0000 1.13 *************** *** 203,207 **** void tcCarrierObject::SaveToPython(scriptinterface::tcScenarioLogger& logger) { ! tcGameObject::SaveToPython(logger); tcFlightOpsObject::SaveToPython(logger); } --- 203,207 ---- void tcCarrierObject::SaveToPython(scriptinterface::tcScenarioLogger& logger) { ! tcPlatformObject::SaveToPython(logger); tcFlightOpsObject::SaveToPython(logger); } Index: tcAirfieldObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcAirfieldObject.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** tcAirfieldObject.cpp 10 Dec 2005 16:52:03 -0000 1.6 --- tcAirfieldObject.cpp 11 Dec 2005 00:34:28 -0000 1.7 *************** *** 197,201 **** void tcAirfieldObject::SaveToPython(scriptinterface::tcScenarioLogger& logger) { ! tcGameObject::SaveToPython(logger); tcFlightOpsObject::SaveToPython(logger); } --- 197,201 ---- void tcAirfieldObject::SaveToPython(scriptinterface::tcScenarioLogger& logger) { ! tcPlatformObject::SaveToPython(logger); tcFlightOpsObject::SaveToPython(logger); } |