gcblue-commits Mailing List for Global Conflict Blue (Page 34)
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-02-20 21:55:13
|
Update of /cvsroot/gcblue/gcb_wx/include/graphics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18469/include/graphics Modified Files: tc3DWindow.h tcGraphicsEngine.h tcMapView.h tcTerrainView.h Removed Files: tc2DGraphicsSurface.h tcWindow.h Log Message: Final GDI+ removal --- tcWindow.h DELETED --- --- tc2DGraphicsSurface.h DELETED --- Index: tc3DWindow.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/graphics/tc3DWindow.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** tc3DWindow.h 21 Dec 2004 02:26:17 -0000 1.12 --- tc3DWindow.h 20 Feb 2005 21:54:31 -0000 1.13 *************** *** 99,102 **** --- 99,109 ---- void DrawImageR(osg::Texture2D* texture, float x, float y, float width, float height, int alignMode = CENTER); + + void DrawZoomedImage(osg::Texture2D* texture, float x, float y, float width, float height, + const tcRect& r, int alignMode = CENTER); + + /// workaround method for inverted coordinates + void DrawZoomedImageR(osg::Texture2D* texture, float x, float y, float width, float height, + const tcRect& r, int alignMode = CENTER); void DrawLine(float x1, float y1, float x2, float y2, const osg::Vec4& color); *************** *** 175,180 **** wxRealPoint RelativeToScreen(float x, float y); ! bool GetBlend(); ! void SetBlend(bool blendingOn); int GetBaseRenderBin() const; virtual void SetBaseRenderBin(int n); --- 182,187 ---- wxRealPoint RelativeToScreen(float x, float y); ! bool GetBlend() const; ! void SetBlend(bool blend); int GetBaseRenderBin() const; virtual void SetBaseRenderBin(int n); *************** *** 219,223 **** /// @see tc3DWindow::OnSize view OnSize method code to see how this is used bool resizeable2DSurface; ! float fontSize; ///< default normal font size float fontSizeLarge; ///< default large font size --- 226,230 ---- /// @see tc3DWindow::OnSize view OnSize method code to see how this is used bool resizeable2DSurface; ! bool blendingOn; ///< true to enable alpha blending for window float fontSize; ///< default normal font size float fontSizeLarge; ///< default large font size Index: tcTerrainView.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/graphics/tcTerrainView.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** tcTerrainView.h 2 Oct 2004 22:41:32 -0000 1.1 --- tcTerrainView.h 20 Feb 2005 21:54:32 -0000 1.2 *************** *** 33,78 **** #endif #include "simmath.h" - #include "tcwindow.h" #include "tcMapData.h" class tcOptions; - class tcGraphicsEngine; namespace MapView { ! struct tsTerrainViewParameters ! { ! int mnSurfaceWidth; ! int mnSurfaceHeight; ! tcGeoRect mrectGeo; ! Gdiplus::RectF mrectDisplay; ! }; ! class tcTerrainView : public tcWindow ! { ! public: ! tcGeoRect mrectCurrentView; ! bool mbHighRes; ! void GetViewParameters(tsTerrainViewParameters& vp); ! void AttachMapData(tcMapData *apMapData) {mpMapData = apMapData;} ! void AttachOptions(tcOptions *pOptions) {mpOptions = pOptions;} ! int LoadHighResSurface(); ! int LoadLowResSurface(); ! void Minimize(); ! int RefreshSurfaces(); ///< reloads terrain data to map view ! int CreateSurfaces(tcGraphicsEngine* apGraphicsEngine); ! void SetActive(bool abActive); ! void SetView(tcGeoRect r); ! tcTerrainView(wxWindow *parent, const wxPoint& pos, const wxSize& size, bool isHighRes, const wxString& name = "TerrainView"); ! virtual ~tcTerrainView(); ! private: ! tcMapData *mpMapData; ! tcOptions *mpOptions; ! tcGeoRect mrectMap; // current borders of loaded map ! }; } --- 33,94 ---- #endif #include "simmath.h" #include "tcMapData.h" + #include "tc3DWindow.h" + #include <osg/ref_ptr> + + namespace osg + { + class Texture2D; + } + class tcOptions; namespace MapView { ! struct tsTerrainViewParameters ! { ! int mnSurfaceWidth; ! int mnSurfaceHeight; ! tcGeoRect mrectGeo; ! tcRect mrectDisplay; ! }; ! /** ! * Modified to use OSG. This constructs a textured image using map data and ! * uses it to draw a textured quad showing a color elevation map for the view ! * area. ! */ ! class tcTerrainView : public tc3DWindow ! { ! public: ! tcGeoRect mrectCurrentView; ! void Draw(); ! void GetViewParameters(tsTerrainViewParameters& vp); ! void AttachMapData(tcMapData *apMapData) {mpMapData = apMapData;} ! int LoadHighResSurface(); ! int LoadLowResSurface(); ! void Minimize(); ! int RefreshSurfaces(); ///< reloads terrain data to map view ! int CreateSurfaces(); ! void SetActive(bool abActive); ! void SetDisplayRegion(tcRect& r); ! void SetView(tcGeoRect r); ! ! tcTerrainView(wxWindow *parent, const wxPoint& pos, const wxSize& size, bool isHighRes, const wxString& name = "TerrainView"); ! ~tcTerrainView(); ! private: ! const bool highRes; ! tcMapData* mpMapData; ! tcOptions* mpOptions; ! tcGeoRect mrectMap; ///< current borders of loaded map ! tcRect displayRegion; ///< normalized coords [0, 1] to display on textured quad ! osg::ref_ptr<osg::Texture2D> mapImage; ! bool redraw; ///< true to redraw ! }; } Index: tcMapView.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/graphics/tcMapView.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** tcMapView.h 10 Jan 2005 00:30:20 -0000 1.11 --- tcMapView.h 20 Feb 2005 21:54:32 -0000 1.12 *************** *** 185,189 **** { mpOptions=apOptions; - terrainView->AttachOptions(apOptions); } void AttachCommandInterface(tcCommandQueue *apCommandInterface) {mpCommandInterface=apCommandInterface;} --- 185,188 ---- *************** *** 207,210 **** --- 206,210 ---- tcPoint ScreenToGeo(float x, float y); virtual void SetActive(bool abActive); ///< overrides base class + void SetBaseRenderBin(int n); void SetSize(const wxRect& rect); void SetView(tcPoint center, float afLonSpan); Index: tcGraphicsEngine.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/graphics/tcGraphicsEngine.h,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** tcGraphicsEngine.h 1 Nov 2004 03:17:16 -0000 1.14 --- tcGraphicsEngine.h 20 Feb 2005 21:54:32 -0000 1.15 *************** *** 40,60 **** #include <GL/glaux.h> // Header file for the GLaux library #include <string> - #include "tc2DGraphicsSurface.h" - // X3 3D code removed and replaced with OSG - #ifndef C_PIOVER180 - #define C_PIOVER180 0.017453293f - #endif - #define MAX_2D_SURFACES 32 - #define MAX_3D_SURFACES 8 - #define MAX_TEXTURES 10 - - namespace osg - { - class MatrixTransform; - } - - typedef tc2DGraphicsSurface* tp2DSurface; #if _MSC_VER > 1000 --- 40,45 ---- *************** *** 62,95 **** #endif // _MSC_VER > 1000 - struct tsLight - { - GLfloat maAmbient[4]; - GLfloat maDiffuse[4]; - GLfloat maSpecular[4]; - GLfloat maPosition[4]; - void SetAmbient(float R, float G, float B, float A) { - maAmbient[0]=R;maAmbient[1]=G;maAmbient[2]=B;maAmbient[3]=A;} - void SetDiffuse(float R, float G, float B, float A) { - maDiffuse[0]=R;maDiffuse[1]=G;maDiffuse[2]=B;maDiffuse[3]=A;} - void SetSpecular(float R, float G, float B, float A) { - maSpecular[0]=R;maSpecular[1]=G;maSpecular[2]=B;maSpecular[3]=A;} - void SetPosition(float x1, float x2, float x3, float x4) { - maPosition[0]=x1;maPosition[1]=x2;maPosition[2]=x3;maPosition[3]=x4;} - }; - - struct tsBmp32 - { - int mnWidth; - int mnHeight; - UINT32 *mpPixels; - }; - - - struct tsGraphicsEngineInfo - { - bool mbTexture; // use texture mapping - bool mbWireFrame; - }; /** --- 47,51 ---- *************** *** 101,110 **** { public: - - bool Create2DSurface(tc2DGraphicsSurface*& rp2DSurface); - bool CreatePixelMaps(); - bool Delete2DSurface(tc2DGraphicsSurface* ap2DSurface); - void DeleteAllSurfaces(); static tcGraphicsEngine * Get(); ///< method to access singleton instance std::string GetDriverInfo(); bool Is3DCapable(); --- 57,62 ---- { public: static tcGraphicsEngine * Get(); ///< method to access singleton instance + std::string GetDriverInfo(); bool Is3DCapable(); *************** *** 112,164 **** void LogGLInfo(); void LogPixelFormats(); - bool MoveSurfaceToTop(tc2DGraphicsSurface* ap2DSurface); - bool RenderAll(); - void ToggleBlending() {mbBlend = !mbBlend;} - void ToggleTexture2D() {mbTexture2D = !mbTexture2D;} - void TogglePerspective2D() {mbPerspective2D = !mbPerspective2D;} - void ToggleWireFrame() {mbWireFrame = !mbWireFrame;} - - void GetInfo(tsGraphicsEngineInfo& asGI); - private: bool mbInitialized; - tp2DSurface ma2D[MAX_2D_SURFACES]; - unsigned mn2D; int mnWindowWidth; int mnWindowHeight; char mzTexturePath[255]; - bool mbLight; // lighting for 3D surfaces - bool mbBlend; // alpha blending for 3D surfaces - bool mbBorder; - bool mbTexture; // use texture mapping - bool mbTexture2D; // use texture mapped quads to render 2D surface - bool mbPerspective2D; // use perspective view for Texture2D - bool mbWireFrame; - bool mbMipMapTextures; - bool mbBlendTransitions; - - enum _graphicsmode - { - MODE_NONE, - MODE_2D, - MODE_TEXTURE2D - } meGraphicsMode; void CheckGLError(const char* location = 0); ! void ConfigureFor2D(); ! void ConfigureForTexture2D(); ! ! AUX_RGBImageRec* LoadBmp(char *szFileName); ! void Render2D(unsigned anSurface); // glDrawPixels rendering of 2D surface ! void RenderTexture2D(unsigned anSurface); // texture mapped rendering of 2D surface ! void ExtractTile(UINT32 *apTile, tsBmp32 asBmp, unsigned anTileSize, int anStartRow, int anStartCol); ! void Load2DSurfaceTextures(int anSurface); ! tcGraphicsEngine(); tcGraphicsEngine(const tcGraphicsEngine& src); ! virtual ~tcGraphicsEngine(); ! }; --- 64,80 ---- void LogGLInfo(); void LogPixelFormats(); private: bool mbInitialized; int mnWindowWidth; int mnWindowHeight; char mzTexturePath[255]; void CheckGLError(const char* location = 0); ! tcGraphicsEngine(); tcGraphicsEngine(const tcGraphicsEngine& src); ! ~tcGraphicsEngine(); }; |
|
From: Dewitt C. <ddc...@us...> - 2005-02-20 21:55:12
|
Update of /cvsroot/gcblue/gcb_wx/include/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18469/include/sim Modified Files: Game.h gcb.h tcMapData.h Removed Files: tcCustomControl.h tcEditControl.h Log Message: Final GDI+ removal Index: Game.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/Game.h,v retrieving revision 1.53 retrieving revision 1.54 diff -C2 -d -r1.53 -r1.54 *** Game.h 10 Jan 2005 00:30:20 -0000 1.53 --- Game.h 20 Feb 2005 21:54:32 -0000 1.54 *************** *** 24,28 **** --- 24,32 ---- #include "wx/wx.h" + + #ifdef WIN32 #include "wx/msw/private.h" // for MS Windows specific definitions + #endif + #include "wx/glcanvas.h" #include "wx/datetime.h" *************** *** 40,44 **** #include "tcObjectControl.h" #include "tcGraphicsEngine.h" - #include "tcEditControl.h" #include "tcTime.h" #include "tcStartView.h" --- 44,47 ---- *************** *** 153,157 **** tcTacticalMapView* tacticalMap; ///< tactical map object tcWorldMapView* worldMap; ///< world map object ! tcEditControl* editControl; tcOptionsView* optionsView; tcHookInfo* hookInfo; ///< window displaying info on hooked object --- 156,160 ---- tcTacticalMapView* tacticalMap; ///< tactical map object tcWorldMapView* worldMap; ///< world map object ! //tcEditControl* editControl; tcOptionsView* optionsView; tcHookInfo* hookInfo; ///< window displaying info on hooked object --- tcEditControl.h DELETED --- Index: tcMapData.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcMapData.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** tcMapData.h 24 Jun 2004 21:35:40 -0000 1.8 --- tcMapData.h 20 Feb 2005 21:54:32 -0000 1.9 *************** *** 5,10 **** ** Documentation http://www.ngdc.noaa.gov/seg/topo/report/ ** Georeferencing info: http://www.ngdc.noaa.gov/seg/topo/report/s5/s5Biii.html ! ** ! ** Copyright (C) 2003-2004 Dewitt Colclough (de...@tw...) ** All rights reserved. --- 5,10 ---- ** Documentation http://www.ngdc.noaa.gov/seg/topo/report/ ** Georeferencing info: http://www.ngdc.noaa.gov/seg/topo/report/s5/s5Biii.html ! */ ! /* Copyright (C) 2003-2004 Dewitt Colclough (de...@tw...) ** All rights reserved. *************** *** 25,33 **** ! #if !defined _TCMAPDATA_H_ #define _TCMAPDATA_H_ #include "wx/wx.h" ! #include "wx/msw/private.h" // for MS Windows specific definitions #include "simmath.h" #include "tcOptions.h" --- 25,37 ---- ! #ifndef _TCMAPDATA_H_ #define _TCMAPDATA_H_ #include "wx/wx.h" ! ! #ifdef WIN32 ! #include "wx/msw/private.h" //for MS Windows specific definitions ! #endif ! #include "simmath.h" #include "tcOptions.h" *************** *** 50,55 **** #define M_TILE 60 #define N_TILE 60 - //#define M_DEMTILE 1200 - //#define N_DEMTILE 1200 #define NULL_TILE 0xFFFF #define TILE_AGEOUT (double)30.0 --- 54,57 ---- *************** *** 113,118 **** void CreateHighResMapImage(int anMode, UINT32 *apData); void CreateMapImage(int anMode, int anMapID, UINT32 *apData); ! float GetHRLatSpan(void) {return 0.5f*mrTheaterView.Height();} ! float GetHRLonSpan(void) {return 0.5f*mrTheaterView.Width();} void GetMapDataInfo(tsMapDataInfo *pMDI); tsGeoPoint GetRandomPointNear(float lon, float lat, float r, --- 115,120 ---- void CreateHighResMapImage(int anMode, UINT32 *apData); void CreateMapImage(int anMode, int anMapID, UINT32 *apData); ! float GetHRLatSpan() {return 0.5f*mrTheaterView.Height();} ! float GetHRLonSpan() {return 0.5f*mrTheaterView.Width();} void GetMapDataInfo(tsMapDataInfo *pMDI); tsGeoPoint GetRandomPointNear(float lon, float lat, float r, *************** *** 137,141 **** unsigned anWidth, unsigned anHeight); tcMapData(); ! virtual ~tcMapData(); private: tcOptions *mpOptions; --- 139,143 ---- unsigned anWidth, unsigned anHeight); tcMapData(); ! ~tcMapData(); private: tcOptions *mpOptions; --- tcCustomControl.h DELETED --- Index: gcb.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/gcb.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** gcb.h 8 Aug 2004 00:31:33 -0000 1.7 --- gcb.h 20 Feb 2005 21:54:32 -0000 1.8 *************** *** 21,29 **** */ ! #if !defined _GCB_H_ #define _GCB_H_ #include "wx/wx.h" #include "wx/msw/private.h" // for MS Windows specific definitions class tcGame; --- 21,32 ---- */ ! #ifndef _GCB_H_ #define _GCB_H_ #include "wx/wx.h" + + #ifdef WIN32 #include "wx/msw/private.h" // for MS Windows specific definitions + #endif class tcGame; *************** *** 45,49 **** private: - ULONG_PTR mgdiplusToken; ///< for GDI+ WXMSG *current_msg; tcGame *gameFrame; ///< main game frame object with game loop, holds all subwindows --- 48,51 ---- *************** *** 55,59 **** bool OnInit(); void SetWorkingDirectory(); ///< sets working directory to level above bin/ dir if necessary - void InitializeGdiPlus(); void InitializeGameFrame(); --- 57,60 ---- |
|
From: Dewitt C. <ddc...@us...> - 2005-02-20 21:55:11
|
Update of /cvsroot/gcblue/gcb_wx/src/ai In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18469/src/ai Modified Files: Brain.cpp Log Message: Final GDI+ removal Index: Brain.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/ai/Brain.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Brain.cpp 20 Feb 2005 18:20:19 -0000 1.3 --- Brain.cpp 20 Feb 2005 21:54:32 -0000 1.4 *************** *** 72,77 **** std::vector<std::string> taskList; ! std::map<std::string, Task*>::iterator iter = taskMap.begin(); ! std::map<std::string, Task*>::iterator& done = taskMap.end(); for (;iter != done; ++iter) { --- 72,77 ---- std::vector<std::string> taskList; ! std::map<std::string, Task*>::const_iterator iter = taskMap.begin(); ! std::map<std::string, Task*>::const_iterator& done = taskMap.end(); for (;iter != done; ++iter) { *************** *** 167,170 **** --- 167,177 ---- Brain::~Brain() { + for (std::map<std::string, Task*>::iterator iter = + taskMap.begin(); iter != taskMap.end(); ) + { + delete iter->second; + taskMap.erase(iter++); + } + taskMap.clear(); } |
|
From: Dewitt C. <ddc...@us...> - 2005-02-20 21:55:10
|
Update of /cvsroot/gcblue/gcb_wx In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18469 Modified Files: GCblue.vcproj Log Message: Final GDI+ removal Index: GCblue.vcproj =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/GCblue.vcproj,v retrieving revision 1.82 retrieving revision 1.83 diff -C2 -d -r1.82 -r1.83 *** GCblue.vcproj 18 Feb 2005 17:42:24 -0000 1.82 --- GCblue.vcproj 20 Feb 2005 21:54:31 -0000 1.83 *************** *** 39,43 **** Name="VCLinkerTool" IgnoreImportLibrary="FALSE" ! AdditionalDependencies="python23.lib boost_python_debug.lib winmm.lib opengl32.lib glu32.lib Gdiplus.lib GLaux.lib wrap_oald.lib ALutd.lib comctl32.lib rpcrt4.lib wsock32.lib wxmswd.lib zlibd.lib pngd.lib jpegd.lib tiffd.lib osgd.lib osgDBd.lib osgParticled.lib osgTextd.lib osgUtild.lib DemeterDebug.lib DemeterOSGDebug.lib ogg_static_d.lib vorbis_static_d.lib vorbisfile_static_d.lib sqlite.lib osgALd.lib oalppd.lib" ShowProgress="0" OutputFile="$(ProjectDir)/bin/GCblueD.exe" --- 39,43 ---- Name="VCLinkerTool" IgnoreImportLibrary="FALSE" ! AdditionalDependencies="python23.lib boost_python_debug.lib winmm.lib opengl32.lib glu32.lib GLaux.lib wrap_oald.lib ALutd.lib comctl32.lib rpcrt4.lib wsock32.lib wxmswd.lib zlibd.lib pngd.lib jpegd.lib tiffd.lib osgd.lib osgDBd.lib osgParticled.lib osgTextd.lib osgUtild.lib DemeterDebug.lib DemeterOSGDebug.lib ogg_static_d.lib vorbis_static_d.lib vorbisfile_static_d.lib sqlite.lib osgALd.lib oalppd.lib" ShowProgress="0" OutputFile="$(ProjectDir)/bin/GCblueD.exe" *************** *** 105,109 **** <Tool Name="VCLinkerTool" ! AdditionalDependencies="boost_python.lib python23.lib winmm.LIB opengl32.lib glu32.lib Gdiplus.lib GLaux.lib wrap_oal.lib ALut.lib comctl32.lib rpcrt4.lib wsock32.lib wxmsw.lib png.lib zlib.lib jpeg.lib tiff.lib osg.lib osgDB.lib osgParticle.lib osgUtil.lib osgText.lib Demeter.lib DemeterOSG.lib ogg_static.lib vorbis_static.lib vorbisfile_static.lib sqlite.lib OpenThreadsWin32.lib osgAL.lib oalpp.lib" OutputFile="$(ProjectDir)/bin/$(ProjectName).exe" LinkIncremental="1" --- 105,109 ---- <Tool Name="VCLinkerTool" ! AdditionalDependencies="boost_python.lib python23.lib winmm.LIB opengl32.lib glu32.lib GLaux.lib wrap_oal.lib ALut.lib comctl32.lib rpcrt4.lib wsock32.lib wxmsw.lib png.lib zlib.lib jpeg.lib tiff.lib osg.lib osgDB.lib osgParticle.lib osgUtil.lib osgText.lib Demeter.lib DemeterOSG.lib ogg_static.lib vorbis_static.lib vorbisfile_static.lib sqlite.lib OpenThreadsWin32.lib osgAL.lib oalpp.lib" OutputFile="$(ProjectDir)/bin/$(ProjectName).exe" LinkIncremental="1" *************** *** 173,179 **** </File> <File - RelativePath="src\common\tcConsole.cpp"> - </File> - <File RelativePath="src\common\tcFile.cpp"> </File> --- 173,176 ---- *************** *** 231,243 **** </File> <File - RelativePath="src\graphics\extgl.c"> - <FileConfiguration - Name="Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - UsePrecompiledHeader="0"/> - </FileConfiguration> - </File> - <File RelativePath="src\graphics\ObjectUpdater.cpp"> </File> --- 228,231 ---- *************** *** 246,252 **** </File> <File - RelativePath="src\graphics\tc2DGraphicsSurface.cpp"> - </File> - <File RelativePath="src\graphics\tc3DModel.cpp"> </File> --- 234,237 ---- *************** *** 369,375 **** </File> <File - RelativePath=".\src\graphics\tcWindow.cpp"> - </File> - <File RelativePath=".\src\graphics\tcXmlWindow.cpp"> </File> --- 354,357 ---- *************** *** 449,455 **** </File> <File - RelativePath="src\sim\tcCustomControl.cpp"> - </File> - <File RelativePath=".\src\sim\tcDemTileReader.cpp"> </File> --- 431,434 ---- *************** *** 461,467 **** </File> <File - RelativePath="src\sim\tcEditControl.cpp"> - </File> - <File RelativePath="src\sim\tcEngagementData.cpp"> </File> --- 440,443 ---- *************** *** 1137,1143 **** </File> <File - RelativePath="include\common\tcConsole.h"> - </File> - <File RelativePath="include\common\tcFile.h"> </File> --- 1113,1116 ---- *************** *** 1201,1207 **** </File> <File - RelativePath="include\graphics\tc2DGraphicsSurface.h"> - </File> - <File RelativePath="include\graphics\tc3DModel.h"> </File> --- 1174,1177 ---- *************** *** 1315,1321 **** </File> <File - RelativePath=".\include\graphics\tcWindow.h"> - </File> - <File RelativePath=".\include\graphics\tcXmlWindow.h"> </File> --- 1285,1288 ---- *************** *** 1395,1401 **** </File> <File - RelativePath="include\sim\tcCustomControl.h"> - </File> - <File RelativePath=".\include\sim\tcDemTileReader.h"> </File> --- 1362,1365 ---- *************** *** 1407,1413 **** </File> <File - RelativePath="include\sim\tcEditControl.h"> - </File> - <File RelativePath="include\sim\tcEngagementData.h"> </File> --- 1371,1374 ---- |
|
From: Dewitt C. <ddc...@us...> - 2005-02-20 21:54:46
|
Update of /cvsroot/gcblue/gcb_wx/src/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18469/src/common Removed Files: tcButtonBar.cpp tcConsole.cpp Log Message: Final GDI+ removal --- tcConsole.cpp DELETED --- --- tcButtonBar.cpp DELETED --- |
|
From: Dewitt C. <ddc...@us...> - 2005-02-20 21:54:45
|
Update of /cvsroot/gcblue/gcb_wx/include/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18469/include/common Removed Files: DConsole.h tcButtonBar.h tcConsole.h Log Message: Final GDI+ removal --- DConsole.h DELETED --- --- tcButtonBar.h DELETED --- --- tcConsole.h DELETED --- |
|
From: Dewitt C. <ddc...@us...> - 2005-02-20 18:20:58
|
Update of /cvsroot/gcblue/gcb_wx/include/scriptinterface In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23561/include/scriptinterface Modified Files: tcPlatformInterface.h Log Message: Parallel ai update Index: tcPlatformInterface.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/scriptinterface/tcPlatformInterface.h,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** tcPlatformInterface.h 18 Feb 2005 17:41:36 -0000 1.32 --- tcPlatformInterface.h 20 Feb 2005 18:20:18 -0000 1.33 *************** *** 184,190 **** // target commands /// set target for platform ! void SetTarget(long anID) {mpPlatformObj->DesignateTarget(anID);} /// get platform target, -1 for no target ! long GetTarget() {return mpPlatformObj->mcAI.GetTarget();} /// get range to target in km float GetRangeToTarget(); --- 184,190 ---- // target commands /// set target for platform ! void SetTarget(long anID); /// get platform target, -1 for no target ! long GetTarget(); /// get range to target in km float GetRangeToTarget(); |
|
From: Dewitt C. <ddc...@us...> - 2005-02-20 18:20:58
|
Update of /cvsroot/gcblue/gcb_wx/include/ai In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23561/include/ai Modified Files: BlackboardInterface.h Brain.h Log Message: Parallel ai update Index: Brain.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/ai/Brain.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Brain.h 16 Feb 2005 23:13:38 -0000 1.3 --- Brain.h 20 Feb 2005 18:20:18 -0000 1.4 *************** *** 56,62 **** --- 56,67 ---- }; void AddTask(const std::string& taskName, double priority_); + std::vector<std::string> GetTaskList(); + double GetTaskPriority(const std::string& taskName) const; void RemoveTask(const std::string& taskName); bool TaskExists(const std::string& taskName); + long GetTarget() const; + void SetTarget(long target_); + void Update(double t); *************** *** 68,72 **** long nextId; ///< id assigned to next task double lastUpdateTime; ///< last time tasks were updated ! Blackboard board; ///< for inter-task communication std::map<std::string, Task*> taskMap; --- 73,78 ---- long nextId; ///< id assigned to next task double lastUpdateTime; ///< last time tasks were updated ! long target; ///< id of target (may be more general way to handle this) ! Blackboard board; ///< for inter-task communication std::map<std::string, Task*> taskMap; Index: BlackboardInterface.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/ai/BlackboardInterface.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** BlackboardInterface.h 16 Feb 2005 23:13:38 -0000 1.1 --- BlackboardInterface.h 20 Feb 2005 18:20:18 -0000 1.2 *************** *** 49,52 **** --- 49,53 ---- BlackboardInterface GetBlackboardInterface(); long GetAuthor() const; + double GetPriority() const; /// blackboard interface |
|
From: Dewitt C. <ddc...@us...> - 2005-02-20 18:20:31
|
Update of /cvsroot/gcblue/gcb_wx/src/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23561/src/sim Modified Files: tcObjectControl.cpp tcPlatformObject.cpp Log Message: Parallel ai update Index: tcPlatformObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcPlatformObject.cpp,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** tcPlatformObject.cpp 18 Feb 2005 17:41:51 -0000 1.36 --- tcPlatformObject.cpp 20 Feb 2005 18:20:20 -0000 1.37 *************** *** 79,83 **** void tcPlatformObject::DesignateTarget(long anID) { ! mcAI.SetTarget(anID); unsigned nLaunchers = mcLauncherState.GetLauncherCount(); for (size_t n=0; n<nLaunchers; n++) --- 79,83 ---- void tcPlatformObject::DesignateTarget(long anID) { ! brain->SetTarget(anID); unsigned nLaunchers = mcLauncherState.GetLauncherCount(); for (size_t n=0; n<nLaunchers; n++) *************** *** 415,419 **** wxASSERT(id >= 0); ! return mcAI.GetTarget() == id; } --- 415,419 ---- wxASSERT(id >= 0); ! return brain->GetTarget() == id; } Index: tcObjectControl.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcObjectControl.cpp,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** tcObjectControl.cpp 27 Jan 2005 01:01:55 -0000 1.30 --- tcObjectControl.cpp 20 Feb 2005 18:20:20 -0000 1.31 *************** *** 46,49 **** --- 46,50 ---- #include "tcLauncherPopup.h" #include "tcCommandQueue.h" + #include "ai/Brain.h" #include <osg/Geometry> *************** *** 65,69 **** const float fontSize = 12.0f; ! if (mpAIData == NULL) {return;} wxASSERT(context); --- 66,70 ---- const float fontSize = 12.0f; ! if (!brain) return; wxASSERT(context); *************** *** 78,82 **** texty += 15.0f; ! long nTargetID = mpAIData->GetTarget(); if (nTargetID != NULL_INDEX) { --- 79,83 ---- texty += 15.0f; ! long nTargetID = brain->GetTarget(); if (nTargetID != NULL_INDEX) { *************** *** 94,121 **** texty += 15.0f; ! int nOrders = mpAIData->GetOrderCount(); ! if (nOrders > 0) { ! int nCurrentOrder = mpAIData->GetCurrentOrderIdx(); ! int n = 0; ! while ((n < nOrders) && (texty < 200.0f)) { ! if (n == nCurrentOrder) ! { ! color.set(0.8f, 1.0f, 0.8f, 1.0f); ! } ! else ! { ! color.set(0.4f, 0.5f, 0.4f, 1.0f); ! } tcOrder order; ! mpAIData->GetOrder(order ,n); ! sprintf(zBuff, "%d %s", n, order.mstrOrdername.c_str()); ! context->DrawTextR(order.mstrOrdername.c_str(), textx, texty, font, color, fontSize, LEFT_BASE_LINE); ! texty += 10.0f; n++; } --- 95,117 ---- texty += 15.0f; ! std::vector<std::string> taskList = brain->GetTaskList(); ! size_t nTasks = taskList.size(); ! ! if (nTasks > 0) { ! size_t n = 0; ! while ((n < nTasks) && (texty < 200.0f)) { ! color.set(0.8f, 1.0f, 0.8f, 1.0f); tcOrder order; ! ! double priority = brain->GetTaskPriority(taskList[n]); ! sprintf(zBuff, "%s %.0f", taskList[n].c_str(), priority); ! context->DrawTextR(zBuff, textx, texty, font, color, fontSize, LEFT_BASE_LINE); ! texty += 12.0f; n++; } *************** *** 124,128 **** { color.set(0.4f, 0.5f, 0.4f, 1.0f); ! context->DrawTextR("No orders", textx, texty, font, color, fontSize, LEFT_BASE_LINE); texty += 10.0f; --- 120,124 ---- { color.set(0.4f, 0.5f, 0.4f, 1.0f); ! context->DrawTextR("No tasks", textx, texty, font, color, fontSize, LEFT_BASE_LINE); texty += 10.0f; *************** *** 136,140 **** tcAIPanel::tcAIPanel() : ! mpAIData(0), mzCaption("ORDERS STATUS") { --- 132,136 ---- tcAIPanel::tcAIPanel() : ! brain(0), mzCaption("ORDERS STATUS") { *************** *** 480,490 **** ftexty += 12; - /*** mnClassID, mnModelType, mnType (classification) ***/ - /* - GetObjectInfo(s ,mpHookedGameObj->mpDBObject, mpHookedGameObj); - DrawTextR(s.GetBuffer(), ftextx, ftexty, - defaultFont.get(), color, fontSize, LEFT_BASE_LINE); - ftexty += 12; - */ /*** speed, heading, altitude, terrain info ***/ --- 476,479 ---- *************** *** 1609,1619 **** { tcPlatformObject *pPlatformObj = dynamic_cast<tcPlatformObject*> (mpHookedGameObj); ! if (pPlatformObj != NULL) { ! mcAIPanel.SetAIData(&pPlatformObj->mcAI); } else { ! mcAIPanel.SetAIData(NULL); } } --- 1598,1608 ---- { tcPlatformObject *pPlatformObj = dynamic_cast<tcPlatformObject*> (mpHookedGameObj); ! if (pPlatformObj) { ! mcAIPanel.SetAIData(pPlatformObj->GetBrain()); } else { ! mcAIPanel.SetAIData(0); } } |
|
From: Dewitt C. <ddc...@us...> - 2005-02-20 18:20:30
|
Update of /cvsroot/gcblue/gcb_wx/include/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23561/include/sim Modified Files: tcAIData.h tcObjectControl.h Log Message: Parallel ai update Index: tcAIData.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcAIData.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** tcAIData.h 17 Aug 2004 02:22:56 -0000 1.8 --- tcAIData.h 20 Feb 2005 18:20:18 -0000 1.9 *************** *** 64,68 **** UINT32 mnScriptVar[N_VAR]; ///< variables for use in scripts ! long mnTargetID; ///< target for AI engagements double mfNextUpdate; ///< time for next update of AI float mfUpdateInterval; ///< interval for AI updates --- 64,68 ---- UINT32 mnScriptVar[N_VAR]; ///< variables for use in scripts ! double mfNextUpdate; ///< time for next update of AI float mfUpdateInterval; ///< interval for AI updates *************** *** 97,100 **** --- 97,103 ---- virtual ~tcAIData(void); + private: + long mnTargetID; ///< target for AI engagements + }; Index: tcObjectControl.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcObjectControl.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** tcObjectControl.h 11 Dec 2004 01:09:05 -0000 1.12 --- tcObjectControl.h 20 Feb 2005 18:20:18 -0000 1.13 *************** *** 57,67 **** } ! namespace AI { ! class tcAIData; } ! using namespace AI; ! using namespace Database; struct tsHeadingObjectInfo --- 57,68 ---- } ! namespace ai { ! class Brain; } ! using ai::Brain; ! using Database::tcDatabaseObject; ! struct tsHeadingObjectInfo *************** *** 101,105 **** std::string mzCaption; ! void SetAIData(tcAIData *apAIData) {mpAIData = apAIData;} void SetLocation(tcRect rect) {window = rect;} void Draw(tc3DWindow* context); --- 102,106 ---- std::string mzCaption; ! void SetAIData(Brain* brain_) {brain = brain_;} void SetLocation(tcRect rect) {window = rect;} void Draw(tc3DWindow* context); *************** *** 107,111 **** ~tcAIPanel(); private: ! tcAIData* mpAIData; }; --- 108,112 ---- ~tcAIPanel(); private: ! Brain* brain; }; |
|
From: Dewitt C. <ddc...@us...> - 2005-02-20 18:20:30
|
Update of /cvsroot/gcblue/gcb_wx/src/ai In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23561/src/ai Modified Files: BlackboardInterface.cpp Brain.cpp Log Message: Parallel ai update Index: BlackboardInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/ai/BlackboardInterface.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** BlackboardInterface.cpp 16 Feb 2005 23:13:49 -0000 1.1 --- BlackboardInterface.cpp 20 Feb 2005 18:20:19 -0000 1.2 *************** *** 79,82 **** --- 79,87 ---- } + double BlackboardInterface::GetPriority() const + { + return priority; + } + void BlackboardInterface::SetPriority(double priority_) Index: Brain.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/ai/Brain.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Brain.cpp 16 Feb 2005 23:13:49 -0000 1.2 --- Brain.cpp 20 Feb 2005 18:20:19 -0000 1.3 *************** *** 49,52 **** --- 49,102 ---- } + /** + * @return target id for platform + */ + long Brain::GetTarget() const + { + return target; + } + + /** + * Set target id for platform + */ + void Brain::SetTarget(long target_) + { + target = target_; + } + + /** + * @return list of task names + */ + std::vector<std::string> Brain::GetTaskList() + { + std::vector<std::string> taskList; + + std::map<std::string, Task*>::iterator iter = taskMap.begin(); + std::map<std::string, Task*>::iterator& done = taskMap.end(); + for (;iter != done; ++iter) + { + taskList.push_back(iter->first); + } + + return taskList; + } + + /** + * @return priority of task or -1.0 if not found + */ + double Brain::GetTaskPriority(const std::string& taskName) const + { + std::map<std::string, Task*>::const_iterator iter = taskMap.find(taskName); + if (iter != taskMap.end()) + { + wxASSERT(iter->second); + return iter->second->GetPriority(); + } + else + { + return -1.0; + } + } + void Brain::AddTask(const std::string& taskName, double priority_) { *************** *** 105,109 **** : platform(platform_), updateInterval(0.125f), ! nextId(0) { wxASSERT(platform); --- 155,160 ---- : platform(platform_), updateInterval(0.125f), ! nextId(0), ! target(-1) { wxASSERT(platform); |
|
From: Dewitt C. <ddc...@us...> - 2005-02-20 18:20:30
|
Update of /cvsroot/gcblue/gcb_wx/src/graphics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23561/src/graphics Modified Files: tcGameView.cpp Log Message: Parallel ai update Index: tcGameView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcGameView.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** tcGameView.cpp 2 Nov 2004 04:23:56 -0000 1.3 --- tcGameView.cpp 20 Feb 2005 18:20:19 -0000 1.4 *************** *** 37,40 **** --- 37,41 ---- #include "tcObjectControl.h" // to pass range circle, etc. symbols to map #include "tcMissileObject.h" + #include "ai/Brain.h" #ifdef _DEBUG *************** *** 481,485 **** if (pPlatformObj != NULL) { ! tnPoolIndex nTarget = pPlatformObj->mcAI.GetTarget(); if (nTarget != NULL_INDEX) { --- 482,486 ---- if (pPlatformObj != NULL) { ! tnPoolIndex nTarget = pPlatformObj->GetBrain()->GetTarget(); if (nTarget != NULL_INDEX) { |
|
From: Dewitt C. <ddc...@us...> - 2005-02-20 18:20:30
|
Update of /cvsroot/gcblue/gcb_wx/src/scriptinterface In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23561/src/scriptinterface Modified Files: tcPlatformInterface.cpp Log Message: Parallel ai update Index: tcPlatformInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcPlatformInterface.cpp,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** tcPlatformInterface.cpp 18 Feb 2005 17:41:51 -0000 1.35 --- tcPlatformInterface.cpp 20 Feb 2005 18:20:19 -0000 1.36 *************** *** 48,52 **** #include "tcLauncher.h" #include "tcStores.h" ! #ifdef _DEBUG --- 48,52 ---- #include "tcLauncher.h" #include "tcStores.h" ! #include "ai/Brain.h" #ifdef _DEBUG *************** *** 232,235 **** --- 232,245 ---- } + void tcPlatformInterface::SetTarget(long anID) + { + mpPlatformObj->DesignateTarget(anID); + } + + long tcPlatformInterface::GetTarget() + { + return mpPlatformObj->GetBrain()->GetTarget(); + } + float tcPlatformInterface::GetRangeToTarget() { *************** *** 567,572 **** bool tcPlatformInterface::HandoffTargetToLauncher(int anLauncher) { ! UINT32 nTargetID = mpPlatformObj->mcAI.mnTargetID; ! bool bAccept = mpSimState->DesignateLauncherTarget(mpPlatformObj->mnID,nTargetID,anLauncher); return bAccept; } --- 577,583 ---- bool tcPlatformInterface::HandoffTargetToLauncher(int anLauncher) { ! UINT32 nTargetID = mpPlatformObj->GetBrain()->GetTarget(); ! bool bAccept = mpSimState->DesignateLauncherTarget(mpPlatformObj->mnID, ! nTargetID, anLauncher); return bAccept; } |
|
From: Dewitt C. <ddc...@us...> - 2005-02-18 17:42:32
|
Update of /cvsroot/gcblue/gcb_wx In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2009 Modified Files: GCblue.vcproj Log Message: Parallel ai update Index: GCblue.vcproj =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/GCblue.vcproj,v retrieving revision 1.81 retrieving revision 1.82 diff -C2 -d -r1.81 -r1.82 *** GCblue.vcproj 4 Feb 2005 18:55:46 -0000 1.81 --- GCblue.vcproj 18 Feb 2005 17:42:24 -0000 1.82 *************** *** 681,684 **** --- 681,687 ---- </File> <File + RelativePath=".\src\ai\BlackboardInterface.cpp"> + </File> + <File RelativePath=".\src\ai\BlackboardItem.cpp"> </File> *************** *** 687,690 **** --- 690,702 ---- </File> <File + RelativePath=".\src\ai\ScriptedTask.cpp"> + </File> + <File + RelativePath=".\src\ai\ScriptedTaskInterface.cpp"> + </File> + <File + RelativePath=".\src\ai\SelfPreservation.cpp"> + </File> + <File RelativePath=".\src\ai\Task.cpp"> </File> *************** *** 1624,1627 **** --- 1636,1642 ---- </File> <File + RelativePath=".\include\ai\BlackboardInterface.h"> + </File> + <File RelativePath=".\include\ai\BlackboardItem.h"> </File> *************** *** 1630,1633 **** --- 1645,1657 ---- </File> <File + RelativePath=".\include\ai\ScriptedTask.h"> + </File> + <File + RelativePath=".\include\ai\ScriptedTaskInterface.h"> + </File> + <File + RelativePath=".\include\ai\SelfPreservation.h"> + </File> + <File RelativePath=".\include\ai\Task.h"> </File> |
|
From: Dewitt C. <ddc...@us...> - 2005-02-18 17:42:17
|
Update of /cvsroot/gcblue/gcb_wx/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1968/scripts Modified Files: AI.py Log Message: Parallel ai update Index: AI.py =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/scripts/AI.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** AI.py 16 Feb 2005 23:13:23 -0000 1.16 --- AI.py 18 Feb 2005 17:42:08 -0000 1.17 *************** *** 71,86 **** TI.SetMemoryValue(1, iteration) ! def AvoidGround(UI): ! if (UI.IsAir()): ! terrainElevation = UI.GetTerrainElevation() ! if (terrainElevation < 0): ! terrainElevation = 0 ! alt = UI.GetAlt() ! if ((alt - terrainElevation) < 80): ! UI.SetAlt(terrainElevation + 100) ! def Patrol(UI): targetid = UI.GetTarget() if targetid != -1: --- 71,279 ---- TI.SetMemoryValue(1, iteration) + def Patrol(TI): + ZigZagPatrol(TI) ! # zig-zag patrol task ! def ZigZagPatrol(TI): ! UI = TI.GetPlatformInterface() ! BB = TI.GetBlackboardInterface() + iteration = TI.GetMemoryValue(1) # will return 0 first time + if (iteration == 0): # do initialization + TI.SetMemoryValue(2, UI.GetHeading()) + TI.SetMemoryValue(3, 0) # 0 is turn left next zig-zag, 1 turn right + TI.SetMemoryValue(4, 90.0 + 90.0 * UI.Rand()) # random turn interval in seconds + TI.SetMemoryText('Description', 'Perform surveillance along a zig-zag course') ! iteration = iteration + 1 ! TI.SetMemoryValue(1, iteration) ! ! # activate all sensors ! can_radiate = GetSensorControl(BB) ! if (can_radiate): ! ActivateAllSensors(UI) ! else: ! ActivatePassiveSensors(UI) ! ! # return if conn is not available ! if (not GetConnControl(BB)): ! return ! ! if (TI.GetMemoryValue(3) == 0): ! new_heading = TI.GetMemoryValue(2) - 45 ! TI.SetMemoryValue(3, 1) ! else: ! new_heading = TI.GetMemoryValue(2) + 45 ! TI.SetMemoryValue(3, 0) ! ! UI.SetHeading(new_heading) ! TI.SetUpdateInterval(TI.GetMemoryValue(4)) ! UI.SetActionText('Patrol') ! ! ! # shoot hostiles and unknowns within range, but do not intercept. ! # Turn if necessary to position launchers ! def EngageAll(TI): ! UI = TI.GetPlatformInterface() ! BB = TI.GetBlackboardInterface() ! ! iteration = TI.GetMemoryValue(1) # will return 0 first time ! if (iteration == 0): # do initialization ! TI.SetMemoryText('Description', 'Engage hostiles and unknowns within range, but do not intercept') ! ! iteration = iteration + 1 ! TI.SetMemoryValue(1, iteration) ! ! # engage_mode values: ! # 0 - searching, 1 - turning to place target within launch sector, 2 - keeping target within semiactive sector ! engage_mode = TI.GetMemoryValue(2) ! ! # memory values ! # 10: target id ! # 11: launcher index ! # 12: launch/follow sector center ! # 13: launch/follow sector width ! ! if (engage_mode == 0): # searching ! TI.SetUpdateInterval(30) ! best_target, best_launcher = GetImmediateTarget(UI) ! if (best_target != -1): ! UI.DisplayMessage('%s: targ: %d, lau: %d' % (UI.GetName(), best_target, best_launcher)) ! launcher_info = UI.GetLauncherInfo(best_launcher) ! if (launcher_info.IsValid()): ! TI.SetMemoryValue(10, best_target) ! TI.SetMemoryValue(11, best_launcher) ! TI.SetMemoryValue(12, launcher_info.SectorCenter) ! TI.SetMemoryValue(13, launcher_info.SectorWidth) ! TI.SetMemoryValue(2, 1) ! engage_mode = 1 ! TI.SetUpdateInterval(10.0) ! else: ! TI.SetMemoryValue(2, 0) ! ! if (engage_mode == 1): # turn to target ! target_id = long(TI.GetMemoryValue(10)) ! if (target_id == -1): ! TI.SetMemoryValue(2, 0) ! return ! UI.SetTarget(target_id) ! launcher = long(TI.GetMemoryValue(11)) ! launcher_angle = TI.GetMemoryValue(12) ! sector_width = TI.GetMemoryValue(13) ! target_bearing = GetTargetBearing(UI) ! if (GetConnControl(BB)): ! UI.SetHeading(target_bearing-launcher_angle) ! ! engagement_angle = target_bearing - launcher_angle ! if (engagement_angle > 180.0): ! engagement_angle = engagement_angle - 360.0 ! elif (engagement_angle < -180.0): ! engagement_angle = engagement_angle + 360.0 ! if (engagement_angle <= 0.5 * sector_width): ! EngageTargetWithLauncher(UI, launcher) ! TI.SetMemoryValue(2, 2) ! TI.SetUpdateInterval(10.0) # wait 10 seconds ! ! if (engage_mode >= 2): ! TI.SetMemoryValue(2, 0) # return to search mode ! TI.SetUpdateInterval(20.0) ! ReleaseConnControl(BB) ! ! ! ! # returns id of closest target that is in-range, engageable, and not already ! # overwhelmingly engaged ! # returns -1 if none ! def GetImmediateTarget(UI): ! ! # anAffiliation: UNKNOWN = 0, FRIENDLY = 1, NEUTRAL = 2, HOSTILE = 3 ! # ! # anClassMask: ! # PTYPE_SURFACE 0x0010 ! # PTYPE_AIR 0x0020 ! # PTYPE_MISSILE 0x0040 ! # PTYPE_SUBSURFACE 0x0080 ! # PTYPE_FIXED 0x0100 ! # int anClassMask, float afMaxRange_km, UINT8 anAffiliation ! track_list = UI.GetTrackList(0x0FFF, 150, 3) ! ! nTracks = track_list.Size() ! best_range = 1e6 ! best_target = -1 ! best_launcher = -1 ! ! for n in range(0, nTracks): ! track_info = track_list.GetTrack(n) ! track_id = track_info.ID ! ! engaged_count = track_info.GetEngagedCount() ! if (track_info.IsAir() or track_info.IsMissile()): ! max_engaged_count = 2 ! else: ! max_engaged_count = 6 ! ! if (engaged_count < max_engaged_count): ! UI.SetTarget(track_id) ! launcher_info = UI.GetBestLauncher() ! launcher_idx = launcher_info.Launcher ! if (launcher_idx != -1): ! target_range = UI.GetRangeToTarget() ! launch_range = launcher_info.Range_km # reference max range, use for launch decision ! if ((target_range <= launch_range) and (target_range < best_range)): ! best_range = target_range ! best_target = track_id ! best_launcher = launcher_idx ! UI.SetTarget(best_target) ! ! return (best_target, best_launcher) ! ! ! ! ! ! ! ! def ActivateAllSensors(UI): ! UI.SetAllSensorState(1) ! ! def ActivatePassiveSensors(UI): ! nSensors = UI.GetSensorCount() ! for n in range(0, nSensors): ! sensor_info = UI.GetSensorInfo(n) ! if (sensor_info.IsPassive()): ! UI.SetSensorState(n, 1) ! ! def Emcon(TI): ! UI = TI.GetPlatformInterface() ! BB = TI.GetBlackboardInterface() ! ! # take control of (active) sensors ! if (not GetSensorControl(BB)): ! return ! ! nSensors = UI.GetSensorCount() ! for n in range(0, nSensors): ! sensor_info = UI.GetSensorInfo(n) ! if (not sensor_info.IsPassive()): # deactivate active sensors ! UI.SetSensorState(n, 0) ! ! ! def AirPatrol(TI): ! UI = TI.GetPlatformInterface() ! ! def GetConnControl(BB): ! return BB.Write('ConnLock', '') ! ! def ReleaseConnControl(BB): ! BB.Erase('ConnLock') ! ! def GetSensorControl(BB): ! return BB.Write('SensorLock', '') ! ! def ReleaseSensorControl(BB): ! BB.Erase('SensorLock') ! ! def SAM_Defense(UI): ! UI = TI.GetPlatformInterface() targetid = UI.GetTarget() if targetid != -1: *************** *** 95,99 **** heading = heading - 360.0 UI.SetHeading(heading) ! UI.SetUpdate(30.0) # engage hostiles in range --- 288,292 ---- heading = heading - 360.0 UI.SetHeading(heading) ! TI.SetUpdateInterval(30.0) # engage hostiles in range *************** *** 114,122 **** UI.SetTarget(best_id) UI.SetHeadingToInterceptTarget() ! UI.SetUpdate(4.0) # Patrols in given direction, zig-zagging along the way # then reverses path ! def ZigZagPatrol(UI): targetid = UI.GetTarget() if targetid != -1: --- 307,329 ---- UI.SetTarget(best_id) UI.SetHeadingToInterceptTarget() ! TI.SetUpdateInterval(4.0) ! ! ! ! def AvoidGround(UI): ! if (UI.IsAir()): ! terrainElevation = UI.GetTerrainElevation() ! if (terrainElevation < 0): ! terrainElevation = 0 ! alt = UI.GetAlt() ! if ((alt - terrainElevation) < 80): ! UI.SetAlt(terrainElevation + 100) ! ! ! # Patrols in given direction, zig-zagging along the way # then reverses path ! def ZigZagPatrolOld(UI): targetid = UI.GetTarget() if targetid != -1: *************** *** 361,374 **** return -1 ! ! # set heading relative to target bearing ! def SetHeadingOffTarget(UI, heading_offset): track_info = UI.GetTargetTrackInfo() lat = track_info.Lat lon = track_info.Lon ! heading = UI.GetHeadingToDatum(lon,lat) heading = heading + heading_offset if (heading > 360.0): heading = heading - 360.0 UI.SetHeading(heading) return --- 568,590 ---- return -1 ! # get target bearing in deg ! def GetTargetBearing(UI): track_info = UI.GetTargetTrackInfo() lat = track_info.Lat lon = track_info.Lon ! bearing = UI.GetHeadingToDatum(lon,lat) ! return bearing ! ! ! # set heading relative to target bearing ! def SetHeadingOffTarget(UI, heading_offset): ! heading = GetTargetBearing(UI) ! heading = heading + heading_offset if (heading > 360.0): heading = heading - 360.0 + elif (heading < -180): + heading = heading + 360.0 + UI.SetHeading(heading) return *************** *** 515,518 **** --- 731,764 ---- + def EngageTargetWithLauncher(UI, launcher): + launcher_info = UI.GetLauncherInfo(launcher) + if (not launcher_info.IsValid()): + return + launch_mode = launcher_info.LaunchMode # 0 - datum, 1 - seeker, 2 - other + target_info = UI.GetTargetTrackInfo() + + if target_info.IsAir(): + launch_qty = 1 + elif target_info.IsMissile(): + launch_qty = 1 + elif target_info.IsSurface(): + launch_qty = 4 + else: + launch_qty = 1 + if launch_mode == 0: # datum launch + lat = target_info.Lat + lon = target_info.Lon + alt = target_info.Alt + UI.HandoffTargetToLauncher(launcher) # to store intended target + UI.SendDatumToLauncher(lon,lat,alt,launcher) + UI.Launch(launcher, launch_qty) + UI.SetActionText('Datum launch') + elif launch_mode == 1: # handoff to active seeker + target_accepted = UI.HandoffTargetToLauncher(launcher) + if (target_accepted): + UI.Launch(launcher, launch_qty) + UI.SetActionText('Handoff launch') + + |
|
From: Dewitt C. <ddc...@us...> - 2005-02-18 17:42:00
|
Update of /cvsroot/gcblue/gcb_wx/src/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1814/src/sim Modified Files: tcAeroAirObject.cpp tcGroundObject.cpp tcLauncher.cpp tcPlatformObject.cpp Log Message: Parallel ai update Index: tcLauncher.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcLauncher.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** tcLauncher.cpp 1 Feb 2005 02:29:15 -0000 1.10 --- tcLauncher.cpp 18 Feb 2005 17:41:51 -0000 1.11 *************** *** 342,345 **** --- 342,385 ---- /** + * + */ + float tcLauncher::GetSectorCenter() const + { + if (fireControlSensor) + { + return fireControlSensor->mountAz_rad; + } + else + { + return pointingAngle; + } + } + + /** + * + */ + float tcLauncher::GetSectorWidth() const + { + if (fireControlSensor) + { + float fcFov = C_PIOVER180 * fireControlSensor->mpDBObj->mfFieldOfView_deg; + + if (meLaunchMode == SEEKER_TRACK) + { + return min(0.524f, fcFov); // guess 30 deg for seeker FOV, TODO: calculate true number + } + else + { + return fcFov; + } + } + else + { + return C_TWOPI; + } + } + + + /** * autopoint launchers will automatically point to target before launch * @return true if launcher is auto-pointable Index: tcGroundObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcGroundObject.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** tcGroundObject.cpp 1 Feb 2005 02:29:15 -0000 1.2 --- tcGroundObject.cpp 18 Feb 2005 17:41:51 -0000 1.3 *************** *** 114,117 **** --- 114,119 ---- UpdateSensors(afStatusTime); + UpdateAI(afStatusTime); + mfStatusTime = afStatusTime; } Index: tcPlatformObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcPlatformObject.cpp,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** tcPlatformObject.cpp 16 Feb 2005 23:13:49 -0000 1.35 --- tcPlatformObject.cpp 18 Feb 2005 17:41:51 -0000 1.36 *************** *** 876,880 **** brain = new Brain(this); ! brain->AddTask("TestTask", 1.0); mpDBObject = obj; --- 876,880 ---- brain = new Brain(this); ! //brain->AddTask("TestTask", 1.0); mpDBObject = obj; Index: tcAeroAirObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcAeroAirObject.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** tcAeroAirObject.cpp 7 Nov 2004 03:40:45 -0000 1.8 --- tcAeroAirObject.cpp 18 Feb 2005 17:41:51 -0000 1.9 *************** *** 159,162 **** --- 159,164 ---- UpdateSensors(afStatusTime); + UpdateAI(afStatusTime); + mfStatusTime = afStatusTime; } |
|
From: Dewitt C. <ddc...@us...> - 2005-02-18 17:41:59
|
Update of /cvsroot/gcblue/gcb_wx/src/scriptinterface In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1814/src/scriptinterface Modified Files: tcPlatformInterface.cpp tcPlatformInterfaceExtension.cpp tcPlatformInterfaceExtensionB.cpp tcScenarioInterface.cpp Log Message: Parallel ai update Index: tcPlatformInterfaceExtensionB.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcPlatformInterfaceExtensionB.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** tcPlatformInterfaceExtensionB.cpp 5 Dec 2004 02:49:47 -0000 1.18 --- tcPlatformInterfaceExtensionB.cpp 18 Feb 2005 17:41:51 -0000 1.19 *************** *** 90,93 **** --- 90,94 ---- .def("GetLauncherWeaponName",&tcPlatformInterface::GetLauncherWeaponName) .def("GetBestLauncher",&tcPlatformInterface::GetBestLauncher) + .def("GetLauncherInfo", &tcPlatformInterface::GetLauncherInfoByValue) .def("SendDatumToLauncher", &tcPlatformInterface::SendDatumToLauncher) .def("HandoffTargetToLauncher", &tcPlatformInterface::HandoffTargetToLauncher) Index: tcPlatformInterfaceExtension.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcPlatformInterfaceExtension.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** tcPlatformInterfaceExtension.cpp 7 Dec 2004 04:00:41 -0000 1.12 --- tcPlatformInterfaceExtension.cpp 18 Feb 2005 17:41:51 -0000 1.13 *************** *** 120,123 **** --- 120,126 ---- .def_readonly("LaunchMode",&tcLauncherInfo::mnLaunchMode) // 0 - datum, 1 - handoff .def_readonly("MaxDepth_m",&tcLauncherInfo::maxDepth_m) + .def_readonly("SectorCenter", &tcLauncherInfo::sectorCenter) + .def_readonly("SectorWidth", &tcLauncherInfo::sectorWidth) + .def("IsValid", &tcLauncherInfo::IsValid) ; *************** *** 125,128 **** --- 128,132 ---- .def_readonly("isActive",&tcSensorInfo::isActive) .def_readonly("type",&tcSensorInfo::type) + .def("IsPassive", &tcSensorInfo::IsPassive) ; Index: tcScenarioInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcScenarioInterface.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** tcScenarioInterface.cpp 16 Feb 2005 23:13:49 -0000 1.18 --- tcScenarioInterface.cpp 18 Feb 2005 17:41:51 -0000 1.19 *************** *** 228,232 **** for (int n=0;n<nOrders;n++) { ! platObj->mcAI.AddOrder(unit.orders[n]); } } --- 228,235 ---- for (int n=0;n<nOrders;n++) { ! /* a cobble to work with old system, use index as reverse priority (first order ! ** has max priority */ ! platObj->GetBrain()->AddTask(unit.orders[n].mstrOrdername, double(nOrders-n)); ! //platObj->mcAI.AddOrder(unit.orders[n]); } } Index: tcPlatformInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcPlatformInterface.cpp,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** tcPlatformInterface.cpp 31 Jan 2005 01:33:08 -0000 1.34 --- tcPlatformInterface.cpp 18 Feb 2005 17:41:51 -0000 1.35 *************** *** 43,46 **** --- 43,47 ---- #include "tcBallisticDBObject.h" #include "tcGenericDBObject.h" + #include "tcSonarDBObject.h" #include "tcTorpedoDBObject.h" #include "tcLauncherState.h" *************** *** 455,462 **** } bool tcPlatformInterface::GetLauncherInfo(tcLauncherInfo& info, int anLauncher) { info.mnLauncher = -1; ! int nCount = GetLauncherCount(); if ((anLauncher < 0)||(anLauncher >= nCount)) --- 456,472 ---- } + tcLauncherInfo tcPlatformInterface::GetLauncherInfoByValue(int launcher) + { + tcLauncherInfo info; + + GetLauncherInfo(info, launcher); + + return info; + } + bool tcPlatformInterface::GetLauncherInfo(tcLauncherInfo& info, int anLauncher) { info.mnLauncher = -1; ! int nCount = GetLauncherCount(); if ((anLauncher < 0)||(anLauncher >= nCount)) *************** *** 464,468 **** return false; } ! const tcLauncher* pLauncherData = mpPlatformObj->mcLauncherState.GetLauncher(anLauncher); info.maxDepth_m = 0; --- 474,484 ---- return false; } ! ! const tcLauncher* const pLauncherData = mpPlatformObj->mcLauncherState.GetLauncher(anLauncher); ! wxASSERT(pLauncherData); ! ! // convert engagement sector values to degrees ! info.sectorCenter = C_180OVERPI * pLauncherData->GetSectorCenter(); ! info.sectorWidth = C_180OVERPI * pLauncherData->GetSectorWidth(); info.maxDepth_m = 0; *************** *** 982,991 **** const tcSensorState* sensor_state = mpPlatformObj->GetSensor(n); info.isActive = sensor_state->GetActive(); ! if (dynamic_cast<tcRadarDBObject*>(sensor_state->mpDBObj)) ! info.type = 0; ! else if (dynamic_cast<tcESMDBObject*>(sensor_state->mpDBObj)) info.type = 1; ! else ! info.type = 0xFF; return info; --- 998,1025 ---- const tcSensorState* sensor_state = mpPlatformObj->GetSensor(n); info.isActive = sensor_state->GetActive(); ! info.type = 0; ! ! if (sensor_state->IsRadar()) ! { info.type = 1; ! } ! else if (sensor_state->IsESM()) ! { ! info.type = 2; ! } ! else if (sensor_state->IsSonar()) ! { ! tcSonarDBObject* sonar = dynamic_cast<tcSonarDBObject*>(sensor_state->mpDBObj); ! if (sonar->isPassive) info.type += 4; ! if (sonar->isActive) info.type += 8; ! } ! else if (sensor_state->IsOptical()) ! { ! info.type = 16; ! } ! else // error ! { ! fprintf(stderr, "tcPlatformInterface::GetSensorInfo - bad sensor type\n"); ! } return info; |
|
From: Dewitt C. <ddc...@us...> - 2005-02-18 17:41:59
|
Update of /cvsroot/gcblue/gcb_wx/src/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1814/src/common Modified Files: tcSound.cpp Log Message: Parallel ai update Index: tcSound.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/common/tcSound.cpp,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** tcSound.cpp 31 Jan 2005 01:33:07 -0000 1.21 --- tcSound.cpp 18 Feb 2005 17:41:50 -0000 1.22 *************** *** 115,119 **** effectMap["RejectBeep"] = osgAL::SoundManager::instance()->getSample("RejectBeep.wav"); effectMap["Ping"] = osgAL::SoundManager::instance()->getSample("Ping.wav"); - effectMap["Ping"] = osgAL::SoundManager::instance()->getSample("Ping.wav"); effectMap["Ping2"] = osgAL::SoundManager::instance()->getSample("Ping2.wav"); effectMap["radarping"] = osgAL::SoundManager::instance()->getSample("radarping.wav"); --- 115,118 ---- |
|
From: Dewitt C. <ddc...@us...> - 2005-02-18 17:41:45
|
Update of /cvsroot/gcblue/gcb_wx/include/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1773/include/sim Modified Files: tcLauncher.h Log Message: Parallel ai update Index: tcLauncher.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcLauncher.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** tcLauncher.h 1 Feb 2005 02:28:09 -0000 1.9 --- tcLauncher.h 18 Feb 2005 17:41:37 -0000 1.10 *************** *** 119,122 **** --- 119,124 ---- int GetErrorCode() const {return errorCode;} int GetLauncherStatus(); + float GetSectorCenter() const; ///< returns center of engagement sector in radians + float GetSectorWidth() const; ///< returns width of engagement sector in radians bool IsAutoPoint() const; |
|
From: Dewitt C. <ddc...@us...> - 2005-02-18 17:41:45
|
Update of /cvsroot/gcblue/gcb_wx/include/scriptinterface In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1773/include/scriptinterface Modified Files: tcPlatformInterface.h Log Message: Parallel ai update Index: tcPlatformInterface.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/scriptinterface/tcPlatformInterface.h,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** tcPlatformInterface.h 31 Jan 2005 01:32:36 -0000 1.31 --- tcPlatformInterface.h 18 Feb 2005 17:41:36 -0000 1.32 *************** *** 56,59 **** --- 56,64 ---- float maxDepth_m; ///< max depth for subsurface launch int mnLaunchMode; ///< 0 - datum, 1 - handoff + + double sectorCenter; ///< az of center of launch engagement sector in deg + double sectorWidth; ///< width of engagement sector in deg + + bool IsValid() const {return mnLauncher != -1;} }; *************** *** 61,66 **** { public: ! int isActive; // 0 if OFF, 1 if ON ! int type; // 0 radar, 1 ESM, 255 Error, more in the future }; --- 66,73 ---- { public: ! int isActive; ///< 0 if OFF, 1 if ON ! int type; ///< FLAGS: 1 radar, 2 ESM, 4 passive sonar, 8 active sonar, 16 optical, 0 error ! ! bool IsPassive() {return ((type & 0x16) != 0);} }; *************** *** 212,215 **** --- 219,224 ---- bool IsDatumLaunch(int anLauncher) {return mpPlatformObj->mcLauncherState.IsDatumLaunch(anLauncher);} bool GetLauncherInfo(tcLauncherInfo& info, int anLauncher); + /// version for python + tcLauncherInfo GetLauncherInfoByValue(int launcher); /// count of types of weapons accepted by this launcher |
|
From: Dewitt C. <ddc...@us...> - 2005-02-16 23:13:58
|
Update of /cvsroot/gcblue/gcb_wx/src/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15507/src/sim Modified Files: Game.cpp tcAirObject.cpp tcPlatformObject.cpp tcSimState.cpp tcSurfaceObject.cpp Log Message: Parallel ai update Index: tcSimState.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcSimState.cpp,v retrieving revision 1.65 retrieving revision 1.66 diff -C2 -d -r1.65 -r1.66 *** tcSimState.cpp 31 Jan 2005 01:33:09 -0000 1.65 --- tcSimState.cpp 16 Feb 2005 23:13:49 -0000 1.66 *************** *** 650,656 **** } /********************************************************************/ ! // for objects with AI active, periodically call AI script to update void tcSimState::UpdateAI(double afSimTime) { tcGameObject *pobj; tnPoolIndex cmappos = maPlatformState.GetStartPosition(); --- 650,659 ---- } /********************************************************************/ ! /** ! * for objects with AI active, periodically call AI script to update ! */ void tcSimState::UpdateAI(double afSimTime) { + #if 0 tcGameObject *pobj; tnPoolIndex cmappos = maPlatformState.GetStartPosition(); *************** *** 675,678 **** --- 678,682 ---- } } + #endif } Index: tcPlatformObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcPlatformObject.cpp,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** tcPlatformObject.cpp 31 Jan 2005 01:33:09 -0000 1.34 --- tcPlatformObject.cpp 16 Feb 2005 23:13:49 -0000 1.35 *************** *** 38,41 **** --- 38,42 ---- #include "common/tcStream.h" #include "common/tcObjStream.h" + #include "ai/Brain.h" #ifdef _DEBUG *************** *** 86,89 **** --- 87,101 ---- } + + /** + * + */ + void tcPlatformObject::UpdateAI(float t) + { + wxASSERT(brain); + + brain->Update(t); + } + // update guidance to maintain/achieve formation position void tcPlatformObject::UpdateFormationGuidance() *************** *** 229,232 **** --- 241,246 ---- } + + /** * update launcher state (reload time) *************** *** 294,300 **** --- 308,323 ---- UpdateMagazines(afStatusTime); + UpdateAI(afStatusTime); + mfStatusTime = afStatusTime; } + /** + * @return pointer to platform's "brain" (AI) + */ + Brain* tcPlatformObject::GetBrain() + { + return brain; + } /** *************** *** 805,808 **** --- 828,832 ---- { Clear(); + brain = new Brain(this); mpDBObject = NULL; mcLauncherState.mnCount = 0; *************** *** 851,854 **** --- 875,881 ---- using namespace Database; + brain = new Brain(this); + brain->AddTask("TestTask", 1.0); + mpDBObject = obj; mnModelType = MTYPE_PLATFORM; *************** *** 936,942 **** } /******************************************************************************/ ! tcPlatformObject::tcPlatformObject(tcPlatformObject& o) : tcGameObject(o), commandObj(o.commandObj) { fuel_kg = o.fuel_kg; mcAI = o.mcAI; --- 963,972 ---- } /******************************************************************************/ ! tcPlatformObject::tcPlatformObject(tcPlatformObject& o) : ! tcGameObject(o), commandObj(o.commandObj) { + brain = new Brain(this); // need copy constructor for this + fuel_kg = o.fuel_kg; mcAI = o.mcAI; *************** *** 969,972 **** --- 999,1004 ---- tcPlatformObject::~tcPlatformObject() { + if (brain) delete brain; + for (size_t n=0; n<magazines.size(); n++) { Index: Game.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/Game.cpp,v retrieving revision 1.119 retrieving revision 1.120 diff -C2 -d -r1.119 -r1.120 *** Game.cpp 1 Feb 2005 02:29:07 -0000 1.119 --- Game.cpp 16 Feb 2005 23:13:49 -0000 1.120 *************** *** 2476,2480 **** glCanvas->SetBackgroundColour(*wxBLACK); ! pythonInterface = new tcSimPythonInterface(); goalTracker = simState->GetGoalTracker(); --- 2476,2480 ---- glCanvas->SetBackgroundColour(*wxBLACK); ! pythonInterface = tcSimPythonInterface::Get(); goalTracker = simState->GetGoalTracker(); *************** *** 2513,2520 **** --- 2513,2522 ---- tcGame::~tcGame() { + /* if (pythonInterface) { delete pythonInterface; } + */ messageConsole = NULL; Index: tcAirObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcAirObject.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** tcAirObject.cpp 31 Jan 2005 01:33:08 -0000 1.16 --- tcAirObject.cpp 16 Feb 2005 23:13:49 -0000 1.17 *************** *** 379,382 **** --- 379,384 ---- UpdateSensors(afStatusTime); + UpdateAI(afStatusTime); + mfStatusTime = afStatusTime; } Index: tcSurfaceObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcSurfaceObject.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** tcSurfaceObject.cpp 23 Nov 2004 23:31:18 -0000 1.14 --- tcSurfaceObject.cpp 16 Feb 2005 23:13:50 -0000 1.15 *************** *** 102,105 **** --- 102,107 ---- UpdateSensors(afStatusTime); + UpdateAI(afStatusTime); + mfStatusTime = afStatusTime; } |
Update of /cvsroot/gcblue/gcb_wx/src/ai In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15507/src/ai Modified Files: Blackboard.cpp BlackboardItem.cpp Brain.cpp Task.cpp Added Files: BlackboardInterface.cpp ScriptedTask.cpp ScriptedTaskInterface.cpp SelfPreservation.cpp Log Message: Parallel ai update --- NEW FILE: ScriptedTask.cpp --- /** ** @file ScriptedTask.cpp */ /* 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 */ #include "stdwx.h" #ifndef WX_PRECOMP #include "wx/wx.h" #endif #include "ai/ScriptedTask.h" #include "scriptinterface/tcSimPythonInterface.h" #ifdef _DEBUG #define new DEBUG_NEW #endif using namespace ai; using ScriptInterface::tcSimPythonInterface; /** * @return "" if no key exists */ const std::string& ScriptedTask::GetMemoryText(const std::string& key) { // returned if key not found static const std::string emptyString(""); std::map<std::string, std::string>::const_iterator iter = textMemory.find(key); if (iter != textMemory.end()) { return iter->second; } else { return emptyString; } } void ScriptedTask::SetMemoryText(const std::string& key, const std::string& text) { textMemory[key] = text; } /** * @return 0 if no key exists */ double ScriptedTask::GetMemoryValue(int key) { std::map<int, double>::const_iterator iter = numberMemory.find(key); if (iter != numberMemory.end()) { return iter->second; } else { return 0; } } void ScriptedTask::SetMemoryValue(int key, double value) { numberMemory[key] = value; } const char* ScriptedTask::GetCommandString() { if (commandString.size()) { return commandString.c_str(); } else { commandString = wxString::Format("AI.%s(TaskInterface)\n", taskName.c_str()); return commandString.c_str(); } } void ScriptedTask::Update(double t) { if (IsReadyForUpdate(t)) { tcSimPythonInterface::Get()->CallTaskScript(this, GetCommandString()); FinishUpdate(t); } } ScriptedTask::ScriptedTask(tcPlatformObject* platform_, Blackboard* bb, long id_, double priority_, const std::string& scriptName) : Task(platform_, bb, id_, priority_, scriptName) { } ScriptedTask::~ScriptedTask() { } Index: Blackboard.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/ai/Blackboard.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Blackboard.cpp 4 Feb 2005 18:50:35 -0000 1.1 --- Blackboard.cpp 16 Feb 2005 23:13:49 -0000 1.2 *************** *** 36,43 **** using namespace ai; ! void Blackboard::EraseAll() ! { ! content.clear(); ! } void Blackboard::Erase(const std::string& key, double priority) --- 36,40 ---- using namespace ai; ! void Blackboard::Erase(const std::string& key, double priority) *************** *** 55,58 **** --- 52,85 ---- } + void Blackboard::EraseAll() + { + content.clear(); + } + + void Blackboard::EraseAllFromAuthor(long author) + { + if (author == -1) + { + fprintf(stderr, "Blackboard::EraseAllFromAuthor - invalid author (-1)\n"); + return; + } + + + + for (std::map<std::string, BlackboardItem>::iterator iter = + content.begin(); iter != content.end(); ) + { + if (iter->second.author == author) + { + content.erase(iter++); + } + else + { + ++iter; + } + } + + } + bool Blackboard::KeyExists(const std::string& key) const { *************** *** 79,82 **** --- 106,149 ---- } + /** + * @return -1 if key not found + */ + long Blackboard::ReadAuthor(const std::string& key) + { + std::map<std::string, BlackboardItem>::const_iterator iter = + content.find(key); + if (iter == content.end()) + { + return -1; + } + else + { + return iter->second.author; + } + } + + /** + * @return "" if key not found + */ + const std::string Blackboard::ReadMessage(const std::string& key) + { + // message to return if key not found + static const std::string emptyMessage(""); + + std::map<std::string, BlackboardItem>::const_iterator iter = + content.find(key); + if (iter == content.end()) + { + return emptyMessage; + } + else + { + return iter->second.message; + } + } + + /** + * @return -1.0 if key not found + */ double Blackboard::ReadPriority(const std::string& key) { *************** *** 93,97 **** } ! void Blackboard::Write(const std::string& key, const BlackboardItem& item) { std::map<std::string, BlackboardItem>::iterator iter = --- 160,167 ---- } ! /** ! * @return true if write successful, false if blocked ! */ ! bool Blackboard::Write(const std::string& key, const BlackboardItem& item) { std::map<std::string, BlackboardItem>::iterator iter = *************** *** 103,107 **** if ((iter->second.priority > item.priority) && (iter->second.author != item.author)) { ! return; } iter->second = item; --- 173,177 ---- if ((iter->second.priority > item.priority) && (iter->second.author != item.author)) { ! return false; } iter->second = item; *************** *** 111,118 **** content[key] = item; } ! } ! void Blackboard::Write(const std::string& key, long author, double priority, const std::string& message) { std::map<std::string, BlackboardItem>::iterator iter = --- 181,192 ---- content[key] = item; } ! ! return true; } ! /** ! * @return true if write successful, false if blocked ! */ ! bool Blackboard::Write(const std::string& key, long author, double priority, const std::string& message) { std::map<std::string, BlackboardItem>::iterator iter = *************** *** 124,128 **** if ((iter->second.priority > priority) && (iter->second.author != author)) { ! return; } iter->second.author = author; --- 198,202 ---- if ((iter->second.priority > priority) && (iter->second.author != author)) { ! return false; } iter->second.author = author; *************** *** 134,137 **** --- 208,213 ---- content[key] = BlackboardItem(author, priority, message); } + + return true; } --- NEW FILE: BlackboardInterface.cpp --- /** ** @file BlackboardInterface.cpp */ /* 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 */ #include "stdwx.h" #ifndef WX_PRECOMP #include "wx/wx.h" #endif #include "ai/BlackboardInterface.h" #include "ai/Blackboard.h" #include "ai/BlackboardItem.h" #include <boost/python.hpp> #ifdef _DEBUG #define new DEBUG_NEW #endif using namespace ai; using namespace boost::python; bool BlackboardInterface::pythonInitialized = false; /** * static method that should be called once to expose class * to Python */ void BlackboardInterface::InitPython() { if (pythonInitialized) return; class_<BlackboardInterface>("BlackboardInterface") .def_readonly("author", &BlackboardInterface::author) .def_readonly("priority", &BlackboardInterface::priority) .def("Erase", &BlackboardInterface::Erase) .def("KeyExists", &BlackboardInterface::KeyExists) .def("Read", &BlackboardInterface::Read) .def("ReadAuthor", &BlackboardInterface::ReadAuthor) .def("ReadMessage", &BlackboardInterface::ReadMessage) .def("ReadPriority", &BlackboardInterface::ReadPriority) .def("Write", &BlackboardInterface::Write) ; pythonInitialized = true; BlackboardItem::InitPython(); } /** * Used to create a BlackboardInterface object in Python */ BlackboardInterface BlackboardInterface::GetBlackboardInterface() { return BlackboardInterface(*this); } long BlackboardInterface::GetAuthor() const { return author; } void BlackboardInterface::SetPriority(double priority_) { priority = priority_; } void BlackboardInterface::Erase(const std::string& key) { board->Erase(key, priority); } bool BlackboardInterface::KeyExists(const std::string& key) const { return board->KeyExists(key); } BlackboardItem BlackboardInterface::Read(const std::string& key) { return board->Read(key); } long BlackboardInterface::ReadAuthor(const std::string& key) { return board->ReadAuthor(key); } const std::string BlackboardInterface::ReadMessage(const std::string& key) { return board->ReadMessage(key); } double BlackboardInterface::ReadPriority(const std::string& key) { return board->ReadPriority(key); } /** * @return true if write successful, false if blocked */ bool BlackboardInterface::Write(const std::string& key, const std::string& message) { return board->Write(key, author, priority, message); } /** * Default constructor should never be used */ BlackboardInterface::BlackboardInterface() : board(0), author(-1), priority(0) { wxASSERT(false); if (!pythonInitialized) InitPython(); } BlackboardInterface::BlackboardInterface(const BlackboardInterface& source) : board(source.board), author(source.author), priority(source.priority) { wxASSERT(board); if (!pythonInitialized) InitPython(); } BlackboardInterface::BlackboardInterface(Blackboard* bb, long author_, double priority_) : board(bb), author(author_), priority(priority_) { wxASSERT(board); if (!pythonInitialized) InitPython(); } BlackboardInterface::~BlackboardInterface() { } Index: Brain.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/ai/Brain.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Brain.cpp 4 Feb 2005 18:50:35 -0000 1.1 --- Brain.cpp 16 Feb 2005 23:13:49 -0000 1.2 *************** *** 27,31 **** #include "ai/Brain.h" ! #ifdef _DEBUG --- 27,33 ---- #include "ai/Brain.h" ! #include "ai/Task.h" ! #include "ai/ScriptedTask.h" ! #include "sim/tcPlatformObject.h" #ifdef _DEBUG *************** *** 35,40 **** using namespace ai; ! Brain::Brain() { } --- 37,115 ---- using namespace ai; ! ! std::map<std::string, int> Brain::taskNameLookup; ! ! void Brain::InitTaskNameLookup() ! { ! if (taskNameLookup.find("Test") != taskNameLookup.end()) ! { ! return; // already initialized ! } ! taskNameLookup["Test"] = TEST_TASK; ! } ! ! void Brain::AddTask(const std::string& taskName, double priority_) ! { ! // check taskNameMap for C++ task, otherwise assume python script task ! std::map<std::string, int>::iterator iter = taskNameLookup.find(taskName); ! if (iter == taskNameLookup.end()) ! { ! taskMap[taskName] = new ScriptedTask(platform, &board, ! nextId++, priority_, taskName); ! } ! else ! { ! int taskCode = iter->second; ! // add switch for C++ task addition ! } ! } ! ! void Brain::RemoveTask(const std::string& taskName) { + std::map<std::string, Task*>::iterator iter = taskMap.find(taskName); + if (iter != taskMap.end()) + { + // remove all blackboard entries from the author being erased + board.EraseAllFromAuthor(iter->second->GetAuthor()); + delete iter->second; + taskMap.erase(iter); + } + } + + bool Brain::TaskExists(const std::string& taskName) + { + return (taskMap.find(taskName) != taskMap.end()); + } + + void Brain::Update(double t) + { + if ((t - lastUpdateTime) < updateInterval) + { + return; + } + + // iterate through task map and update tasks + std::map<std::string, Task*>::iterator iter = taskMap.begin(); + std::map<std::string, Task*>::iterator& done = taskMap.end(); + for (;iter != done; ++iter) + { + wxASSERT(iter->second); + + iter->second->Update(t); + } + + lastUpdateTime = t; + } + + Brain::Brain(tcPlatformObject* platform_) + : platform(platform_), + updateInterval(0.125f), + nextId(0) + { + wxASSERT(platform); + + InitTaskNameLookup(); // lazy init, could also have separate call in app init for this + + lastUpdateTime = randf(updateInterval); // randomize update phase } Index: BlackboardItem.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/ai/BlackboardItem.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** BlackboardItem.cpp 4 Feb 2005 18:50:35 -0000 1.1 --- BlackboardItem.cpp 16 Feb 2005 23:13:49 -0000 1.2 *************** *** 27,31 **** #include "ai/BlackboardItem.h" ! #ifdef _DEBUG --- 27,31 ---- #include "ai/BlackboardItem.h" ! #include <boost/python.hpp> #ifdef _DEBUG *************** *** 34,37 **** --- 34,60 ---- using namespace ai; + using namespace boost::python; + + bool BlackboardItem::pythonInitialized = false; + + /** + * static method that should be called once to expose class + * to Python + */ + void BlackboardItem::InitPython() + { + if (pythonInitialized) return; + + class_<BlackboardItem>("BlackboardItem") + .def_readonly("author", &BlackboardItem::author) + .def_readonly("priority", &BlackboardItem::priority) + .def_readonly("message", &BlackboardItem::message) + + .def("Valid", &BlackboardItem::Valid) + ; + + pythonInitialized = true; + } + bool BlackboardItem::Valid() const Index: Task.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/ai/Task.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Task.cpp 4 Feb 2005 18:50:35 -0000 1.1 --- Task.cpp 16 Feb 2005 23:13:49 -0000 1.2 *************** *** 27,30 **** --- 27,31 ---- #include "ai/Task.h" + #include "scriptinterface/tcPlatformInterface.h" *************** *** 34,65 **** using namespace ai; ! void Task::SetBoard(Blackboard* bb) { ! commBoard = bb; } ! void Task::SetId(long id_) { } ! void Task::SetPriority(double priority_) { } ! Task::Task(Blackboard* bb, long id_, double priority_) ! : commBoard(bb), ! id(id_), ! priority(priority_) { } ! Task::Task() ! : commBoard(0), ! id(-1), ! priority(0) { } Task::~Task() { --- 35,84 ---- using namespace ai; + using ScriptInterface::tcPlatformInterface; ! ! ! /** ! * Call at the end of every update ! */ ! void Task::FinishUpdate(double t) { ! lastUpdateTime = t; } ! tcPlatformInterface Task::GetPlatformInterface() { + return tcPlatformInterface(platform); } ! bool Task::IsReadyForUpdate(double t) const { + return ((t - lastUpdateTime) >= updateInterval); } ! ! ! void Task::SetUpdateInterval(float interval) { + updateInterval = interval; } ! void Task::Update(double t) { } + Task::Task(tcPlatformObject* platform_, Blackboard* bb, + long id_, double priority_, const std::string& taskName_) + : BlackboardInterface(bb, id_, priority_), + platform(platform_), + taskName(taskName_), + lastUpdateTime(0), + updateInterval(4.0f) + { + wxASSERT(platform); + } + + + Task::~Task() { --- NEW FILE: ScriptedTaskInterface.cpp --- /** ** @file ScriptedTaskInterface.cpp */ /* 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 */ #include "stdwx.h" #ifndef WX_PRECOMP #include "wx/wx.h" #endif #include "ai/ScriptedTaskInterface.h" #include "ai/BlackboardInterface.h" #include "ai/ScriptedTask.h" #include "scriptinterface/tcPlatformInterface.h" #include <boost/python.hpp> #ifdef _DEBUG #define new DEBUG_NEW #endif using namespace ai; using namespace boost::python; using ScriptInterface::tcPlatformInterface; bool ScriptedTaskInterface::pythonInitialized = false; /** * static method that should be called once to expose class * to Python */ void ScriptedTaskInterface::InitPython() { if (pythonInitialized) return; class_<ScriptedTaskInterface>("ScriptedTaskInterface") .def("GetBlackboardInterface", &ScriptedTaskInterface::GetBlackboardInterface) .def("GetPlatformInterface", &ScriptedTaskInterface::GetPlatformInterface) .def("SetUpdateInterval", &ScriptedTaskInterface::SetUpdateInterval) .def("GetMemoryText", &ScriptedTaskInterface::GetMemoryText) .def("SetMemoryText", &ScriptedTaskInterface::SetMemoryText) .def("GetMemoryValue", &ScriptedTaskInterface::GetMemoryValue) .def("SetMemoryValue", &ScriptedTaskInterface::SetMemoryValue) ; pythonInitialized = false; } BlackboardInterface ScriptedTaskInterface::GetBlackboardInterface() { wxASSERT(task); return task->GetBlackboardInterface(); } const std::string ScriptedTaskInterface::GetMemoryText(const std::string& key) { wxASSERT(task); return task->GetMemoryText(key); } double ScriptedTaskInterface::GetMemoryValue(int key) { wxASSERT(task); return task->GetMemoryValue(key); } tcPlatformInterface ScriptedTaskInterface::GetPlatformInterface() { wxASSERT(task); return task->GetPlatformInterface(); } void ScriptedTaskInterface::SetMemoryText(const std::string& key, const std::string& text) { wxASSERT(task); task->SetMemoryText(key, text); } void ScriptedTaskInterface::SetMemoryValue(int key, double value) { wxASSERT(task); return task->SetMemoryValue(key, value); } void ScriptedTaskInterface::SetTask(ScriptedTask* scriptedTask) { task = scriptedTask; wxASSERT(task); } void ScriptedTaskInterface::SetUpdateInterval(float interval) { wxASSERT(task); task->SetUpdateInterval(interval); } /** * Default constructor is defined for Python, SetTask needs to be * called after this constructor */ ScriptedTaskInterface::ScriptedTaskInterface() : task(0) { if (!pythonInitialized) InitPython(); } ScriptedTaskInterface::ScriptedTaskInterface(ScriptedTask* scriptedTask) : task(scriptedTask) { wxASSERT(task); if (!pythonInitialized) InitPython(); } ScriptedTaskInterface::~ScriptedTaskInterface() { } --- NEW FILE: SelfPreservation.cpp --- /** ** @file SelfPreservation.cpp */ /* 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 */ #include "stdwx.h" #ifndef WX_PRECOMP #include "wx/wx.h" #endif #include "ai/SelfPreservation.h" #include "scriptinterface/tcPlatformInterface.h" #ifdef _DEBUG #define new DEBUG_NEW #endif using namespace ai; using ScriptInterface::tcPlatformInterface; /** * version for air objects */ void SelfPreservation::UpdateAir(double t) { tcPlatformInterface platformInterface = GetPlatformInterface(); // avoid crashing float alt_m = platformInterface.GetAltitude(); float terrain_m = platformInterface.GetTerrainElevation(); if (alt_m < terrain_m + 50) { if (!haveAltitudeControl) { haveAltitudeControl = Write("Altitude", ""); } if (haveAltitudeControl) { platformInterface.SetAltitude(terrain_m + 70); } } else { if (haveAltitudeControl) { Erase("Altitude"); haveAltitudeControl = false; } } } void SelfPreservation::Update(double t) { if (!IsReadyForUpdate(t)) return; tcPlatformInterface platformInterface = GetPlatformInterface(); if (platformInterface.IsAir()) { UpdateAir(t); } FinishUpdate(t); } SelfPreservation::SelfPreservation(tcPlatformObject* platform_, Blackboard* bb, long id_, double priority_, const std::string& taskName_) : Task(platform_, bb, id_, priority_, taskName_) { wxASSERT(platform); } SelfPreservation::~SelfPreservation() { } |
|
From: Dewitt C. <ddc...@us...> - 2005-02-16 23:13:57
|
Update of /cvsroot/gcblue/gcb_wx/src/scriptinterface In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15507/src/scriptinterface Modified Files: tcScenarioInterface.cpp tcSimPythonInterface.cpp Log Message: Parallel ai update Index: tcSimPythonInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcSimPythonInterface.cpp,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** tcSimPythonInterface.cpp 4 Feb 2005 18:50:35 -0000 1.26 --- tcSimPythonInterface.cpp 16 Feb 2005 23:13:49 -0000 1.27 *************** *** 2,6 **** ** @file tcSimPythonInterface.cpp */ ! /* Copyright (C) 2003-2004 Dewitt Colclough (de...@tw...) ** All rights reserved. --- 2,6 ---- ** @file tcSimPythonInterface.cpp */ ! /* Copyright (C) 2003-2005 Dewitt Colclough (de...@tw...) ** All rights reserved. *************** *** 38,41 **** --- 38,43 ---- #include "tcSoundConsole.h" #include "tcDirector.h" + #include "ai/ScriptedTask.h" + #include "ai/ScriptedTaskInterface.h" #ifdef _DEBUG *************** *** 142,147 **** ! // write apObj --- 144,156 ---- + /** + * Singleton accessor + */ + tcSimPythonInterface* tcSimPythonInterface::Get() + { + static tcSimPythonInterface instance; ! return &instance; ! } // write apObj *************** *** 151,167 **** ! void tcSimPythonInterface::CallPlatformScript(tcPlatformObject *apObj, char *azCommand) { - /* - SetUnitInfo(apObj); - PlatformInterface.attr("GetLocalObj")(); - */ platformInterface->SetPlatform(apObj); ! try { handle<>( PyRun_String(azCommand , Py_file_input, mpDictionary->ptr(), mpDictionary->ptr()) ); } ! catch(error_already_set) { // handle the exception in some way fprintf(stderr,"Exception occured\n"); --- 160,174 ---- ! void tcSimPythonInterface::CallPlatformScript(tcPlatformObject *apObj, const char* azCommand) { platformInterface->SetPlatform(apObj); ! try ! { handle<>( PyRun_String(azCommand , Py_file_input, mpDictionary->ptr(), mpDictionary->ptr()) ); } ! catch(error_already_set) ! { // handle the exception in some way fprintf(stderr,"Exception occured\n"); *************** *** 170,173 **** --- 177,203 ---- } + + /** + * Task script for ai + */ + void tcSimPythonInterface::CallTaskScript(ScriptedTask* task, const char* azCommand) + { + wxASSERT(taskInterface); + + taskInterface->SetTask(task); + + try + { + handle<>( PyRun_String(azCommand + , Py_file_input, mpDictionary->ptr(), mpDictionary->ptr()) ); + } + catch (error_already_set) + { + // handle the exception in some way + fprintf(stderr,"Exception occured in CallTaskScript\n"); + PyErr_Print(); + } + } + tcFlightPort* tcSimPythonInterface::GetHookedObjFlightPort() { *************** *** 754,757 **** --- 784,791 ---- ScenarioInterface = scenarioInterfaceType(); + ScriptedTaskInterface tempInterface; + TaskInterfaceObject = object(tempInterface); + taskInterface = extract<ScriptedTaskInterface*>(TaskInterfaceObject); + // add PlatformInterface to python environment as global var // called "UnitInfo" *************** *** 764,767 **** --- 798,802 ---- PyDict_SetItemString(mpDictionary->ptr(), "ScenarioManager", ScenarioInterface.ptr()); PyDict_SetItemString(mpDictionary->ptr(), "GroupInfo", GroupInterface.ptr()); + PyDict_SetItemString(mpDictionary->ptr(), "TaskInterface", TaskInterfaceObject.ptr()); PyDict_SetItemString(mpDictionary->ptr(), "Y", PyInt_FromLong(2)); /* dict['Y']=2 */ Index: tcScenarioInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcScenarioInterface.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** tcScenarioInterface.cpp 31 Jan 2005 01:33:08 -0000 1.17 --- tcScenarioInterface.cpp 16 Feb 2005 23:13:49 -0000 1.18 *************** *** 46,49 **** --- 46,50 ---- #include "tcStores.h" #include "tcSubObject.h" + #include "ai/Brain.h" #include "wxcommands.h" *************** *** 51,54 **** --- 52,56 ---- using namespace std; using namespace boost::python; + using ai::Brain; #ifdef _DEBUG *************** *** 137,140 **** --- 139,143 ---- .def("AddUnitToAlliance",&tcScenarioInterface::AddUnitToAlliance) .def("AddUnitToFlightDeck",&tcScenarioInterface::AddUnitToFlightDeck) + .def("AddUnitTask", &tcScenarioInterface::AddUnitTask) .def("AddToUnitMagazine",&tcScenarioInterface::AddToUnitMagazine) .def("SetUnitLauncherItem",&tcScenarioInterface::SetUnitLauncherItem) *************** *** 322,325 **** --- 325,352 ---- } } + + /** + * Adds task to unit (newer AI system with parallel tasks) + * Logs error if unit is not eligible + */ + void tcScenarioInterface::AddUnitTask(const std::string& unitName, const std::string& taskName, + double priority) + { + wxASSERT(simState); + tcGameObject* parentObj = simState->GetObjectByName(unitName); + if (tcPlatformObject* platform = dynamic_cast<tcPlatformObject*>(parentObj)) + { + ai::Brain* brain = platform->GetBrain(); + wxASSERT(brain); + brain->AddTask(taskName, priority); + } + else + { + fprintf(stderr, "tcScenarioInterface::AddUnitTask - " + "Unit not found: %s\n", unitName.c_str()); + } + + } + /** |
Update of /cvsroot/gcblue/gcb_wx/include/ai In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15468/include/ai Modified Files: Blackboard.h BlackboardItem.h Brain.h Task.h Added Files: BlackboardInterface.h ScriptedTask.h ScriptedTaskInterface.h SelfPreservation.h Log Message: Parallel ai update Index: Blackboard.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/ai/Blackboard.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Blackboard.h 4 Feb 2005 18:50:46 -0000 1.1 --- Blackboard.h 16 Feb 2005 23:13:37 -0000 1.2 *************** *** 39,49 **** { public: - void EraseAll(); void Erase(const std::string& key, double priority); bool KeyExists(const std::string& key) const; BlackboardItem Read(const std::string& key); double ReadPriority(const std::string& key); ! void Write(const std::string& key, const BlackboardItem& item); ! void Write(const std::string& key, long author, double priority, const std::string& message); Blackboard(); --- 39,53 ---- { public: void Erase(const std::string& key, double priority); + void EraseAll(); + void EraseAllFromAuthor(long author); + bool KeyExists(const std::string& key) const; BlackboardItem Read(const std::string& key); + long ReadAuthor(const std::string& key); + const std::string ReadMessage(const std::string& key); double ReadPriority(const std::string& key); ! bool Write(const std::string& key, const BlackboardItem& item); ! bool Write(const std::string& key, long author, double priority, const std::string& message); Blackboard(); --- NEW FILE: BlackboardInterface.h --- /** ** @file BlackboardInterface.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 */ #ifndef _BLACKBOARDINTERFACE_H_ #define _BLACKBOARDINTERFACE_H_ #if _MSC_VER > 1000 #pragma once #endif #include <map> #include <string> #include <vector> namespace ai { class Blackboard; class BlackboardItem; /** * Class to interface with blackboard. Handles priority and * author aspects. */ class BlackboardInterface { public: void SetPriority(double priority_); BlackboardInterface GetBlackboardInterface(); long GetAuthor() const; /// blackboard interface void Erase(const std::string& key); bool KeyExists(const std::string& key) const; BlackboardItem Read(const std::string& key); long ReadAuthor(const std::string& key); const std::string ReadMessage(const std::string& key); double ReadPriority(const std::string& key); bool Write(const std::string& key, const std::string& message); BlackboardInterface(); BlackboardInterface(const BlackboardInterface& source); BlackboardInterface(Blackboard* bb, long author_, double priority_); ~BlackboardInterface(); protected: Blackboard* const board; const long author; double priority; static bool pythonInitialized; static void InitPython(); }; } #endif --- NEW FILE: ScriptedTask.h --- /** ** @file ScriptedTask.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 */ #ifndef _SCRIPTEDTASK_H_ #define _SCRIPTEDTASK_H_ #if _MSC_VER > 1000 #pragma once #endif #include "ai/Task.h" #include <map> #include <string> #include <vector> namespace ai { class Blackboard; /** * Task that is scripted through Python */ class ScriptedTask : public Task { public: const std::string& GetMemoryText(const std::string& key); void SetMemoryText(const std::string& key, const std::string& text); double GetMemoryValue(int key); void SetMemoryValue(int key, double value); void Update(double t); ScriptedTask(tcPlatformObject* platform_, Blackboard* bb, long id_, double priority_, const std::string& scriptName_); ~ScriptedTask(); protected: std::map<std::string, std::string> textMemory; std::map<int, double> numberMemory; const char* GetCommandString(); private: wxString commandString; }; } #endif --- NEW FILE: SelfPreservation.h --- /** ** @file SelfPreservation.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 */ #ifndef _SELFPRESERVATION_H_ #define _SELFPRESERVATION_H_ #if _MSC_VER > 1000 #pragma once #endif #include "ai/Task.h" #include <map> #include <string> #include <vector> class tcPlatformObject; namespace ai { /** * Basic self preservation behavior. Avoid crashing, run from * threats. */ class SelfPreservation : public Task { public: void Update(double t); void UpdateAir(double t); SelfPreservation(tcPlatformObject* platform_, Blackboard* bb, long id_, double priority_, const std::string& taskName_); ~SelfPreservation(); private: bool haveAltitudeControl; }; } #endif Index: Brain.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/ai/Brain.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Brain.h 8 Feb 2005 12:58:21 -0000 1.2 --- Brain.h 16 Feb 2005 23:13:38 -0000 1.3 *************** *** 33,36 **** --- 33,38 ---- #include "ai/Blackboard.h" + class tcPlatformObject; + namespace ai { *************** *** 48,57 **** { public: ! Brain(); ! ~Brain(); private: Blackboard board; ///< for inter-task communication std::map<std::string, Task*> taskMap; }; --- 50,78 ---- { public: ! /** task codes for C++ tasks */ ! enum ! { ! TEST_TASK = 0 ! }; ! void AddTask(const std::string& taskName, double priority_); ! void RemoveTask(const std::string& taskName); ! bool TaskExists(const std::string& taskName); + void Update(double t); + + Brain(tcPlatformObject* platform_); + ~Brain(); private: + tcPlatformObject* const platform; + const float updateInterval; + long nextId; ///< id assigned to next task + double lastUpdateTime; ///< last time tasks were updated + Blackboard board; ///< for inter-task communication std::map<std::string, Task*> taskMap; + + static std::map<std::string, int> taskNameLookup; + + static void InitTaskNameLookup(); }; --- NEW FILE: ScriptedTaskInterface.h --- /** ** @file ScriptedTaskInterface.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 */ #ifndef _SCRIPTEDTASKINTERFACE_H_ #define _SCRIPTEDTASKINTERFACE_H_ #if _MSC_VER > 1000 #pragma once #endif #include "ai/Task.h" #include <map> #include <string> #include <vector> namespace ScriptInterface { class tcPlatformInterface; } namespace ai { class BlackboardInterface; class ScriptedTask; /** * Interface for ScriptedTask passed to Python */ class ScriptedTaskInterface { public: BlackboardInterface GetBlackboardInterface(); tcPlatformInterface GetPlatformInterface(); void SetUpdateInterval(float interval); const std::string GetMemoryText(const std::string& key); void SetMemoryText(const std::string& key, const std::string& text); double GetMemoryValue(int key); void SetMemoryValue(int key, double value); void SetTask(ScriptedTask* scriptedTask); ScriptedTaskInterface(ScriptedTask* scriptedTask); ScriptedTaskInterface(); ~ScriptedTaskInterface(); protected: ScriptedTask* task; static bool pythonInitialized; static void InitPython(); }; } #endif Index: BlackboardItem.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/ai/BlackboardItem.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** BlackboardItem.h 4 Feb 2005 18:50:46 -0000 1.1 --- BlackboardItem.h 16 Feb 2005 23:13:38 -0000 1.2 *************** *** 38,42 **** { public: ! long author; ///< -1 for invalid, 0 for anonymous double priority; std::string message; --- 38,42 ---- { public: ! long author; ///< -1 for invalid double priority; std::string message; *************** *** 49,52 **** --- 49,55 ---- BlackboardItem(); ~BlackboardItem(); + + static bool pythonInitialized; + static void InitPython(); }; } Index: Task.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/ai/Task.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Task.h 8 Feb 2005 12:58:21 -0000 1.2 --- Task.h 16 Feb 2005 23:13:38 -0000 1.3 *************** *** 27,35 **** --- 27,44 ---- #endif + #include "ai/BlackboardInterface.h" + #include <map> #include <string> #include <vector> + namespace ScriptInterface + { + class tcPlatformInterface; + } + using ScriptInterface::tcPlatformInterface; + + class tcPlatformObject; namespace ai *************** *** 39,62 **** /** ! * */ ! class Task { public: ! std::map<std::string, std::string> textMemory; ! std::map<int, double> numberMemory; ! void SetBoard(Blackboard* bb); ! void SetId(long id_); ! void SetPriority(double priority_); ! Task(Blackboard* bb, long id_, double priority_); ! Task(); ! ~Task(); private: ! Blackboard* commBoard; ! double priority; ! long id; ! std::string scriptName; }; --- 48,77 ---- /** ! * Base class for ai tasks. Could also call these behaviors. */ ! class Task : public BlackboardInterface { public: ! tcPlatformInterface GetPlatformInterface(); ! ! void FinishUpdate(double t); ! bool IsReadyForUpdate(double t) const; ! void SetUpdateInterval(float interval); ! virtual void Update(double t); ! ! Task(tcPlatformObject* platform_, Blackboard* bb, ! long id_, double priority_, const std::string& taskName_); ! virtual ~Task(); ! ! protected: ! tcPlatformObject* const platform; ! ! const std::string taskName; ! private: ! double lastUpdateTime; ! float updateInterval; }; |
|
From: Dewitt C. <ddc...@us...> - 2005-02-16 23:13:47
|
Update of /cvsroot/gcblue/gcb_wx/include/scriptinterface In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15468/include/scriptinterface Modified Files: tcScenarioInterface.h tcSimPythonInterface.h Log Message: Parallel ai update Index: tcScenarioInterface.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/scriptinterface/tcScenarioInterface.h,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** tcScenarioInterface.h 27 Jan 2005 01:01:45 -0000 1.13 --- tcScenarioInterface.h 16 Feb 2005 23:13:38 -0000 1.14 *************** *** 93,96 **** --- 93,100 ---- unsigned int launcherIdx, const std::string& item, unsigned int quantity); + void AddUnitTask(const std::string& unitName, const std::string& taskName, + double priority); + + void CreateAlliance(int alliance, std::string name); tcOrder GetDefaultOrder(); Index: tcSimPythonInterface.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/scriptinterface/tcSimPythonInterface.h,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** tcSimPythonInterface.h 10 Jan 2005 00:30:20 -0000 1.19 --- tcSimPythonInterface.h 16 Feb 2005 23:13:38 -0000 1.20 *************** *** 43,47 **** class tcDirector; ! namespace Sensor { class tcAllianceSensorMap; } --- 43,48 ---- class tcDirector; ! namespace Sensor ! { class tcAllianceSensorMap; } *************** *** 51,54 **** --- 52,63 ---- using namespace Sensor; + namespace ai + { + class ScriptedTask; + class ScriptedTaskInterface; + } + using ai::ScriptedTask; + using ai::ScriptedTaskInterface; + /** * Embedded python scripting interface code. *************** *** 80,87 **** using namespace Sensor; class tcSimPythonInterface : public tcPythonInterface { public: - void CallPlatformScript(tcPlatformObject *apObj, char *azCommand); void SetUnitInfo(tcPlatformObject *apObj); void Test(); --- 89,98 ---- using namespace Sensor; + /** + * Singleton class + */ class tcSimPythonInterface : public tcPythonInterface { public: void SetUnitInfo(tcPlatformObject *apObj); void Test(); *************** *** 99,102 **** --- 110,115 ---- void BuildFlightPortPanel(); void CallPython(const char *commandtext, const char *errortext); + void CallPlatformScript(tcPlatformObject *apObj, const char* azCommand); + void CallTaskScript(ScriptedTask* task, const char* azCommand); void GetObjectStringByMode(char *str); // gets name of python object to pass to python function void LoadScenario(const char *filePath, const char *fileName); ///< loads scenario from Python script file *************** *** 121,127 **** void SetMenuGroup(const std::vector<long>& unitIds); ! tcSimPythonInterface(); ! virtual ~tcSimPythonInterface(); private: object PlatformInterface; ///< python tcPlatformInterface tcPlatformInterface *platformInterface; ///< C++ handle to PlatformInterface --- 134,143 ---- void SetMenuGroup(const std::vector<long>& unitIds); ! static tcSimPythonInterface* Get(); ///< singleton accessor ! private: + tcSimPythonInterface(); + ~tcSimPythonInterface(); + object PlatformInterface; ///< python tcPlatformInterface tcPlatformInterface *platformInterface; ///< C++ handle to PlatformInterface *************** *** 148,151 **** --- 164,170 ---- tcSoundConsole *mpConsole; + ScriptedTaskInterface* taskInterface; + object TaskInterfaceObject; + enum teInterfaceMode { |