gcblue-commits Mailing List for Global Conflict Blue (Page 16)
Status: Alpha
Brought to you by:
ddcforge
You can subscribe to this list here.
| 2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(6) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2004 |
Jan
(112) |
Feb
(106) |
Mar
(88) |
Apr
(111) |
May
(53) |
Jun
(60) |
Jul
(58) |
Aug
(61) |
Sep
(45) |
Oct
(31) |
Nov
(71) |
Dec
(70) |
| 2005 |
Jan
(33) |
Feb
(57) |
Mar
(98) |
Apr
(47) |
May
(53) |
Jun
(79) |
Jul
(79) |
Aug
|
Sep
(33) |
Oct
(1) |
Nov
(20) |
Dec
(64) |
| 2006 |
Jan
(20) |
Feb
(1) |
Mar
(43) |
Apr
(11) |
May
(8) |
Jun
(23) |
Jul
|
Aug
(28) |
Sep
(58) |
Oct
(25) |
Nov
(47) |
Dec
(70) |
|
From: Dewitt C. <ddc...@us...> - 2005-12-12 02:37:10
|
Update of /cvsroot/gcblue/gcb_wx/src/ai In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16711/src/ai Modified Files: Blackboard.cpp BlackboardInterface.cpp Brain.cpp Log Message: Updates to save goals to python scenario Index: Blackboard.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/ai/Blackboard.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Blackboard.cpp 16 Feb 2005 23:13:49 -0000 1.2 --- Blackboard.cpp 12 Dec 2005 02:37:01 -0000 1.3 *************** *** 2,6 **** ** @file Blackboard.cpp */ ! /* Copyright (C) 2005 Dewitt Colclough (de...@tw...) ** All rights reserved. --- 2,6 ---- ** @file Blackboard.cpp */ ! /* Copyright (C) 2005 Dewitt Colclough (de...@gc...) ** All rights reserved. *************** *** 28,32 **** #include "ai/Blackboard.h" #include "ai/BlackboardItem.h" ! #ifdef _DEBUG --- 28,32 ---- #include "ai/Blackboard.h" #include "ai/BlackboardItem.h" ! #include "tcScenarioLogger.h" #ifdef _DEBUG *************** *** 161,164 **** --- 161,187 ---- /** + * Assumes a blackboard interface object, "BB", has been created + * on previous line. Board contents written by tasks will not be saved. + * Items with author != 0 are ignored. + * Note tasks sensitive to sim time will not be saved correctly unless + * capbility to start game with arbitrary (non-zero) sim time is added. + */ + void Blackboard::SaveToPython(scriptinterface::tcScenarioLogger& logger) + { + wxString s; + + for (std::map<std::string, BlackboardItem>::iterator iter = + content.begin(); iter != content.end(); ++iter) + { + if (iter->second.author == 0) + { + s.Printf("BB.Write('%s', '%s')", iter->first.c_str(), + iter->second.message.c_str()); + logger.AddScenarioText(s); + } + } + } + + /** * @return true if write successful, false if blocked */ Index: BlackboardInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/ai/BlackboardInterface.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** BlackboardInterface.cpp 20 Feb 2005 18:20:19 -0000 1.2 --- BlackboardInterface.cpp 12 Dec 2005 02:37:01 -0000 1.3 *************** *** 31,35 **** #include <boost/python.hpp> - #ifdef _DEBUG #define new DEBUG_NEW --- 31,34 ---- *************** *** 121,125 **** } - /** * @return true if write successful, false if blocked --- 120,123 ---- Index: Brain.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/ai/Brain.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Brain.cpp 11 Dec 2005 00:34:28 -0000 1.10 --- Brain.cpp 12 Dec 2005 02:37:01 -0000 1.11 *************** *** 174,178 **** --- 174,208 ---- void Brain::SaveToPython(scriptinterface::tcScenarioLogger& logger) { + wxString s; + + std::map<std::string, Task*>::iterator iter = taskMap.begin(); + std::map<std::string, Task*>::iterator& done = taskMap.end(); + for (;iter != done; ++iter) + { + Task* task = iter->second; + wxASSERT(task); + + const std::string& taskName = task->GetTaskName(); + + s.Printf("UI.AddTask('%s', %f)", taskName.c_str(), task->GetPriority()); + logger.AddScenarioText(s); + + if (Nav* nav = dynamic_cast<Nav*>(task)) + { + const std::vector<GeoPoint>& waypoints = nav->GetWaypoints(); + for (size_t k=0; k<waypoints.size(); k++) + { + s.Printf("UI.AddNavWaypoint(%f, %f)", waypoints[k].mfLon_rad, + waypoints[k].mfLat_rad); + logger.AddScenarioText(s); + } + } + } + // write blackboard contents + logger.AddScenarioText("BB = UI.GetBlackboardInterface()"); + board.SaveToPython(logger); + + } |
|
From: Dewitt C. <ddc...@us...> - 2005-12-12 02:37:10
|
Update of /cvsroot/gcblue/gcb_wx In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16711 Modified Files: GCblue.vcproj Log Message: Updates to save goals to python scenario Index: GCblue.vcproj =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/GCblue.vcproj,v retrieving revision 1.100 retrieving revision 1.101 diff -C2 -d -r1.100 -r1.101 *** GCblue.vcproj 10 Dec 2005 16:52:02 -0000 1.100 --- GCblue.vcproj 12 Dec 2005 02:37:00 -0000 1.101 *************** *** 390,393 **** --- 390,396 ---- </File> <File + RelativePath=".\src\graphics\tcTextEntryBox.cpp"> + </File> + <File RelativePath=".\src\graphics\tcXmlWindow.cpp"> </File> *************** *** 1417,1420 **** --- 1420,1426 ---- </File> <File + RelativePath=".\include\graphics\tcTextEntryBox.h"> + </File> + <File RelativePath=".\include\graphics\tcXmlWindow.h"> </File> |
|
From: Dewitt C. <ddc...@us...> - 2005-12-12 02:37:10
|
Update of /cvsroot/gcblue/gcb_wx/include/ai In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16711/include/ai Modified Files: Blackboard.h BlackboardInterface.h Log Message: Updates to save goals to python scenario Index: Blackboard.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/ai/Blackboard.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Blackboard.h 16 Feb 2005 23:13:37 -0000 1.2 --- Blackboard.h 12 Dec 2005 02:37:01 -0000 1.3 *************** *** 2,6 **** ** @file Blackboard.h */ ! /* Copyright (C) 2005 Dewitt Colclough (de...@tw...) ** All rights reserved. --- 2,6 ---- ** @file Blackboard.h */ ! /* Copyright (C) 2005 Dewitt Colclough (de...@gc...) ** All rights reserved. *************** *** 30,33 **** --- 30,37 ---- #include <string> + namespace scriptinterface + { + class tcScenarioLogger; + } namespace ai *************** *** 48,51 **** --- 52,56 ---- const std::string ReadMessage(const std::string& key); double ReadPriority(const std::string& key); + void SaveToPython(scriptinterface::tcScenarioLogger& logger); bool Write(const std::string& key, const BlackboardItem& item); bool Write(const std::string& key, long author, double priority, const std::string& message); Index: BlackboardInterface.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/ai/BlackboardInterface.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** BlackboardInterface.h 20 Feb 2005 18:20:18 -0000 1.2 --- BlackboardInterface.h 12 Dec 2005 02:37:01 -0000 1.3 *************** *** 31,35 **** #include <vector> - namespace ai { --- 31,34 ---- |
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); } |
|
From: Dewitt C. <ddc...@us...> - 2005-12-11 00:34:36
|
Update of /cvsroot/gcblue/gcb_wx/src/ai In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29814/src/ai Modified Files: Brain.cpp Log Message: Updates to save goals to python scenario Index: Brain.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/ai/Brain.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Brain.cpp 29 Jul 2005 02:35:52 -0000 1.9 --- Brain.cpp 11 Dec 2005 00:34:28 -0000 1.10 *************** *** 34,37 **** --- 34,38 ---- #include "common/tcStream.h" #include "common/tcObjStream.h" + #include "tcScenarioLogger.h" #ifdef _DEBUG *************** *** 171,174 **** --- 172,180 ---- } + void Brain::SaveToPython(scriptinterface::tcScenarioLogger& logger) + { + + } + /** * For multiplayer, call when task is added or deleted, or nav task waypoints have changed |
|
From: Dewitt C. <ddc...@us...> - 2005-12-11 00:34:36
|
Update of /cvsroot/gcblue/gcb_wx/include/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29814/include/sim Modified Files: tcAeroAirObject.h tcGoal.h tcGoalTracker.h tcPlatformObject.h tcStores.h Log Message: Updates to save goals to python scenario Index: tcGoal.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcGoal.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** tcGoal.h 26 Jul 2005 00:37:03 -0000 1.6 --- tcGoal.h 11 Dec 2005 00:34:28 -0000 1.7 *************** *** 39,42 **** --- 39,46 ---- } } + namespace scriptinterface + { + class tcScenarioLogger; + } void InitGoalPython(boost::python::dict *dictionary); *************** *** 63,66 **** --- 67,71 ---- virtual void Update(); ///< updates goal state using on simState virtual void WriteStatus(std::stringstream& stream, unsigned int level = 0); + virtual void SaveToPython(scriptinterface::tcScenarioLogger& logger); virtual tcGoal* Clone(); *************** *** 91,94 **** --- 96,100 ---- virtual void Update(); ///< updates goal state using on simState virtual void WriteStatus(std::stringstream& stream, unsigned int level = 0); + virtual void SaveToPython(scriptinterface::tcScenarioLogger& logger); virtual tcGoal* Clone(); *************** *** 96,99 **** --- 102,108 ---- tcCompoundGoal(const tcCompoundGoal& goal); virtual ~tcCompoundGoal(); + + protected: + static unsigned pythonWriteCount; ///< used to handle nested compound goas in SaveToPython }; *************** *** 111,114 **** --- 120,124 ---- virtual void Update(); ///< updates goal state using on simState virtual void WriteStatus(std::stringstream& stream, unsigned int level = 0); + virtual void SaveToPython(scriptinterface::tcScenarioLogger& logger); virtual tcGoal* Clone(); *************** *** 128,131 **** --- 138,142 ---- virtual void Update(); virtual void WriteStatus(std::stringstream& stream, unsigned int level = 0); + virtual void SaveToPython(scriptinterface::tcScenarioLogger& logger); virtual tcGoal* Clone(); *************** *** 144,147 **** --- 155,159 ---- virtual void Update(); virtual void WriteStatus(std::stringstream& stream, unsigned int level = 0); + virtual void SaveToPython(scriptinterface::tcScenarioLogger& logger); virtual tcGoal* Clone(); Index: tcStores.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcStores.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** tcStores.h 22 Jun 2005 01:21:27 -0000 1.6 --- tcStores.h 11 Dec 2005 00:34:28 -0000 1.7 *************** *** 35,38 **** --- 35,42 ---- class tcStoresDBObject; } + namespace scriptinterface + { + class tcScenarioLogger; + } using namespace database; *************** *** 102,109 **** tcGameObject* child = 0); bool LoadOther(const std::string& item, tcGameObject* child = 0); void SetParent(tcPlatformObject* obj); bool UnloadLauncher(unsigned int idx, tcGameObject* child = 0); void Update(double t); ! tcCommandStream& operator<<(tcCommandStream& stream); tcCreateStream& operator<<(tcCreateStream& stream); --- 106,114 ---- tcGameObject* child = 0); bool LoadOther(const std::string& item, tcGameObject* child = 0); + virtual void SaveToPython(scriptinterface::tcScenarioLogger& logger); void SetParent(tcPlatformObject* obj); bool UnloadLauncher(unsigned int idx, tcGameObject* child = 0); void Update(double t); ! tcCommandStream& operator<<(tcCommandStream& stream); tcCreateStream& operator<<(tcCreateStream& stream); Index: tcAeroAirObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcAeroAirObject.h,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** tcAeroAirObject.h 1 Jun 2005 00:13:28 -0000 1.13 --- tcAeroAirObject.h 11 Dec 2005 00:34:28 -0000 1.14 *************** *** 31,34 **** --- 31,38 ---- class tcAirDBObject; } + namespace scriptinterface + { + class tcScenarioLogger; + } class tcCommandStream; *************** *** 56,59 **** --- 60,64 ---- void LoadFromFile(tcFile& file); virtual void Serialize(tcFile& file, bool mbLoad); + virtual void SaveToPython(scriptinterface::tcScenarioLogger& logger); virtual tcCommandStream& operator<<(tcCommandStream& stream); Index: tcGoalTracker.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcGoalTracker.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** tcGoalTracker.h 26 Jul 2005 00:37:03 -0000 1.4 --- tcGoalTracker.h 11 Dec 2005 00:34:28 -0000 1.5 *************** *** 32,35 **** --- 32,36 ---- bool HasStatusChanged(int alliance); void LogAllianceGoalStatus(std::string fileName, int alliance); + tcGoal* GetAllianceGoal(int alliance); void SetAllianceGoal(int alliance, tcGoal* goal); void Update(double currentTime); Index: tcPlatformObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcPlatformObject.h,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** tcPlatformObject.h 10 Sep 2005 21:48:06 -0000 1.32 --- tcPlatformObject.h 11 Dec 2005 00:34:28 -0000 1.33 *************** *** 54,57 **** --- 54,62 ---- } + namespace scriptinterface + { + class tcScenarioLogger; + } + using ai::Brain; *************** *** 131,134 **** --- 136,140 ---- void LoadFromFile(tcFile& file); virtual void Serialize(tcFile& file, bool mbLoad); + virtual void SaveToPython(scriptinterface::tcScenarioLogger& logger); virtual tcCommandStream& operator<<(tcCommandStream& stream); |
|
From: Dewitt C. <ddc...@us...> - 2005-12-11 00:34:36
|
Update of /cvsroot/gcblue/gcb_wx/include/ai In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29814/include/ai Modified Files: Brain.h Log Message: Updates to save goals to python scenario Index: Brain.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/ai/Brain.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Brain.h 29 Jul 2005 02:35:52 -0000 1.8 --- Brain.h 11 Dec 2005 00:34:28 -0000 1.9 *************** *** 34,37 **** --- 34,42 ---- #include "ai/Blackboard.h" + namespace scriptinterface + { + class tcScenarioLogger; + } + class tcPlatformObject; class tcStream; *************** *** 83,87 **** bool HasNewCommand() const; void SetNewCommand(); ! Brain(tcPlatformObject* platform_); --- 88,92 ---- bool HasNewCommand() const; void SetNewCommand(); ! virtual void SaveToPython(scriptinterface::tcScenarioLogger& logger); Brain(tcPlatformObject* platform_); |
|
From: Dewitt C. <ddc...@us...> - 2005-12-10 21:54:52
|
Update of /cvsroot/gcblue/gcb_wx/src/scriptinterface In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26763/src/scriptinterface Added Files: tcScenarioLogger.cpp Log Message: --- NEW FILE: tcScenarioLogger.cpp --- /** ** @file tcScenarioLogger.cpp */ /* Copyright (C) 2005 Dewitt Colclough (de...@gc...) ** All rights reserved. ** This file is part of the Global Conflict Blue (GCB) program. ** GCB is free software; you can redistribute it and/or modify ** it under the terms of version 2 of the GNU General Public License as ** published by the Free Software Foundation. ** GCB is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** You should have received a copy of the GNU General Public License ** along with GCB; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "stdwx.h" // precompiled header file #ifndef WX_PRECOMP #include "wx/wx.h" #endif #include "tcScenarioLogger.h" #ifdef _DEBUG #define new DEBUG_NEW #endif namespace scriptinterface { void tcScenarioLogger::AddScenarioText(const std::string& s) { scenarioText << " "; scenarioText << s; scenarioText << "\n"; } void tcScenarioLogger::CreateHeaderText() { headerText.clear(); headerText << "from math import *\n"; headerText << "from random import *\n"; headerText << "from UnitCommands import *\n\n"; } void tcScenarioLogger::InitScenarioText() { scenarioText.clear(); scenarioText << "def CreateScenario(SM):\n\n"; scenarioText << " SM.SetScenarioDescription('Scenario description goes here')\n"; scenarioText << " SM.SetScenarioName('Scenario name goes here')\n"; scenarioText << " SM.SetUserAlliance(1)\n"; } void tcScenarioLogger::WriteAll() { scenario.WriteString(headerText.str().c_str()); scenario.WriteString(scenarioText.str().c_str()); } tcScenarioLogger::tcScenarioLogger(const std::string& fileName) : scenario(fileName + ".py") { CreateHeaderText(); InitScenarioText(); } tcScenarioLogger::~tcScenarioLogger() { } } |
|
From: Dewitt C. <ddc...@us...> - 2005-12-10 21:54:45
|
Update of /cvsroot/gcblue/gcb_wx/include/scriptinterface In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26731/include/scriptinterface Added Files: tcScenarioLogger.h Log Message: --- NEW FILE: tcScenarioLogger.h --- /** ** @file tcScenarioLogger.h */ /* Copyright (C) 2005 Dewitt Colclough (de...@tw...) ** All rights reserved. ** This file is part of the Global Conflict Blue (GCB) program. ** GCB is free software; you can redistribute it and/or modify ** it under the terms of version 2 of the GNU General Public License as ** published by the Free Software Foundation. ** GCB is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** You should have received a copy of the GNU General Public License ** along with GCB; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ** ** Python interface to tcPanel for scripting */ #ifndef _TCSCENARIOLOGGER_H_ #define _TCSCENARIOLOGGER_H_ #if _MSC_VER > 1000 #pragma once #endif #include <sstream> #include "tcFile.h" namespace scriptinterface { /** * Class to assist in writing game state to python-compliant scenario file */ class tcScenarioLogger { public: /// add scenario text with correct indent level and trailing '\n' void AddScenarioText(const std::string& s); /// write all scenario info to file void WriteAll(); tcScenarioLogger(const std::string& fileName); ~tcScenarioLogger(); private: tcFile scenario; std::stringstream headerText; std::stringstream scenarioText; void CreateHeaderText(); void InitScenarioText(); }; } #endif // _TCSCENARIOLOGGER_H_ |
|
From: Dewitt C. <ddc...@us...> - 2005-12-10 21:45:50
|
Update of /cvsroot/gcblue/gcb_wx/src/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25004/src/sim Modified Files: tcAeroAirObject.cpp Log Message: Index: tcAeroAirObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcAeroAirObject.cpp,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** tcAeroAirObject.cpp 10 Sep 2005 21:47:38 -0000 1.20 --- tcAeroAirObject.cpp 10 Dec 2005 21:45:43 -0000 1.21 *************** *** 34,37 **** --- 34,38 ---- #include "common/tcStream.h" #include "common/tcObjStream.h" + #include "tcScenarioLogger.h" #ifdef _DEBUG |
|
From: Dewitt C. <ddc...@us...> - 2005-12-10 16:52:12
|
Update of /cvsroot/gcblue/gcb_wx/src/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29922/src/common Modified Files: tcFile.cpp Log Message: Start of save to python feature Index: tcFile.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/common/tcFile.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** tcFile.cpp 8 Aug 2004 00:31:33 -0000 1.5 --- tcFile.cpp 10 Dec 2005 16:52:02 -0000 1.6 *************** *** 47,52 **** int tcFile::Close() { ! if (mpFile == NULL) {return false;} ! return fclose(mpFile); } --- 47,57 ---- int tcFile::Close() { ! if (mpFile == 0) {return false;} ! int val = fclose(mpFile); ! if (val == 0) ! { ! mpFile = 0; ! } ! return val; } *************** *** 151,160 **** ! tcFile::tcFile(void) { - mpFile = NULL; } ! tcFile::~tcFile(void) { } --- 156,178 ---- ! tcFile::tcFile() ! : mpFile(0) { } ! tcFile::tcFile(const std::string& fileName) ! : mpFile(0) ! { ! if (Open(fileName.c_str(), modeWrite | modeText) == 0) ! { ! fprintf(stderr, "tcFile::tcFile - Error opening %s\n", fileName.c_str()); ! } ! } ! ! tcFile::~tcFile() { + if (IsOpen()) + { + Close(); + } } |
|
From: Dewitt C. <ddc...@us...> - 2005-12-10 16:52:12
|
Update of /cvsroot/gcblue/gcb_wx/docs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29922/docs Modified Files: CHANGES.txt Log Message: Start of save to python feature Index: CHANGES.txt =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/docs/CHANGES.txt,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** CHANGES.txt 27 Nov 2005 22:34:58 -0000 1.44 --- CHANGES.txt 10 Dec 2005 16:52:02 -0000 1.45 *************** *** 4,7 **** --- 4,11 ---- 0.8.1 --------------------------------------------------------------------- + *** 2005-12-10 Dewitt Colclough *** + - Started work for feature to save scenario to a python scenario file. + Initially this can be used in a mission editor mode to create scenario + templates from within the game. *** 2005-11-27 Dewitt Colclough *** |
|
From: Dewitt C. <ddc...@us...> - 2005-12-10 16:52:12
|
Update of /cvsroot/gcblue/gcb_wx In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29922 Modified Files: GCblue.vcproj Log Message: Start of save to python feature Index: GCblue.vcproj =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/GCblue.vcproj,v retrieving revision 1.99 retrieving revision 1.100 diff -C2 -d -r1.99 -r1.100 *** GCblue.vcproj 16 Sep 2005 00:16:08 -0000 1.99 --- GCblue.vcproj 10 Dec 2005 16:52:02 -0000 1.100 *************** *** 421,424 **** --- 421,427 ---- </File> <File + RelativePath=".\src\scriptinterface\tcScenarioLogger.cpp"> + </File> + <File RelativePath="src\scriptinterface\tcSimPythonInterface.cpp"> </File> *************** *** 1439,1442 **** --- 1442,1448 ---- </File> <File + RelativePath=".\include\scriptinterface\tcScenarioLogger.h"> + </File> + <File RelativePath="include\scriptinterface\tcSimPythonInterface.h"> </File> |
Update of /cvsroot/gcblue/gcb_wx/include/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29922/include/sim Modified Files: commandlist.h tcAirfieldObject.h tcCarrierObject.h tcFlightOpsObject.h tcGameObjIterator.h tcGameObject.h tcSensorMap.h tcSimState.h Log Message: Start of save to python feature Index: tcSensorMap.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcSensorMap.h,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** tcSensorMap.h 1 Jun 2005 00:13:28 -0000 1.15 --- tcSensorMap.h 10 Dec 2005 16:52:02 -0000 1.16 *************** *** 101,104 **** --- 101,105 ---- tcAllianceSensorMap* GetOrCreateMap(UINT8 alliance); void CreateMapForAlliance(UINT8 anAlliance); + bool MapExists(UINT8 alliance) const; bool AddReport(const tcSensorReport& report, UINT8 anAlliance); Index: tcSimState.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcSimState.h,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** tcSimState.h 26 Jul 2005 00:37:03 -0000 1.43 --- tcSimState.h 10 Dec 2005 16:52:02 -0000 1.44 *************** *** 173,176 **** --- 173,177 ---- void RequestLaunch(long anKey,int anLauncher); void SaveTimeToStream(tcStream& stream); + void SaveToPython(const std::string& scenarioName); int Serialize(tcString scenname, bool mbLoad); void SetDateTime(DateZulu dz) {dateZulu = dz;} ///< Sets DateZulu object for environment date (sky, etc) Index: tcAirfieldObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcAirfieldObject.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** tcAirfieldObject.h 29 Apr 2005 18:52:02 -0000 1.3 --- tcAirfieldObject.h 10 Dec 2005 16:52:02 -0000 1.4 *************** *** 31,34 **** --- 31,39 ---- #include "tcFlightOpsObject.h" + namespace scriptinterface + { + class tcScenariologger; + } + class tcStream; class tcCommandStream; *************** *** 52,55 **** --- 57,61 ---- void LoadFromFile(tcFile& file); virtual void Serialize(tcFile& file, bool mbLoad); + virtual void SaveToPython(scriptinterface::tcScenarioLogger& logger); virtual void Update(double afStatusTime); Index: tcGameObjIterator.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcGameObjIterator.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** tcGameObjIterator.h 17 Aug 2004 02:22:56 -0000 1.3 --- tcGameObjIterator.h 10 Dec 2005 16:52:02 -0000 1.4 *************** *** 40,43 **** --- 40,44 ---- void Next(); bool NotDone(); + void SetAllianceFilter(unsigned alliance_); tcGameObjIterator(const tcGeoRect& filterRegion); *************** *** 54,57 **** --- 55,59 ---- unsigned nIterated; ///< count of elements iterated unsigned nSize; ///< size of list + unsigned allianceFilter; ///< filter by alliance if non-zero bool PassesFilter(const tcGameObject *obj); Index: tcGameObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcGameObject.h,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** tcGameObject.h 27 Nov 2005 22:21:28 -0000 1.42 --- tcGameObject.h 10 Dec 2005 16:52:02 -0000 1.43 *************** *** 48,51 **** --- 48,56 ---- } + namespace scriptinterface + { + class tcScenarioLogger; + } + class tcSimState; class tcStream; *************** *** 156,159 **** --- 161,165 ---- virtual void LoadFromFile(tcFile& file); virtual void Serialize(tcFile& file, bool mbLoad); + virtual void SaveToPython(scriptinterface::tcScenarioLogger& logger); virtual void Update(double afStatusTime) {} virtual void UpdateCaptivePosition(); Index: commandlist.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/commandlist.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** commandlist.h 27 Nov 2005 22:21:28 -0000 1.9 --- commandlist.h 10 Dec 2005 16:52:02 -0000 1.10 *************** *** 47,50 **** --- 47,51 ---- GC_SHOWBRIEFING, GC_SHOWMISSIONSTATUS, + GC_SAVEGAME, PC_GETNEWHEADING, PC_CHANGEHEADING, Index: tcFlightOpsObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcFlightOpsObject.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** tcFlightOpsObject.h 2 Jul 2005 16:51:09 -0000 1.7 --- tcFlightOpsObject.h 10 Dec 2005 16:52:02 -0000 1.8 *************** *** 43,46 **** --- 43,50 ---- class tcDatabase; } + namespace scriptinterface + { + class tcScenarioLogger; + } class tcTrack; *************** *** 75,78 **** --- 79,84 ---- virtual void UpdateLaunch(); + virtual void SaveToPython(scriptinterface::tcScenarioLogger& logger); + virtual tcCommandStream& operator<<(tcCommandStream& stream); virtual tcCreateStream& operator<<(tcCreateStream& stream); Index: tcCarrierObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcCarrierObject.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** tcCarrierObject.h 29 Apr 2005 18:52:02 -0000 1.12 --- tcCarrierObject.h 10 Dec 2005 16:52:02 -0000 1.13 *************** *** 33,36 **** --- 33,40 ---- class tcCreateStream; class tcUpdateStream; + namespace scriptinterface + { + class tcScenariologger; + } /** *************** *** 53,56 **** --- 57,61 ---- void LoadFromFile(tcFile& file); virtual void Serialize(tcFile& file, bool mbLoad); + virtual void SaveToPython(scriptinterface::tcScenarioLogger& logger); virtual void Update(double afStatusTime); |
|
From: Dewitt C. <ddc...@us...> - 2005-12-10 16:52:12
|
Update of /cvsroot/gcblue/gcb_wx/src/graphics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29922/src/graphics Modified Files: tcMapView.cpp tcPopupControl.cpp Log Message: Start of save to python feature Index: tcMapView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcMapView.cpp,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** tcMapView.cpp 8 Dec 2005 23:27:55 -0000 1.36 --- tcMapView.cpp 10 Dec 2005 16:52:03 -0000 1.37 *************** *** 1988,1992 **** long nMinID = GetClosest(pscreen); ! if (nMinID == -1) return -1; if (nMinID != currentHook) --- 1988,2001 ---- long nMinID = GetClosest(pscreen); ! /* added quick workaround so that hook can be cleared with two clicks ! ** that don't hook a new unit. Allows access to main popup menu ! */ ! static long lastMinID = 0; ! if ((nMinID == -1)&&(lastMinID != -1)) ! { ! lastMinID = nMinID; ! return -1; ! } ! lastMinID = nMinID; if (nMinID != currentHook) Index: tcPopupControl.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcPopupControl.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** tcPopupControl.cpp 10 Sep 2005 21:47:38 -0000 1.11 --- tcPopupControl.cpp 10 Dec 2005 16:52:03 -0000 1.12 *************** *** 86,89 **** --- 86,90 ---- mcGameMenu.AddItem("Show briefing", GC_SHOWBRIEFING); mcGameMenu.AddItem("Show mission status", GC_SHOWMISSIONSTATUS); + mcGameMenu.AddItem("Save game", GC_SAVEGAME); //mcGameMenu.EndSubMenu(); |
|
From: Dewitt C. <ddc...@us...> - 2005-12-10 16:52:12
|
Update of /cvsroot/gcblue/gcb_wx/include/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29922/include/common Modified Files: tcFile.h Log Message: Start of save to python feature Index: tcFile.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/common/tcFile.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** tcFile.h 8 Aug 2004 00:31:32 -0000 1.7 --- tcFile.h 10 Dec 2005 16:52:02 -0000 1.8 *************** *** 54,59 **** void WriteString(const char *azString); ! tcFile(void); ! virtual ~tcFile(void); private: FILE *mpFile; --- 54,60 ---- void WriteString(const char *azString); ! tcFile(); ! tcFile(const std::string& fileName); ! virtual ~tcFile(); private: FILE *mpFile; |
|
From: Dewitt C. <ddc...@us...> - 2005-12-10 16:52:12
|
Update of /cvsroot/gcblue/gcb_wx/src/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29922/src/sim Modified Files: Game.cpp tcAirfieldObject.cpp tcCarrierObject.cpp tcFlightOpsObject.cpp tcGameObjIterator.cpp tcGameObject.cpp tcSensorMap.cpp tcSimState.cpp Log Message: Start of save to python feature Index: tcSensorMap.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcSensorMap.cpp,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** tcSensorMap.cpp 10 Sep 2005 21:47:38 -0000 1.23 --- tcSensorMap.cpp 10 Dec 2005 16:52:03 -0000 1.24 *************** *** 449,452 **** --- 449,457 ---- } + bool tcSensorMap::MapExists(UINT8 alliance) const + { + return (maMapIdxForAlliance[alliance] != -1); + } + /** * Gets sensor map for alliance, creating if necessary Index: tcGameObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcGameObject.cpp,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** tcGameObject.cpp 27 Nov 2005 22:21:29 -0000 1.40 --- tcGameObject.cpp 10 Dec 2005 16:52:03 -0000 1.41 *************** *** 32,35 **** --- 32,36 ---- #include "tc3DModel.h" #include "tcSimState.h" + #include "tcScenarioLogger.h" #include "common/tcStream.h" #include "common/tcObjStream.h" *************** *** 714,717 **** --- 715,746 ---- } + void tcGameObject::SaveToPython(scriptinterface::tcScenarioLogger& logger) + { + wxString s; + + logger.AddScenarioText("unit = SM.GetDefaultUnit()"); + + s.Printf("unit.className = '%s'", mzClass.mz); + logger.AddScenarioText(s.c_str()); + + s.Printf("unit.unitName = '%s'", mzUnit.mz); + logger.AddScenarioText(s.c_str()); + + s.Printf("unit.SetPosition(%f, %f, %.1f)", C_180OVERPI*mcKin.mfLon_rad, + C_180OVERPI*mcKin.mfLat_rad, mcKin.mfAlt_m); + logger.AddScenarioText(s.c_str()); + + s.Printf("unit.heading = %.2f", C_180OVERPI*mcKin.mfHeading_rad); + logger.AddScenarioText(s.c_str()); + + s.Printf("unit.speed = %.1f", mcKin.mfSpeed_kts); + logger.AddScenarioText(s.c_str()); + + s.Printf("SM.AddUnitToAlliance(unit, %d)", GetAlliance()); + logger.AddScenarioText(s.c_str()); + + logger.AddScenarioText("UI = SM.GetUnitInterface(unit.unitName)"); + } + /** * Index: tcSimState.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcSimState.cpp,v retrieving revision 1.90 retrieving revision 1.91 diff -C2 -d -r1.90 -r1.91 *** tcSimState.cpp 27 Nov 2005 22:21:29 -0000 1.90 --- tcSimState.cpp 10 Dec 2005 16:52:03 -0000 1.91 *************** *** 32,35 **** --- 32,36 ---- #include "tcFile.h" #include "tcSimPythonInterface.h" + #include "tcScenarioInterface.h" #include "osg/Group" #include "tcCommandQueue.h" *************** *** 64,67 **** --- 65,69 ---- #include "tcPositionRegistry.h" #include "network/tcMultiplayerInterface.h" + #include "tcScenarioLogger.h" #ifdef _DEBUG *************** *** 2568,2571 **** --- 2570,2635 ---- /** + * Saves game state to python scenario file + */ + void tcSimState::SaveToPython(const std::string& scenarioName) + { + tcScenarioLogger logger(scenarioName); + + wxString s; + + std::vector<unsigned> alliances; + + // add CreateAlliance commands for alliances that exist in sensor map + for (unsigned alliance = 1; alliance <= 255; alliance++) + { + if (mcSensorMap.MapExists(alliance)) + { + alliances.push_back(alliance); + + s.Printf("SM.CreateAlliance(%d, 'add alliance title here')", alliance); + logger.AddScenarioText(s.c_str()); + } + } + + // time and date, offset previous scenario with sim time + s.Printf("SM.SetDateTime(%d,%d,%d,%d,%d,%d)", dateZulu.getYear(), dateZulu.getMonth(), + dateZulu.getDay(), dateZulu.getHour(), dateZulu.getMinute(), dateZulu.getSecond()); + logger.AddScenarioText(s.c_str()); + + tcGeoRect theater; + mpMapData->GetTheaterArea(theater); + float lon_deg = C_180OVERPI * theater.XCenter(); + float lat_deg = C_180OVERPI * theater.YCenter(); + s.Printf("SM.SetStartTheater(%f, %f) # (lon, lat) in degrees, negative is West or South", + lon_deg, lat_deg); + logger.AddScenarioText(s.c_str()); + logger.AddScenarioText("SM.SetScenarioLoaded(1)\n"); + + + + // save all entities to file, grouped by alliance + for (size_t k=0; k<alliances.size(); k++) + { + tcGameObjIterator iter; + iter.SetAllianceFilter(alliances[k]); + + logger.AddScenarioText("##############################"); + s.Printf("### Alliance %d units", alliances[k]); + logger.AddScenarioText(s.c_str()); + logger.AddScenarioText("##############################\n"); + + for (iter.First();iter.NotDone();iter.Next()) + { + tcGameObject *obj = iter.Get(); + obj->SaveToPython(logger); + logger.AddScenarioText(""); + } + } + + + logger.WriteAll(); + } + + /** * Saves sim time and date zulu to stream */ Index: tcFlightOpsObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcFlightOpsObject.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** tcFlightOpsObject.cpp 2 Jul 2005 16:51:12 -0000 1.12 --- tcFlightOpsObject.cpp 10 Dec 2005 16:52:03 -0000 1.13 *************** *** 2,7 **** ** @file tcFlightOpsObject.cpp */ ! /* ! ** Copyright (C) 2004 Dewitt Colclough (de...@tw...) ** All rights reserved. --- 2,6 ---- ** @file tcFlightOpsObject.cpp */ ! /* Copyright (C) 2004-2005 Dewitt Colclough (de...@gc...) ** All rights reserved. *************** *** 32,35 **** --- 31,35 ---- #include "tcDatabase.h" #include "tcLauncher.h" + #include "tcScenarioLogger.h" #include "common/tcStream.h" #include "common/tcObjStream.h" *************** *** 369,372 **** --- 369,390 ---- + void tcFlightOpsObject::SaveToPython(scriptinterface::tcScenarioLogger& logger) + { + wxString s; + unsigned nChildren = flight_deck.GetCount(); + + for (unsigned short k=0; k < nChildren; k++) + { + tcAirState* airState = flight_deck.GetAirState(k); + tcGameObject* obj = airState->obj; + wxASSERT(obj); + + s.Printf("SM.AddUnitToFlightDeck('%s', '%s', '%s', %d)", gameObj->mzUnit.mz, + obj->mzClass.mz, obj->mzUnit.mz, airState->current_location); + logger.AddScenarioText(s.c_str()); + } + + } + /** * Set up default spots and capacities for carrier flightport. Index: tcGameObjIterator.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcGameObjIterator.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** tcGameObjIterator.cpp 2 Nov 2004 04:23:56 -0000 1.5 --- tcGameObjIterator.cpp 10 Dec 2005 16:52:03 -0000 1.6 *************** *** 1,20 **** ! /** @file tcGameObjIterator.cpp */ ! /** ! * Copyright (C) 2003 Dewitt Colclough (de...@tw...) ! * All rights reserved. ! * ! * This file is part of the Global Conflict Blue (GCB) program. ! * GCB is free software; you can redistribute it and/or modify ! * it under the terms of version 2 of the GNU General Public License as ! * published by the Free Software Foundation. ! * ! * GCB is distributed in the hope that it will be useful, ! * but WITHOUT ANY WARRANTY; without even the implied warranty of ! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! * GNU General Public License for more details. ! * ! * You should have received a copy of the GNU General Public License ! * along with GCB; if not, write to the Free Software ! * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ --- 1,21 ---- ! /** ! ** @file tcGameObjIterator.cpp ! */ ! /* Copyright (C) 2003-2005 Dewitt Colclough (de...@gc...) ! ** All rights reserved. ! ! ** This file is part of the Global Conflict Blue (GCB) program. ! ** GCB is free software; you can redistribute it and/or modify ! ** it under the terms of version 2 of the GNU General Public License as ! ** published by the Free Software Foundation. ! ! ** GCB is distributed in the hope that it will be useful, ! ** but WITHOUT ANY WARRANTY; without even the implied warranty of ! ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! ** GNU General Public License for more details. ! ! ** You should have received a copy of the GNU General Public License ! ** along with GCB; if not, write to the Free Software ! ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ *************** *** 23,29 **** #ifndef WX_PRECOMP #include "wx/wx.h" - #ifdef WIN32 - #include "wx/msw/private.h" // for MS Windows specific definitions - #endif #endif --- 24,27 ---- *************** *** 96,99 **** --- 94,101 ---- } + void tcGameObjIterator::SetAllianceFilter(unsigned alliance) + { + allianceFilter = alliance; + } /** *************** *** 104,109 **** bool tcGameObjIterator::PassesFilter(const tcGameObject *obj) { - if (!useRegion) return true; if (obj == NULL) return false; return region.ContainsPoint(obj->mcKin.mfLon_rad, obj->mcKin.mfLat_rad); --- 106,113 ---- bool tcGameObjIterator::PassesFilter(const tcGameObject *obj) { if (obj == NULL) return false; + if ((allianceFilter != 0) && (obj->GetAlliance() != allianceFilter)) return false; + + if (!useRegion) return true; return region.ContainsPoint(obj->mcKin.mfLon_rad, obj->mcKin.mfLat_rad); *************** *** 112,115 **** --- 116,120 ---- tcGameObjIterator::tcGameObjIterator(const tcGeoRect& filterRegion) + : allianceFilter(0) { wxASSERT(simState); *************** *** 122,125 **** --- 127,131 ---- tcGameObjIterator::tcGameObjIterator() + : allianceFilter(0) { wxASSERT(simState); Index: Game.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/Game.cpp,v retrieving revision 1.142 retrieving revision 1.143 diff -C2 -d -r1.142 -r1.143 *** Game.cpp 27 Nov 2005 22:21:29 -0000 1.142 --- Game.cpp 10 Dec 2005 16:52:03 -0000 1.143 *************** *** 2464,2467 **** --- 2464,2471 ---- messageCenter->ActivateChannel("Mission"); } + else if (cmd_info.meCmd == GC_SAVEGAME) + { + simState->SaveToPython("scenarios//Saved"); + } else { Index: tcCarrierObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcCarrierObject.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** tcCarrierObject.cpp 29 Apr 2005 18:52:55 -0000 1.11 --- tcCarrierObject.cpp 10 Dec 2005 16:52:03 -0000 1.12 *************** *** 1,4 **** ! /* ! ** Copyright (C) 2003-2005 Dewitt Colclough (de...@tw...) ** All rights reserved. --- 1,6 ---- ! /** ! ** @file tcCarrierObject.cpp ! */ ! /* Copyright (C) 2003-2005 Dewitt Colclough (de...@gc...) ** All rights reserved. *************** *** 17,20 **** --- 19,23 ---- ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + #include "stdwx.h" *************** *** 30,33 **** --- 33,37 ---- #include "common/tcStream.h" #include "common/tcObjStream.h" + #include "tcScenarioLogger.h" #ifdef _DEBUG *************** *** 196,199 **** --- 200,210 ---- } + + void tcCarrierObject::SaveToPython(scriptinterface::tcScenarioLogger& logger) + { + tcGameObject::SaveToPython(logger); + tcFlightOpsObject::SaveToPython(logger); + } + /** * Index: tcAirfieldObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcAirfieldObject.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** tcAirfieldObject.cpp 11 Jun 2005 21:01:45 -0000 1.5 --- tcAirfieldObject.cpp 10 Dec 2005 16:52:03 -0000 1.6 *************** *** 1,6 **** ! /* @file tcAirfieldObject.cpp */ ! /* ! ** Copyright (C) 2004 Dewitt Colclough (de...@tw...) ** All rights reserved. --- 1,6 ---- ! /** ! ** @file tcAirfieldObject.cpp */ ! /* Copyright (C) 2004-2005 Dewitt Colclough (de...@gc...) ** All rights reserved. *************** *** 31,34 **** --- 31,35 ---- #include "common/tcStream.h" #include "common/tcObjStream.h" + #include "tcScenarioLogger.h" #ifdef _DEBUG *************** *** 194,197 **** --- 195,204 ---- } + void tcAirfieldObject::SaveToPython(scriptinterface::tcScenarioLogger& logger) + { + tcGameObject::SaveToPython(logger); + tcFlightOpsObject::SaveToPython(logger); + } + /** * Update method calls flightops update and updates that are not |
|
From: Dewitt C. <ddc...@us...> - 2005-12-08 23:28:08
|
Update of /cvsroot/gcblue/gcb_wx/src/ai In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29232/src/ai Modified Files: Nav.cpp Log Message: Index: Nav.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/ai/Nav.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Nav.cpp 27 Nov 2005 22:21:29 -0000 1.5 --- Nav.cpp 8 Dec 2005 23:27:55 -0000 1.6 *************** *** 126,129 **** --- 126,134 ---- } + unsigned Nav::GetCurrentWaypoint() const + { + return currentWaypoint; + } + bool Nav::GetLoopState() const { |
|
From: Dewitt C. <ddc...@us...> - 2005-12-08 23:28:08
|
Update of /cvsroot/gcblue/gcb_wx/src/scriptinterface In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29232/src/scriptinterface Modified Files: tcPlatformInterface.cpp tcPlatformInterfaceExtensionB.cpp Log Message: Index: tcPlatformInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcPlatformInterface.cpp,v retrieving revision 1.53 retrieving revision 1.54 diff -C2 -d -r1.53 -r1.54 *** tcPlatformInterface.cpp 27 Nov 2005 22:21:29 -0000 1.53 --- tcPlatformInterface.cpp 8 Dec 2005 23:27:55 -0000 1.54 *************** *** 807,810 **** --- 807,825 ---- } + unsigned int tcPlatformInterface::GetCurrentWaypoint() const + { + if (mpPlatformObj->IsClientMode()) return 0; + + ai::Brain* brain = mpPlatformObj->GetBrain(); + wxASSERT(brain); + + ai::Nav* nav = brain->GetNavTask(); + if (!nav) return 0; + wxASSERT(nav); + + return nav->GetCurrentWaypoint(); + + } + void tcPlatformInterface::SetNavLoopState(bool state) { Index: tcPlatformInterfaceExtensionB.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcPlatformInterfaceExtensionB.cpp,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** tcPlatformInterfaceExtensionB.cpp 27 Nov 2005 22:21:29 -0000 1.27 --- tcPlatformInterfaceExtensionB.cpp 8 Dec 2005 23:27:55 -0000 1.28 *************** *** 111,114 **** --- 111,115 ---- .def("AddNavWaypoint", &tcPlatformInterface::AddNavWaypoint) .def("EditNavWaypoint", &tcPlatformInterface::EditNavWaypoint) + .def("GetCurrentWaypoint", &tcPlatformInterface::GetCurrentWaypoint) .def("SetNavLoopState", &tcPlatformInterface::SetNavLoopState) .def("AddTask", &tcPlatformInterface::AddTask) |
|
From: Dewitt C. <ddc...@us...> - 2005-12-08 23:28:08
|
Update of /cvsroot/gcblue/gcb_wx/src/graphics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29232/src/graphics Modified Files: tcGameView.cpp tcMapView.cpp Log Message: Index: tcMapView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcMapView.cpp,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** tcMapView.cpp 27 Nov 2005 22:34:58 -0000 1.35 --- tcMapView.cpp 8 Dec 2005 23:27:55 -0000 1.36 *************** *** 2421,2425 **** wxString argString = wxString::Format(",%d,%f,%f", editPointIdx-1, geoPoint.x, geoPoint.y); ! mpCommandInterface->AddPythonCommandGeneral("EditWaypoint", argString.c_str(), hookedId); editPointIdx = -1; --- 2421,2425 ---- wxString argString = wxString::Format(",%d,%f,%f", editPointIdx-1, geoPoint.x, geoPoint.y); ! mpCommandInterface->AddPythonCommandGeneral("EditActiveWaypoint", argString.c_str(), hookedId); editPointIdx = -1; Index: tcGameView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcGameView.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** tcGameView.cpp 10 Sep 2005 21:47:38 -0000 1.15 --- tcGameView.cpp 8 Dec 2005 23:27:55 -0000 1.16 *************** *** 153,158 **** navpoints.push_back(pcurrent); // add current position } ! // copy waypoints ! for (size_t k=0; k<waypoints.size(); k++) { navpoints.push_back(waypoints[k]); --- 153,158 ---- navpoints.push_back(pcurrent); // add current position } ! // copy waypoints, starting with current waypoint (don't draw completed waypoints) ! for (size_t k=nav->GetCurrentWaypoint(); k<waypoints.size(); k++) { navpoints.push_back(waypoints[k]); |
|
From: Dewitt C. <ddc...@us...> - 2005-12-08 23:28:08
|
Update of /cvsroot/gcblue/gcb_wx/include/scriptinterface In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29232/include/scriptinterface Modified Files: tcPlatformInterface.h Log Message: Index: tcPlatformInterface.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/scriptinterface/tcPlatformInterface.h,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** tcPlatformInterface.h 27 Nov 2005 22:21:28 -0000 1.46 --- tcPlatformInterface.h 8 Dec 2005 23:27:55 -0000 1.47 *************** *** 246,249 **** --- 246,251 ---- /// edits existing navigation waypoint void EditNavWaypoint(size_t idx, float afLon_rad, float afLat_rad); + /// @return idx of current waypoint + unsigned int GetCurrentWaypoint() const; /// true to loop through waypoints indefinitely void SetNavLoopState(bool state); |
|
From: Dewitt C. <ddc...@us...> - 2005-12-08 23:28:07
|
Update of /cvsroot/gcblue/gcb_wx/include/ai In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29232/include/ai Modified Files: Nav.h Log Message: Index: Nav.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/ai/Nav.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Nav.h 27 Nov 2005 22:21:28 -0000 1.4 --- Nav.h 8 Dec 2005 23:27:54 -0000 1.5 *************** *** 55,58 **** --- 55,59 ---- void ClearWaypoints(); void EditWaypoint(size_t idx, double lon_rad, double lat_rad, float alt_m); + unsigned GetCurrentWaypoint() const; bool GetLoopState() const; const std::vector<GeoPoint>& GetWaypoints() const; |
|
From: Dewitt C. <ddc...@us...> - 2005-12-08 23:28:06
|
Update of /cvsroot/gcblue/gcb_wx/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29232/scripts Modified Files: UnitCommands.py Log Message: Index: UnitCommands.py =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/scripts/UnitCommands.py,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** UnitCommands.py 27 Nov 2005 22:21:29 -0000 1.23 --- UnitCommands.py 8 Dec 2005 23:27:55 -0000 1.24 *************** *** 81,87 **** --- 81,93 ---- UI.AddNavWaypoint(deg_to_rad*lon_deg, deg_to_rad*lat_deg) + def EditWaypoint(UI, idx, lon, lat): UI.EditNavWaypoint(idx, lon, lat) + # version with idx starting from current waypoint + def EditActiveWaypoint(UI, idx, lon, lat): + EditWaypoint(UI, idx + UI.GetCurrentWaypoint(), lon, lat) + + def AddPatrolOrderGroup(GI): unit_count = GI.GetUnitCount() |
|
From: Dewitt C. <ddc...@us...> - 2005-11-27 22:35:07
|
Update of /cvsroot/gcblue/gcb_wx/src/graphics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9407/src/graphics Modified Files: tcMapView.cpp Log Message: Index: tcMapView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcMapView.cpp,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** tcMapView.cpp 27 Nov 2005 22:21:29 -0000 1.34 --- tcMapView.cpp 27 Nov 2005 22:34:58 -0000 1.35 *************** *** 1971,1974 **** --- 1971,1975 ---- * Single-unit hook. * Hooks a single object closest to pscreen + * Modified so that hook is not cleared if no object is close to click point */ long tcTacticalMapView::Hook(wxPoint pscreen) *************** *** 1986,1989 **** --- 1987,1993 ---- long nMinID = GetClosest(pscreen); + + if (nMinID == -1) return -1; + if (nMinID != currentHook) { *************** *** 2072,2076 **** geoRegion.Set(northWest.x, southEast.x, northWest.y, southEast.y); ! hookedId.clear(); // add all friendly units within region --- 2076,2081 ---- geoRegion.Set(northWest.x, southEast.x, northWest.y, southEast.y); ! ! std::vector<long> newHooks; // add all friendly units within region *************** *** 2083,2091 **** if (pMO->meAffiliation == FRIENDLY) { ! hookedId.push_back(pMO->mnID); } } } long hookCount = GetHookCount(); wxCommandEvent command(wxEVT_COMMAND_BUTTON_CLICKED, ID_GROUPHOOK); --- 2088,2100 ---- if (pMO->meAffiliation == FRIENDLY) { ! newHooks.push_back(pMO->mnID); } } } + if (newHooks.size() == 0) return; + + hookedId = newHooks; + long hookCount = GetHookCount(); wxCommandEvent command(wxEVT_COMMAND_BUTTON_CLICKED, ID_GROUPHOOK); |
|
From: Dewitt C. <ddc...@us...> - 2005-11-27 22:35:06
|
Update of /cvsroot/gcblue/gcb_wx/docs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9407/docs Modified Files: CHANGES.txt Log Message: Index: CHANGES.txt =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/docs/CHANGES.txt,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** CHANGES.txt 27 Nov 2005 22:21:28 -0000 1.43 --- CHANGES.txt 27 Nov 2005 22:34:58 -0000 1.44 *************** *** 6,9 **** --- 6,10 ---- *** 2005-11-27 Dewitt Colclough *** + - Clicking in empty area no longer clears current hook - Added waypoint drag edit feature to gui. User can adjust waypoints on map screen by clicking and dragging |