[Gcblue-commits] gcb_wx/include/sim tcCommandQueue.h,NONE,1.1 tcSensorTrackIterator.h,NONE,1.1 Game.
Status: Alpha
Brought to you by:
ddcforge
Update of /cvsroot/gcblue/gcb_wx/include/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30338/include/sim Modified Files: Game.h commandlist.h tcCustomControl.h tcObjectControl.h tcRadar.h tcSimState.h Added Files: tcCommandQueue.h tcSensorTrackIterator.h Log Message: Sonar work, passive sonar, torpedoes --- NEW FILE: tcCommandQueue.h --- /** ** @file tcCommandQueue.h */ /* Copyright (C) 2003-2004 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 _COMMANDQUEUE_H_ #define _COMMANDQUEUE_H_ #if _MSC_VER > 1000 #pragma once #endif #include "commandlist.h" /** * Converted into singleton class * Holdover from old code, needs cleaning */ class tcCommandQueue { public: enum {MAX_QUEUED_COMMANDS = 32}; tsCommandInfo maCommand[MAX_QUEUED_COMMANDS]; unsigned mnCount; void AddCommand(const tsCommandInfo& newcmd); void AddCommand(teGameCommand aeCmd, float afData, long anData, int anData2 = 0); void AddCommand(const char *azCommand, int param = -1); void AddPythonCommand(const char *azCommand, int param = -1); void AddPythonCommand(const char *azCommand, std::string textParam); void GetUserInput(const char *azCallback, const char *azUserInput, int param = -1) ; void GetUserInputForID(const char *azCallback, const char *azUserInput, long platformID, int param = -1) ; void AddPythonCallback(const char *azCallback, const char *azUserInput, int param = -1) ; void AddPythonCallbackForID(const char *azCallback, const char *azUserInput, long platformID, int param = -1) ; void DisplayInfoMessage(const char *azString); bool GetCommand(tsCommandInfo& newcmd); static tcCommandQueue* Get(); ///< singleton accessor private: tcCommandQueue(); ~tcCommandQueue(); }; #endif Index: tcObjectControl.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcObjectControl.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** tcObjectControl.h 2 Dec 2004 04:17:24 -0000 1.11 --- tcObjectControl.h 11 Dec 2004 01:09:05 -0000 1.12 *************** *** 45,48 **** --- 45,49 ---- class tcGameObject; class tcControl; + class tcCommandQueue; namespace osg *************** *** 162,167 **** public: void Draw(); - void AttachSimState(tcSimState *apSS) {mpSS=apSS;} - void AttachCommandInterface(tcCommandQueue *apCommandInterface) {mpCommandInterface=apCommandInterface;} void AttachUserInfo(tcUserInfo *apUserInfo) {mpUserInfo=apUserInfo;} bool ButtonContainingPoint(wxPoint point, int& rnRow, int& rnColumn); --- 163,166 ---- Index: commandlist.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/commandlist.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** commandlist.h 2 Dec 2004 04:17:24 -0000 1.5 --- commandlist.h 11 Dec 2004 01:09:05 -0000 1.6 *************** *** 1,4 **** ! /* ! ** Copyright (C) 2003 Dewitt Colclough (de...@tw...) ** All rights reserved. --- 1,6 ---- ! /** ! ** @file commandlist.h ! */ ! /* Copyright (C) 2003 Dewitt Colclough (de...@tw...) ** All rights reserved. *************** *** 22,26 **** #define _COMMANDLIST_H_ ! typedef enum _gamecommand { GC_NULL, GC_QUIT, --- 24,38 ---- #define _COMMANDLIST_H_ ! #if _MSC_VER > 1000 ! #pragma once ! #endif ! ! #include <string> ! ! /** ! * ! */ ! enum teGameCommand ! { GC_NULL, GC_QUIT, *************** *** 45,51 **** PC_LAUNCH, PC_DELETE ! } teGameCommand; - #define MAX_QUEUED_COMMANDS 32 /** --- 57,62 ---- PC_LAUNCH, PC_DELETE ! }; /** *************** *** 64,208 **** bool mbGetUserInput; std::string textParam; ///< string parameter for python }; - class tcCommandQueue - { - public: - tsCommandInfo maCommand[MAX_QUEUED_COMMANDS]; - unsigned mnCount; - - void AddCommand(const tsCommandInfo& newcmd) { - if (mnCount < MAX_QUEUED_COMMANDS) { - maCommand[mnCount++] = newcmd; - } - } - void AddCommand(teGameCommand aeCmd, float afData, long anData, int anData2 = 0) { - tsCommandInfo newcmd; - newcmd.meCmd = aeCmd; - newcmd.mfData = afData; - newcmd.mnData = anData; - newcmd.mnData2 = anData2; - newcmd.mbUsePython = false; - newcmd.mbCallback = false; - newcmd.mbGetUserInput = false; - if (mnCount < MAX_QUEUED_COMMANDS) { - maCommand[mnCount++] = newcmd; - } - } - // For string commands - void AddCommand(const char *azCommand, int param = -1) { - tsCommandInfo newcmd; - newcmd.meCmd = GC_TEXTCOMMAND; - newcmd.mbUsePython = false; - newcmd.mbCallback = false; - newcmd.mbGetUserInput = false; - newcmd.mnData = param; - strcpy(newcmd.mzString , azCommand); - strcpy(newcmd.mzUserInput, ""); - if (mnCount < MAX_QUEUED_COMMANDS) { - maCommand[mnCount++] = newcmd; - } - } - /** - * version without user input and callback - */ - void AddPythonCommand(const char *azCommand, int param = -1) - { - tsCommandInfo newcmd; - newcmd.meCmd = (teGameCommand)0; - newcmd.mbUsePython = true; - newcmd.mbCallback = false; - newcmd.mbGetUserInput = false; - newcmd.mnData = param; // int param - newcmd.textParam = ""; // text param - strcpy(newcmd.mzString , azCommand); - strcpy(newcmd.mzUserInput, ""); - if (mnCount < MAX_QUEUED_COMMANDS) { - maCommand[mnCount++] = newcmd; - } - } - - /** - * version without user input and callback - */ - void AddPythonCommand(const char *azCommand, std::string textParam) - { - tsCommandInfo newcmd; - newcmd.meCmd = (teGameCommand)0; - newcmd.mbUsePython = true; - newcmd.mbCallback = false; - newcmd.mbGetUserInput = false; - newcmd.mnData = -1; // int param - newcmd.textParam = textParam; - strcpy(newcmd.mzString , azCommand); - strcpy(newcmd.mzUserInput, ""); - if (mnCount < MAX_QUEUED_COMMANDS) { - maCommand[mnCount++] = newcmd; - } - } - - - /* GetUserInput is called to add a command to get user input data. - ** Once the user input is complete, the callback function is called though - ** AddPythonCallback. Data that describes the user input is passed to the - ** callback function along with an optional parameter. - */ - void GetUserInput(const char *azCallback, const char *azUserInput, int param = -1) - { - tsCommandInfo newcmd; - newcmd.meCmd = (teGameCommand)0; - newcmd.mbUsePython = true; - newcmd.mbCallback = false; - newcmd.mbGetUserInput = true; - newcmd.mnData = param; - newcmd.textParam = ""; - strcpy(newcmd.mzString , azCallback); - strcpy(newcmd.mzUserInput, azUserInput); - if (mnCount < MAX_QUEUED_COMMANDS) { - maCommand[mnCount++] = newcmd; - } - } - /** - * version for callback - */ - void AddPythonCallback(const char *azCallback, const char *azUserInput, int param = -1) - { - tsCommandInfo newcmd; - newcmd.meCmd = (teGameCommand)0; - newcmd.mbUsePython = true; - newcmd.mbCallback = true; - newcmd.mbGetUserInput = false; - newcmd.mnData = param; - newcmd.textParam = ""; - strcpy(newcmd.mzString , azCallback); - strcpy(newcmd.mzUserInput, azUserInput); - - if (mnCount < MAX_QUEUED_COMMANDS) { - maCommand[mnCount++] = newcmd; - } - } - // for sending messages - void DisplayInfoMessage(const char *azString) { - tsCommandInfo newcmd; - newcmd.meCmd = GC_DISPLAYMESSAGE; - newcmd.mbUsePython = false; - strcpy(newcmd.mzString, azString); - if (mnCount < MAX_QUEUED_COMMANDS) { - maCommand[mnCount++] = newcmd; - } - } - - bool GetCommand(tsCommandInfo& newcmd) { - if (mnCount == 0) { - newcmd.meCmd = GC_NULL; - return false; - } - else { - newcmd = maCommand[--mnCount]; - return true; - } - } - tcCommandQueue() {mnCount = 0;} - }; --- 75,81 ---- bool mbGetUserInput; std::string textParam; ///< string parameter for python + long platformID; ///< -1 to use current hooked }; Index: tcRadar.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcRadar.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** tcRadar.h 2 Dec 2004 04:17:24 -0000 1.12 --- tcRadar.h 11 Dec 2004 01:09:05 -0000 1.13 *************** *** 1,20 **** /* ! * Copyright (C) 2003 Dewitt Colclough (de...@tw...) ! * All rights reserved. ! * ! * This file is part of the Global Conflict Blue (GCB) program. ! * GCB is free software; you can redistribute it and/or modify ! * it under the terms of version 2 of the GNU General Public License as ! * published by the Free Software Foundation. ! * ! * GCB is distributed in the hope that it will be useful, ! * but WITHOUT ANY WARRANTY; without even the implied warranty of ! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! * GNU General Public License for more details. ! * ! * You should have received a copy of the GNU General Public License ! * along with GCB; if not, write to the Free Software ! * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! */ #if _MSC_VER > 1000 --- 1,23 ---- + /** + ** @file tcRadar.h + */ /* ! ** Copyright (C) 2003-2004 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 ! */ #if _MSC_VER > 1000 Index: tcCustomControl.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcCustomControl.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** tcCustomControl.h 17 Aug 2004 02:22:56 -0000 1.5 --- tcCustomControl.h 11 Dec 2004 01:09:05 -0000 1.6 *************** *** 27,33 **** --- 27,35 ---- #include "tcwindow.h" #include "commandlist.h" + #include "tcCommandQueue.h" #include "aerror.h" + class tcCustomControl : public tcWindow { Index: tcSimState.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcSimState.h,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** tcSimState.h 5 Dec 2004 02:49:46 -0000 1.31 --- tcSimState.h 11 Dec 2004 01:09:05 -0000 1.32 *************** *** 61,64 **** --- 61,65 ---- using namespace ScriptInterface; + class tcCommandQueue; class tcGoalTracker; class tcStream; Index: Game.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/Game.h,v retrieving revision 1.50 retrieving revision 1.51 diff -C2 -d -r1.50 -r1.51 *** Game.h 14 Nov 2004 22:52:20 -0000 1.50 --- Game.h 11 Dec 2004 01:09:05 -0000 1.51 *************** *** 53,56 **** --- 53,57 ---- } + class tcCommandQueue; class tcHookInfo; class tcOOBView; *************** *** 163,167 **** tcSimState* simState; tcMapData mcMapData; ! tcCommandQueue mcCommandQueue; tcSimPythonInterface* pythonInterface; tcUserInfo mcUserInfo; --- 164,168 ---- tcSimState* simState; tcMapData mcMapData; ! tcCommandQueue* commandQueue; tcSimPythonInterface* pythonInterface; tcUserInfo mcUserInfo; *************** *** 230,234 **** bool Finish(); teMenuMode GetMenuMode(); ! void GetUserInput(char *azCallback, char *azUserInput, int param = -1); ///< for python interface void Init(); ///< basic initialization and start screen init bool InitGame(); ///< game initialization called prior to starting game --- 231,235 ---- bool Finish(); teMenuMode GetMenuMode(); ! void GetUserInput(char *azCallback, char *azUserInput, long id, int param = -1); ///< for python interface void Init(); ///< basic initialization and start screen init bool InitGame(); ///< game initialization called prior to starting game *************** *** 249,253 **** void OnPaint(wxPaintEvent& event); void OnRButtonDown(wxMouseEvent& event); ! void ProcessCallback(char *azCallback, char *azUserInput, int param = -1); ///< for python interface void ProcessCommandList(); void ProcessEsc(); --- 250,254 ---- void OnPaint(wxPaintEvent& event); void OnRButtonDown(wxMouseEvent& event); ! void ProcessCallback(char *azCallback, char *azUserInput, long id, int param = -1); ///< for python interface void ProcessCommandList(); void ProcessEsc(); --- NEW FILE: tcSensorTrackIterator.h --- /** ** @file tcSensorTrackIterator.h */ /* ** Copyright (C) 2004 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 _SENSORTRACKITERATOR_H_ #define _SENSORTRACKITERATOR_H_ #if _MSC_VER > 1000 #pragma once #endif #include "simmath.h" class tcSimState; namespace Sensor { class tcSensorMapTrack; class tcAllianceSensorMap; /** * This should subsume tcTrackIterator * @see tcTrackIterator */ class tcSensorTrackIterator { public: void First(); tcSensorMapTrack* Get(); void Next(); bool NotDone(); tcSensorTrackIterator(unsigned int alliance_, unsigned int classificationMask, const tcGeoRect& filterRegion); tcSensorTrackIterator(); virtual ~tcSensorTrackIterator(); private: static tcSimState *simState; tcAllianceSensorMap* map; long firstPos; ///< index of first game object, last advances to first long currentPos; ///< current position index for pool tcSensorMapTrack* currentObj; bool useRegion; tcGeoRect region; unsigned int classMask; unsigned int alliance; unsigned nIterated; ///< count of elements iterated unsigned nSize; ///< size of list bool PassesFilter(const tcSensorMapTrack* track); }; } #endif |