gcblue-commits Mailing List for Global Conflict Blue (Page 18)
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-09-16 00:16:16
|
Update of /cvsroot/gcblue/gcb_wx In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24731 Modified Files: GCblue.vcproj Log Message: Upgraded to Sqlite 3.2.5 Index: GCblue.vcproj =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/GCblue.vcproj,v retrieving revision 1.98 retrieving revision 1.99 diff -C2 -d -r1.98 -r1.99 *** GCblue.vcproj 10 Sep 2005 21:50:34 -0000 1.98 --- GCblue.vcproj 16 Sep 2005 00:16:08 -0000 1.99 *************** *** 719,729 **** Filter=""> <File ! RelativePath=".\src\sqlite\sqlite_connection.cpp"> </File> <File ! RelativePath=".\src\sqlite\sqlite_internal.cpp"> </File> <File ! RelativePath=".\src\sqlite\sqlite_reader.cpp"> </File> </Filter> --- 719,735 ---- Filter=""> <File ! RelativePath=".\src\sqlite\sqlite3x_command.cpp"> </File> <File ! RelativePath=".\src\sqlite\sqlite3x_connection.cpp"> </File> <File ! RelativePath=".\src\sqlite\sqlite3x_exception.cpp"> ! </File> ! <File ! RelativePath=".\src\sqlite\sqlite3x_reader.cpp"> ! </File> ! <File ! RelativePath=".\src\sqlite\sqlite3x_transaction.cpp"> </File> </Filter> *************** *** 1752,1759 **** Filter=""> <File ! RelativePath=".\include\sqlite\sqlite_internal.h"> ! </File> ! <File ! RelativePath=".\include\sqlite\sqlite_plus.h"> </File> </Filter> --- 1758,1762 ---- Filter=""> <File ! RelativePath=".\include\sqlite\sqlite3x.hpp"> </File> </Filter> |
|
From: Dewitt C. <ddc...@us...> - 2005-09-16 00:16:16
|
Update of /cvsroot/gcblue/gcb_wx/docs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24731/docs Modified Files: BUILDING.txt Log Message: Upgraded to Sqlite 3.2.5 Index: BUILDING.txt =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/docs/BUILDING.txt,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** BUILDING.txt 14 Sep 2005 01:33:23 -0000 1.5 --- BUILDING.txt 16 Sep 2005 00:16:08 -0000 1.6 *************** *** 1,3 **** ! Updated June 2005 --- Download information --- --- 1,3 ---- ! Updated September 2005 --- Download information --- |
|
From: Dewitt C. <ddc...@us...> - 2005-09-16 00:16:16
|
Update of /cvsroot/gcblue/gcb_wx/database In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24731/database Modified Files: database.db Log Message: Upgraded to Sqlite 3.2.5 Index: database.db =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/database/database.db,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 Binary files /tmp/cvs4q8HyA and /tmp/cvsweuX0r differ |
|
From: Dewitt C. <ddc...@us...> - 2005-09-14 01:33:33
|
Update of /cvsroot/gcblue/gcb_wx/src/graphics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3870/src/graphics Modified Files: tc3DViewer.cpp tc3DWindow.cpp tcConsoleBox.cpp Added Files: tcBriefingView.cpp Log Message: Updates for wxWidgets 2.6.1 compatibility Index: tcConsoleBox.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcConsoleBox.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** tcConsoleBox.cpp 10 Sep 2005 21:47:38 -0000 1.15 --- tcConsoleBox.cpp 14 Sep 2005 01:33:24 -0000 1.16 *************** *** 33,36 **** --- 33,39 ---- #endif + using std::min; + using std::max; + *************** *** 175,179 **** if (lineOffset + MIN_LINES_DISPLAY > nLines) { ! nLines = min(nLines, MIN_LINES_DISPLAY); } else --- 178,182 ---- if (lineOffset + MIN_LINES_DISPLAY > nLines) { ! nLines = min(nLines, (unsigned int)MIN_LINES_DISPLAY); } else Index: tc3DViewer.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tc3DViewer.cpp,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** tc3DViewer.cpp 10 Sep 2005 21:47:38 -0000 1.26 --- tc3DViewer.cpp 14 Sep 2005 01:33:24 -0000 1.27 *************** *** 76,79 **** --- 76,81 ---- #endif + using std::min; + using std::max; BEGIN_EVENT_TABLE(tc3DViewer, wxWindow) Index: tc3DWindow.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tc3DWindow.cpp,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** tc3DWindow.cpp 10 Sep 2005 21:47:38 -0000 1.25 --- tc3DWindow.cpp 14 Sep 2005 01:33:24 -0000 1.26 *************** *** 57,61 **** BEGIN_EVENT_TABLE(tc3DWindow, wxWindow) EVT_PAINT(tc3DWindow::OnPaint) ! EVT_NC_PAINT(tc3DWindow::OnPaint) EVT_ERASE_BACKGROUND(tc3DWindow::OnEraseBackground) EVT_MOVE(tc3DWindow::OnMove) --- 57,61 ---- BEGIN_EVENT_TABLE(tc3DWindow, wxWindow) EVT_PAINT(tc3DWindow::OnPaint) ! EVT_NC_PAINT(tc3DWindow::OnNcPaint) EVT_ERASE_BACKGROUND(tc3DWindow::OnEraseBackground) EVT_MOVE(tc3DWindow::OnMove) *************** *** 123,126 **** --- 123,131 ---- } + void tc3DWindow::OnNcPaint(wxNcPaintEvent& event) + { + wxPaintDC dc(this); + } + /** * Do nothing for OnPaint event. --- NEW FILE: tcBriefingView.cpp --- /** ** @file tcBriefingView.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 "tcBriefingView.h" #include "tcSimPythonInterface.h" #include "tcScenarioInterface.h" #include "common/tinyxml.h" #include "tcUserInfo.h" BEGIN_EVENT_TABLE(tcBriefingView, tcXmlWindow) END_EVENT_TABLE() #ifdef _DEBUG #define new DEBUG_NEW #endif using scriptinterface::tcSimPythonInterface; using scriptinterface::tcScenarioInterface; void tcBriefingView::Draw() { tcScenarioInterface* scenarioInterface = tcSimPythonInterface::Get()->GetScenarioInterface(); wxASSERT(scenarioInterface); osg::Vec4 color(0.6f, 1, 0.6f, 1); int userAlliance = tcUserInfo::Get()->GetOwnAlliance(); const std::string& briefingText = scenarioInterface->GetSimpleBriefing(userAlliance); float x = 55.0f; float y = 150.0f; float fontSize; if (mnWidth > 1200) { fontSize = 18.0f; } else if (mnWidth > 1000) { fontSize = 16.0f; } else { fontSize = 14.0f; } DrawTextR(briefingText.c_str(), x, y, defaultFont.get(), color, fontSize, LEFT_BASE_LINE); DrawChildren(); HideUnusedObjects(); } /** * @param surfaceHost tcWindow to share surface of */ tcBriefingView::tcBriefingView(wxWindow *parent, const wxPoint& pos, const wxSize& size, const wxString& name) : tcXmlWindow(parent, pos, size, "xml/briefing_view.xml", name) { if (config == 0) { fprintf(stderr, "tcBriefingView::tcBriefingView - NULL xml config node\n"); return; } /* TiXmlNode* root = config->FirstChild("Window"); if (!root) { std::cerr << "tcBriefingView::tcBriefingView - Missing top level <Window> tag\n"; return; } */ } tcBriefingView::~tcBriefingView() { } |
|
From: Dewitt C. <ddc...@us...> - 2005-09-14 01:33:33
|
Update of /cvsroot/gcblue/gcb_wx/include/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3870/include/sim Modified Files: Game.h gcb.h Log Message: Updates for wxWidgets 2.6.1 compatibility Index: Game.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/Game.h,v retrieving revision 1.61 retrieving revision 1.62 diff -C2 -d -r1.61 -r1.62 *** Game.h 10 Sep 2005 21:48:06 -0000 1.61 --- Game.h 14 Sep 2005 01:33:24 -0000 1.62 *************** *** 257,260 **** --- 257,261 ---- void OnMouseMove(wxMouseEvent& event); void OnMouseWheel(wxMouseEvent& event); + void OnNcPaint(wxNcPaintEvent& event); void OnPaint(wxPaintEvent& event); void OnRButtonDown(wxMouseEvent& event); Index: gcb.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/gcb.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** gcb.h 20 Feb 2005 21:54:32 -0000 1.8 --- gcb.h 14 Sep 2005 01:33:24 -0000 1.9 *************** *** 26,32 **** #include "wx/wx.h" - #ifdef WIN32 - #include "wx/msw/private.h" // for MS Windows specific definitions - #endif class tcGame; --- 26,29 ---- *************** *** 51,54 **** --- 48,52 ---- tcGame *gameFrame; ///< main game frame object with game loop, holds all subwindows bool closeApp; + wxEventLoop *eventLoop; void DoMessage(WXMSG *pMsg); |
|
From: Dewitt C. <ddc...@us...> - 2005-09-14 01:33:32
|
Update of /cvsroot/gcblue/gcb_wx/docs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3870/docs Modified Files: BUILDING.txt Log Message: Updates for wxWidgets 2.6.1 compatibility Index: BUILDING.txt =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/docs/BUILDING.txt,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** BUILDING.txt 8 Jun 2005 21:58:08 -0000 1.4 --- BUILDING.txt 14 Sep 2005 01:33:23 -0000 1.5 *************** *** 17,21 **** Follow links to Sourceforge download page ! * wxWidgets 2.4.2 http://www.wxwidgets.org --- 17,21 ---- Follow links to Sourceforge download page ! * wxWidgets 2.6.1 http://www.wxwidgets.org *************** *** 41,45 **** Library Nominal installation path ------------------ ----------------------- ! wxWidgets-2.4.2 C:\wxWindows-2.4.2 OpenSceneGraph-0.9.8-2 C:\OpenSceneGraph-0.9.8-2 OpenThreads-v1.2dev3-osg0.9.6 C:\OpenThreads-v1.2dev3-osg0.9.6 --- 41,45 ---- Library Nominal installation path ------------------ ----------------------- ! wxWidgets-2.6.1 C:\wxWidgets-2.6.1 OpenSceneGraph-0.9.8-2 C:\OpenSceneGraph-0.9.8-2 OpenThreads-v1.2dev3-osg0.9.6 C:\OpenThreads-v1.2dev3-osg0.9.6 *************** *** 58,63 **** C:\3rdParty\include ! C:\wxWindows-2.4.2\include ! C:\wxWindows-2.4.2\lib\msw C:\OSG_OP_OT-0.9.8-2\OpenSceneGraph\include C:\OSG_OP_OT-0.9.8-2\OpenThreads\include --- 58,63 ---- C:\3rdParty\include ! C:\wxWidgets-2.6.1\include ! C:\wxWidgets-2.6.1\lib\msw C:\OSG_OP_OT-0.9.8-2\OpenSceneGraph\include C:\OSG_OP_OT-0.9.8-2\OpenThreads\include *************** *** 74,78 **** C:\3rdParty\lib C:\OSG_OP_OT-0.9.8-2\OpenThreads\lib\win32 ! C:\wxWindows-2.4.1\lib C:\OSG_OP_OT-0.9.8-2\OpenSceneGraph\lib C:\openal\lib --- 74,78 ---- C:\3rdParty\lib C:\OSG_OP_OT-0.9.8-2\OpenThreads\lib\win32 ! C:\wxWidgets-2.6.1\lib C:\OSG_OP_OT-0.9.8-2\OpenSceneGraph\lib C:\openal\lib *************** *** 163,171 **** ! * Build wxWidgets 2.4.2 (formerly known as wxWindows) - Project file is at src/wxWindows.dsw ! - In wxWindows project, open Headers/Setup/setup.h and change line 782 to read: #define wxUSE_GLCANVAS 1 --- 163,171 ---- ! * Build wxWidgets 2.6.1 - Project file is at src/wxWindows.dsw ! - In wxWindows project, open Headers/Setup/setup.h and change line 885 #define wxUSE_GLCANVAS 1 *************** *** 179,184 **** This is a workaround to stop flicker. Since wxWindows / wxWidgets is not ! used for drawing, it is safe to disable this code. Should get this added ! as a flag to wxWidgets. - Build Debug and Release configs for all projects in solution --- 179,184 ---- This is a workaround to stop flicker. Since wxWindows / wxWidgets is not ! used for drawing, it is safe to disable this code. I'm not sure if this is still ! required for 2.6.1. - Build Debug and Release configs for all projects in solution |
|
From: Dewitt C. <ddc...@us...> - 2005-09-14 01:33:32
|
Update of /cvsroot/gcblue/gcb_wx/src/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3870/src/sim Modified Files: Game.cpp gcb.cpp tcHeloObject.cpp tcLauncher.cpp tcMapData.cpp Log Message: Updates for wxWidgets 2.6.1 compatibility Index: tcLauncher.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcLauncher.cpp,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** tcLauncher.cpp 10 Sep 2005 21:47:38 -0000 1.29 --- tcLauncher.cpp 14 Sep 2005 01:33:24 -0000 1.30 *************** *** 21,24 **** --- 21,29 ---- #include "stdwx.h" // precompiled header file + + #ifndef WX_PRECOMP + #include "wx/wx.h" + #endif // WX_PRECOMP + #include "tcLauncher.h" #include "tcDatabase.h" *************** *** 38,41 **** --- 43,49 ---- #endif + using std::max; + using std::min; + tcSimState* tcLauncher::simState = 0; Index: tcHeloObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcHeloObject.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** tcHeloObject.cpp 10 Sep 2005 21:47:38 -0000 1.7 --- tcHeloObject.cpp 14 Sep 2005 01:33:24 -0000 1.8 *************** *** 33,36 **** --- 33,39 ---- #endif + using std::min; + using std::max; + void tcHeloObject::Clear() { Index: tcMapData.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcMapData.cpp,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** tcMapData.cpp 20 Jul 2005 16:24:54 -0000 1.24 --- tcMapData.cpp 14 Sep 2005 01:33:24 -0000 1.25 *************** *** 22,25 **** --- 22,29 ---- #include "stdwx.h" + #ifndef WX_PRECOMP + #include "wx/wx.h" + #endif + #include "tcMapData.h" #include "aerror.h" *************** *** 33,36 **** --- 37,42 ---- #endif + using std::max; + using std::min; tcMapData* tcMapData::Get() *************** *** 198,205 **** if (rSource.top != 0) {rSource.top--;} if (rSource.bottom < (M_HIGHRES - 1)) {rSource.bottom++;} ! rSource.top = max(rSource.top,0); ! rSource.bottom = min(rSource.bottom,M_HIGHRES); ! rSource.left = max(rSource.left,0); ! rSource.right = min(rSource.right,N_HIGHRES); if (bJitterPatch) {if ((rSource.left % 16 ==0)&&(rSource.left>0)) {rSource.left--;rSource.right--;}} --- 204,211 ---- if (rSource.top != 0) {rSource.top--;} if (rSource.bottom < (M_HIGHRES - 1)) {rSource.bottom++;} ! rSource.top = max((int)rSource.top,0); ! rSource.bottom = min((int)rSource.bottom,M_HIGHRES); ! rSource.left = max((int)rSource.left,0); ! rSource.right = min((int)rSource.right,N_HIGHRES); if (bJitterPatch) {if ((rSource.left % 16 ==0)&&(rSource.left>0)) {rSource.left--;rSource.right--;}} *************** *** 259,265 **** ** This started happening after switching the terrain map to use osg::Texture */ ! nRed = min(128,nRed+80); ! nGreen = min(128,nGreen+80); ! nBlue = min(128,nBlue+60); maPalette1[k] = nRed + (nGreen << 8) + (nBlue << 16) + alpha_val; --- 265,271 ---- ** This started happening after switching the terrain map to use osg::Texture */ ! nRed = min((unsigned int)128, nRed+80); ! nGreen = min((unsigned int)128,nGreen+80); ! nBlue = min((unsigned int)128,nBlue+60); maPalette1[k] = nRed + (nGreen << 8) + (nBlue << 16) + alpha_val; Index: gcb.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/gcb.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** gcb.cpp 20 Feb 2005 21:54:35 -0000 1.18 --- gcb.cpp 14 Sep 2005 01:33:24 -0000 1.19 *************** *** 22,25 **** --- 22,26 ---- #include "stdwx.h" // precompiled header file + #ifndef WX_PRECOMP #include "wx/wx.h" *************** *** 30,33 **** --- 31,35 ---- #include "wx/dir.h" + #include "wx/evtloop.h" #include "gcb.h" *************** *** 48,51 **** --- 50,57 ---- FILE *errStream, *outStream; ///< for redirecting stderr, stdout + #ifdef _DEBUG + #define new DEBUG_NEW + #endif + /** * tcGame seems to be skipped for key events, this is a workaround *************** *** 126,130 **** int GcbApp::MainLoop() { ! m_keepGoing = TRUE; while (m_keepGoing) --- 132,136 ---- int GcbApp::MainLoop() { ! bool m_keepGoing = TRUE; while (m_keepGoing) *************** *** 152,156 **** } ! return ((MSG*)current_msg)->wParam; } --- 158,162 ---- } ! return 0; // ((MSG*)current_msg)->wParam; } *************** *** 180,183 **** --- 186,193 ---- gameFrame->Show(true); SetTopWindow(gameFrame); + + eventLoop = new wxEventLoop(); + wxEventLoop::SetActive(eventLoop); + } catch (...) *************** *** 212,215 **** --- 222,228 ---- WTL("FCLOSE"); // special string to close file + delete eventLoop; + eventLoop = 0; + return wxApp::OnExit(); } Index: Game.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/Game.cpp,v retrieving revision 1.140 retrieving revision 1.141 diff -C2 -d -r1.140 -r1.141 *** Game.cpp 10 Sep 2005 21:47:38 -0000 1.140 --- Game.cpp 14 Sep 2005 01:33:24 -0000 1.141 *************** *** 77,81 **** BEGIN_EVENT_TABLE(tcGame, wxFrame) EVT_PAINT(tcGame::OnPaint) ! EVT_NC_PAINT(tcGame::OnPaint) EVT_ERASE_BACKGROUND(tcGame::OnEraseBackground) EVT_LEFT_DOWN(tcGame::OnLButtonDown) --- 77,81 ---- BEGIN_EVENT_TABLE(tcGame, wxFrame) EVT_PAINT(tcGame::OnPaint) ! EVT_NC_PAINT(tcGame::OnNcPaint) EVT_ERASE_BACKGROUND(tcGame::OnEraseBackground) EVT_LEFT_DOWN(tcGame::OnLButtonDown) *************** *** 1974,1977 **** --- 1974,1982 ---- void tcGame::OnMouseWheel(wxMouseEvent& event) {} + void tcGame::OnNcPaint(wxNcPaintEvent& event) + { + wxPaintDC dc(this); + } + void tcGame::OnPaint(wxPaintEvent& event) { |
|
From: Dewitt C. <ddc...@us...> - 2005-09-14 01:33:32
|
Update of /cvsroot/gcblue/gcb_wx/include/graphics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3870/include/graphics Modified Files: tc3DWindow.h Added Files: tcBriefingView.h Log Message: Updates for wxWidgets 2.6.1 compatibility Index: tc3DWindow.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/graphics/tc3DWindow.h,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** tc3DWindow.h 16 Jul 2005 23:10:59 -0000 1.17 --- tc3DWindow.h 14 Sep 2005 01:33:24 -0000 1.18 *************** *** 30,33 **** --- 30,34 ---- #include "wx/wx.h" #endif + #include <wx/event.h> #include <queue> *************** *** 269,272 **** --- 270,274 ---- virtual void OnMouseWheel(wxMouseEvent& event); virtual void OnMove(wxMoveEvent& event); + void OnNcPaint(wxNcPaintEvent& event); void OnPaint(wxPaintEvent& event); virtual void OnRButtonDown(wxMouseEvent& event); --- NEW FILE: tcBriefingView.h --- /** ** @file tcBriefingView.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 _BRIEFINGVIEW_H_ #define _BRIEFINGVIEW_H_ #if _MSC_VER > 1000 #pragma once #endif #include "wx/wx.h" #include "tcXmlWindow.h" /** * Window to display simple briefing text */ class tcBriefingView : public tcXmlWindow { public: void Draw(); tcBriefingView(wxWindow *parent, const wxPoint& pos, const wxSize& size, const wxString& name = "BriefingView"); virtual ~tcBriefingView(); private: DECLARE_EVENT_TABLE() }; #endif |
|
From: Dewitt C. <ddc...@us...> - 2005-09-10 21:53:12
|
Update of /cvsroot/gcblue/gcb_wx/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2302/scripts Added Files: random.py types.py Log Message: GCB 0.8.0 release --- NEW FILE: random.py --- """Random variable generators. integers -------- uniform within range sequences --------- pick random element pick random sample generate random permutation distributions on the real line: ------------------------------ uniform normal (Gaussian) lognormal negative exponential gamma beta pareto Weibull distributions on the circle (angles 0 to 2pi) --------------------------------------------- circular uniform von Mises General notes on the underlying Mersenne Twister core generator: * The period is 2**19937-1. * It is one of the most extensively tested generators in existence * Without a direct way to compute N steps forward, the semantics of jumpahead(n) are weakened to simply jump to another distant state and rely on the large period to avoid overlapping sequences. * The random() method is implemented in C, executes in a single Python step, and is, therefore, threadsafe. """ from types import BuiltinMethodType as _BuiltinMethodType from math import log as _log, exp as _exp, pi as _pi, e as _e from math import sqrt as _sqrt, acos as _acos, cos as _cos, sin as _sin from math import floor as _floor __all__ = ["Random","seed","random","uniform","randint","choice","sample", "randrange","shuffle","normalvariate","lognormvariate", "cunifvariate","expovariate","vonmisesvariate","gammavariate", "stdgamma","gauss","betavariate","paretovariate","weibullvariate", "getstate","setstate","jumpahead", "WichmannHill"] NV_MAGICCONST = 4 * _exp(-0.5)/_sqrt(2.0) TWOPI = 2.0*_pi LOG4 = _log(4.0) SG_MAGICCONST = 1.0 + _log(4.5) BPF = 53 # Number of bits in a float # Translated by Guido van Rossum from C source provided by # Adrian Baddeley. Adapted by Raymond Hettinger for use with # the Mersenne Twister core generator. import _random class Random(_random.Random): """Random number generator base class used by bound module functions. Used to instantiate instances of Random to get generators that don't share state. Especially useful for multi-threaded programs, creating a different instance of Random for each thread, and using the jumpahead() method to ensure that the generated sequences seen by each thread don't overlap. Class Random can also be subclassed if you want to use a different basic generator of your own devising: in that case, override the following methods: random(), seed(), getstate(), setstate() and jumpahead(). """ VERSION = 2 # used by getstate/setstate def __init__(self, x=None): """Initialize an instance. Optional argument x controls seeding, as for Random.seed(). """ self.seed(x) self.gauss_next = None def seed(self, a=None): """Initialize internal state from hashable object. None or no argument seeds from current time. If a is not None or an int or long, hash(a) is used instead. """ if a is None: import time a = long(time.time() * 256) # use fractional seconds super(Random, self).seed(a) self.gauss_next = None def getstate(self): """Return internal state; can be passed to setstate() later.""" return self.VERSION, super(Random, self).getstate(), self.gauss_next def setstate(self, state): """Restore internal state from object returned by getstate().""" version = state[0] if version == 2: version, internalstate, self.gauss_next = state super(Random, self).setstate(internalstate) else: raise ValueError("state with version %s passed to " "Random.setstate() of version %s" % (version, self.VERSION)) ## ---- Methods below this point do not need to be overridden when ## ---- subclassing for the purpose of using a different core generator. ## -------------------- pickle support ------------------- def __getstate__(self): # for pickle return self.getstate() def __setstate__(self, state): # for pickle self.setstate(state) def __reduce__(self): return self.__class__, (), self.getstate() ## -------------------- integer methods ------------------- def randrange(self, start, stop=None, step=1, int=int, default=None, maxwidth=1L<<BPF, _BuiltinMethod=_BuiltinMethodType): """Choose a random item from range(start, stop[, step]). This fixes the problem with randint() which includes the endpoint; in Python this is usually not what you want. Do not supply the 'int', 'default', and 'maxwidth' arguments. """ # This code is a bit messy to make it fast for the # common case while still doing adequate error checking. istart = int(start) if istart != start: raise ValueError, "non-integer arg 1 for randrange()" if stop is default: if istart > 0: if istart >= maxwidth and type(self.random) is _BuiltinMethod: return self._randbelow(istart) return int(self.random() * istart) raise ValueError, "empty range for randrange()" # stop argument supplied. istop = int(stop) if istop != stop: raise ValueError, "non-integer stop for randrange()" width = istop - istart if step == 1 and width > 0: # Note that # int(istart + self.random()*(istop - istart)) # instead would be incorrect. For example, consider istart # = -2 and istop = 0. Then the guts would be in # -2.0 to 0.0 exclusive on both ends (ignoring that random() # might return 0.0), and because int() truncates toward 0, the # final result would be -1 or 0 (instead of -2 or -1). # istart + int(self.random()*(istop - istart)) # would also be incorrect, for a subtler reason: the RHS # can return a long, and then randrange() would also return # a long, but we're supposed to return an int (for backward # compatibility). if width >= maxwidth and type(self.random) is _BuiltinMethod: return int(istart + self._randbelow(width)) return int(istart + int(self.random()*width)) if step == 1: raise ValueError, "empty range for randrange()" # Non-unit step argument supplied. istep = int(step) if istep != step: raise ValueError, "non-integer step for randrange()" if istep > 0: n = (width + istep - 1) / istep elif istep < 0: n = (width + istep + 1) / istep else: raise ValueError, "zero step for randrange()" if n <= 0: raise ValueError, "empty range for randrange()" if n >= maxwidth and type(self.random) is _BuiltinMethod: return istart + self._randbelow(n) return istart + istep*int(self.random() * n) def randint(self, a, b): """Return random integer in range [a, b], including both end points. """ return self.randrange(a, b+1) def _randbelow(self, n, bpf=BPF, maxwidth=1L<<BPF, long=long, _log=_log, int=int): """Return a random int in the range [0,n) Handles the case where n has more bits than returned by a single call to the underlying generator. """ # k is a sometimes over but never under estimate of the bits in n k = int(1.00001 + _log(n-1, 2)) # 2**k > n-1 >= 2**(k-2) random = self.random r = n while r >= n: # In Py2.4, this section becomes: r = self.getrandbits(k) r = long(random() * maxwidth) bits = bpf while bits < k: r = (r << bpf) | (long(random() * maxwidth)) bits += bpf r >>= (bits - k) return r ## -------------------- sequence methods ------------------- def choice(self, seq): """Choose a random element from a non-empty sequence.""" return seq[int(self.random() * len(seq))] def shuffle(self, x, random=None, int=int): """x, random=random.random -> shuffle list x in place; return None. Optional arg random is a 0-argument function returning a random float in [0.0, 1.0); by default, the standard random.random. Note that for even rather small len(x), the total number of permutations of x is larger than the period of most random number generators; this implies that "most" permutations of a long sequence can never be generated. """ if random is None: random = self.random for i in xrange(len(x)-1, 0, -1): # pick an element in x[:i+1] with which to exchange x[i] j = int(random() * (i+1)) x[i], x[j] = x[j], x[i] def sample(self, population, k): """Chooses k unique random elements from a population sequence. Returns a new list containing elements from the population while leaving the original population unchanged. The resulting list is in selection order so that all sub-slices will also be valid random samples. This allows raffle winners (the sample) to be partitioned into grand prize and second place winners (the subslices). Members of the population need not be hashable or unique. If the population contains repeats, then each occurrence is a possible selection in the sample. To choose a sample in a range of integers, use xrange as an argument. This is especially fast and space efficient for sampling from a large population: sample(xrange(10000000), 60) """ # Sampling without replacement entails tracking either potential # selections (the pool) in a list or previous selections in a # dictionary. # When the number of selections is small compared to the population, # then tracking selections is efficient, requiring only a small # dictionary and an occasional reselection. For a larger number of # selections, the pool tracking method is preferred since the list takes # less space than the dictionary and it doesn't suffer from frequent # reselections. n = len(population) if not 0 <= k <= n: raise ValueError, "sample larger than population" random = self.random _int = int result = [None] * k if n < 6 * k: # if n len list takes less space than a k len dict pool = list(population) for i in xrange(k): # invariant: non-selected at [0,n-i) j = _int(random() * (n-i)) result[i] = pool[j] pool[j] = pool[n-i-1] # move non-selected item into vacancy else: try: n > 0 and (population[0], population[n//2], population[n-1]) except (TypeError, KeyError): # handle sets and dictionaries population = tuple(population) selected = {} for i in xrange(k): j = _int(random() * n) while j in selected: j = _int(random() * n) result[i] = selected[j] = population[j] return result ## -------------------- real-valued distributions ------------------- ## -------------------- uniform distribution ------------------- def uniform(self, a, b): """Get a random number in the range [a, b).""" return a + (b-a) * self.random() ## -------------------- normal distribution -------------------- def normalvariate(self, mu, sigma): """Normal distribution. mu is the mean, and sigma is the standard deviation. """ # mu = mean, sigma = standard deviation # Uses Kinderman and Monahan method. Reference: Kinderman, # A.J. and Monahan, J.F., "Computer generation of random # variables using the ratio of uniform deviates", ACM Trans # Math Software, 3, (1977), pp257-260. random = self.random while True: u1 = random() u2 = 1.0 - random() z = NV_MAGICCONST*(u1-0.5)/u2 zz = z*z/4.0 if zz <= -_log(u2): break return mu + z*sigma ## -------------------- lognormal distribution -------------------- def lognormvariate(self, mu, sigma): """Log normal distribution. If you take the natural logarithm of this distribution, you'll get a normal distribution with mean mu and standard deviation sigma. mu can have any value, and sigma must be greater than zero. """ return _exp(self.normalvariate(mu, sigma)) ## -------------------- circular uniform -------------------- def cunifvariate(self, mean, arc): """Circular uniform distribution. mean is the mean angle, and arc is the range of the distribution, centered around the mean angle. Both values must be expressed in radians. Returned values range between mean - arc/2 and mean + arc/2 and are normalized to between 0 and pi. Deprecated in version 2.3. Use: (mean + arc * (Random.random() - 0.5)) % Math.pi """ # mean: mean angle (in radians between 0 and pi) # arc: range of distribution (in radians between 0 and pi) import warnings warnings.warn("The cunifvariate function is deprecated; Use (mean " "+ arc * (Random.random() - 0.5)) % Math.pi instead.", DeprecationWarning, 2) return (mean + arc * (self.random() - 0.5)) % _pi ## -------------------- exponential distribution -------------------- def expovariate(self, lambd): """Exponential distribution. lambd is 1.0 divided by the desired mean. (The parameter would be called "lambda", but that is a reserved word in Python.) Returned values range from 0 to positive infinity. """ # lambd: rate lambd = 1/mean # ('lambda' is a Python reserved word) random = self.random u = random() while u <= 1e-7: u = random() return -_log(u)/lambd ## -------------------- von Mises distribution -------------------- def vonmisesvariate(self, mu, kappa): """Circular data distribution. mu is the mean angle, expressed in radians between 0 and 2*pi, and kappa is the concentration parameter, which must be greater than or equal to zero. If kappa is equal to zero, this distribution reduces to a uniform random angle over the range 0 to 2*pi. """ # mu: mean angle (in radians between 0 and 2*pi) # kappa: concentration parameter kappa (>= 0) # if kappa = 0 generate uniform random angle # Based upon an algorithm published in: Fisher, N.I., # "Statistical Analysis of Circular Data", Cambridge # University Press, 1993. # Thanks to Magnus Kessler for a correction to the # implementation of step 4. random = self.random if kappa <= 1e-6: return TWOPI * random() a = 1.0 + _sqrt(1.0 + 4.0 * kappa * kappa) b = (a - _sqrt(2.0 * a))/(2.0 * kappa) r = (1.0 + b * b)/(2.0 * b) while True: u1 = random() z = _cos(_pi * u1) f = (1.0 + r * z)/(r + z) c = kappa * (r - f) u2 = random() if not (u2 >= c * (2.0 - c) and u2 > c * _exp(1.0 - c)): break u3 = random() if u3 > 0.5: theta = (mu % TWOPI) + _acos(f) else: theta = (mu % TWOPI) - _acos(f) return theta ## -------------------- gamma distribution -------------------- def gammavariate(self, alpha, beta): """Gamma distribution. Not the gamma function! Conditions on the parameters are alpha > 0 and beta > 0. """ # alpha > 0, beta > 0, mean is alpha*beta, variance is alpha*beta**2 # Warning: a few older sources define the gamma distribution in terms # of alpha > -1.0 if alpha <= 0.0 or beta <= 0.0: raise ValueError, 'gammavariate: alpha and beta must be > 0.0' random = self.random if alpha > 1.0: # Uses R.C.H. Cheng, "The generation of Gamma # variables with non-integral shape parameters", # Applied Statistics, (1977), 26, No. 1, p71-74 ainv = _sqrt(2.0 * alpha - 1.0) bbb = alpha - LOG4 ccc = alpha + ainv while True: u1 = random() if not 1e-7 < u1 < .9999999: continue u2 = 1.0 - random() v = _log(u1/(1.0-u1))/ainv x = alpha*_exp(v) z = u1*u1*u2 r = bbb+ccc*v-x if r + SG_MAGICCONST - 4.5*z >= 0.0 or r >= _log(z): return x * beta elif alpha == 1.0: # expovariate(1) u = random() while u <= 1e-7: u = random() return -_log(u) * beta else: # alpha is between 0 and 1 (exclusive) # Uses ALGORITHM GS of Statistical Computing - Kennedy & Gentle while True: u = random() b = (_e + alpha)/_e p = b*u if p <= 1.0: x = pow(p, 1.0/alpha) else: # p > 1 x = -_log((b-p)/alpha) u1 = random() if not (((p <= 1.0) and (u1 > _exp(-x))) or ((p > 1) and (u1 > pow(x, alpha - 1.0)))): break return x * beta def stdgamma(self, alpha, ainv, bbb, ccc): # This method was (and shall remain) undocumented. # This method is deprecated # for the following reasons: # 1. Returns same as .gammavariate(alpha, 1.0) # 2. Requires caller to provide 3 extra arguments # that are functions of alpha anyway # 3. Can't be used for alpha < 0.5 # ainv = sqrt(2 * alpha - 1) # bbb = alpha - log(4) # ccc = alpha + ainv import warnings warnings.warn("The stdgamma function is deprecated; " "use gammavariate() instead.", DeprecationWarning, 2) return self.gammavariate(alpha, 1.0) ## -------------------- Gauss (faster alternative) -------------------- def gauss(self, mu, sigma): """Gaussian distribution. mu is the mean, and sigma is the standard deviation. This is slightly faster than the normalvariate() function. Not thread-safe without a lock around calls. """ # When x and y are two variables from [0, 1), uniformly # distributed, then # # cos(2*pi*x)*sqrt(-2*log(1-y)) # sin(2*pi*x)*sqrt(-2*log(1-y)) # # are two *independent* variables with normal distribution # (mu = 0, sigma = 1). # (Lambert Meertens) # (corrected version; bug discovered by Mike Miller, fixed by LM) # Multithreading note: When two threads call this function # simultaneously, it is possible that they will receive the # same return value. The window is very small though. To # avoid this, you have to use a lock around all calls. (I # didn't want to slow this down in the serial case by using a # lock here.) random = self.random z = self.gauss_next self.gauss_next = None if z is None: x2pi = random() * TWOPI g2rad = _sqrt(-2.0 * _log(1.0 - random())) z = _cos(x2pi) * g2rad self.gauss_next = _sin(x2pi) * g2rad return mu + z*sigma ## -------------------- beta -------------------- ## See ## http://sourceforge.net/bugs/?func=detailbug&bug_id=130030&group_id=5470 ## for Ivan Frohne's insightful analysis of why the original implementation: ## ## def betavariate(self, alpha, beta): ## # Discrete Event Simulation in C, pp 87-88. ## ## y = self.expovariate(alpha) ## z = self.expovariate(1.0/beta) ## return z/(y+z) ## ## was dead wrong, and how it probably got that way. def betavariate(self, alpha, beta): """Beta distribution. Conditions on the parameters are alpha > -1 and beta} > -1. Returned values range between 0 and 1. """ # This version due to Janne Sinkkonen, and matches all the std # texts (e.g., Knuth Vol 2 Ed 3 pg 134 "the beta distribution"). y = self.gammavariate(alpha, 1.) if y == 0: return 0.0 else: return y / (y + self.gammavariate(beta, 1.)) ## -------------------- Pareto -------------------- def paretovariate(self, alpha): """Pareto distribution. alpha is the shape parameter.""" # Jain, pg. 495 u = 1.0 - self.random() return 1.0 / pow(u, 1.0/alpha) ## -------------------- Weibull -------------------- def weibullvariate(self, alpha, beta): """Weibull distribution. alpha is the scale parameter and beta is the shape parameter. """ # Jain, pg. 499; bug fix courtesy Bill Arms u = 1.0 - self.random() return alpha * pow(-_log(u), 1.0/beta) ## -------------------- Wichmann-Hill ------------------- class WichmannHill(Random): VERSION = 1 # used by getstate/setstate def seed(self, a=None): """Initialize internal state from hashable object. None or no argument seeds from current time. If a is not None or an int or long, hash(a) is used instead. If a is an int or long, a is used directly. Distinct values between 0 and 27814431486575L inclusive are guaranteed to yield distinct internal states (this guarantee is specific to the default Wichmann-Hill generator). """ if a is None: # Initialize from current time import time a = long(time.time() * 256) if not isinstance(a, (int, long)): a = hash(a) a, x = divmod(a, 30268) a, y = divmod(a, 30306) a, z = divmod(a, 30322) self._seed = int(x)+1, int(y)+1, int(z)+1 self.gauss_next = None def random(self): """Get the next random number in the range [0.0, 1.0).""" # Wichman-Hill random number generator. # # Wichmann, B. A. & Hill, I. D. (1982) # Algorithm AS 183: # An efficient and portable pseudo-random number generator # Applied Statistics 31 (1982) 188-190 # # see also: # Correction to Algorithm AS 183 # Applied Statistics 33 (1984) 123 # # McLeod, A. I. (1985) # A remark on Algorithm AS 183 # Applied Statistics 34 (1985),198-200 # This part is thread-unsafe: # BEGIN CRITICAL SECTION x, y, z = self._seed x = (171 * x) % 30269 y = (172 * y) % 30307 z = (170 * z) % 30323 self._seed = x, y, z # END CRITICAL SECTION # Note: on a platform using IEEE-754 double arithmetic, this can # never return 0.0 (asserted by Tim; proof too long for a comment). return (x/30269.0 + y/30307.0 + z/30323.0) % 1.0 def getstate(self): """Return internal state; can be passed to setstate() later.""" return self.VERSION, self._seed, self.gauss_next def setstate(self, state): """Restore internal state from object returned by getstate().""" version = state[0] if version == 1: version, self._seed, self.gauss_next = state else: raise ValueError("state with version %s passed to " "Random.setstate() of version %s" % (version, self.VERSION)) def jumpahead(self, n): """Act as if n calls to random() were made, but quickly. n is an int, greater than or equal to 0. Example use: If you have 2 threads and know that each will consume no more than a million random numbers, create two Random objects r1 and r2, then do r2.setstate(r1.getstate()) r2.jumpahead(1000000) Then r1 and r2 will use guaranteed-disjoint segments of the full period. """ if not n >= 0: raise ValueError("n must be >= 0") x, y, z = self._seed x = int(x * pow(171, n, 30269)) % 30269 y = int(y * pow(172, n, 30307)) % 30307 z = int(z * pow(170, n, 30323)) % 30323 self._seed = x, y, z def __whseed(self, x=0, y=0, z=0): """Set the Wichmann-Hill seed from (x, y, z). These must be integers in the range [0, 256). """ if not type(x) == type(y) == type(z) == int: raise TypeError('seeds must be integers') if not (0 <= x < 256 and 0 <= y < 256 and 0 <= z < 256): raise ValueError('seeds must be in range(0, 256)') if 0 == x == y == z: # Initialize from current time import time t = long(time.time() * 256) t = int((t&0xffffff) ^ (t>>24)) t, x = divmod(t, 256) t, y = divmod(t, 256) t, z = divmod(t, 256) # Zero is a poor seed, so substitute 1 self._seed = (x or 1, y or 1, z or 1) self.gauss_next = None def whseed(self, a=None): """Seed from hashable object's hash code. None or no argument seeds from current time. It is not guaranteed that objects with distinct hash codes lead to distinct internal states. This is obsolete, provided for compatibility with the seed routine used prior to Python 2.1. Use the .seed() method instead. """ if a is None: self.__whseed() return a = hash(a) a, x = divmod(a, 256) a, y = divmod(a, 256) a, z = divmod(a, 256) x = (x + a) % 256 or 1 y = (y + a) % 256 or 1 z = (z + a) % 256 or 1 self.__whseed(x, y, z) ## -------------------- test program -------------------- def _test_generator(n, funccall): import time print n, 'times', funccall code = compile(funccall, funccall, 'eval') total = 0.0 sqsum = 0.0 smallest = 1e10 largest = -1e10 t0 = time.time() for i in range(n): x = eval(code) total += x sqsum = sqsum + x*x smallest = min(x, smallest) largest = max(x, largest) t1 = time.time() print round(t1-t0, 3), 'sec,', avg = total/n stddev = _sqrt(sqsum/n - avg*avg) print 'avg %g, stddev %g, min %g, max %g' % \ (avg, stddev, smallest, largest) def _test(N=2000): _test_generator(N, 'random()') _test_generator(N, 'normalvariate(0.0, 1.0)') _test_generator(N, 'lognormvariate(0.0, 1.0)') _test_generator(N, 'cunifvariate(0.0, 1.0)') _test_generator(N, 'vonmisesvariate(0.0, 1.0)') _test_generator(N, 'gammavariate(0.01, 1.0)') _test_generator(N, 'gammavariate(0.1, 1.0)') _test_generator(N, 'gammavariate(0.1, 2.0)') _test_generator(N, 'gammavariate(0.5, 1.0)') _test_generator(N, 'gammavariate(0.9, 1.0)') _test_generator(N, 'gammavariate(1.0, 1.0)') _test_generator(N, 'gammavariate(2.0, 1.0)') _test_generator(N, 'gammavariate(20.0, 1.0)') _test_generator(N, 'gammavariate(200.0, 1.0)') _test_generator(N, 'gauss(0.0, 1.0)') _test_generator(N, 'betavariate(3.0, 3.0)') # Create one instance, seeded from current time, and export its methods # as module-level functions. The functions share state across all uses #(both in the user's code and in the Python libraries), but that's fine # for most programs and is easier for the casual user than making them # instantiate their own Random() instance. _inst = Random() seed = _inst.seed random = _inst.random uniform = _inst.uniform randint = _inst.randint choice = _inst.choice randrange = _inst.randrange sample = _inst.sample shuffle = _inst.shuffle normalvariate = _inst.normalvariate lognormvariate = _inst.lognormvariate cunifvariate = _inst.cunifvariate expovariate = _inst.expovariate vonmisesvariate = _inst.vonmisesvariate gammavariate = _inst.gammavariate stdgamma = _inst.stdgamma gauss = _inst.gauss betavariate = _inst.betavariate paretovariate = _inst.paretovariate weibullvariate = _inst.weibullvariate getstate = _inst.getstate setstate = _inst.setstate jumpahead = _inst.jumpahead if __name__ == '__main__': _test() --- NEW FILE: types.py --- """Define names for all type symbols known in the standard interpreter. Types that are part of optional modules (e.g. array) are not listed. """ import sys # Iterators in Python aren't a matter of type but of protocol. A large # and changing number of builtin types implement *some* flavor of # iterator. Don't check the type! Use hasattr to check for both # "__iter__" and "next" attributes instead. NoneType = type(None) TypeType = type ObjectType = object IntType = int LongType = long FloatType = float BooleanType = bool try: ComplexType = complex except NameError: pass StringType = str # StringTypes is already outdated. Instead of writing "type(x) in # types.StringTypes", you should use "isinstance(x, basestring)". But # we keep around for compatibility with Python 2.2. try: UnicodeType = unicode StringTypes = (StringType, UnicodeType) except NameError: StringTypes = (StringType,) BufferType = buffer TupleType = tuple ListType = list DictType = DictionaryType = dict def _f(): pass FunctionType = type(_f) LambdaType = type(lambda: None) # Same as FunctionType try: CodeType = type(_f.func_code) except RuntimeError: # Execution in restricted environment pass def g(): yield 1 GeneratorType = type(g()) del g class _C: def _m(self): pass ClassType = type(_C) UnboundMethodType = type(_C._m) # Same as MethodType _x = _C() InstanceType = type(_x) MethodType = type(_x._m) BuiltinFunctionType = type(len) BuiltinMethodType = type([].append) # Same as BuiltinFunctionType ModuleType = type(sys) FileType = file XRangeType = xrange try: raise TypeError except TypeError: try: tb = sys.exc_info()[2] TracebackType = type(tb) FrameType = type(tb.tb_frame) except AttributeError: # In the restricted environment, exc_info returns (None, None, # None) Then, tb.tb_frame gives an attribute error pass tb = None; del tb SliceType = slice EllipsisType = type(Ellipsis) DictProxyType = type(TypeType.__dict__) NotImplementedType = type(NotImplemented) del sys, _f, _C, _x # Not for export |
|
From: Dewitt C. <ddc...@us...> - 2005-09-10 21:52:34
|
Update of /cvsroot/gcblue/gcb_wx/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2168/scripts Added Files: SubTactics.py Log Message: GCB 0.8.0 release --- NEW FILE: SubTactics.py --- ########################################## # Sub tactics ########################################## from UnitCommands import * # zig-zag patrol task def SubPatrol(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, 255.0 + 90.0 * UI.Rand()) # random turn interval in seconds TI.SetMemoryText('Description', 'Perform surveillance along a zig-zag course') if (not UI.IsSub()): TI.EndTask() iteration = iteration + 1 TI.SetMemoryValue(1, iteration) # activate all passive sensors # can_radiate = GetSensorControl(BB) ActivatePassiveSensors(UI) # return if conn is not available if (not GetConnControl(BB)): return # if at periscope depth and battery is not fully charged, activate snorkel and set speed slow # if at periscope depth and battery is fully charged, stop snorkeling, and set depth to deep # if deep and battery is nearly empty, set depth to periscope depth SI = UI.GetSubInterface() # get sub interface object bottomDepth = -UI.GetTerrainElevation() maxPatrolDepth = SI.GetMaxDepth() - 30 if (bottomDepth > 210): patrolDepth = 300 else: patrolDepth = bottomDepth - 30 if (patrolDepth > maxPatrolDepth): patrolDepth = maxPatrolDepth UI.SetSpeed(5) # default patrol speed updateInterval = TI.GetMemoryValue(4) if (SI.IsDieselElectric()): battery = SI.GetBatteryFraction() if (SI.IsAtPeriscopeDepth()): if (battery < 0.99): SI.SetSnorkelState(1) UI.SetSpeed(3) else: SI.SetSnorkelState(0) UI.SetSpeed(5) UI.SetAlt(-patrolDepth) elif (battery < 0.2): SI.GoToPeriscopeDepth() UI.SetSpeed(5) updateInterval = 0.5 * updateInterval else: # nuclear sub UI.SetAlt(-patrolDepth) if (TI.GetMemoryValue(3) == 0): new_heading = TI.GetMemoryValue(2) - 30 TI.SetMemoryValue(3, 1) else: new_heading = TI.GetMemoryValue(2) + 30 TI.SetMemoryValue(3, 0) UI.SetHeading(new_heading) TI.SetUpdateInterval(updateInterval) UI.SetActionText('Patrol') # torpedo evasion tactics def EvadeTorpedoes(TI): UI = TI.GetPlatformInterface() BB = TI.GetBlackboardInterface() iteration = TI.GetMemoryValue(1) # will return 0 first time if (iteration == 0): # do initialization TI.SetMemoryText('Description', 'Evade incoming torpedoes') iteration = iteration + 1 TI.SetMemoryValue(1, iteration) # find closest torpedo within 12 km (or bearing-only torpedo track with longest track life) # if any found, take conn control, set depth deep, set speed to max, set course to evade # (when available) if any found that are within 1 km(?), release countermeasure # if no torpedoes found and have conn control, release conn control |
|
From: Dewitt C. <ddc...@us...> - 2005-09-10 21:51:31
|
Update of /cvsroot/gcblue/gcb_wx/3d In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2031/3d Added Files: burke.xml guppy.xml tu-16.xml zwaardvis.xml Log Message: GCB 0.8.0 release --- NEW FILE: zwaardvis.xml --- <Model File="zwaardvis.ive"/> <Info Author="TLAM-Strike" Notes=""/> <Animation Object="Prop_L" Type="Propeller" AzisX="0" AxisY="1" AxisZ="0" AngleRate="0.07"/> <Smoke X="0.0" Y="-31.7" Z="-3.4"/> --- NEW FILE: burke.xml --- <Model File="burke.ive"/> <Info Author="Marcelo Caceres" Notes="ab_f2a"/> <Animation Object="nav_radar1" Type="Sensor" SensorIndex="0" AxisX="0" AxisY="0" AxisZ="1" AngleRate="0.2"/> <Animation Object="nav_radar2" Type="Sensor" SensorIndex="0" AxisX="0" AxisY="0" AxisZ="1" AngleRate="0.2"/> <Animation Object="prop_l" Type="Propeller" AxisX="0.0" AxisY="1" AxisZ="0" AngleRate="0.2"/> <Animation Object="prop_r" Type="Propeller" AxisX="0.0" AxisY="1" AxisZ="0" AngleRate="-0.2"/> --- NEW FILE: guppy.xml --- <Model File="guppy.ive"/> <Info Author="TLAM-Strike" Notes="Used for ROC Hai Shih submarine"/> <Animation Object="Object04" Type="Propeller" AzisX="0" AxisY="1" AxisZ="0" AngleRate="0.07"/> <Animation Object="Object03" Type="Propeller" AzisX="0" AxisY="1" AxisZ="0" AngleRate="-0.07"/> --- NEW FILE: tu-16.xml --- <Model File="tu-16.ive"/> <Info Author="Guido Militello" Notes=""/> <Smoke X="2.0" Y="-4.6" Z="0.0"/> <Smoke X="-2.0" Y="-4.6" Z="0.0"/> |
|
From: Dewitt C. <ddc...@us...> - 2005-09-10 21:50:46
|
Update of /cvsroot/gcblue/gcb_wx In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1917 Modified Files: GCblue.vcproj Log Message: GCB 0.8.0 release Index: GCblue.vcproj =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/GCblue.vcproj,v retrieving revision 1.97 retrieving revision 1.98 diff -C2 -d -r1.97 -r1.98 *** GCblue.vcproj 20 Jul 2005 16:24:52 -0000 1.97 --- GCblue.vcproj 10 Sep 2005 21:50:34 -0000 1.98 *************** *** 39,43 **** Name="VCLinkerTool" IgnoreImportLibrary="FALSE" ! AdditionalDependencies="python23.lib boost_python_debug.lib winmm.lib opengl32.lib glu32.lib GLaux.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 sqlited.lib ogg_static_d.lib vorbis_static_d.lib vorbisfile_static_d.lib gcb_wrap_oald.lib ALutd.lib oalpp_gcbd.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 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 sqlited.lib ogg_static_d.lib vorbis_static_d.lib vorbisfile_static_d.lib OpenAL32.lib ALut.lib oalpp_gcbd.lib" ShowProgress="0" OutputFile="$(ProjectDir)/bin/GCblueD.exe" *************** *** 105,109 **** <Tool Name="VCLinkerTool" ! AdditionalDependencies="boost_python.lib python23.lib opengl32.lib winmm.lib GLaux.lib glu32.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 sqlite.lib OpenThreadsWin32.lib gcb_wrap_oal.lib ALut.lib oalpp_gcb.lib ogg_static.lib vorbis_static.lib vorbisfile_static.lib" OutputFile="$(ProjectDir)/bin/$(ProjectName).exe" LinkIncremental="1" --- 105,109 ---- <Tool Name="VCLinkerTool" ! AdditionalDependencies="boost_python.lib python23.lib opengl32.lib winmm.lib GLaux.lib glu32.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 sqlite.lib OpenThreadsWin32.lib OpenAL32.lib ALut.lib oalpp_gcb.lib ogg_static.lib vorbis_static.lib vorbisfile_static.lib" OutputFile="$(ProjectDir)/bin/$(ProjectName).exe" LinkIncremental="1" *************** *** 249,252 **** --- 249,255 ---- </File> <File + RelativePath=".\src\graphics\tcBriefingView.cpp"> + </File> + <File RelativePath="src\graphics\tcButton.cpp"> </File> *************** *** 1273,1276 **** --- 1276,1282 ---- </File> <File + RelativePath=".\include\graphics\tcBriefingView.h"> + </File> + <File RelativePath="include\graphics\tcButton.h"> </File> |
|
From: Dewitt C. <ddc...@us...> - 2005-09-10 21:50:21
|
Update of /cvsroot/gcblue/gcb_wx/database In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1855/database Modified Files: database.db Log Message: Index: database.db =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/database/database.db,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 Binary files /tmp/cvsQNko5T and /tmp/cvsVWPkBB differ |
|
From: Dewitt C. <ddc...@us...> - 2005-09-10 21:49:29
|
Update of /cvsroot/gcblue/gcb_wx/xml In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1703/xml Modified Files: info_console.xml network_view.xml options.xml scenarioselect_view.xml Log Message: GCB 0.8.0 release Index: scenarioselect_view.xml =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/xml/scenarioselect_view.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** scenarioselect_view.xml 14 Sep 2004 02:01:48 -0000 1.1 --- scenarioselect_view.xml 10 Sep 2005 21:49:21 -0000 1.2 *************** *** 4,7 **** <Button X="170" Y="25" Width="65" Height="15" Caption="Database" Command="30"/> <Button X="240" Y="25" Width="65" Height="15" Caption="Options" Command="40"/> ! <Button X="310" Y="25" Width="65" Height="15" Caption="Play" Command="70"/> </Window> \ No newline at end of file --- 4,9 ---- <Button X="170" Y="25" Width="65" Height="15" Caption="Database" Command="30"/> <Button X="240" Y="25" Width="65" Height="15" Caption="Options" Command="40"/> ! <Button X="310" Y="25" Width="65" Height="15" Caption="Briefing" Command="65"/> ! <Button X="380" Y="25" Width="65" Height="15" Caption="Play" Command="70"/> ! </Window> \ No newline at end of file Index: options.xml =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/xml/options.xml,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** options.xml 29 Jul 2005 02:35:53 -0000 1.20 --- options.xml 10 Sep 2005 21:49:21 -0000 1.21 *************** *** 1,7 **** <Options> ! <HostAddress>192.168.0.102</HostAddress> ! <DisplaySettings>default</DisplaySettings> ! <LastScenarioPath>TaiwanNavalBattle.py</LastScenarioPath> ! <LastScenarioName>TaiwanNavalBattle</LastScenarioName> <noCopyDatabase /> <noWriteXmlDatabase /> --- 1,6 ---- <Options> ! <HostAddress>192.168.0.100</HostAddress> ! <LastScenarioPath>SinglePlayer.JumpingFish.py</LastScenarioPath> ! <LastScenarioName>JumpingFish</LastScenarioName> <noCopyDatabase /> <noWriteXmlDatabase /> *************** *** 11,14 **** <ShakeAirCamera /> <ShowPythonErrors /> ! <UserName>Dewitt</UserName> </Options> --- 10,14 ---- <ShakeAirCamera /> <ShowPythonErrors /> ! <UserName>EnterNameHere</UserName> ! <DisplaySettings>default</DisplaySettings> </Options> Index: network_view.xml =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/xml/network_view.xml,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** network_view.xml 17 May 2005 00:20:41 -0000 1.10 --- network_view.xml 10 Sep 2005 21:49:21 -0000 1.11 *************** *** 5,8 **** --- 5,9 ---- <Button X="240" Y="50" Width="65" Height="15" Caption="Options" Command="40"/> <Button X="310" Y="50" Width="65" Height="15" Caption="Scenarios" Command="50"/> + <Button X="380" Y="50" Width="65" Height="15" Caption="Briefing" Command="65"/> <RadioButton X="30" Y="130" Width="170" Height="40" Caption="Multiplayer Mode" Command="150"> *************** *** 13,18 **** <EditIP X="30" Y="300" Width="180" Height="25" BarX="10.0" BarY="5.0" BarWidth="160.0" BarHeight="14.0" FontSize="14.0" Caption="IP Address"/> ! <EditName X="30" Y="350" Width="180" Height="25" BarX="10.0" BarY="5.0" BarWidth="160.0" BarHeight="14.0" FontSize="14.0" Caption="Username"/> ! <EditPassword X="30" Y="400" Width="180" Height="25" BarX="10.0" BarY="5.0" BarWidth="160.0" BarHeight="14.0" FontSize="14.0" Caption="Password" PasswordMode="1"/> <Button X="240" Y="305" Width="65" Height="15" Caption="Connect" Command="160"/> --- 14,19 ---- <EditIP X="30" Y="300" Width="180" Height="25" BarX="10.0" BarY="5.0" BarWidth="160.0" BarHeight="14.0" FontSize="14.0" Caption="IP Address"/> ! <EditName X="30" Y="340" Width="180" Height="25" BarX="10.0" BarY="5.0" BarWidth="160.0" BarHeight="14.0" FontSize="14.0" Caption="Username"/> ! <EditPassword X="30" Y="380" Width="180" Height="25" BarX="10.0" BarY="5.0" BarWidth="160.0" BarHeight="14.0" FontSize="14.0" Caption="Password" PasswordMode="1"/> <Button X="240" Y="305" Width="65" Height="15" Caption="Connect" Command="160"/> *************** *** 23,30 **** --- 24,38 ---- <ChatEntry X="30" Y="706" Width="450" Height="16" BarX="0.0" BarY="1.0" BarWidth="450.0" BarHeight="14.0" FontSize="14.0" Caption=""/> + <!-- <RadioButton X="30" Y="190" Width="115" Height="40" Caption="Chat Protocol" Command="180"> <Button X="5" Y="20" Width="50" Height="15" Caption="TCP" Command="0"/> <Button X="60" Y="20" Width="50" Height="15" Caption="UDP" Command="1"/> </RadioButton> + --> + + <RadioButton X="30" Y="200" Width="115" Height="40" Caption="Client Login Policy" Command="190"> + <Button X="5" Y="20" Width="50" Height="15" Caption="All" Command="0"/> + <Button X="60" Y="20" Width="50" Height="15" Caption="Reg Only" Command="1"/> + </RadioButton> </Window> \ No newline at end of file Index: info_console.xml =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/xml/info_console.xml,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** info_console.xml 10 Jul 2005 20:32:04 -0000 1.7 --- info_console.xml 10 Sep 2005 21:49:21 -0000 1.8 *************** *** 1,5 **** <Window> ! <TextBox TopMargin="2" BottomMargin="2" Wrap="35" DrawBorder="0" FontSize="12"/> </Window> \ No newline at end of file --- 1,5 ---- <Window> ! <TextBox TopMargin="2" BottomMargin="2" Wrap="32" DrawBorder="0" FontSize="12"/> </Window> \ No newline at end of file |
|
From: Dewitt C. <ddc...@us...> - 2005-09-10 21:49:07
|
Update of /cvsroot/gcblue/gcb_wx/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1643/scripts Modified Files: AI.py HotKey.py Menu.py UnitCommands.py Log Message: GCB 0.8.0 release Index: HotKey.py =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/scripts/HotKey.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** HotKey.py 11 Jun 2005 21:01:44 -0000 1.5 --- HotKey.py 10 Sep 2005 21:48:58 -0000 1.6 *************** *** 9,15 **** else: # last argument set to 1 to print message ! SetFractionalSpeed(UnitInfo, 0.4, 1) elif (key == '2'): ! SetFractionalSpeed(UnitInfo, 0.75, 1) elif (key == '3'): SetFractionalSpeed(UnitInfo, 1.0, 1) --- 9,15 ---- else: # last argument set to 1 to print message ! SetFractionalSpeed(UnitInfo, 0.3, 1) elif (key == '2'): ! SetFractionalSpeed(UnitInfo, 0.80, 1) elif (key == '3'): SetFractionalSpeed(UnitInfo, 1.0, 1) Index: AI.py =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/scripts/AI.py,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** AI.py 20 Jul 2005 16:24:53 -0000 1.23 --- AI.py 10 Sep 2005 21:48:58 -0000 1.24 *************** *** 93,97 **** # activate all sensors can_radiate = GetSensorControl(BB) ! if (can_radiate): ActivateAllSensors(UI) else: --- 93,97 ---- # activate all sensors can_radiate = GetSensorControl(BB) ! if (can_radiate and not UI.IsSub()): ActivateAllSensors(UI) else: *************** *** 147,151 **** # activate all sensors can_radiate = GetSensorControl(BB) ! if (can_radiate): ActivateAllSensors(UI) else: --- 147,151 ---- # activate all sensors can_radiate = GetSensorControl(BB) ! if (can_radiate and not UI.IsSub()): ActivateAllSensors(UI) else: *************** *** 312,315 **** --- 312,316 ---- # for duration of engagement + # Adjust heading toward target, maintain altitude and speed to release point, # release ALL bombs at release point, and then reverse course *************** *** 332,339 **** return bomb_state = TI.GetMemoryValue(2) if (bomb_state == 2): ! DropAllBombs(UI) ! UI.SetHeading(UI.GetHeading() + 160) UI.SetActionText('') TI.EndTask() --- 333,349 ---- return + + track_info = UI.GetTargetTrackInfo() + tgt_lat = track_info.Lat + tgt_lon = track_info.Lon + tgt_alt = UI.GetMapTerrainElevation(tgt_lon, tgt_lat) # since we're bombing a ground target (does track have same altitude value?) + + bomb_state = TI.GetMemoryValue(2) + + if (bomb_state == 2): ! DropAllBombs(UI, tgt_lon, tgt_lat, tgt_alt) ! UI.SetHeading(UI.GetHeading() + 180) UI.SetActionText('') TI.EndTask() *************** *** 341,348 **** - track_info = UI.GetTargetTrackInfo() - tgt_lat = track_info.Lat - tgt_lon = track_info.Lon - tgt_alt = UI.GetMapTerrainElevation(tgt_lon, tgt_lat) # since we're bombing a ground target (does track have same altitude value?) # adjust heading to target --- 351,354 ---- *************** *** 351,354 **** --- 357,361 ---- tgt_range_m = 1000 * UI.GetRangeToTrack(track_info) # horizontal range in m + tgt_range_m = tgt_range_m - 10 # move in a little to spread bombs on either side own_speed_mps = 0.51444444 * UI.GetSpeed() # get speed in m/s own_alt_m = UI.GetAlt() *************** *** 382,385 **** --- 389,395 ---- BB = TI.GetBlackboardInterface() + if (UI.TaskExists('Nav')): + return + iteration = TI.GetMemoryValue(1) # will return 0 first time if (iteration == 0): # do initialization *************** *** 400,407 **** return bomb_state = TI.GetMemoryValue(2) if (bomb_state == 2): ! DropAllBombs(UI) ! UI.SetHeading(UI.GetHeading() + 160) UI.SetActionText('') TI.EndTask() --- 410,422 ---- return + tgt_lon = TI.GetMemoryValue(10) + tgt_lat = TI.GetMemoryValue(11) + tgt_alt = UI.GetMapTerrainElevation(tgt_lon, tgt_lat) # since we're bombing a ground target (does track have same altitude value?) + + bomb_state = TI.GetMemoryValue(2) if (bomb_state == 2): ! DropAllBombs(UI, tgt_lon, tgt_lat, tgt_alt) ! UI.SetHeading(UI.GetHeading() + 180) UI.SetActionText('') TI.EndTask() *************** *** 409,415 **** - tgt_lon = TI.GetMemoryValue(10) - tgt_lat = TI.GetMemoryValue(11) - tgt_alt = UI.GetMapTerrainElevation(tgt_lon, tgt_lat) # since we're bombing a ground target (does track have same altitude value?) # adjust heading to target --- 424,427 ---- *************** *** 418,421 **** --- 430,435 ---- tgt_range_m = 1000 * UI.GetRangeToDatum(tgt_lon, tgt_lat) # horizontal range in m + tgt_range_m = tgt_range_m - 10 # move in a little to spread bombs on either side + own_speed_mps = 0.51444444 * UI.GetSpeed() # get speed in m/s own_alt_m = UI.GetAlt() *************** *** 470,481 **** ! def DropAllBombs(UI): UI.DisplayMessage('Dropping all bombs') ! track_info = UI.GetTargetTrackInfo() ! ! tgt_lat = track_info.Lat ! tgt_lon = track_info.Lon ! tgt_alt = UI.GetMapTerrainElevation(tgt_lon, tgt_lat) nLaunchers = UI.GetLauncherCount() --- 484,491 ---- ! def DropAllBombs(UI, tgt_lon, tgt_lat, tgt_alt): UI.DisplayMessage('Dropping all bombs') ! nLaunchers = UI.GetLauncherCount() *************** *** 715,719 **** TI.SetMemoryText('Description', 'Land at designated airbase') TI.SetMemoryValue(2, 0) # 0 - init, 1 - distant, 2 - init approach, 3 - final approach ! dest_name = BB.ReadMessage('LandingTarget') dest_id = UI.LookupFriendlyId(dest_name) TI.SetMemoryValue(3, dest_id) --- 725,729 ---- TI.SetMemoryText('Description', 'Land at designated airbase') TI.SetMemoryValue(2, 0) # 0 - init, 1 - distant, 2 - init approach, 3 - final approach ! dest_name = BB.ReadMessage('Home') dest_id = UI.LookupFriendlyId(dest_name) TI.SetMemoryValue(3, dest_id) *************** *** 754,761 **** UI.SetAlt(400 + alt_m) UI.SetPitchLimit(15) elif (land_state == 3): UI.SetAlt(18 + alt_m) UI.SetPitchLimit(10) ! SetFractionalSpeed(UI,0.6) if(UI.GetLandingState()==0): UI.SetLandingState(1) # gear down --- 764,772 ---- UI.SetAlt(400 + alt_m) UI.SetPitchLimit(15) + SetFractionalSpeed(UI,0.5) elif (land_state == 3): UI.SetAlt(18 + alt_m) UI.SetPitchLimit(10) ! SetFractionalSpeed(UI,0.4) if(UI.GetLandingState()==0): UI.SetLandingState(1) # gear down *************** *** 786,790 **** TI.SetMemoryText('Description', 'Land at designated airbase') TI.SetMemoryValue(2, 0) # 0 - init, 1 - distant, 2 - init approach, 3 - final approach ! dest_name = BB.ReadMessage('LandingTarget') dest_id = UI.LookupFriendlyId(dest_name) TI.SetMemoryValue(3, dest_id) --- 797,801 ---- TI.SetMemoryText('Description', 'Land at designated airbase') TI.SetMemoryValue(2, 0) # 0 - init, 1 - distant, 2 - init approach, 3 - final approach ! dest_name = BB.ReadMessage('Home') dest_id = UI.LookupFriendlyId(dest_name) TI.SetMemoryValue(3, dest_id) *************** *** 964,968 **** return 0 engaged_count = target_info.GetEngagedCount() ! if (engaged_count > 4): return 0 --- 975,979 ---- return 0 engaged_count = target_info.GetEngagedCount() ! if (engaged_count > 2): return 0 *************** *** 1075,1082 **** if (not launcher_info.IsValid()): return ! launch_mode = launcher_info.LaunchMode # 0 - datum, 1 - seeker, 2 - bomb, 3 - other target_info = UI.GetTargetTrackInfo() ! if target_info.IsAir(): launch_qty = 1 --- 1086,1094 ---- if (not launcher_info.IsValid()): return ! launch_mode = launcher_info.LaunchMode # 0 - datum, 1 - seeker, 2 - bomb, 3 - other target_info = UI.GetTargetTrackInfo() ! ! if target_info.IsAir(): launch_qty = 1 *************** *** 1101,1104 **** --- 1113,1154 ---- UI.Launch(launcher, launch_qty) UI.SetActionText('Handoff launch') + else: + UI.DisplayMessage('Unrecognized launch mode: %d' % launch_mode) + + + # For aircraft, return to home base when at bingo fuel or after specified time + def ReturnToBase(TI): + UI = TI.GetPlatformInterface() + BB = TI.GetBlackboardInterface() + + iteration = TI.GetMemoryValue(1) # will return 0 first time + if (iteration == 0): # do initialization + bingo_fuel = GetMessageParam(BB, 'Bingo') + rtb_time = GetMessageParam(BB, 'RTBtime') + if (rtb_time <= 0): + rtb_time = 1e15 # effectively disable rtb_time if value hasn't been set + if (bingo_fuel < 0.2): + bingo_fuel = 0.2 # set min bingo_fuel to 20% + + TI.SetMemoryValue(11, bingo_fuel) + TI.SetMemoryValue(12, rtb_time) + TI.SetUpdateInterval(30) + + iteration = iteration + 1 + TI.SetMemoryValue(1, iteration) + + home_id = long(TI.GetMemoryValue(10)) + bingo_fuel = TI.GetMemoryValue(11) + rtb_time = TI.GetMemoryValue(12) + + fuel = UI.GetFuel() + time = UI.GetTime() + if ((fuel <= bingo_fuel) or (time >= rtb_time)): + UI.AddTask('Land', 2.0) + TI.EndTask() + + + + Index: UnitCommands.py =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/scripts/UnitCommands.py,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** UnitCommands.py 20 Jul 2005 16:24:53 -0000 1.21 --- UnitCommands.py 10 Sep 2005 21:48:58 -0000 1.22 *************** *** 1,4 **** --- 1,6 ---- + deg_to_rad = 0.01745329252 + def ActivateAllSensors(UI): UI.SetAllSensorState(1) *************** *** 47,50 **** --- 49,70 ---- UI.AddTask('BombDatum', 3.0) + def AddBombDatumTaskDeg(UI, lon, lat): + BB = UI.GetBlackboardInterface() + deg_to_rad = 0.01745329252 + BB.Write('DatumLongitude', '%f' % (deg_to_rad*lon)) + BB.Write('DatumLatitude', '%f' % (deg_to_rad*lat)) + UI.AddTask('BombDatum', 3.0) + + + # @param bingo_fuel return to base when fuel is less than this fuel fraction + # @param rtb_time return to base when indicated sim time has elapsed + def AddRTBtask(UI, home_name, bingo_fuel, rtb_time): + BB = UI.GetBlackboardInterface() + current_time = UI.GetTime() + BB.Write('Home', home_name) + BB.Write('Bingo', '%f' % bingo_fuel) + BB.Write('RTBtime', '%f' % (current_time + rtb_time)) + UI.AddTask('ReturnToBase', 2.0) + def AddWaypointOrderGroup(GI, lon, lat): *************** *** 80,83 **** --- 100,110 ---- BB.Write('StationAltitude', '%f' % UI.GetAlt()) + def AddPatrolStationDeg(UI, lon, lat): + UI.AddTask('PatrolCircle', 1.0) + BB = UI.GetBlackboardInterface() + BB.Write('StationLongitude', '%f' % (deg_to_rad*lon)) + BB.Write('StationLatitude', '%f' % (deg_to_rad*lat)) + BB.Write('StationAltitude', '%f' % UI.GetAlt()) + def AddLandingOrder(UI, dest_id): if (UI.IsHelo()): *************** *** 88,92 **** dest_name = UI.LookupFriendlyName(dest_id) BB = UI.GetBlackboardInterface() ! BB.Write('LandingTarget', dest_name) def AddMissileWarnTask(UI): --- 115,119 ---- dest_name = UI.LookupFriendlyName(dest_id) BB = UI.GetBlackboardInterface() ! BB.Write('Home', dest_name) def AddMissileWarnTask(UI): *************** *** 123,127 **** if (datum_alt < 5.0): datum_alt = 0.0 ! UI.SendDatumToLauncher(lon,lat,datum_alt + 5.0,launcher_num) UI.Launch(launcher_num, 1) --- 150,154 ---- if (datum_alt < 5.0): datum_alt = 0.0 ! UI.SendDatumToLauncher(lon,lat,datum_alt + 0.0,launcher_num) UI.Launch(launcher_num, 1) *************** *** 151,154 **** --- 178,182 ---- lat = predicted_track.Lat lon = predicted_track.Lon + #UI.DisplayMessage('tti: %.1f' % tti_s) UI.HandoffTargetToLauncher(launcher) # so that intended target is set LaunchDatum(UI, lon, lat, launcher) *************** *** 178,181 **** --- 206,212 ---- SetFractionalSpeed(UI, 0.5) + def Speed30(UI): + SetFractionalSpeed(UI, 0.3) + def GroupSpeed100(GI): *************** *** 319,323 **** def ShowStoresPanel(UI): ! UI.Sendcommand('ShowStoresPanel') def ToggleRadars(UI): --- 350,357 ---- def ShowStoresPanel(UI): ! UI.SendCommand('ShowStoresPanel') ! ! def ShowPlatformPanel(UI): ! UI.SendCommand('ShowPlatformPanel') def ToggleRadars(UI): Index: Menu.py =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/scripts/Menu.py,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** Menu.py 10 Jul 2005 20:32:02 -0000 1.15 --- Menu.py 10 Sep 2005 21:48:58 -0000 1.16 *************** *** 73,83 **** ! UnitMenu.AddItemUI('Change heading','SetHeading','Heading') # Speed submenu UnitMenu.AddItem('Set speed','') UnitMenu.BeginSubMenu() ! UnitMenu.AddItem('50%','Speed50') ! UnitMenu.AddItem('80%','Speed80') ! UnitMenu.AddItem('Max','Speed100') UnitMenu.EndSubMenu() --- 73,83 ---- ! UnitMenu.AddItemUI('Change heading [h]','SetHeading','Heading') # Speed submenu UnitMenu.AddItem('Set speed','') UnitMenu.BeginSubMenu() ! UnitMenu.AddItem('30%','Speed30 [1]') ! UnitMenu.AddItem('80%','Speed80 [2]') ! UnitMenu.AddItem('Max','Speed100 [3]') UnitMenu.EndSubMenu() *************** *** 97,102 **** UnitMenu.AddItemUI('ZigZag patrol','AddPatrolOrder','Null') UnitMenu.AddItemUI('Patrol station','AddPatrolStation', 'Datum') ! UnitMenu.AddItemUI('Add waypoint', 'AddWaypointOrder', 'Datum') ! UnitMenu.AddItemUI('EngageAll', 'AddEngageAllOrder','Null') UnitMenu.AddItemUI('Missile alert', 'AddMissileWarnTask','Null') UnitMenu.AddItemUI('Clear waypoints','ClearWaypoints','Null') --- 97,102 ---- UnitMenu.AddItemUI('ZigZag patrol','AddPatrolOrder','Null') UnitMenu.AddItemUI('Patrol station','AddPatrolStation', 'Datum') ! UnitMenu.AddItemUI('Add waypoint [w]', 'AddWaypointOrder', 'Datum') ! UnitMenu.AddItemUI('EngageAll [e]', 'AddEngageAllOrder','Null') UnitMenu.AddItemUI('Missile alert', 'AddMissileWarnTask','Null') UnitMenu.AddItemUI('Clear waypoints','ClearWaypoints','Null') *************** *** 119,125 **** BuildSubmarineMenu(UnitMenu, UnitInfo) # Flight port panel if available if (UnitInfo.HasFlightPort()): ! UnitMenu.AddItem('Flight deck', 'ShowFlightPanel') if (UnitInfo.IsPlayerControlled()): --- 119,127 ---- BuildSubmarineMenu(UnitMenu, UnitInfo) + UnitMenu.AddItem('Platform panel [s]', 'ShowPlatformPanel') + # Flight port panel if available if (UnitInfo.HasFlightPort()): ! UnitMenu.AddItem('Flight deck [f]', 'ShowFlightPanel') if (UnitInfo.IsPlayerControlled()): |
|
From: Dewitt C. <ddc...@us...> - 2005-09-10 21:48:17
|
Update of /cvsroot/gcblue/gcb_wx/include/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1435/include/common Modified Files: simmath.h tcSound.h wxcommands.h Log Message: GCB 0.8.0 release Index: simmath.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/common/simmath.h,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** simmath.h 22 Jun 2005 01:21:25 -0000 1.31 --- simmath.h 10 Sep 2005 21:48:06 -0000 1.32 *************** *** 145,154 **** { public: - char mnType; float mfHeight_m; ///< negative is water float mfLonDatum; ///< location where terrain info recorded (used to see float mfLatDatum; ///< if object has moved enough to require update) ! void Clear(void); void Serialize(tcFile& file, bool abLoad); }; --- 145,155 ---- { public: float mfHeight_m; ///< negative is water + float lookAheadHeight_m; ///< height of terrain a short distance ahead of platform (e.g. for avoiding crashing into mountains) + float mfLonDatum; ///< location where terrain info recorded (used to see float mfLatDatum; ///< if object has moved enough to require update) ! void Clear(); void Serialize(tcFile& file, bool abLoad); }; Index: wxcommands.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/common/wxcommands.h,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** wxcommands.h 6 Apr 2005 02:19:48 -0000 1.20 --- wxcommands.h 10 Sep 2005 21:48:06 -0000 1.21 *************** *** 3,7 **** ** IDs for commands processed via wxWindows event handler. */ ! /* Copyright (C) 2003-2004 Dewitt Colclough (de...@tw...) ** All rights reserved. --- 3,7 ---- ** IDs for commands processed via wxWindows event handler. */ ! /* Copyright (C) 2003-2005 Dewitt Colclough (de...@tw...) ** All rights reserved. *************** *** 37,40 **** --- 37,41 ---- ID_SCENARIOSELECTVIEW = 50, ///< switch to scenario select view ID_MULTIPLAYERVIEW = 60, ///< switch to multiplayer view + ID_BRIEFINGVIEW = 65, ///< switch to simple briefing view ID_STARTGAME = 70, ///< start game ID_ENDGAME = 72, ///< end game *************** *** 52,56 **** ID_CONNECT = 160, ID_JOINGAME = 170, ! ID_CHATPROTOCOL = 180 }; --- 53,58 ---- ID_CONNECT = 160, ID_JOINGAME = 170, ! ID_CHATPROTOCOL = 180, ! ID_LOGINMODE = 190 }; Index: tcSound.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/common/tcSound.h,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** tcSound.h 4 Mar 2005 00:46:14 -0000 1.21 --- tcSound.h 10 Sep 2005 21:48:06 -0000 1.22 *************** *** 48,52 **** ! #define N_EFFECT_BUFFERS 32 --- 48,52 ---- ! #define N_EFFECT_BUFFERS 16 |
|
From: Dewitt C. <ddc...@us...> - 2005-09-10 21:48:17
|
Update of /cvsroot/gcblue/gcb_wx/include/network In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1435/include/network Modified Files: tcMultiplayerInterface.h tcNetworkInterface.h tcUpdateMessageHandler.h Log Message: GCB 0.8.0 release Index: tcUpdateMessageHandler.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/network/tcUpdateMessageHandler.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** tcUpdateMessageHandler.h 26 Jul 2005 00:37:02 -0000 1.10 --- tcUpdateMessageHandler.h 10 Sep 2005 21:48:06 -0000 1.11 *************** *** 63,69 **** SCRIPT_COMMANDS = 9, ///< script commands to execute on server SCENARIO_INFO = 10, ///< info on scenario ! GOAL_STATUS = 11 ///< goal status for client }; static void AddCommandAck(tcGameObject* obj, tcCommandStream& stream); static void AddCommandUpdate(tcGameObject* obj, tcCommandStream& stream); --- 63,71 ---- SCRIPT_COMMANDS = 9, ///< script commands to execute on server SCENARIO_INFO = 10, ///< info on scenario ! GOAL_STATUS = 11, ///< goal status for client ! BRIEFING_TEXT = 12 ///< briefing text for client }; + static void AddBriefingText(long alliance, tcStream& stream); static void AddCommandAck(tcGameObject* obj, tcCommandStream& stream); static void AddCommandUpdate(tcGameObject* obj, tcCommandStream& stream); *************** *** 83,86 **** --- 85,89 ---- virtual void Handle(int connectionId, unsigned messageSize, const unsigned char *data); + void HandleBriefingText(tcStream& stream); void HandleCommandAck(tcCommandStream& stream); ///< command ack void HandleCommandUpdate(tcCommandStream& stream, int connectionId); ///< command update Index: tcMultiplayerInterface.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/network/tcMultiplayerInterface.h,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** tcMultiplayerInterface.h 26 Jul 2005 00:37:02 -0000 1.26 --- tcMultiplayerInterface.h 10 Sep 2005 21:48:06 -0000 1.27 *************** *** 118,121 **** --- 118,122 ---- //std::string GetChatText(); + bool GetAcceptAllClients() const; const std::list<int>& GetConnectionList() const; const std::vector<int>& GetConnectionVector() const; *************** *** 144,147 **** --- 145,149 ---- void SendAuthRequest(int destination); void SendAuthResponse(int destination); + void SendBriefingText(int destination, int alliance); void SendChatText(int destination, const std::string& message); void SendControlMessage(int destination, int messageCode, int param = 0); *************** *** 157,160 **** --- 159,163 ---- void SendUpdateMessageAck(int destination, tcStream& stream); void SendUpdateMessageTCP(int destination, tcStream& stream); + void SetAcceptAllClients(bool state); void SetChatProtocol(int code); void SetEvtHandler(wxEvtHandler *eh); *************** *** 177,180 **** --- 180,184 ---- std::map<int, std::vector<tcMessageHandler*> > messageMap; ///< map of (message id, message handler vector) pairs bool tcpChat; ///< true to use TCP for chat protocol, otherwise UDP + bool acceptAllClients; ///< true to accept all client logins, adding to accounts db if necessary tcPlayerStatus errorPlayerStatus; ///< status to return if player not found tcPlayerStatus serverPlayerStatus; ///< status to use for server actions *************** *** 198,201 **** --- 202,206 ---- void ProcessReceiveMessages(); + void ProcessWho(tcPlayerStatus& player, const wxString& args); void UpdateDestroyedEntities(int connectionId); void UpdateNewAndExistingEntities(int connectionId); Index: tcNetworkInterface.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/network/tcNetworkInterface.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** tcNetworkInterface.h 6 May 2005 23:57:15 -0000 1.12 --- tcNetworkInterface.h 10 Sep 2005 21:48:06 -0000 1.13 *************** *** 64,68 **** const std::map<int, tcConnectionData*>& GetConnectionMap(); ! const std::string& GetConnectionStatus(int id); tcMessage* GetMessage(int id); unsigned int GetNumConnections(); --- 64,68 ---- const std::map<int, tcConnectionData*>& GetConnectionMap(); ! const std::string& GetConnectionStatus(int id, int detailLevel = 1); tcMessage* GetMessage(int id); unsigned int GetNumConnections(); |
|
From: Dewitt C. <ddc...@us...> - 2005-09-10 21:48:17
|
Update of /cvsroot/gcblue/gcb_wx/include/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1435/include/sim Modified Files: Game.h commandlist.h tcLauncher.h tcPlatformObject.h Log Message: GCB 0.8.0 release Index: tcLauncher.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcLauncher.h,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** tcLauncher.h 30 Jun 2005 01:06:09 -0000 1.21 --- tcLauncher.h 10 Sep 2005 21:48:06 -0000 1.22 *************** *** 139,142 **** --- 139,143 ---- void SetChildQuantity(unsigned int quantity); void SetDamaged(bool state); + void SetDatum(double lon_rad, double lat_rad, float alt_m); void SetLaunch(unsigned int quantity); void SetLoadState(bool state); Index: Game.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/Game.h,v retrieving revision 1.60 retrieving revision 1.61 diff -C2 -d -r1.60 -r1.61 *** Game.h 22 Jun 2005 01:21:26 -0000 1.60 --- Game.h 10 Sep 2005 21:48:06 -0000 1.61 *************** *** 72,75 **** --- 72,76 ---- class tcDraggedIconDisplay; class tcMapData; + class tcBriefingView; using namespace scriptinterface; *************** *** 105,108 **** --- 106,110 ---- NETWORK, DISPLAYSETTINGS, + SIMPLEBRIEF, TACTICAL, TACTICALBRIEF, *************** *** 155,158 **** --- 157,161 ---- tcSoundConsole* briefingConsoleLeft; ///< console object for briefing text tcSoundConsole* briefingConsoleBottom; ///< to fill space at bottom for now + tcBriefingView* briefingView; ///< full screen window for simple briefing tcTacticalMapView* tacticalMap; ///< tactical map object tcWorldMapView* worldMap; ///< world map object *************** *** 177,181 **** tcChatBox* chatBox; ///< popup for multiplayer chat tcDraggedIconDisplay* draggedIconDisplay; ///< display of drag-drop icons ! // interfaces for START game mode (unloaded when game is started) tcStartView* startView; --- 180,185 ---- tcChatBox* chatBox; ///< popup for multiplayer chat tcDraggedIconDisplay* draggedIconDisplay; ///< display of drag-drop icons ! ! // interfaces for START game mode (unloaded when game is started) tcStartView* startView; *************** *** 275,278 **** --- 279,283 ---- void StartGame(wxCommandEvent& event); + void SwitchToBriefing(wxCommandEvent& event); void SwitchToCredit(wxCommandEvent& event); void SwitchToDisplaySettings(wxCommandEvent& event); Index: commandlist.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/commandlist.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** commandlist.h 10 Jan 2005 00:30:21 -0000 1.7 --- commandlist.h 10 Sep 2005 21:48:06 -0000 1.8 *************** *** 45,48 **** --- 45,50 ---- GC_DISPLAYMESSAGE, GC_TEXTCOMMAND, + GC_SHOWBRIEFING, + GC_SHOWMISSIONSTATUS, PC_GETNEWHEADING, PC_CHANGEHEADING, Index: tcPlatformObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcPlatformObject.h,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** tcPlatformObject.h 22 Jun 2005 01:21:27 -0000 1.31 --- tcPlatformObject.h 10 Sep 2005 21:48:06 -0000 1.32 *************** *** 81,85 **** }; ! float fuel_kg; ///< current fuel tcLauncherState mcLauncherState; std::vector<tcStores*> magazines; --- 81,85 ---- }; ! double fuel_kg; ///< current fuel tcLauncherState mcLauncherState; std::vector<tcStores*> magazines; |
|
From: Dewitt C. <ddc...@us...> - 2005-09-10 21:48:17
|
Update of /cvsroot/gcblue/gcb_wx/include/scriptinterface In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1435/include/scriptinterface Modified Files: tcPlatformInterface.h tcScenarioInterface.h Log Message: GCB 0.8.0 release Index: tcPlatformInterface.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/scriptinterface/tcPlatformInterface.h,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** tcPlatformInterface.h 26 Jul 2005 00:37:03 -0000 1.44 --- tcPlatformInterface.h 10 Sep 2005 21:48:06 -0000 1.45 *************** *** 244,248 **** /// adds navigation waypoint (creates nav task if necessary) void AddNavWaypoint(float afLon_rad, float afLat_rad); ! /// clear all tasks void ClearTasks(); /// delete task --- 244,250 ---- /// adds navigation waypoint (creates nav task if necessary) void AddNavWaypoint(float afLon_rad, float afLat_rad); ! /// true to loop through waypoints indefinitely ! void SetNavLoopState(bool state); ! /// clear all tasks void ClearTasks(); /// delete task Index: tcScenarioInterface.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/scriptinterface/tcScenarioInterface.h,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** tcScenarioInterface.h 26 Jul 2005 00:37:03 -0000 1.22 --- tcScenarioInterface.h 10 Sep 2005 21:48:06 -0000 1.23 *************** *** 157,160 **** --- 157,165 ---- tcProtectGoal ProtectGoal(const std::string& target); + // simple briefing text + void ClearSimpleBriefing(); + const std::string& GetSimpleBriefing(int alliance) const; + void SetSimpleBriefing(int alliance, const std::string& briefingText); + // non-python methods tcGameObject* GetLastObjectAdded() const; *************** *** 171,176 **** tcScenarioInterface(); ~tcScenarioInterface(); - private: double eventTime; ///< start time for briefing event functions tcGameObject* lastObjectAdded; ///< last object added to sim --- 176,181 ---- tcScenarioInterface(); ~tcScenarioInterface(); private: + double eventTime; ///< start time for briefing event functions tcGameObject* lastObjectAdded; ///< last object added to sim *************** *** 178,181 **** --- 183,187 ---- double lat_theater_deg; ///< default starting latitude for theater int sideCode; ///< used to toggle user's alliance in scenario, 0 means uninitialized + std::map<int, std::string> simpleBriefingText; ///< text for each alliance for simple briefing screen static tcDirector* director; |
Update of /cvsroot/gcblue/gcb_wx/include/graphics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1435/include/graphics Modified Files: tc3DTerrain.h tcButton.h tcLauncherPopup.h tcMessageCenter.h tcNetworkView.h tcRadioButton.h tcScenarioSelectView.h tcXmlWindow.h Log Message: GCB 0.8.0 release Index: tcXmlWindow.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/graphics/tcXmlWindow.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** tcXmlWindow.h 1 Jun 2005 00:13:27 -0000 1.5 --- tcXmlWindow.h 10 Sep 2005 21:48:06 -0000 1.6 *************** *** 41,45 **** { public: ! tcXmlWindow(wxWindow *parent, const wxPoint& pos, const wxSize& size, --- 41,48 ---- { public: ! /// find first button with matching command and change caption ! void SetButtonCaption(long command, const std::string& caption); ! void SetRadioButtonState(long radioCommand, long buttonCommand); ! tcXmlWindow(wxWindow *parent, const wxPoint& pos, const wxSize& size, Index: tcButton.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/graphics/tcButton.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** tcButton.h 27 Jan 2005 01:01:44 -0000 1.12 --- tcButton.h 10 Sep 2005 21:48:06 -0000 1.13 *************** *** 46,57 **** public: virtual void Draw(); ! std::string GetCaption() const {return caption;} long GetCommand() const {return command;} bool IsOn() {return isButtonOn;} ! void LoadImages(std::string offImageName, std::string onImageName, ! std::string overOffImageName, std::string overOnImageName); void SetBackgroundAlpha(float val); ! void SetCaption(std::string s) {caption = s;} void SetCommand(long cmd) {command = cmd;} void SetFillColors(const osg::Vec4& off_color, const osg::Vec4& over_color, --- 46,57 ---- public: virtual void Draw(); ! const std::string& GetCaption() const {return caption;} long GetCommand() const {return command;} bool IsOn() {return isButtonOn;} ! void LoadImages(const std::string& offImageName, const std::string& onImageName, ! const std::string& overOffImageName, const std::string& overOnImageName); void SetBackgroundAlpha(float val); ! void SetCaption(const std::string& s) {caption = s;} void SetCommand(long cmd) {command = cmd;} void SetFillColors(const osg::Vec4& off_color, const osg::Vec4& over_color, Index: tcMessageCenter.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/graphics/tcMessageCenter.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** tcMessageCenter.h 26 Jul 2005 00:37:02 -0000 1.5 --- tcMessageCenter.h 10 Sep 2005 21:48:06 -0000 1.6 *************** *** 35,38 **** --- 35,39 ---- #include "tc3DWindow.h" + class tcButton; class tcMessageChannel; class tcSoundConsole; *************** *** 43,46 **** --- 44,48 ---- { public: + void ActivateChannel(const std::string& channelName); void AddMessage(const std::string& channelName, const std::string& msg); void ClearChannel(const std::string& channelName); *************** *** 72,75 **** --- 74,78 ---- tcSoundConsole* console; bool popupChatText; + tcButton* closeButton; ///< button to close this window tcMessageChannel* GetChannel(const std::string& channelName); Index: tc3DTerrain.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/graphics/tc3DTerrain.h,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** tc3DTerrain.h 23 Nov 2004 23:30:34 -0000 1.13 --- tc3DTerrain.h 10 Sep 2005 21:48:06 -0000 1.14 *************** *** 65,69 **** ~tc3DTerrain(); private: ! tcMapData* mapData; ///< pointer to tcMapData object enum { --- 65,74 ---- ~tc3DTerrain(); private: ! struct WaterTileInfo ! { ! float half_width; ! float xc; ! float yc; ! }; enum { *************** *** 72,75 **** --- 77,81 ---- BASE_TEX_DIM = 515 }; + tcMapData* mapData; ///< pointer to tcMapData object float gridSpacing; ///< distance between neighbors in terrain grid [world coord units=m] float gridOffset; ///< offset for x and y for (0,0) grid element Index: tcScenarioSelectView.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/graphics/tcScenarioSelectView.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** tcScenarioSelectView.h 22 Jun 2005 01:21:26 -0000 1.4 --- tcScenarioSelectView.h 10 Sep 2005 21:48:06 -0000 1.5 *************** *** 129,132 **** --- 129,133 ---- void DrawScenarioDirectory(std::vector<scenarioInfo>& info); wxArrayString GetListOfScenarioFiles(); + bool IsChildScenarioLoaded(const std::vector<scenarioInfo>& info) const; void LogScenarioInfo(std::vector<scenarioInfo>& info, int level); bool ProcessMouseClick(std::vector<scenarioInfo>& info, wxPoint pos); Index: tcRadioButton.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/graphics/tcRadioButton.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** tcRadioButton.h 2 Oct 2004 22:41:32 -0000 1.5 --- tcRadioButton.h 10 Sep 2005 21:48:06 -0000 1.6 *************** *** 42,47 **** --- 42,49 ---- { public: + void ActivateButton(long buttonCommand); virtual void Draw(); std::string GetCaption() const {return caption;} + long GetCommand() const {return command;} void SetCaption(std::string s) {caption = s;} void SetCommand(long cmd) {command = cmd;} Index: tcLauncherPopup.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/graphics/tcLauncherPopup.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** tcLauncherPopup.h 10 Jul 2005 20:32:01 -0000 1.6 --- tcLauncherPopup.h 10 Sep 2005 21:48:06 -0000 1.7 *************** *** 105,108 **** --- 105,109 ---- float runToEnable; + float runToEnable_prev; float depth; float speed; Index: tcNetworkView.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/graphics/tcNetworkView.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** tcNetworkView.h 16 Apr 2005 20:43:55 -0000 1.4 --- tcNetworkView.h 10 Sep 2005 21:48:06 -0000 1.5 *************** *** 48,52 **** MULTIPLAYER_OFF = 0, MULTIPLAYER_CLIENT = 1, ! MULTIPLAYER_SERVER = 2 }; void Draw(); --- 48,54 ---- MULTIPLAYER_OFF = 0, MULTIPLAYER_CLIENT = 1, ! MULTIPLAYER_SERVER = 2, ! ALLOW_ALL = 0, // allow any client to login, creating account if necessary ! ALLOW_REGISTERED = 1 // only allow clients registered in account database to login }; void Draw(); *************** *** 60,63 **** --- 62,67 ---- void SetChatProtocol(wxCommandEvent& event); void SetIPText(wxCommandEvent& event); + void SetLoginMode(wxCommandEvent& event); + void SetLoginMode(int mode); void SetNetworkMode(wxCommandEvent& event); void SetNetworkMode(int mode); |
|
From: Dewitt C. <ddc...@us...> - 2005-09-10 21:48:16
|
Update of /cvsroot/gcblue/gcb_wx/include/ai In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1435/include/ai Modified Files: Nav.h Log Message: GCB 0.8.0 release Index: Nav.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/ai/Nav.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Nav.h 29 Jul 2005 02:35:52 -0000 1.2 --- Nav.h 10 Sep 2005 21:48:06 -0000 1.3 *************** *** 54,58 **** --- 54,60 ---- void AddWaypoint(double lon_rad, double lat_rad, float alt_m); void ClearWaypoints(); + bool GetLoopState() const; const std::vector<GeoPoint>& GetWaypoints() const; + void SetLoopState(bool state); void Update(double t); *************** *** 68,71 **** --- 70,74 ---- std::vector<GeoPoint> waypoints; unsigned currentWaypoint; + bool loop; ///< true to loop back to first waypoint }; |
|
From: Dewitt C. <ddc...@us...> - 2005-09-10 21:47:47
|
Update of /cvsroot/gcblue/gcb_wx/src/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1255/src/sim Modified Files: Game.cpp tcAeroAirObject.cpp tcAirObject.cpp tcBallisticWeapon.cpp tcFlightPort.cpp tcHeloObject.cpp tcLauncher.cpp tcLauncherState.cpp tcObjectControl.cpp tcRadar.cpp tcSensorMap.cpp tcSensorPlatform.cpp tcSimState.cpp Log Message: GCB 0.8.0 release Index: tcSimState.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcSimState.cpp,v retrieving revision 1.88 retrieving revision 1.89 diff -C2 -d -r1.88 -r1.89 *** tcSimState.cpp 26 Jul 2005 00:37:05 -0000 1.88 --- tcSimState.cpp 10 Sep 2005 21:47:38 -0000 1.89 *************** *** 418,421 **** --- 418,422 ---- if (trueRange2 < 144.0f) // 12.0 m range { + bool alreadyDestroyed = target->mfDamageLevel >= 1.0f; float fDamage = missile->mpDBObject->mfDamage; float damageFraction = GetFractionalDamage(fDamage, target); *************** *** 431,444 **** if (mpUserInfo->IsOwnAlliance(target->GetAlliance())) { ! ReportDamage(target); } else if (missile->IsOwnAlliance()) { - tcSound::Get()->PlayEffect("Explosion2"); - wxString msg = wxString::Format("Missile (%s) hit Track %d\n", missile->mzClass.mz, target->mnID); tcMessageInterface::Get()->ConsoleMessage(msg.c_str()); } } --- 432,444 ---- if (mpUserInfo->IsOwnAlliance(target->GetAlliance())) { ! if (!alreadyDestroyed) ReportDamage(target); } else if (missile->IsOwnAlliance()) { wxString msg = wxString::Format("Missile (%s) hit Track %d\n", missile->mzClass.mz, target->mnID); tcMessageInterface::Get()->ConsoleMessage(msg.c_str()); } + PlayEntitySoundEffect(missile, "Explosion2"); } *************** *** 475,478 **** --- 475,479 ---- if (trueRange2 < 144.0f) // 12.0 m range, dz not counted as heavily { + bool alreadyDestroyed = target->mfDamageLevel >= 1.0f; float fDamage = torp->mpDBObject->mfDamage; float damageFraction = GetFractionalDamage(fDamage, target); *************** *** 487,491 **** if (mpUserInfo->IsOwnAlliance(target->GetAlliance())) { ! ReportDamage(target); } else if (torp->IsOwnAlliance()) --- 488,492 ---- if (mpUserInfo->IsOwnAlliance(target->GetAlliance())) { ! if (!alreadyDestroyed) ReportDamage(target); } else if (torp->IsOwnAlliance()) *************** *** 494,500 **** target->mnID); tcMessageInterface::Get()->ConsoleMessage(msg.c_str()); - - tcSound::Get()->PlayEffect("Explosion2"); } } --- 495,500 ---- target->mnID); tcMessageInterface::Get()->ConsoleMessage(msg.c_str()); } + PlayEntitySoundEffect(torp, "Explosion2"); } *************** *** 567,574 **** { float range_m = 1000.0f * target->mcKin.RangeToKmAlt(weapon->mcKin); ! float damage_range_m = 0.5f * target->GetSpan() + 25.0f; if (range_m <= damage_range_m) { float damageFraction = GetFractionalDamage(fDamage, target); target->mfDamageLevel += damageFraction; --- 567,575 ---- { float range_m = 1000.0f * target->mcKin.RangeToKmAlt(weapon->mcKin); ! float damage_range_m = 0.6f * target->GetSpan(); if (range_m <= damage_range_m) { float damageFraction = GetFractionalDamage(fDamage, target); + bool alreadyDestroyed = target->mfDamageLevel >= 1.0f; target->mfDamageLevel += damageFraction; *************** *** 586,590 **** if (mpUserInfo->IsOwnAlliance(target->GetAlliance())) { ! ReportDamage(target); } else if (weapon->IsOwnAlliance()) --- 587,591 ---- if (mpUserInfo->IsOwnAlliance(target->GetAlliance())) { ! if (!alreadyDestroyed) ReportDamage(target); } else if (weapon->IsOwnAlliance()) *************** *** 593,599 **** target->mnID); tcMessageInterface::Get()->ConsoleMessage(msg.c_str()); - - tcSound::Get()->PlayEffect("Explosion2"); } } else --- 594,599 ---- target->mnID); tcMessageInterface::Get()->ConsoleMessage(msg.c_str()); } + PlayEntitySoundEffect(weapon, "Explosion2"); } else *************** *** 648,651 **** --- 648,652 ---- if (randf() < 0.3f) damageFraction = 0; // additional miss chance + bool alreadyDestroyed = target->mfDamageLevel >= 1.0f; target->mfDamageLevel += damageFraction; weapon->mfDamageLevel += 1.0f; // destroys itself on impact *************** *** 657,666 **** if (mpUserInfo->IsOwnAlliance(target->GetAlliance())) { ! ReportDamage(target); ! } ! else ! { ! tcSound::Get()->PlayEffect("Explosion2"); } } } --- 658,665 ---- if (mpUserInfo->IsOwnAlliance(target->GetAlliance())) { ! if (!alreadyDestroyed) ReportDamage(target); } + + PlayEntitySoundEffect(weapon, "Explosion2"); } } *************** *** 767,771 **** tnPoolIndex nKey; tcKinematics *pKin; ! tcTerrainInfo *pTerrainInfo; for (tnPoolIndex i=0;i<nSize;i++) --- 766,773 ---- tnPoolIndex nKey; tcKinematics *pKin; ! tcTerrainInfo *terrainInfo; ! ! const updateDistance_rad = 20.0 * C_MTORAD; ! const lookAheadUpdateSpeed_kts = 200.0f; // speed threshold for updating lookAheadHeight_m for (tnPoolIndex i=0;i<nSize;i++) *************** *** 773,785 **** maPlatformState.GetNextAssoc(cmappos,nKey,pobj); pKin = &pobj->mcKin; ! pTerrainInfo = &pobj->mcTerrain; ! if ((fabs(pKin->mfLat_rad - pTerrainInfo->mfLatDatum) > 1.6e-6f)|| ! (fabs(pKin->mfLon_rad - pTerrainInfo->mfLonDatum) > 1.6e-6f)) { // about 10 meters ! pobj->mcTerrain.mfHeight_m = mpMapData->GetTerrainHeight(C_180OVERPI*(float)pKin->mfLon_rad, C_180OVERPI*(float)pKin->mfLat_rad,mfSimTime); ! pTerrainInfo->mfLonDatum = (float)pKin->mfLon_rad; ! pTerrainInfo->mfLatDatum = (float)pKin->mfLat_rad; } } --- 775,800 ---- maPlatformState.GetNextAssoc(cmappos,nKey,pobj); pKin = &pobj->mcKin; ! terrainInfo = &pobj->mcTerrain; ! if ((fabs(pKin->mfLat_rad - terrainInfo->mfLatDatum) > updateDistance_rad)|| ! (fabs(pKin->mfLon_rad - terrainInfo->mfLonDatum) > updateDistance_rad)) { // about 10 meters ! terrainInfo->mfHeight_m = mpMapData->GetTerrainHeight(C_180OVERPI*(float)pKin->mfLon_rad, C_180OVERPI*(float)pKin->mfLat_rad,mfSimTime); ! terrainInfo->mfLonDatum = (float)pKin->mfLon_rad; ! terrainInfo->mfLatDatum = (float)pKin->mfLat_rad; ! ! if (pobj->mcKin.mfSpeed_kts > lookAheadUpdateSpeed_kts) ! { ! double lon_rad, lat_rad; ! float alt_m; ! pKin->PredictPosition(3.0f, lon_rad, lat_rad, alt_m); ! terrainInfo->lookAheadHeight_m = mpMapData->GetTerrainHeight(C_180OVERPI * (float)lon_rad, ! C_180OVERPI * (float)lat_rad, mfSimTime); ! } ! else ! { ! terrainInfo->lookAheadHeight_m = terrainInfo->mfHeight_m; ! } } } *************** *** 1859,1862 **** --- 1874,1880 ---- void tcSimState::RandInit() { + wxASSERT(false); + return; // disabled for now + int nPlatforms = 12; // number of platforms to add *************** *** 1927,1935 **** tcGeoRect theater; mpMapData->GetTheaterArea(theater); ! float dlon = fabsf(theater.GetLeft() + 8.0); ! float dlat = fabsf(theater.GetTop() - 55.0); if ((dlon > 0.1) || (dlat > 0.1)) { ! mpMapData->LoadHighResB(-8.0, 55.0); } --- 1945,1957 ---- tcGeoRect theater; mpMapData->GetTheaterArea(theater); ! ! const float rand_lon = 119.0; ! const float rand_lat = 26.0; ! ! float dlon = fabsf(theater.GetLeft() - rand_lon); ! float dlat = fabsf(theater.GetTop() - rand_lat); if ((dlon > 0.1) || (dlat > 0.1)) { ! mpMapData->LoadHighResB(rand_lon, rand_lat); } *************** *** 2447,2450 **** --- 2469,2474 ---- track.mnID = obj->mnID; track.mnAffiliation = FRIENDLY; + track.mfTimestamp = obj->mfStatusTime; + track.SetAllValid(); return true; Index: tcSensorMap.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcSensorMap.cpp,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** tcSensorMap.cpp 1 Jun 2005 00:13:33 -0000 1.22 --- tcSensorMap.cpp 10 Sep 2005 21:47:38 -0000 1.23 *************** *** 546,550 **** { tcAllianceSensorMap *pMap = GetMap(anAlliance); ! return pMap->GetSensorMapTrack(anTrackID); } --- 546,557 ---- { tcAllianceSensorMap *pMap = GetMap(anAlliance); ! if (pMap != 0) ! { ! return pMap->GetSensorMapTrack(anTrackID); ! } ! else ! { ! return 0; ! } } Index: tcFlightPort.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcFlightPort.cpp,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** tcFlightPort.cpp 20 Jul 2005 16:24:54 -0000 1.22 --- tcFlightPort.cpp 10 Sep 2005 21:47:38 -0000 1.23 *************** *** 433,437 **** airstate->obj->mnID = localId++; // assign local id airstate->op = OP_NONE; ! airstate->ready_time = 0; airstate->current_location = loc; airstate->current_spot = emptySpotIdx; --- 433,437 ---- airstate->obj->mnID = localId++; // assign local id airstate->op = OP_NONE; ! airstate->ready_time = last_update_time; airstate->current_location = loc; airstate->current_spot = emptySpotIdx; *************** *** 654,657 **** --- 654,662 ---- } + if (spot->obj_info->ready_time > last_update_time) + { + return 0; // not ready yet + } + MoveToLaunchQueue(airstate); *************** *** 677,684 **** tsSpotInfo *spot = &launch_spots.at(n); if ((spot->obj_info != 0) && (spot->obj_info->obj != 0) && ! (spot->obj_info->obj->mnID == id)) { ! Launch((int)n); ! return 1; } } --- 682,697 ---- tsSpotInfo *spot = &launch_spots.at(n); if ((spot->obj_info != 0) && (spot->obj_info->obj != 0) && ! (spot->obj_info->obj->mnID == id)) { ! bool isReady = (spot->obj_info->ready_time >= last_update_time); ! if (isReady) ! { ! Launch((int)n); ! return 1; ! } ! else ! { ! return 0; ! } } } Index: tcHeloObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcHeloObject.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** tcHeloObject.cpp 20 Jul 2005 16:24:54 -0000 1.6 --- tcHeloObject.cpp 10 Sep 2005 21:47:38 -0000 1.7 *************** *** 100,104 **** mcKin.mfClimbAngle_rad = 0; ! if ((dalt_m > -0.25f)&&(dalt_m < 0.25f)) { return; --- 100,104 ---- mcKin.mfClimbAngle_rad = 0; ! if ((dalt_m > -0.25f)&&(dalt_m < 0.25f)&&(fuel_kg > 0)) { return; *************** *** 130,135 **** // restrict climb to altitude rate ! dalt_max = fAltitudeRate_mps * dt_s; ! dalt_min = (mcKin.mfAlt_m <= 200.0f) ? -dalt_max : -2.0f*dalt_max; if (dalt_m < dalt_min) {dalt_m = dalt_min;} --- 130,135 ---- // restrict climb to altitude rate ! dalt_max = (fuel_kg > 0) ? fAltitudeRate_mps * dt_s : -0.5f * fAltitudeRate_mps * dt_s; ! dalt_min = (mcKin.mfAlt_m <= 200.0f) ? -dalt_max : -2.0f*dalt_max; if (dalt_m < dalt_min) {dalt_m = dalt_min;} *************** *** 167,171 **** { if (mcKin.mfSpeed_kts > 0) mcKin.mfSpeed_kts -= 2*ds_max; ! if (mcKin.mfAlt_m > 0) mcKin.mfAlt_m -= dt_s * 10; } } --- 167,171 ---- { if (mcKin.mfSpeed_kts > 0) mcKin.mfSpeed_kts -= 2*ds_max; ! //if (mcKin.mfAlt_m > 0) mcKin.mfAlt_m -= dt_s * 10; } } Index: tcLauncher.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcLauncher.cpp,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** tcLauncher.cpp 26 Jul 2005 00:37:05 -0000 1.28 --- tcLauncher.cpp 10 Sep 2005 21:47:38 -0000 1.29 *************** *** 368,372 **** float fcFov = C_PIOVER180 * fireControlSensor->mpDBObj->mfFieldOfView_deg; ! if ((meLaunchMode == SEEKER_TRACK) & (!IsAutoPoint())) { if (tcMissileDBObject* missile = dynamic_cast<tcMissileDBObject*>(mpChildDBObj)) --- 368,372 ---- float fcFov = C_PIOVER180 * fireControlSensor->mpDBObj->mfFieldOfView_deg; ! if ((meLaunchMode == SEEKER_TRACK) && (!IsAutoPoint())) { if (tcMissileDBObject* missile = dynamic_cast<tcMissileDBObject*>(mpChildDBObj)) *************** *** 436,440 **** return true; } ! else if ((targetClassification & PTYPE_SUBMARINE)&&(mnTargetFlags & SUBSURFACE_TARGET)) { return true; --- 436,440 ---- return true; } ! else if ((targetClassification == PTYPE_SUBMARINE)&&(mnTargetFlags & SUBSURFACE_TARGET)) { return true; *************** *** 461,464 **** --- 461,465 ---- mnChildDBKey = -1; mpChildDBObj = 0; + mnCurrent = 0; return; } *************** *** 578,581 **** --- 579,593 ---- } + void tcLauncher::SetDatum(double lon_rad, double lat_rad, float alt_m) + { + msDatum.Set(lon_rad, lat_rad, alt_m); + + // update run to enable for torpedo + if (tcTorpedoDBObject* torpedoData = dynamic_cast<tcTorpedoDBObject*>(mpChildDBObj)) + { + runToEnable_m = 500.0f * parent->mcKin.RangeToKm(lon_rad, lat_rad); + } + } + /** * Added so that appropriate commandObj receives new command for multiplayer *************** *** 753,757 **** // needs a fire control track (launching platform) to launch ! if ((meLaunchMode == FC_TRACK)||(meLaunchMode == SEEKER_TRACK)) { if (!fireControlSensor) --- 765,769 ---- // needs a fire control track (launching platform) to launch ! if (meLaunchMode == FC_TRACK) { if (!fireControlSensor) *************** *** 797,800 **** --- 809,843 ---- return; } + + /* check fire control state if necessary (this should be able to be handled without + ** all of this sprawling code) */ + if (pMissileDBObj->NeedsFireControl()) + { + if (!fireControlSensor) + { + status = NO_FIRECONTROL; // database error + return; + } + + if (!fireControlSensor->IsTrackAvailable()) + { + status = FC_BUSY; // no FC tracks available + return; + } + + if (targetObj == 0) + { + status = NOT_DETECTED_FC; // target doesn't exist + return; + } + + float range; + if (!fireControlSensor->CanDetectTarget(targetObj, range)) + { + status = NOT_DETECTED_FC; + return; + } + } + long nSensorKey = pMissileDBObj->GetSensorKey(); Index: tcObjectControl.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcObjectControl.cpp,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** tcObjectControl.cpp 26 Jul 2005 00:37:05 -0000 1.46 --- tcObjectControl.cpp 10 Sep 2005 21:47:38 -0000 1.47 *************** *** 113,119 **** 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); --- 113,123 ---- tcOrder order; ! #ifdef _DEBUG ! double priority = brain->GetTaskPriority(taskList[n]); sprintf(zBuff, "%s %.0f", taskList[n].c_str(), priority); + #else + sprintf(zBuff, "%s", taskList[n].c_str()); // don't draw priority in release mode + #endif + context->DrawTextR(zBuff, textx, texty, font, color, fontSize, LEFT_BASE_LINE); *************** *** 867,871 **** // place next to altitude bar float x = 70.0f; ! float y = 80.0f; osg::Vec4 color(0.4f, 1.0f, 0.4f, 1.0f); DrawTextR("Gear down", x, y, defaultFont.get(), --- 871,875 ---- // place next to altitude bar float x = 70.0f; ! float y = 100.0f; osg::Vec4 color(0.4f, 1.0f, 0.4f, 1.0f); DrawTextR("Gear down", x, y, defaultFont.get(), Index: tcAirObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcAirObject.cpp,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** tcAirObject.cpp 14 Jul 2005 23:42:23 -0000 1.27 --- tcAirObject.cpp 10 Sep 2005 21:47:38 -0000 1.28 *************** *** 208,215 **** // avoid crashing ! if (mcGS.mfGoalAltitude_m < mcTerrain.mfHeight_m + 20) { ! mcGS.mfGoalAltitude_m = mcTerrain.mfHeight_m + 20; } float dalt_m = mcGS.mfGoalAltitude_m - mcKin.mfAlt_m; --- 208,249 ---- // avoid crashing ! float& terrain_m = mcTerrain.mfHeight_m; ! ! // handle mountainous (high-alt) terrain differently ! float minAGL_m; ! float correction_m; ! ! if (readyForLanding) ! { ! minAGL_m = 10.0f; ! correction_m = 7.0f; ! } ! else if (terrain_m < 500.0f) ! { ! minAGL_m = 50.0f; ! correction_m = 75.0f; ! } ! else ! { ! minAGL_m = 200.0f; ! correction_m = 300.0f; ! } ! ! ! float correctedAltitude_m = mcGS.mfGoalAltitude_m; ! ! if (mcGS.mfGoalAltitude_m < mcTerrain.mfHeight_m + minAGL_m) { ! correctedAltitude_m = mcTerrain.mfHeight_m + correction_m; } + else if (mcGS.mfGoalAltitude_m < mcTerrain.lookAheadHeight_m + minAGL_m) + { + correctedAltitude_m = mcTerrain.lookAheadHeight_m + correction_m; + } + + if (correctedAltitude_m > mcGS.mfGoalAltitude_m) + { + mcGS.mfGoalAltitude_m = correctedAltitude_m; + } float dalt_m = mcGS.mfGoalAltitude_m - mcKin.mfAlt_m; *************** *** 219,225 **** if ((dalt_m > -0.5f)&&(dalt_m < 0.5f)&& (mcKin.mfClimbAngle_rad < C_PIOVER180*0.2f)&&(mcKin.mfClimbAngle_rad > -C_PIOVER180*0.2f)) ! { ! mcKin.mfClimbAngle_rad = 0; ! mcKin.mfPitch_rad = fAOA_rad; return; } --- 253,263 ---- if ((dalt_m > -0.5f)&&(dalt_m < 0.5f)&& (mcKin.mfClimbAngle_rad < C_PIOVER180*0.2f)&&(mcKin.mfClimbAngle_rad > -C_PIOVER180*0.2f)) ! { ! mcKin.mfClimbAngle_rad = 0; ! if (mcKin.mfClimbAngle_rad > maxPitch_rad) ! { ! mcKin.mfClimbAngle_rad = maxPitch_rad; ! } ! mcKin.mfPitch_rad = fAOA_rad; return; } *************** *** 243,247 **** ! dalt_max = fAltitudeRate_mps*dt_s; dalt_min = (mcKin.mfAlt_m <= 200.0f) ? -dalt_max : -2.0f*dalt_max; if (dalt_m < dalt_min) {dalt_m = dalt_min;} // restrict to altitude rate --- 281,287 ---- ! ! ! dalt_max = (fuel_kg > 0) ? fAltitudeRate_mps * dt_s : -0.25f * fAltitudeRate_mps * dt_s; dalt_min = (mcKin.mfAlt_m <= 200.0f) ? -dalt_max : -2.0f*dalt_max; if (dalt_m < dalt_min) {dalt_m = dalt_min;} // restrict to altitude rate *************** *** 263,266 **** --- 303,311 ---- mcKin.mfClimbAngle_rad = 0; } + + if (mcKin.mfClimbAngle_rad > maxPitch_rad) + { + mcKin.mfClimbAngle_rad = maxPitch_rad; + } mcKin.mfPitch_rad = mcKin.mfClimbAngle_rad + fAOA_rad; Index: tcLauncherState.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcLauncherState.cpp,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** tcLauncherState.cpp 2 Jul 2005 16:51:12 -0000 1.34 --- tcLauncherState.cpp 10 Sep 2005 21:47:38 -0000 1.35 *************** *** 346,350 **** } ! launchers[nLauncher]->msDatum.Set(lon_rad, lat_rad, alt_m); commandObj.SetNewCommand(GetLauncherFlag(nLauncher)); return true; --- 346,350 ---- } ! launchers[nLauncher]->SetDatum(lon_rad, lat_rad, alt_m); commandObj.SetNewCommand(GetLauncherFlag(nLauncher)); return true; Index: Game.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/Game.cpp,v retrieving revision 1.139 retrieving revision 1.140 diff -C2 -d -r1.139 -r1.140 *** Game.cpp 29 Jul 2005 02:35:53 -0000 1.139 --- Game.cpp 10 Sep 2005 21:47:38 -0000 1.140 *************** *** 43,46 **** --- 43,47 ---- #include "tcString.h" #include "tcSimPythonInterface.h" + #include "tcScenarioInterface.h" #include "cspDate.h" #include "tcDirector.h" *************** *** 62,65 **** --- 63,67 ---- #include "tcStoresGui.h" #include "tcPlatformGui.h" + #include "tcBriefingView.h" #if defined(_MSC_VER) *************** *** 90,93 **** --- 92,96 ---- EVT_COMMAND(ID_SCENARIOSELECTVIEW, wxEVT_COMMAND_BUTTON_CLICKED , tcGame::SwitchToScenarioSelect) EVT_COMMAND(ID_MULTIPLAYERVIEW, wxEVT_COMMAND_BUTTON_CLICKED , tcGame::SwitchToNetwork) + EVT_COMMAND(ID_BRIEFINGVIEW, wxEVT_COMMAND_BUTTON_CLICKED , tcGame::SwitchToBriefing) EVT_COMMAND(ID_ENDGAME, wxEVT_COMMAND_BUTTON_CLICKED , tcGame::EndGame) EVT_COMMAND(ID_STARTGAME, wxEVT_COMMAND_BUTTON_CLICKED , tcGame::StartGame) *************** *** 230,233 **** --- 233,237 ---- briefingConsoleLeft->SetActive(false); briefingConsoleBottom->SetActive(false); + briefingView->SetActive(false); chatBox->SetActive(false); displaySettingsView->SetActive(false); *************** *** 243,247 **** viewer->SetActive(false); worldMap->SetActive(false); ! // undo initialization UninitGame(); --- 247,255 ---- viewer->SetActive(false); worldMap->SetActive(false); ! ! briefingView->SetButtonCaption(ID_STARTVIEW, "Return"); ! ! pythonInterface->GetScenarioInterface()->ClearSimpleBriefing(); ! // undo initialization UninitGame(); *************** *** 251,262 **** if (!simState->IsMultiplayerActive()) { - simState->RandInit(); // generate new random scenario - - HookRandomFriendly(); - // reset time gameTime = 0; directorTime = 0; nLastCount = 0; // clear briefing console text --- 259,267 ---- if (!simState->IsMultiplayerActive()) { // reset time gameTime = 0; directorTime = 0; nLastCount = 0; + accelerateTime = 1; // clear briefing console text *************** *** 267,271 **** director->ClearEvents(); director->SetStartTime(0); ! director->InitTest(); // load test event sequence (for random scen) } --- 272,289 ---- director->ClearEvents(); director->SetStartTime(0); ! ! // try to reload last scenario played ! std::string lastPath = tcOptions::Get()->GetOptionString("LastScenarioPath"); ! std::string lastName = tcOptions::Get()->GetOptionString("LastScenarioName"); ! ! if ((lastName.length() > 2) && (lastName != "default")) ! { ! scenarioSelectView->LoadScenario(lastPath, lastName); ! } ! ! if (simState->IsScenarioLoaded()) ! { ! HookRandomFriendly(); ! } } *************** *** 343,347 **** meGameMode = GM_PLAY; ! meScreenMode = TACTICAL; } else --- 361,366 ---- meGameMode = GM_PLAY; ! meScreenMode = SIMPLEBRIEF; ! briefingView->SetButtonCaption(ID_STARTVIEW, "PLAY"); } else *************** *** 351,354 **** --- 370,380 ---- } + void tcGame::SwitchToBriefing(wxCommandEvent& event) + { + if (meGameMode != GM_START) return; + + meScreenMode = SIMPLEBRIEF; + } + void tcGame::SwitchToCredit(wxCommandEvent& event) { *************** *** 583,587 **** try { ! // try to load last scenario played, otherwise use random scenario std::string lastPath = tcOptions::Get()->GetOptionString("LastScenarioPath"); std::string lastName = tcOptions::Get()->GetOptionString("LastScenarioName"); --- 609,613 ---- try { ! // try to load last scenario played std::string lastPath = tcOptions::Get()->GetOptionString("LastScenarioPath"); std::string lastName = tcOptions::Get()->GetOptionString("LastScenarioName"); *************** *** 597,606 **** } ! HookRandomFriendly(); } catch(std::string s) { std::string message; ! message += "Error during RandInit: "; message += s; wxMessageBox(message.c_str(), "Fatal error", wxICON_ERROR); --- 623,635 ---- } ! if (simState->IsScenarioLoaded()) ! { ! HookRandomFriendly(); ! } } catch(std::string s) { std::string message; ! message += "Error during scenario loading: "; message += s; wxMessageBox(message.c_str(), "Fatal error", wxICON_ERROR); *************** *** 609,613 **** catch (...) { ! wxMessageBox("Unknown error during RandInit", "Fatal error", wxICON_ERROR); throw; } --- 638,642 ---- catch (...) { ! wxMessageBox("Unknown error during scenario loading", "Fatal error", wxICON_ERROR); throw; } *************** *** 785,788 **** --- 814,820 ---- briefingConsoleBottom->Print(" "); // need this to get it to display + briefingView = new tcBriefingView(glCanvas, wxPoint(0, 0), wxSize(mnWidth, mnHeight)); + briefingView->SetActive(false); + briefingView->SetButtonCaption(ID_STARTVIEW, "Return"); } *************** *** 914,925 **** bool tcGame::InitGame() { /* ** Info console init * **/ mrectLowerLeft.left = 0; mrectLowerLeft.top = mnHeight-200; ! mrectLowerLeft.right = 200; mrectLowerLeft.bottom = mnHeight; infoConsole = new tcSoundConsole(glCanvas, ! wxPoint(mrectLowerLeft.left, mrectLowerLeft.top), wxSize(200,200), "xml/info_console.xml", "InfoConsole"); infoConsole->SetBaseRenderBin(30); --- 946,959 ---- bool tcGame::InitGame() { + int panelWidth = (mnWidth > 1000) ? 200 : 150; /* ** Info console init * **/ mrectLowerLeft.left = 0; mrectLowerLeft.top = mnHeight-200; ! mrectLowerLeft.right = panelWidth; mrectLowerLeft.bottom = mnHeight; infoConsole = new tcSoundConsole(glCanvas, ! wxPoint(mrectLowerLeft.left, mrectLowerLeft.top), ! wxSize(panelWidth, mrectLowerLeft.bottom - mrectLowerLeft.top), "xml/info_console.xml", "InfoConsole"); infoConsole->SetBaseRenderBin(30); *************** *** 941,946 **** /* ** hookInfo init * **/ ! hookInfo = new tcHookInfo(glCanvas, wxPoint(mrectLowerLeft.right,mrectLowerLeft.top), ! wxSize(200,200)); hookInfo->SetBaseRenderBin(30); if (!hookInfo) --- 975,982 ---- /* ** hookInfo init * **/ ! hookInfo = new tcHookInfo(glCanvas, ! wxPoint(mrectLowerLeft.right,mrectLowerLeft.top), ! wxSize(panelWidth, mrectLowerLeft.bottom - mrectLowerLeft.top)); ! hookInfo->SetBaseRenderBin(30); if (!hookInfo) *************** *** 957,961 **** // objectControl init ! objectControl = new tcObjectControl(glCanvas, wxPoint(mrectLowerLeft.right+200,mrectLowerLeft.top), wxSize(mnWidth-400,200)); //objectControl->SetBaseRenderBin(20); if (!objectControl) --- 993,999 ---- // objectControl init ! objectControl = new tcObjectControl(glCanvas, ! wxPoint(mrectLowerLeft.right+panelWidth, mrectLowerLeft.top), ! wxSize(mnWidth-2*panelWidth, 200)); //objectControl->SetBaseRenderBin(20); if (!objectControl) *************** *** 973,979 **** mrectOOB.left = 0; mrectOOB.top = 0; ! mrectOOB.right = 200; mrectOOB.bottom = mnHeight-200; ! oobView = new tcOOBView(glCanvas, wxPoint(mrectOOB.left,mrectOOB.top), wxSize(mrectOOB.right-mrectOOB.left, mrectOOB.bottom-mrectOOB.top)); oobView->SetBaseRenderBin(20); oobView->MoveToTop(); --- 1011,1018 ---- mrectOOB.left = 0; mrectOOB.top = 0; ! mrectOOB.right = panelWidth; mrectOOB.bottom = mnHeight-200; ! oobView = new tcOOBView(glCanvas, wxPoint(mrectOOB.left,mrectOOB.top), ! wxSize(mrectOOB.right-mrectOOB.left, mrectOOB.bottom-mrectOOB.top)); oobView->SetBaseRenderBin(20); oobView->MoveToTop(); *************** *** 1046,1050 **** pythonInterface->AttachConsole(infoConsole); // sensor maps get cleared in tcSimState::RandInit() ! pythonInterface->AttachSensorMap(simState->mcSensorMap.GetMap(userInfo->GetOwnAlliance())); mcGameView.AttachObjectControl(objectControl); --- 1085,1089 ---- pythonInterface->AttachConsole(infoConsole); // sensor maps get cleared in tcSimState::RandInit() ! pythonInterface->AttachSensorMap(simState->mcSensorMap.GetOrCreateMap(userInfo->GetOwnAlliance())); mcGameView.AttachObjectControl(objectControl); *************** *** 1080,1083 **** --- 1119,1127 ---- briefingConsoleLeft->Clear(); + + pythonInterface->AttachConsole(0); + mcGameView.AttachObjectControl(0); + messageCenter->AttachConsole(0); + } *************** *** 1384,1387 **** --- 1428,1432 ---- networkView->SetActive(false); chatBox->SetActive(false); + briefingView->SetActive(false); } *************** *** 1416,1419 **** --- 1461,1468 ---- networkView->Draw(); break; + case SIMPLEBRIEF: + briefingView->SetActive(true); + briefingView->Draw(); + break; } viewer->SetActive(true); *************** *** 1531,1534 **** --- 1580,1584 ---- briefingConsoleLeft->SetActive(false); briefingConsoleBottom->SetActive(false); + briefingView->SetActive(false); chatBox->SetActive(false); displaySettingsView->SetActive(false); *************** *** 1624,1627 **** --- 1674,1683 ---- draggedIconDisplay->Draw(); } + else if (meScreenMode == SIMPLEBRIEF) + { + briefingView->SetActive(true); + + briefingView->Draw(); + } else if (meScreenMode == OPTIONS) { *************** *** 1742,1746 **** } } ! directorTime += fdt; dateTimeString = gameDateZulu.asString(); if (mbPaused) --- 1798,1802 ---- } } ! if (meScreenMode != SIMPLEBRIEF) directorTime += fdt; // run director when not in simple brief mode dateTimeString = gameDateZulu.asString(); if (mbPaused) *************** *** 1840,1844 **** viewer->Update(gameDateZulu); ! if ((directorTime > 0.1f) && doRender) { viewer->Frame(); --- 1896,1900 ---- viewer->Update(gameDateZulu); ! if (doRender) // if ((directorTime > 0.1f) && doRender) { viewer->Frame(); *************** *** 2205,2209 **** case 'a': accelerateTime = 2*(accelerateTime + 1) - 1; ! if (accelerateTime > 15) { accelerateTime = 0; // return to normal time after 8x --- 2261,2265 ---- case 'a': accelerateTime = 2*(accelerateTime + 1) - 1; ! if (accelerateTime > 31) { accelerateTime = 0; // return to normal time after 8x *************** *** 2214,2230 **** if (chatBox->mbActive) chatBox->MoveToTop(); return; ! case 'g': ! enableGraphicsEngine = !enableGraphicsEngine; ! return; ! case 'h': ! { ! //tcPopupMessage* msg = new tcPopupMessage("TEST", wxPoint(50, 50), 100); ! //msg->SetActive(true); ! tcContainerGui* gui = new tcContainerGui(wxPoint(250, 50), "xml/test_container.xml", "TestContainer"); ! } ! return; ! case 'm': ! enableTacticalMap = !enableTacticalMap; ! return; case 'p': if (!mbScenarioEdit) mbPaused = !mbPaused; --- 2270,2279 ---- if (chatBox->mbActive) chatBox->MoveToTop(); return; ! //case 'g': ! // enableGraphicsEngine = !enableGraphicsEngine; ! // return; ! //case 'm': ! // enableTacticalMap = !enableTacticalMap; ! // return; case 'p': if (!mbScenarioEdit) mbPaused = !mbPaused; *************** *** 2354,2358 **** tsCommandInfo cmd_info; ! if(commandQueue->GetCommand(cmd_info)) { if (cmd_info.mbUsePython) --- 2403,2407 ---- tsCommandInfo cmd_info; ! if (commandQueue->GetCommand(cmd_info)) { if (cmd_info.mbUsePython) *************** *** 2385,2395 **** infoConsole->Print(cmd_info.mzString); } else { ! if (cmd_info.meCmd == GC_QUIT) // a hack for now ! { ! mbQuit = true; ! } ! // ProcessCommand(cmd_info.meCmd,cmd_info.mfData,cmd_info.mnData,cmd_info.mnData2); } } --- 2434,2453 ---- infoConsole->Print(cmd_info.mzString); } + else if (cmd_info.meCmd == GC_QUIT) + { + mbQuit = true; + } + else if (cmd_info.meCmd == GC_SHOWBRIEFING) + { + meScreenMode = SIMPLEBRIEF; + } + else if (cmd_info.meCmd == GC_SHOWMISSIONSTATUS) + { + meScreenMode = MESSAGES; + messageCenter->ActivateChannel("Mission"); + } else { ! fprintf(stderr, "Unrecognized command (%d)\n", cmd_info.meCmd); } } *************** *** 2617,2620 **** --- 2675,2685 ---- std::cout << "Game constructor success" << std::endl; + + // popup warning if game is run lower than 1024 x 768 + if (mnWidth < 1024) + { + wxMessageBox("Graphics layout will not display properly at resolutions lower than 1024 x 768", + "GCB screen resolution warning", wxICON_WARNING); + } } Index: tcBallisticWeapon.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcBallisticWeapon.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** tcBallisticWeapon.cpp 5 May 2005 02:14:54 -0000 1.14 --- tcBallisticWeapon.cpp 10 Sep 2005 21:47:38 -0000 1.15 *************** *** 98,102 **** mcKin.mfSpeed_kts = obj->mcKin.mfSpeed_kts; mcKin.mfHeading_rad = obj->mcKin.mfHeading_rad; ! mcKin.mfPitch_rad = obj->mcKin.mfPitch_rad; mfStatusTime = obj->mfStatusTime; --- 98,108 ---- mcKin.mfSpeed_kts = obj->mcKin.mfSpeed_kts; mcKin.mfHeading_rad = obj->mcKin.mfHeading_rad; ! ! /* use parent platform climb angle for pitch, since pitch determines vertical ! ** velocity for ballistic objects. For gravity bombs we want zero initial vertical ! ** velocity if parent plaform is in level flight. ! */ ! mcKin.mfPitch_rad = obj->mcKin.mfClimbAngle_rad; ! mcKin.mfClimbAngle_rad = mcKin.mfPitch_rad; mfStatusTime = obj->mfStatusTime; *************** *** 109,115 **** if (mpDBObject->IsGunRound()) { ! mcKin.mfSpeed_kts = C_MPSTOKTS * mpDBObject->launchSpeed_mps; ! GeoPoint targetDatum = pLauncher->msDatum; mcKin.mfHeading_rad = mcKin.HeadingToGeoRad(&targetDatum); --- 115,145 ---- if (mpDBObject->IsGunRound()) { ! GeoPoint targetDatum; ! tcTrack targetTrack; ! targetTrack.Clear(); ! // if the launcher has a target, set launch az based on projected position ! if (simState->GetTruthTrack(pLauncher->mnTargetID, targetTrack)) ! { ! targetDatum.mfLon_rad = targetTrack.mfLon_rad; ! targetDatum.mfLat_rad = targetTrack.mfLat_rad; ! targetDatum.mfAlt_m = targetTrack.mfAlt_m; ! ! float range_m = 1000.0f * mcKin.RangeToKm(&targetDatum); ! float dz_m = targetDatum.mfAlt_m - mcKin.mfAlt_m; ! float tti_s; ! ! mpDBObject->GetGunneryElevation(range_m, dz_m, tti_s); ! targetTrack = targetTrack.PredictAhead(tti_s); ! targetDatum.mfLon_rad = targetTrack.mfLon_rad; ! targetDatum.mfLat_rad = targetTrack.mfLat_rad; ! targetDatum.mfAlt_m = targetTrack.mfAlt_m; ! } ! else ! { ! targetDatum = pLauncher->msDatum; ! } ! ! mcKin.mfSpeed_kts = C_MPSTOKTS * mpDBObject->launchSpeed_mps; mcKin.mfHeading_rad = mcKin.HeadingToGeoRad(&targetDatum); *************** *** 119,122 **** --- 149,160 ---- mcKin.mfPitch_rad = mpDBObject->GetGunneryElevation(range_m, dz_m, tti_s); + + // add some error to launch az and el + mcKin.mfPitch_rad += randfc(0.006); + mcKin.mfHeading_rad += randfc(0.006); + + mcKin.mfClimbAngle_rad = mcKin.mfPitch_rad; + + /* *************** *** 155,158 **** --- 193,197 ---- } + wxString s = wxString::Format("Ball %d-%d", obj->mnID, rand() % 1000); mzUnit = s.c_str(); Index: tcSensorPlatform.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcSensorPlatform.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** tcSensorPlatform.cpp 29 Jul 2005 02:35:53 -0000 1.9 --- tcSensorPlatform.cpp 10 Sep 2005 21:47:38 -0000 1.10 *************** *** 29,32 **** --- 29,33 ---- #include "tcSensorPlatformDBObject.h" #include "tcSonarDBObject.h" + #include "tcGameObject.h" #include "tcESMSensor.h" #include "tcRadar.h" *************** *** 428,431 **** --- 429,433 ---- wxASSERT(sensor); + sensor->mfSensorHeight_m = 0.1f * parent->GetSpan(); //< guess sensor height is 10% of length sensor->SetMountAz(0); sensorState.push_back(sensor); Index: tcAeroAirObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcAeroAirObject.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** tcAeroAirObject.cpp 20 Jul 2005 16:24:54 -0000 1.19 --- tcAeroAirObject.cpp 10 Sep 2005 21:47:38 -0000 1.20 *************** *** 322,335 **** angleOfAttack = aoaConstant / ias_mps; if (ias_mps <= mpDBObject->stallSpeed_mps) { throttleFraction = 1.0f; ! mcGS.mfGoalAltitude_m = k.mfAlt_m - 50.0f; // avoid flooding connection with stall adjustments inducedDrag_N = 0; // stall, no induced drag } ! else { // assumes level flight inducedDrag_N = mpDBObject->mfKdi * weight_N * angleOfAttack; } --- 322,342 ---- angleOfAttack = aoaConstant / ias_mps; + const float stallPitch = -0.1f; if (ias_mps <= mpDBObject->stallSpeed_mps) { throttleFraction = 1.0f; ! //mcGS.mfGoalAltitude_m = k.mfAlt_m - 50.0f; // avoid flooding connection with stall adjustments ! maxPitch_rad = stallPitch; inducedDrag_N = 0; // stall, no induced drag } ! else if (ias_mps <= mpDBObject->stallSpeed_mps + 50.0f) { + maxPitch_rad = stallPitch + 0.02f * (ias_mps - mpDBObject->stallSpeed_mps); + } + else + { // assumes level flight + maxPitch_rad = 1.0f + stallPitch; inducedDrag_N = mpDBObject->mfKdi * weight_N * angleOfAttack; } *************** *** 347,351 **** if (k.mfSpeed_kts > mpDBObject->mfMaxSpeed_kts) k.mfSpeed_kts = mpDBObject->mfMaxSpeed_kts; ! else if (k.mfSpeed_kts < 40.0) { // shouldn't happen, but limit speed to 40 and slowly dive in this case --- 354,358 ---- if (k.mfSpeed_kts > mpDBObject->mfMaxSpeed_kts) k.mfSpeed_kts = mpDBObject->mfMaxSpeed_kts; ! else if (k.mfSpeed_kts <= 40.0) { // shouldn't happen, but limit speed to 40 and slowly dive in this case Index: tcRadar.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcRadar.cpp,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** tcRadar.cpp 7 Jul 2005 01:13:44 -0000 1.32 --- tcRadar.cpp 10 Sep 2005 21:47:38 -0000 1.33 *************** *** 175,179 **** } ! float fRadarHorizon = C_RADARHOR*(sqrtf(tgt_kin->mfAlt_m) +sqrtf(rdr_kin->mfAlt_m)); fTargetRange_km = C_RADTOKM*nsNav::GCDistanceApprox_rad(rdr_kin->mfLat_rad, rdr_kin->mfLon_rad, tgt_kin->mfLat_rad,tgt_kin->mfLon_rad); --- 175,179 ---- } ! float fRadarHorizon = C_RADARHOR*(sqrtf(tgt_kin->mfAlt_m) +sqrtf(rdr_kin->mfAlt_m + mfSensorHeight_m)); fTargetRange_km = C_RADTOKM*nsNav::GCDistanceApprox_rad(rdr_kin->mfLat_rad, rdr_kin->mfLon_rad, tgt_kin->mfLat_rad,tgt_kin->mfLon_rad); |
Update of /cvsroot/gcblue/gcb_wx/src/graphics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1255/src/graphics Modified Files: ObjectUpdater.cpp tc3DTerrain.cpp tc3DViewer.cpp tc3DWindow.cpp tcButton.cpp tcConsoleBox.cpp tcCreditView.cpp tcGameView.cpp tcHookInfo.cpp tcLauncherPopup.cpp tcMapView.cpp tcMessageCenter.cpp tcNetworkView.cpp tcPopupControl.cpp tcRadioButton.cpp tcScenarioSelectView.cpp tcStartView.cpp tcXmlWindow.cpp Log Message: GCB 0.8.0 release Index: tcStartView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcStartView.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** tcStartView.cpp 5 May 2005 02:14:52 -0000 1.10 --- tcStartView.cpp 10 Sep 2005 21:47:38 -0000 1.11 *************** *** 96,103 **** ! wxString s = wxString::Format("%s Test Build", __DATE__); DrawTextR(s.c_str(), 85.0, 180.0, ! GetDefaultFont(), color, 24.0, LEFT_BASE_LINE); --- 96,103 ---- ! /*wxString s = wxString::Format("%s Test Build", __DATE__); DrawTextR(s.c_str(), 85.0, 180.0, ! GetDefaultFont(), color, 24.0, LEFT_BASE_LINE);*/ Index: tcNetworkView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcNetworkView.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** tcNetworkView.cpp 26 Jul 2005 00:37:04 -0000 1.10 --- tcNetworkView.cpp 10 Sep 2005 21:47:38 -0000 1.11 *************** *** 44,47 **** --- 44,48 ---- EVT_COMMAND(ID_JOINGAME, wxEVT_COMMAND_BUTTON_CLICKED , tcNetworkView::JoinGame) EVT_COMMAND(ID_CHATPROTOCOL, wxEVT_COMMAND_BUTTON_CLICKED , tcNetworkView::SetChatProtocol) + EVT_COMMAND(ID_LOGINMODE, wxEVT_COMMAND_BUTTON_CLICKED , tcNetworkView::SetLoginMode) EVT_COMMAND(1, wxEVT_COMMAND_TEXT_UPDATED, tcNetworkView::SetIPText) EVT_COMMAND(2, wxEVT_COMMAND_TEXT_UPDATED, tcNetworkView::SendChatText) *************** *** 200,203 **** --- 201,227 ---- } + void tcNetworkView::SetLoginMode(wxCommandEvent& event) + { + int mode = event.m_extraLong; + + SetLoginMode(mode); + } + + void tcNetworkView::SetLoginMode(int mode) + { + if (mode == ALLOW_ALL) + { + tcMultiplayerInterface::Get()->SetAcceptAllClients(true); + } + else if (mode == ALLOW_REGISTERED) + { + tcMultiplayerInterface::Get()->SetAcceptAllClients(false); + } + else + { + wxASSERT(false); // unrecognized mode + } + } + void tcNetworkView::SetNetworkMode(wxCommandEvent& event) { *************** *** 341,345 **** if (!tcOptions::Get()->OptionStringExists("HostAddress")) { ! tcOptions::Get()->SetOptionString("HostAddress", "192.168.0.100"); } ipEdit->SetBuffer(tcOptions::Get()->GetOptionString("HostAddress")); --- 365,369 ---- if (!tcOptions::Get()->OptionStringExists("HostAddress")) { ! tcOptions::Get()->SetOptionString("HostAddress", "192.168.1.2"); } ipEdit->SetBuffer(tcOptions::Get()->GetOptionString("HostAddress")); *************** *** 378,381 **** --- 402,415 ---- chatEntry->SetClearOnReturn(true); chatEntry->SetBuffer(""); + + // set client policy to match tcMultiplayerInterface + if (tcMultiplayerInterface::Get()->GetAcceptAllClients()) + { + SetRadioButtonState(ID_LOGINMODE, 0); + } + else + { + SetRadioButtonState(ID_LOGINMODE, 1); + } } Index: tc3DTerrain.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tc3DTerrain.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** tc3DTerrain.cpp 20 Jul 2005 16:24:54 -0000 1.19 --- tc3DTerrain.cpp 10 Sep 2005 21:47:38 -0000 1.20 *************** *** 57,104 **** waterSurface = new osg::Geometry; ! osg::Vec3Array* vertices = new osg::Vec3Array(8); ! (*vertices)[0] = osg::Vec3(1e5, 1e5, 0); ! (*vertices)[1] = osg::Vec3(-1e5, 1e5, 0); ! (*vertices)[2] = osg::Vec3(-1e5, -1e5, 0); ! (*vertices)[3] = osg::Vec3(1e5, -1e5, 0); ! (*vertices)[4] = osg::Vec3(1e5, -1e5, 0); ! (*vertices)[5] = osg::Vec3(-1e5, -1e5, 0); ! (*vertices)[6] = osg::Vec3(-1e5, 1e5, 0); ! (*vertices)[7] = osg::Vec3(1e5, 1e5, 0); ! waterSurface->setVertexArray(vertices); ! ! osg::Vec2Array* texcoords = new osg::Vec2Array(8); ! const float k_tex = 500.0f; // larger repeats texture more ! (*texcoords)[0].set(0.0f, k_tex); ! (*texcoords)[1].set(0.0f, 0.0f); ! (*texcoords)[2].set(k_tex, 0.0f); ! (*texcoords)[3].set(k_tex, k_tex); ! (*texcoords)[4].set(0.0f, k_tex); ! (*texcoords)[5].set(0.0f, 0.0f); ! (*texcoords)[6].set(k_tex, 0.0f); ! (*texcoords)[7].set(k_tex, k_tex); ! waterSurface->setTexCoordArray(0, texcoords); ! ! osg::Vec3Array* normals = new osg::Vec3Array(2); ! (*normals)[0].set(0.0f, 0.0f, 1.0f); ! (*normals)[1].set(0.0f, 0.0f, -1.0f); ! waterSurface->setNormalArray(normals); ! waterSurface->setNormalBinding(osg::Geometry::BIND_PER_PRIMITIVE); ! osg::Vec4Array* colors = new osg::Vec4Array; ! colors->push_back(osg::Vec4(1.0f,1.0f,1.0f,1.0f)); ! waterSurface->setColorArray(colors); ! waterSurface->setColorBinding(osg::Geometry::BIND_OFF); // BIND_OVERALL ! waterSurface->addPrimitiveSet(new osg::DrawArrays(GL_QUADS,0,8)); - waterSurface->setUseDisplayList(true); --- 57,163 ---- waterSurface = new osg::Geometry; ! /* Use 9 smaller tiles in center with 8 larger tiles surrounding. ! ** This avoids ATI false lighting issue with big textured quad. */ ! const float hw_small = 5000.0f; ! const float hw_large = 3 * hw_small; ! const float hw_large2 = 3 * hw_large; ! std::vector<WaterTileInfo> tiles; ! for (float xc=-2*hw_small; xc<=2*hw_small; xc+=2*hw_small) ! { ! for(float yc=-2*hw_small; yc<=2*hw_small; yc+=2*hw_small) ! { ! WaterTileInfo tile; ! tile.half_width = hw_small; ! tile.xc = xc; ! tile.yc = yc; ! tiles.push_back(tile); ! } ! } + for (float xc=-2*hw_large; xc<=2*hw_large; xc+=2*hw_large) + { + for(float yc=-2*hw_large; yc<=2*hw_large; yc+=2*hw_large) + { + if ((xc != 0) || (yc != 0)) + { + WaterTileInfo tile; + tile.half_width = hw_large; + tile.xc = xc; + tile.yc = yc; ! tiles.push_back(tile); ! } ! } ! } + for (float xc=-2*hw_large2; xc<=2*hw_large2; xc+=2*hw_large2) + { + for(float yc=-2*hw_large2; yc<=2*hw_large2; yc+=2*hw_large2) + { + if ((xc != 0) || (yc != 0)) + { + WaterTileInfo tile; + tile.half_width = hw_large2; + tile.xc = xc; + tile.yc = yc; ! tiles.push_back(tile); ! } ! } ! } ! ! osg::Vec3Array* vertices = new osg::Vec3Array; ! osg::Vec2Array* texcoords = new osg::Vec2Array; ! osg::Vec3Array* normals = new osg::Vec3Array; ! ! ! ! for (size_t k=0; k<tiles.size(); k++) ! { ! WaterTileInfo& tile = tiles[k]; ! ! float half_width = tile.half_width; ! float xc = tile.xc; ! float yc = tile.yc; ! float k_tex = 0.002f * half_width; // larger repeats texture more + vertices->push_back(osg::Vec3(half_width + xc, half_width + yc, 0)); + vertices->push_back(osg::Vec3(-half_width + xc, half_width + yc, 0)); + vertices->push_back(osg::Vec3(-half_width + xc, -half_width + yc, 0)); + vertices->push_back(osg::Vec3(half_width + xc, -half_width + yc, 0)); + vertices->push_back(osg::Vec3(half_width + xc, -half_width + yc, 0)); + vertices->push_back(osg::Vec3(-half_width + xc, -half_width + yc, 0)); + vertices->push_back(osg::Vec3(-half_width + xc, half_width + yc, 0)); + vertices->push_back(osg::Vec3(half_width + xc, half_width + yc, 0)); + + + texcoords->push_back(osg::Vec2(0.0f, k_tex)); + texcoords->push_back(osg::Vec2(0.0f, 0.0f)); + texcoords->push_back(osg::Vec2(k_tex, 0.0f)); + texcoords->push_back(osg::Vec2(k_tex, k_tex)); + texcoords->push_back(osg::Vec2(0.0f, k_tex)); + texcoords->push_back(osg::Vec2(0.0f, 0.0f)); + texcoords->push_back(osg::Vec2(k_tex, 0.0f)); + texcoords->push_back(osg::Vec2(k_tex, k_tex)); + + + normals->push_back(osg::Vec3(0.0f, 1.0f, 0.0f)); + normals->push_back(osg::Vec3(0.0f, 0.0f, -1.0f)); + + } + + waterSurface->setVertexArray(vertices); + waterSurface->setTexCoordArray(0, texcoords); + waterSurface->setNormalArray(normals); + waterSurface->setNormalBinding(osg::Geometry::BIND_PER_PRIMITIVE); // BIND_PER_PRIMITIVE BIND_PER_VERTEX + + waterSurface->addPrimitiveSet(new osg::DrawArrays(GL_QUADS,0,vertices->size())); + + waterSurface->setUseDisplayList(true); *************** *** 107,114 **** //stateSet->setMode(GL_DEPTH_WRITEMASK, osg::StateAttribute::ON); stateSet->setMode(GL_LIGHTING, osg::StateAttribute::ON); ! stateSet->setMode(GL_BLEND, osg::StateAttribute::ON); stateSet->setMode(GL_FOG, osg::StateAttribute::ON); //stateSet->setRenderBinDetails(baseRenderBin + rectRenderBin, "RenderBin"); waterTexture = new osg::Texture2D; waterTexture->setImage(osgDB::readImageFile("water2b.bmp")); --- 166,179 ---- //stateSet->setMode(GL_DEPTH_WRITEMASK, osg::StateAttribute::ON); stateSet->setMode(GL_LIGHTING, osg::StateAttribute::ON); ! stateSet->setMode(GL_BLEND, osg::StateAttribute::OFF); stateSet->setMode(GL_FOG, osg::StateAttribute::ON); //stateSet->setRenderBinDetails(baseRenderBin + rectRenderBin, "RenderBin"); + + osg::Vec4Array* colors = new osg::Vec4Array; + colors->push_back(osg::Vec4(1.0f,1.0f,1.0f,1.0f)); + waterSurface->setColorArray(colors); + waterSurface->setColorBinding(osg::Geometry::BIND_OVERALL); // BIND_OVERALL BIND_OFF + waterTexture = new osg::Texture2D; waterTexture->setImage(osgDB::readImageFile("water2b.bmp")); Index: tcLauncherPopup.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcLauncherPopup.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** tcLauncherPopup.cpp 10 Jul 2005 20:32:03 -0000 1.8 --- tcLauncherPopup.cpp 10 Sep 2005 21:47:38 -0000 1.9 *************** *** 108,111 **** --- 108,112 ---- } + unsigned currentCount = tcTime::Get()->Get30HzCount(); unsigned age = currentCount - birthCount; *************** *** 180,184 **** activePassiveButton->SetCaption("Active"); } ! DrawChildren(); --- 181,185 ---- activePassiveButton->SetCaption("Active"); } ! DrawChildren(); *************** *** 221,224 **** --- 222,226 ---- if (!launcher) return; + launchButton = new tcButton(this, wxPoint(mnWidth - 40, 20), wxSize(widgetHeight, widgetHeight)); *************** *** 249,252 **** --- 251,255 ---- runToEnableAdjust->SetSendRedraw(true); runToEnable = launcher->runToEnable_m; + runToEnable_prev = runToEnable; y += widgetHeight + 5; *************** *** 300,307 **** activePassiveButton->SetFontSize(12.0); activePassiveButton->SetSendRedraw(true); - activePassiveButton->SetOn(launcher->usePassive); activePassiveButton->SetFillColors(osg::Vec4(0.0, 0.0, 0.0, 1.0), osg::Vec4(1.0, 1.0, 1.0, 1.0), osg::Vec4(0.4, 1.0, 0.4, 1.0)); } --- 303,310 ---- activePassiveButton->SetFontSize(12.0); activePassiveButton->SetSendRedraw(true); activePassiveButton->SetFillColors(osg::Vec4(0.0, 0.0, 0.0, 1.0), osg::Vec4(1.0, 1.0, 1.0, 1.0), osg::Vec4(0.4, 1.0, 0.4, 1.0)); + isPassive = true; } *************** *** 315,319 **** if (launcher == 0) return; ! launcher->runToEnable_m = runToEnable; launcher->runDepth_m = depth; --- 318,332 ---- if (launcher == 0) return; ! // use launcher value if local value hasn't changed to pick up changes due to ! // datum changes ! if (runToEnable != runToEnable_prev) ! { ! launcher->runToEnable_m = runToEnable; ! } ! else ! { ! runToEnable = launcher->runToEnable_m; ! } ! runToEnable_prev = runToEnable; launcher->runDepth_m = depth; *************** *** 323,327 **** launcher->usePassive = isPassive; ! activePassiveButton->SetOn(isPassive); } --- 336,340 ---- launcher->usePassive = isPassive; ! activePassiveButton->SetOn(!isPassive); } *************** *** 475,478 **** --- 488,493 ---- isPassive = true; } + + activePassiveButton->SetOn(!launcher->usePassive); } } Index: tcRadioButton.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcRadioButton.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** tcRadioButton.cpp 17 Apr 2005 22:35:31 -0000 1.9 --- tcRadioButton.cpp 10 Sep 2005 21:47:38 -0000 1.10 *************** *** 138,141 **** --- 138,162 ---- /** + * Sets button with command matching buttonCommand on and all others off + */ + void tcRadioButton::ActivateButton(long buttonCommand) + { + for(size_t n=0;n<buttons.size();n++) + { + if (buttons[n]->GetCommand() == buttonCommand) + { + buttons[n]->SetOn(true); + } + else + { + buttons[n]->SetOn(false); + } + + } + + } + + + /** * version to initialize from XML file */ Index: tcHookInfo.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcHookInfo.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** tcHookInfo.cpp 26 Jul 2005 00:37:04 -0000 1.14 --- tcHookInfo.cpp 10 Sep 2005 21:47:38 -0000 1.15 *************** *** 143,146 **** --- 143,151 ---- if (k < nContributors-1) s += ","; } + if (s.size() > 35) + { + s = s.substr(0, 35); + } + DrawTextR(s.c_str(), ftextx, ftexty, defaultFont.get(), color, fontSize, LEFT_BASE_LINE); ftexty += 15; Index: tcScenarioSelectView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcScenarioSelectView.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** tcScenarioSelectView.cpp 29 Jul 2005 02:35:53 -0000 1.12 --- tcScenarioSelectView.cpp 10 Sep 2005 21:47:38 -0000 1.13 *************** *** 36,39 **** --- 36,40 ---- #include "wxcommands.h" #include "tcSimPythonInterface.h" + #include "tcScenarioInterface.h" #include "common/tinyxml.h" #include "network/tcMultiplayerInterface.h" *************** *** 215,221 **** totalPath += filePath; if (!wxString(caption.c_str()).Contains("Random")) { ! mpSimState->mpPythonInterface->LoadScenario(totalPath.c_str(), filePath.c_str()); } else --- 216,230 ---- totalPath += filePath; + + tcSimPythonInterface* pythonInterface = tcSimPythonInterface::Get(); + // clear briefing in case scenario fails to set it + pythonInterface->GetScenarioInterface()->ClearSimpleBriefing(); + pythonInterface->LoadScenario(totalPath.c_str(), filePath.c_str()); + + + /* random loading broken for now if (!wxString(caption.c_str()).Contains("Random")) { ! } else *************** *** 224,227 **** --- 233,237 ---- mpSimState->RandInit(); } + */ if (mpSimState->msScenarioInfo.mbLoaded) *************** *** 306,309 **** --- 316,343 ---- /** + * Recursive method to check if child matches loaded scenario + * This is used to expand the correct parent directories to show the initial scenario loaded + * at the start of the game. + */ + bool tcScenarioSelectView::IsChildScenarioLoaded(const std::vector<scenarioInfo>& info) const + { + for (size_t n=0; n < info.size(); ++n) + { + const scenarioInfo& item = info[n]; + bool hasChildren = item.children.size(); + if (hasChildren) + { + if (IsChildScenarioLoaded(item.children)) return true; + } + else + { + if (item.caption == loadedScenarioCaption) return true; + } + } + + return false; + } + + /** * Recursive method to update drawing info of scenarioInfo vector */ *************** *** 328,331 **** --- 362,371 ---- item.drawBox.x -= xIndent; item.drawBox.width += xIndent; + + if (!item.showChildren && (IsChildScenarioLoaded(item.children))) + { + item.showChildren = true; + } + if (item.showChildren) { *************** *** 343,346 **** --- 383,387 ---- item.drawState = scenarioInfo::ON; if (item.drawState != oldState) tcSound::Get()->PlayEffect("Beep2"); + } else if (r.Inside(mousePosition)) Index: tcXmlWindow.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcXmlWindow.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** tcXmlWindow.cpp 1 Jun 2005 00:13:31 -0000 1.6 --- tcXmlWindow.cpp 10 Sep 2005 21:47:38 -0000 1.7 *************** *** 140,143 **** --- 140,184 ---- } + /** + * This allows a window to change the caption of a button based on game state + * Using this will override the caption specified in the xml file + */ + void tcXmlWindow::SetButtonCaption(long command, const std::string& caption) + { + for (unsigned int n=0; n<children.size(); n++) + { + if (tcButton* button = dynamic_cast<tcButton*>(children[n])) + { + if (button->GetCommand() == command) + { + button->SetCaption(caption); + return; + } + } + + } + } + + /** + * Finds first radio button with command matching radioCommand and sets + * button on with command matching buttonCommand. + */ + void tcXmlWindow::SetRadioButtonState(long radioCommand, long buttonCommand) + { + for (unsigned int n=0; n<children.size(); n++) + { + if (tcRadioButton* radio = dynamic_cast<tcRadioButton*>(children[n])) + { + if (radio->GetCommand() == radioCommand) + { + radio->ActivateButton(buttonCommand); + return; + } + } + + } + } + + tcXmlWindow::tcXmlWindow(wxWindow *parent, const wxPoint& pos, const wxSize& size, Index: tcMessageCenter.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcMessageCenter.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** tcMessageCenter.cpp 26 Jul 2005 00:37:04 -0000 1.8 --- tcMessageCenter.cpp 10 Sep 2005 21:47:38 -0000 1.9 *************** *** 26,33 **** #include "tcPopupMessage.h" #include "tcSoundConsole.h" #include <stdio.h> #include <iostream> ! #include "tcTime.h" #ifdef _DEBUG --- 26,36 ---- #include "tcPopupMessage.h" #include "tcSoundConsole.h" + #include "tcButton.h" + #include "tcTime.h" + #include "common/wxcommands.h" #include <stdio.h> #include <iostream> ! #ifdef _DEBUG *************** *** 35,38 **** --- 38,69 ---- #endif + + /** + * Set indicated channel active if it exists, otherwise do nothing + */ + void tcMessageCenter::ActivateChannel(const std::string& channelName) + { + if (channelName == activeChannelName) return; // already active + + tcMessageChannel* activeChannel = GetChannel(activeChannelName); + + std::map<std::string, tcMessageChannel*>::iterator iter; + for (iter = channelMap.begin(); iter != channelMap.end(); ++iter) + { + tcMessageChannel* channel = iter->second; + if (channel->GetName() == channelName) + { + channel->SetActive(true); + if (activeChannel) + { + activeChannel->SetActive(false); + } + activeChannelName = channelName; + return; + } + } + + } + /** * *************** *** 93,96 **** --- 124,131 ---- channel->Draw(this); } + + DrawChildren(); + + DrawBorder(); FinishDraw(); *************** *** 246,249 **** --- 281,294 ---- LoadBackgroundImage("background.jpg"); + + const int closeButtonSize = 16; + closeButton = new tcButton(this, wxPoint(mnWidth - closeButtonSize - 1, 1), + wxSize(closeButtonSize, closeButtonSize)); + closeButton->SetActive(true); + closeButton->SetBackgroundAlpha(1.0); + closeButton->SetCaption(""); + closeButton->SetCommand(ID_STARTVIEW); + closeButton->LoadImages("close.png", "close.png", "close.png", "close.png"); + closeButton->SetSendRedraw(true); } Index: tcCreditView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcCreditView.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** tcCreditView.cpp 26 Jul 2005 00:37:04 -0000 1.16 --- tcCreditView.cpp 10 Sep 2005 21:47:38 -0000 1.17 *************** *** 85,90 **** AddCredit(s, 25.0f, 1); s = "Havoc"; ! AddCredit(s, 125.0f, 1); --- 85,99 ---- AddCredit(s, 25.0f, 1); + s = "Guido Militello"; + AddCredit(s, 25.0f, 1); + s = "Havoc"; ! AddCredit(s, 75.0f, 1); ! ! s = "--- \"Music\" ---"; ! AddCredit(s, 25.0f, 1); ! ! s = "Dewitt Colclough"; ! AddCredit(s, 150.0f, 1); Index: tcMapView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcMapView.cpp,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** tcMapView.cpp 20 Jul 2005 16:24:54 -0000 1.32 --- tcMapView.cpp 10 Sep 2005 21:47:38 -0000 1.33 *************** *** 1954,1962 **** long tcTacticalMapView::Hook(wxPoint pscreen) { - long nMinID; long currentHook; - hookedId.clear(); - if (GetHookCount() == 1) { --- 1954,1959 ---- *************** *** 1968,1972 **** } ! nMinID = GetClosest(pscreen); if (nMinID != currentHook) { --- 1965,1969 ---- } ! long nMinID = GetClosest(pscreen); if (nMinID != currentHook) { *************** *** 1977,1980 **** --- 1974,1978 ---- } + hookedId.clear(); if (nMinID != -1) { *************** *** 2317,2321 **** ! /***********************************************************************************/ void tcTacticalMapView::OnLButtonDown(wxMouseEvent& event) { --- 2315,2321 ---- ! /** ! * ! */ void tcTacticalMapView::OnLButtonDown(wxMouseEvent& event) { Index: tcPopupControl.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcPopupControl.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** tcPopupControl.cpp 14 Jul 2005 23:42:22 -0000 1.10 --- tcPopupControl.cpp 10 Sep 2005 21:47:38 -0000 1.11 *************** *** 84,87 **** --- 84,89 ---- //mcGameMenu.AddItem("Load scenario", GC_LOADSCEN); mcGameMenu.AddItem("Quit", GC_QUIT); + mcGameMenu.AddItem("Show briefing", GC_SHOWBRIEFING); + mcGameMenu.AddItem("Show mission status", GC_SHOWMISSIONSTATUS); //mcGameMenu.EndSubMenu(); Index: tcButton.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcButton.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** tcButton.cpp 1 Jun 2005 00:13:30 -0000 1.18 --- tcButton.cpp 10 Sep 2005 21:47:38 -0000 1.19 *************** *** 2,6 **** ** @file tcButton.cpp */ ! /* Copyright (C) 2003-2004 Dewitt Colclough (de...@tw...) ** All rights reserved. --- 2,6 ---- ** @file tcButton.cpp */ ! /* Copyright (C) 2003-2005 Dewitt Colclough (de...@tw...) ** All rights reserved. *************** *** 72,75 **** --- 72,76 ---- { tc3DWindow::DrawImage(image, 0, 0, mnWidth, mnHeight, LEFT_BASE_LINE); + HideUnusedObjects(); return; } *************** *** 120,125 **** * a successful LoadImages call */ ! void tcButton::LoadImages(std::string offImageName, std::string onImageName, ! std::string overOffImageName, std::string overOnImageName) { offImage = LoadTexture(offImageName.c_str()); --- 121,126 ---- * a successful LoadImages call */ ! void tcButton::LoadImages(const std::string& offImageName, const std::string& onImageName, ! const std::string& overOffImageName, const std::string& overOnImageName) { offImage = LoadTexture(offImageName.c_str()); Index: tcConsoleBox.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcConsoleBox.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** tcConsoleBox.cpp 29 Apr 2005 18:52:53 -0000 1.14 --- tcConsoleBox.cpp 10 Sep 2005 21:47:38 -0000 1.15 *************** *** 77,81 **** int nLen = (int)strlen(line); ! wxASSERT(nLen < 255); if (nLen < nwrapcol) --- 77,81 ---- int nLen = (int)strlen(line); ! wxASSERT(nwrapcol < 254); if (nLen < nwrapcol) *************** *** 93,97 **** { char c = line[nStart+nWrapLen]; ! if (c == ' ') { bSearching = false; --- 93,97 ---- { char c = line[nStart+nWrapLen]; ! if ((c == ' ')||(nWrapLen > nwrapcol + 3)) { bSearching = false; Index: ObjectUpdater.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/ObjectUpdater.cpp,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** ObjectUpdater.cpp 26 Jul 2005 00:37:04 -0000 1.21 --- ObjectUpdater.cpp 10 Sep 2005 21:47:38 -0000 1.22 *************** *** 233,237 **** model->SetDistanceFromCamera(distanceFromCamera); ! if (!isVisible) return; if (model->IsSmokeEnabled()) --- 233,241 ---- model->SetDistanceFromCamera(distanceFromCamera); ! if (!isVisible) ! { ! model->SetGenericMode(tc3DModel::DISABLE_MODEL); ! return; ! } if (model->IsSmokeEnabled()) Index: tc3DWindow.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tc3DWindow.cpp,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** tc3DWindow.cpp 16 Jul 2005 23:12:38 -0000 1.24 --- tc3DWindow.cpp 10 Sep 2005 21:47:38 -0000 1.25 *************** *** 725,732 **** osg::Vec4 white(1.0f, 1.0f, 1.0f, 1.0f); ! DrawLine(0, 0, 0, mnHeight, white); ! DrawLine(0, mnHeight-1, mnWidth, mnHeight-1, white); ! DrawLine(mnWidth, mnHeight, mnWidth, 0, white); ! DrawLine(mnWidth, 0, 0, 0, white); } --- 725,732 ---- osg::Vec4 white(1.0f, 1.0f, 1.0f, 1.0f); ! DrawLine(0, 0, 0, mnHeight, white); // left ! DrawLine(0, mnHeight-1, mnWidth, mnHeight-1, white); // top ! DrawLine(mnWidth-1, 0, mnWidth-1, mnHeight, white); // right ! DrawLine(0, 0, mnWidth, 0, white); // bottom } Index: tcGameView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcGameView.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** tcGameView.cpp 26 Jul 2005 00:37:04 -0000 1.14 --- tcGameView.cpp 10 Sep 2005 21:47:38 -0000 1.15 *************** *** 137,142 **** { vector<GeoPoint> navpoints; ! ! if (tcPlatformObject *platformObj = dynamic_cast<tcPlatformObject*>(mpHookedObj)) { if (ai::Nav* nav = platformObj->GetBrain()->GetNavTask()) --- 137,143 ---- { vector<GeoPoint> navpoints; ! tcPlatformObject* platformObj = dynamic_cast<tcPlatformObject*>(mpHookedObj); ! ! if (platformObj && mpHookedObj->IsOwnAlliance()) { if (ai::Nav* nav = platformObj->GetBrain()->GetNavTask()) Index: tc3DViewer.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tc3DViewer.cpp,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** tc3DViewer.cpp 20 Jul 2005 16:24:54 -0000 1.25 --- tc3DViewer.cpp 10 Sep 2005 21:47:38 -0000 1.26 *************** *** 514,520 **** { fog->setColor(airFog); // blue-white fog ! fog->setStart(5000.0f); fog->setEnd(60000.0f); ! fog->setDensity(0.000006f); view->setClearColor(airFog); } --- 514,521 ---- { fog->setColor(airFog); // blue-white fog ! fog->setStart(4000.0f); fog->setEnd(60000.0f); ! fog->setDensity(0.000015f); ! //fog->setFogCoordinateSource(osg::Fog::FRAGMENT_DEPTH); view->setClearColor(airFog); } *************** *** 1083,1092 **** // workaround for sky issue, deactivate sky when camera underwater ! if (cameraPosition._v[2] < -1.0) { if (skyTransform->getNumParents()) { terrainRoot->removeChild(skyTransform.get()); ! SetFogMode(FOG_WATER); } } --- 1084,1093 ---- // workaround for sky issue, deactivate sky when camera underwater ! if (cameraPosition._v[2] < -1.0+10e3) { if (skyTransform->getNumParents()) { terrainRoot->removeChild(skyTransform.get()); ! // SetFogMode(FOG_WATER); } } *************** *** 1331,1334 **** --- 1332,1336 ---- else { + static unsigned errorCount = 0; x = lastPos._v[0]; y = lastPos._v[1]; *************** *** 1336,1340 **** classification = 0; ! fprintf(stderr, "tc3DViewer::GetHookedObjectPositionAndType - graphics error\n"); } } --- 1338,1346 ---- classification = 0; ! ! if (errorCount++ < 4) ! { ! fprintf(stderr, "tc3DViewer::GetHookedObjectPositionAndType - graphics error\n"); ! } } } *************** *** 1344,1365 **** } ! void tc3DViewer::InitLight() ! { ! #if 0 // using CSP sky lights instead ! // add either a headlight or sun light to the scene. ! osg::LightSource* lightsource = new osg::LightSource; ! camera_group->setSceneDecorator(lightsource); ! { ! osg::Light* light = new osg::Light; ! lightsource->setLight(light); ! lightsource->setReferenceFrame(osg::LightSource::ABSOLUTE_RF); // headlight. ! lightsource->setLocalStateSetModes(osg::StateAttribute::ON); ! light->setPosition(osg::Vec4(0,0,1,1)); ! light->setAmbient(osg::Vec4(0.2,0.1,0.1,1.0)); ! light->setDiffuse(osg::Vec4(0.5,0.5,0.3,1.0)); ! light->setSpecular(osg::Vec4(0.3,0.0,0.1,1.0)); ! } ! #endif ! } /** --- 1350,1354 ---- } ! /** *************** *** 1446,1450 **** sceneView->setLightingMode(osgUtil::SceneView::NO_SCENEVIEW_LIGHT); sceneView->setClearColor(osg::Vec4(0, 0, 0, 1.0f)); ! //sceneView->setComputeNearFarMode(osgUtil::CullVisitor::COMPUTE_NEAR_FAR_USING_BOUNDING_VOLUMES); /* --- 1435,1439 ---- sceneView->setLightingMode(osgUtil::SceneView::NO_SCENEVIEW_LIGHT); sceneView->setClearColor(osg::Vec4(0, 0, 0, 1.0f)); ! //sceneView->setComputeNearFarMode(osgUtil::CullVisitor::COMPUTE_NEAR_FAR_USING_BOUNDING_VOLUMES); /* *************** *** 1595,1598 **** --- 1584,1589 ---- alphafunc->setFunction(osg::AlphaFunc::GREATER,0.0f); globalStateSet->setAttributeAndModes(alphafunc, osg::StateAttribute::ON); + + } } *************** *** 2067,2072 **** InitState(); - - InitLight(); CreateScene(); --- 2058,2061 ---- *************** *** 2077,2080 **** --- 2066,2072 ---- defaultSensorModel->LoadXml("unknown.xml"); + //osg::Light* light = sceneView->getLight(); + //osgUtil::SceneView::LightingMode lm = sceneView->getLightingMode(); + //light->setPosition(osg::Vec4(0, 0, 1, 0)); // rootnode->addChild(tcSound::Get()->GetSoundRoot()); |
Update of /cvsroot/gcblue/gcb_wx/src/scriptinterface In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1255/src/scriptinterface Modified Files: tcPlatformInterface.cpp tcPlatformInterfaceExtensionB.cpp tcScenarioInterface.cpp tcSimPythonInterface.cpp tcTrackInterface.cpp Log Message: GCB 0.8.0 release Index: tcScenarioInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcScenarioInterface.cpp,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** tcScenarioInterface.cpp 26 Jul 2005 00:37:04 -0000 1.33 --- tcScenarioInterface.cpp 10 Sep 2005 21:47:38 -0000 1.34 *************** *** 24,30 **** #ifndef WX_PRECOMP #include "wx/wx.h" - #ifdef WIN32 - #include "wx/msw/private.h" // for MS Windows specific definitions - #endif #endif --- 24,27 ---- *************** *** 65,68 **** --- 62,68 ---- using namespace ai; + + + void tcScenarioUnit::AddOrder(tcOrder order) { *************** *** 101,105 **** return true; ! } tcDirector* tcScenarioInterface::director = 0; --- 101,106 ---- return true; ! } ! tcDirector* tcScenarioInterface::director = 0; *************** *** 107,111 **** tcMapOverlay* tcScenarioInterface::overlay = 0; tcSimState* tcScenarioInterface::simState = 0; ! // non-python methods --- 108,113 ---- tcMapOverlay* tcScenarioInterface::overlay = 0; tcSimState* tcScenarioInterface::simState = 0; ! ! // non-python methods *************** *** 203,206 **** --- 205,210 ---- .def("DestroyGoal",&tcScenarioInterface::DestroyGoal) .def("ProtectGoal",&tcScenarioInterface::ProtectGoal) + // simple briefing text + .def("SetSimpleBriefing", &tcScenarioInterface::SetSimpleBriefing) ; return InterfaceType; *************** *** 589,592 **** --- 593,598 ---- wxASSERT(director); director->ClearEvents(); + + ClearSimpleBriefing(); } *************** *** 822,825 **** --- 828,861 ---- } + void tcScenarioInterface::ClearSimpleBriefing() + { + simpleBriefingText.clear(); + } + + const std::string& tcScenarioInterface::GetSimpleBriefing(int alliance) const + { + static std::string errorText = "No briefing found"; + + std::map<int, std::string>::const_iterator iter = + simpleBriefingText.find(alliance); + + if (iter != simpleBriefingText.end()) + { + return iter->second; + } + else + { + return errorText; + } + } + + void tcScenarioInterface::SetSimpleBriefing(int alliance, const std::string& briefingText) + { + simpleBriefingText[alliance] = briefingText; + } + + + + tcScenarioInterface::tcScenarioInterface() : lon_theater_deg(0), Index: tcSimPythonInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcSimPythonInterface.cpp,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** tcSimPythonInterface.cpp 14 Jul 2005 23:42:23 -0000 1.38 --- tcSimPythonInterface.cpp 10 Sep 2005 21:47:38 -0000 1.39 *************** *** 544,548 **** // call CreateBriefing method with ScenarioManager global object // ignore error here ! CallPython("CreateBriefing(ScenarioManager)\n", "Error with CreateBriefing method\n"); } --- 544,548 ---- // call CreateBriefing method with ScenarioManager global object // ignore error here ! //CallPython("CreateBriefing(ScenarioManager)\n", "Error with CreateBriefing method\n"); } *************** *** 949,953 **** { // TODO: this causes exception on game quit sometimes ! if (mpHookedObj && (mpHookedObj->mnID == anID)) return; // already set groupInterface->SetUnit(anID); --- 949,953 ---- { // TODO: this causes exception on game quit sometimes ! //if (mpHookedObj && (mpHookedObj->mnID == anID)) return; // already set groupInterface->SetUnit(anID); Index: tcTrackInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcTrackInterface.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** tcTrackInterface.cpp 1 Jun 2005 00:13:32 -0000 1.9 --- tcTrackInterface.cpp 10 Sep 2005 21:47:38 -0000 1.10 *************** *** 45,48 **** --- 45,50 ---- void tcTrackInterface::AttachSensorMap(tcAllianceSensorMap *apSM) { + wxASSERT(apSM); + mpSensorMap = apSM; fprintf(stdout, "tcTrackInterface - Attaching sensor map for alliance: %d\n", Index: tcPlatformInterfaceExtensionB.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcPlatformInterfaceExtensionB.cpp,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** tcPlatformInterfaceExtensionB.cpp 1 Jun 2005 00:13:32 -0000 1.25 --- tcPlatformInterfaceExtensionB.cpp 10 Sep 2005 21:47:38 -0000 1.26 *************** *** 108,113 **** ! // orders .def("AddNavWaypoint", &tcPlatformInterface::AddNavWaypoint) .def("AddTask", &tcPlatformInterface::AddTask) .def("ClearTasks", &tcPlatformInterface::ClearTasks) --- 108,114 ---- ! // task interface commands .def("AddNavWaypoint", &tcPlatformInterface::AddNavWaypoint) + .def("SetNavLoopState", &tcPlatformInterface::SetNavLoopState) .def("AddTask", &tcPlatformInterface::AddTask) .def("ClearTasks", &tcPlatformInterface::ClearTasks) Index: tcPlatformInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcPlatformInterface.cpp,v retrieving revision 1.51 retrieving revision 1.52 diff -C2 -d -r1.51 -r1.52 *** tcPlatformInterface.cpp 26 Jul 2005 00:37:04 -0000 1.51 --- tcPlatformInterface.cpp 10 Sep 2005 21:47:38 -0000 1.52 *************** *** 526,529 **** --- 526,530 ---- bool isBomb = false; + bool isGunRound = false; if (tcMissileDBObject* missileDBObj = *************** *** 541,544 **** --- 542,549 ---- isBomb = true; } + else if (ballisticDBObj->ballisticType == tcBallisticDBObject::GUN_ROUND) + { + isGunRound = true; + } } else if (tcTorpedoDBObject* torpDBObj = *************** *** 566,570 **** info.mnLaunchMode = 0; } ! else if (pLauncher->meLaunchMode == SEEKER_TRACK) { info.mnLaunchMode = 1; --- 571,576 ---- info.mnLaunchMode = 0; } ! else if ((pLauncher->meLaunchMode == SEEKER_TRACK)|| ! (pLauncher->meLaunchMode == FC_TRACK)) { info.mnLaunchMode = 1; *************** *** 787,790 **** --- 793,813 ---- } + void tcPlatformInterface::SetNavLoopState(bool state) + { + if (mpPlatformObj->IsClientMode()) return; + + ai::Brain* brain = mpPlatformObj->GetBrain(); + wxASSERT(brain); + + ai::Nav* nav = brain->GetNavTask(); + if (!nav) + { + wxASSERT(false); + return; + } + + nav->SetLoopState(state); + } + /** * Remove all tasks from ai brain *************** *** 835,839 **** { unsigned int nAlliance = mpPlatformObj->GetAlliance(); ! mpSensorMap = mpSimState->mcSensorMap.GetMap(nAlliance); wxASSERT(mpSensorMap); } --- 858,862 ---- { unsigned int nAlliance = mpPlatformObj->GetAlliance(); ! mpSensorMap = mpSimState->mcSensorMap.GetOrCreateMap(nAlliance); wxASSERT(mpSensorMap); } *************** *** 1183,1187 **** { tcGameObject* obj = mpSimState->GetObjectByName(unitName); ! bool isOwnAlliance = mpPlatformObj->GetAlliance() == obj->GetAlliance(); if ((obj == 0) || !isOwnAlliance) --- 1206,1210 ---- { tcGameObject* obj = mpSimState->GetObjectByName(unitName); ! bool isOwnAlliance = (obj != 0) && (mpPlatformObj->GetAlliance() == obj->GetAlliance()); if ((obj == 0) || !isOwnAlliance) *************** *** 1198,1202 **** { tcGameObject* obj = mpSimState->GetObject(id); ! bool isOwnAlliance = mpPlatformObj->GetAlliance() == obj->GetAlliance(); if ((obj == 0) || !isOwnAlliance) --- 1221,1225 ---- { tcGameObject* obj = mpSimState->GetObject(id); ! bool isOwnAlliance = (obj != 0) && (mpPlatformObj->GetAlliance() == obj->GetAlliance()); if ((obj == 0) || !isOwnAlliance) |
|
From: Dewitt C. <ddc...@us...> - 2005-09-10 21:47:46
|
Update of /cvsroot/gcblue/gcb_wx/src/network In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1255/src/network Modified Files: tcMultiplayerInterface.cpp tcNetworkInterface.cpp tcUpdateMessageHandler.cpp Log Message: GCB 0.8.0 release Index: tcUpdateMessageHandler.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/network/tcUpdateMessageHandler.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** tcUpdateMessageHandler.cpp 26 Jul 2005 00:37:04 -0000 1.17 --- tcUpdateMessageHandler.cpp 10 Sep 2005 21:47:38 -0000 1.18 *************** *** 38,41 **** --- 38,42 ---- #include "tcScenarioInterface.h" #include "tcMapOverlay.h" + #include "tcMessageInterface.h" #ifdef _DEBUG *************** *** 45,48 **** --- 46,63 ---- BEGIN_NAMESPACE(network) + + + void tcUpdateMessageHandler::AddBriefingText(long alliance, tcStream& stream) + { + + tcScenarioInterface* scenarioInterface = tcSimPythonInterface::Get()->GetScenarioInterface(); + wxASSERT(scenarioInterface); + + const std::string& briefingText = scenarioInterface->GetSimpleBriefing(alliance); + + stream << alliance; + stream << briefingText; + } + /** * stream must have SetAck(true) called first *************** *** 371,374 **** --- 386,396 ---- } break; + case BRIEFING_TEXT: + { + tcStream stream((const char*)data, messageSize); + stream >> messageType; + HandleBriefingText(stream); + } + break; default: fprintf(stderr, "tcUpdateMessageHandler::Handle - " *************** *** 380,383 **** --- 402,422 ---- } + void tcUpdateMessageHandler::HandleBriefingText(tcStream& stream) + { + long alliance; + std::string briefingText; + + stream >> alliance; + stream >> briefingText; + + tcScenarioInterface* scenarioInterface = tcSimPythonInterface::Get()->GetScenarioInterface(); + + scenarioInterface->SetSimpleBriefing(alliance, briefingText); + + tcMessageInterface::Get()->ClearChannel("Briefing"); + tcMessageInterface::Get()->ChannelMessage("Briefing", briefingText); + } + + /** * Handle COMMAND_ACK *************** *** 681,684 **** --- 720,728 ---- wxASSERT(simState->IsMultiplayerClient()); + // clear previous scenario info + pythonInterface->SetMenuPlatform(-1); + simState->Clear(); + + std::string scenarioName; stream >> scenarioName; Index: tcMultiplayerInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/network/tcMultiplayerInterface.cpp,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** tcMultiplayerInterface.cpp 29 Jul 2005 02:35:53 -0000 1.31 --- tcMultiplayerInterface.cpp 10 Sep 2005 21:47:38 -0000 1.32 *************** *** 273,277 **** else if (status == tcAccountDatabase::USER_NOT_FOUND) { ! msg = wxString::Format("Username, %s, does not exist\n", username.c_str()); } else if (status == tcAccountDatabase::PASSWORD_INVALID) --- 273,317 ---- else if (status == tcAccountDatabase::USER_NOT_FOUND) { ! // if acceptAllClients then add this user to the database and login ! if (acceptAllClients) ! { ! int status = tcAccountDatabase::Get()->AddUser(username, passwordHash, "unk"); ! if (status == tcAccountDatabase::SUCCESS) ! { ! msg.Printf("*** Added account for %s", username.c_str()); ! playerStatus.name = username; ! ! int loginStatus = LogInPlayer(username, connectionId, playerStatus, msg); ! ! if (loginStatus == tcAccountDatabase::SUCCESS) ! { ! playerStatus.isAuthenticated = true; ! SendSoundEffect(connectionId, "Welcome"); ! ! std::vector<int> connectionList; ! connectionList.push_back(connectionId); ! SendScenarioInfo(connectionList); ! ! wxString s = wxString::Format("*** %s has entered the game (new player)", playerStatus.GetNameWithRank().c_str()); ! BroadcastChatText(s.c_str()); ! SendChatText(connectionId, "A new account has been created for you.\n"); ! SendChatText(connectionId, "Please choose your alliance with the '/alliance <#>' command"); ! } ! else if (loginStatus == tcAccountDatabase::DUPLICATE_LOGIN) ! { ! playerStatus.name += "_DUP"; ! } ! ! ! } ! else ! { ! msg.Printf("*** Error adding account %s (%d)", username.c_str(), status); ! } ! } ! else ! { ! msg = wxString::Format("Username, %s, is not registered\n", username.c_str()); ! } } else if (status == tcAccountDatabase::PASSWORD_INVALID) *************** *** 312,315 **** --- 352,360 ---- SendControlMessage(connectionId, tcControlMessageHandler::CM_ALLIANCE, userData.alliance); + if (playerStatus.alliance != 0) + { + SendBriefingText(connectionId, playerStatus.alliance); + } + unsigned char rank = tcUserInfo::Get()->ScoreToRank(userData.score); playerStatus.SetRank(rank); *************** *** 480,483 **** --- 525,533 ---- */ + bool tcMultiplayerInterface::GetAcceptAllClients() const + { + return acceptAllClients; + } + const std::list<int>& tcMultiplayerInterface::GetConnectionList() const { *************** *** 726,732 **** tcAccountDatabase::Get()->SetUserAlliance(player.GetName(), player.alliance); ! SendControlMessage(connectionId, tcControlMessageHandler::CM_ALLIANCE, alliance); ! msg = wxString::Format("*** Success - alliance set to %d", alliance); ! } else { --- 776,788 ---- tcAccountDatabase::Get()->SetUserAlliance(player.GetName(), player.alliance); ! SendControlMessage(connectionId, tcControlMessageHandler::CM_ALLIANCE, alliance); ! msg = wxString::Format("*** Success - alliance set to %d", alliance); ! ! // update briefing text for new alliance ! if (alliance != 0) ! { ! SendBriefingText(connectionId, alliance); ! } ! } else { *************** *** 1077,1080 **** --- 1133,1140 ---- ProcessGameMasterCommand(pstatus, args); } + else if (command == "who") + { + ProcessWho(pstatus, args); + } else { *************** *** 1176,1179 **** --- 1236,1261 ---- } + /** + * Send list of players currently in game back to client + */ + void tcMultiplayerInterface::ProcessWho(tcPlayerStatus& player, const wxString& args) + { + const std::list<int>& connectionList = networkInterface->GetConnectionList(); + std::list<int>::const_iterator iter = connectionList.begin(); + + SendChatText(player.connectionId, ""); + SendChatText(player.connectionId, "Players currently in game:"); + for( ; iter != connectionList.end(); ++iter) + { + tcPlayerStatus& playerInfo = GetPlayerStatus(*iter); + const std::string& connectionStatus = networkInterface->GetConnectionStatus(*iter, 0); + + wxString s = wxString::Format("%s [%d] %s", playerInfo.GetNameWithRank().c_str(), + playerInfo.GetAlliance(), connectionStatus.c_str()); + + SendChatText(player.connectionId, s.c_str()); + } + } + void tcMultiplayerInterface::SendAuthRequest(int destination) *************** *** 1202,1205 **** --- 1284,1300 ---- /** + * Sends simple briefing text to client for indicated alliance + * This is the only way of getting briefing info in multiplayer + */ + void tcMultiplayerInterface::SendBriefingText(int destination, int alliance) + { + tcUpdateStream stream; + tcUpdateMessageHandler::InitializeMessage(tcUpdateMessageHandler::BRIEFING_TEXT, stream); + tcUpdateMessageHandler::AddBriefingText(alliance, stream); + + SendUpdateMessageTCP(destination, stream); + } + + /** * Sends a test message of text to destination */ *************** *** 1338,1342 **** --- 1433,1442 ---- for (unsigned n=0; n<destinations.size(); n++) { + int connectionId = destinations[n]; + + tcPlayerStatus& player = GetPlayerStatus(connectionId); + SendUpdateMessageTCP(destinations[n], stream); + SendBriefingText(destinations[n], player.alliance); } *************** *** 1410,1427 **** } ! /** ! * 0 - UDP, otherwise - TCP ! */ ! void tcMultiplayerInterface::SetChatProtocol(int code) ! { ! if (code) ! { ! tcpChat = true; ! } ! else ! { ! tcpChat = false; // use UDP ! } ! } /** --- 1510,1532 ---- } ! void tcMultiplayerInterface::SetAcceptAllClients(bool state) ! { ! acceptAllClients = state; ! } ! ! /** ! * 0 - UDP, otherwise - TCP ! */ ! void tcMultiplayerInterface::SetChatProtocol(int code) ! { ! if (code) ! { ! tcpChat = true; ! } ! else ! { ! tcpChat = false; // use UDP ! } ! } /** *************** *** 1639,1643 **** tcPlayerStatus& player = GetPlayerStatus(connectionId); ! if (player.isAuthenticated) { tcUpdateStream updateStream; --- 1744,1748 ---- tcPlayerStatus& player = GetPlayerStatus(connectionId); ! if ((player.isAuthenticated) && (player.GetAlliance() != 0)) { tcUpdateStream updateStream; *************** *** 2034,2038 **** entityUpdateInterval(50), sensorUpdateInterval(50), ! goalUpdateInterval(600) { networkInterface = new tcNetworkInterface(); --- 2139,2144 ---- entityUpdateInterval(50), sensorUpdateInterval(50), ! goalUpdateInterval(600), ! acceptAllClients(true) { networkInterface = new tcNetworkInterface(); *************** *** 2058,2062 **** */ tcMultiplayerInterface::tcMultiplayerInterface(const tcMultiplayerInterface& source) ! : entityUpdateInterval(50), sensorUpdateInterval(50), goalUpdateInterval(600) --- 2164,2168 ---- */ tcMultiplayerInterface::tcMultiplayerInterface(const tcMultiplayerInterface& source) ! : entityUpdateInterval(10), sensorUpdateInterval(50), goalUpdateInterval(600) Index: tcNetworkInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/network/tcNetworkInterface.cpp,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** tcNetworkInterface.cpp 11 Jun 2005 21:01:44 -0000 1.20 --- tcNetworkInterface.cpp 10 Sep 2005 21:47:38 -0000 1.21 *************** *** 220,224 **** ! const std::string& tcNetworkInterface::GetConnectionStatus(int id) { static std::string s; --- 220,224 ---- ! const std::string& tcNetworkInterface::GetConnectionStatus(int id, int detailLevel) { static std::string s; *************** *** 258,264 **** float ping_ms = 1000.0f * connData->GetPingTime(); ! wxString status = wxString::Format("(%.0f) %04d %04d %03d %.0f", ! dt_sec, bytesIn, bytesOut, resentCount, ping_ms); ! s = status.c_str(); return s; } --- 258,282 ---- float ping_ms = 1000.0f * connData->GetPingTime(); ! if (detailLevel <= 0) ! { ! if (dt_sec < 300.0f) ! { ! wxString status = wxString::Format("(%.0f s) ping %.0f ms", ! dt_sec, ping_ms); ! s = status.c_str(); ! } ! else // show connection time in minutes ! { ! wxString status = wxString::Format("(%.0f m) ping %.0f ms", ! 0.0166667f * dt_sec, ping_ms); ! s = status.c_str(); ! } ! } ! else ! { ! wxString status = wxString::Format("(%.0f) %04d %04d %03d %.0f", ! dt_sec, bytesIn, bytesOut, resentCount, ping_ms); ! s = status.c_str(); ! } return s; } |