gcblue-commits Mailing List for Global Conflict Blue (Page 12)
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...> - 2006-03-28 02:44:59
|
Update of /cvsroot/gcblue/gcb_wx/src/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1528/src/sim Modified Files: Game.cpp Log Message: Index: Game.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/Game.cpp,v retrieving revision 1.152 retrieving revision 1.153 diff -C2 -d -r1.152 -r1.153 *** Game.cpp 27 Mar 2006 01:08:17 -0000 1.152 --- Game.cpp 28 Mar 2006 02:44:56 -0000 1.153 *************** *** 878,881 **** --- 878,883 ---- throw exception(); } + + databaseViewer->Set3DViewer(viewer); databaseViewer->SetActive(false); *************** *** 1489,1492 **** --- 1491,1495 ---- briefingView->SetActive(false); gameWindow->SetActive(false); + viewer->SetDatabaseView(false); } *************** *** 1508,1511 **** --- 1511,1515 ---- databaseViewer->SetActive(true); databaseViewer->Draw(); + viewer->SetDatabaseView(true); break; case OPTIONS: *************** *** 1543,1594 **** viewer->SetCameraEl(0.5f * sinf(0.1f*cameraTime)); ! if (!viewer->TextObjectExists(0)) ! { ! viewer->AddDefaultTextObjects(); ! } ! ! long hookID = tacticalMap->GetHookID(); ! if (tcGameObject* obj = simState->GetObject(hookID)) ! { ! viewer->SetCameraRange(1.2f * obj->GetSpan()); ! wxString description; ! description = wxString::Format("%s\n%s", obj->mzClass.mz, obj->mzUnit.mz); ! wxString launcherDescription; ! wxString sensorDescription; ! if (tcPlatformObject* plat = dynamic_cast<tcPlatformObject*>(obj)) ! { ! launcherDescription = plat->GetLauncherDescription(); ! sensorDescription = plat->GetSensorDescription(); ! } ! else ! { ! launcherDescription = "No weapons\n"; ! sensorDescription = "No sensors\n"; ! } ! ! wxString scenarioDescription = ! wxString::Format("Scenario: %s", simState->msScenarioInfo.mzName); ! viewer->UpdateTextObject(2, description.c_str()); ! viewer->UpdateTextObject(0, launcherDescription.c_str()); ! viewer->UpdateTextObject(1, sensorDescription.c_str()); ! viewer->UpdateTextObject(3, scenarioDescription.c_str()); ! } ! else ! { ! HookRandomFriendly(); ! } ! if (cameraTime > 7) ! { ! cameraTime = 0; ! HookRandomFriendly(); ! } --- 1547,1599 ---- viewer->SetCameraEl(0.5f * sinf(0.1f*cameraTime)); ! if (meScreenMode != DATABASEVIEW) ! { ! if (!viewer->TextObjectExists(0)) ! { ! viewer->AddDefaultTextObjects(); ! } ! long hookID = tacticalMap->GetHookID(); ! if (tcGameObject* obj = simState->GetObject(hookID)) ! { ! viewer->SetCameraRange(1.2f * obj->GetSpan()); ! wxString description; ! description = wxString::Format("%s\n%s", obj->mzClass.mz, obj->mzUnit.mz); ! wxString launcherDescription; ! wxString sensorDescription; ! if (tcPlatformObject* plat = dynamic_cast<tcPlatformObject*>(obj)) ! { ! launcherDescription = plat->GetLauncherDescription(); ! sensorDescription = plat->GetSensorDescription(); ! } ! else ! { ! launcherDescription = "No weapons\n"; ! sensorDescription = "No sensors\n"; ! } ! wxString scenarioDescription = ! wxString::Format("Scenario: %s", simState->msScenarioInfo.mzName); ! viewer->UpdateTextObject(2, description.c_str()); + viewer->UpdateTextObject(0, launcherDescription.c_str()); + viewer->UpdateTextObject(1, sensorDescription.c_str()); + viewer->UpdateTextObject(3, scenarioDescription.c_str()); + } + else + { + HookRandomFriendly(); + } ! if (cameraTime > 7) ! { ! cameraTime = 0; ! HookRandomFriendly(); ! } ! } |
|
From: Dewitt C. <ddc...@us...> - 2006-03-28 02:44:58
|
Update of /cvsroot/gcblue/gcb_wx/src/graphics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1528/src/graphics Modified Files: tc3DModel.cpp tc3DViewer.cpp tcDatabaseInfoWindow.cpp tcDatabaseViewer.cpp Log Message: Index: tcDatabaseInfoWindow.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcDatabaseInfoWindow.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** tcDatabaseInfoWindow.cpp 27 Mar 2006 01:08:17 -0000 1.3 --- tcDatabaseInfoWindow.cpp 28 Mar 2006 02:44:55 -0000 1.4 *************** *** 271,274 **** --- 271,278 ---- + void tcDatabaseInfoWindow::SetDatabaseClassName(const std::string& className) + { + databaseClassName = className; + } void tcDatabaseInfoWindow::SetDatabaseObject(long id) Index: tcDatabaseViewer.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcDatabaseViewer.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** tcDatabaseViewer.cpp 27 Mar 2006 01:08:17 -0000 1.1 --- tcDatabaseViewer.cpp 28 Mar 2006 02:44:55 -0000 1.2 *************** *** 33,40 **** #include "common/tinyxml.h" #include "tcButton.h" #include "tcDatabaseObject.h" #include "tcDatabaseIterator.h" #include "tcDatabaseInfoWindow.h" ! #ifdef _DEBUG --- 33,41 ---- #include "common/tinyxml.h" #include "tcButton.h" + #include "tcDatabase.h" #include "tcDatabaseObject.h" #include "tcDatabaseIterator.h" #include "tcDatabaseInfoWindow.h" ! #include "tc3DViewer.h" #ifdef _DEBUG *************** *** 132,136 **** if (r.Inside(pos)) { ! return true; } --- 133,137 ---- if (r.Inside(pos)) { ! SelectDisplayClass(info[n].className); return true; } *************** *** 179,183 **** int oldState = item.drawState; ! if (item.className == displayName) { item.drawState = BrowseItem::ON; --- 180,184 ---- int oldState = item.drawState; ! if (item.className == displayClassName) { item.drawState = BrowseItem::ON; *************** *** 239,242 **** --- 240,260 ---- x += width + 16.0f; + + std::string caption; + + switch (n) + { + case 0: caption = "Surface naval"; break; + case 1: caption = "Submarine"; break; + case 2: caption = "Air, fixed wing"; break; + case 3: caption = "Air, rotary wing"; break; + case 4: caption = "Land"; break; + case 5: caption = "Missile"; break; + case 6: caption = "Torpedo"; break; + case 7: caption = "Ballistic"; break; + default: caption = "Error"; break; + } + + button->SetCaption(caption); } *************** *** 285,288 **** --- 303,321 ---- + void tcDatabaseViewer::SelectDisplayClass(const std::string& className) + { + databaseInfoWindow->SetDatabaseClassName(className); + if (viewer) + { + viewer->SetDatabaseViewClass(className); + } + } + + + void tcDatabaseViewer::Set3DViewer(tc3DViewer* viewer_) + { + viewer = viewer_; + } + /** * *************** *** 293,297 **** tcXmlWindow(parent, pos, size, "xml/database_viewer.xml", name), basePosition(20, 50), ! classificationMask(0) { --- 326,332 ---- tcXmlWindow(parent, pos, size, "xml/database_viewer.xml", name), basePosition(20, 50), ! classificationMask(0), ! displayClassName(""), ! viewer(0) { Index: tc3DModel.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tc3DModel.cpp,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** tc3DModel.cpp 23 Mar 2006 01:11:02 -0000 1.34 --- tc3DModel.cpp 28 Mar 2006 02:44:55 -0000 1.35 *************** *** 500,503 **** --- 500,506 ---- } + /** + * Use this for accessing mode of tcDatabaseObject since transform is not valid + */ osg::Node* tc3DModel::GetModelNode() { Index: tc3DViewer.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tc3DViewer.cpp,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** tc3DViewer.cpp 26 Mar 2006 00:32:14 -0000 1.31 --- tc3DViewer.cpp 28 Mar 2006 02:44:55 -0000 1.32 *************** *** 64,68 **** #include "tcParticleEffect.h" #include "tcSensorTrackIterator.h" ! --- 64,68 ---- #include "tcParticleEffect.h" #include "tcSensorTrackIterator.h" ! #include "tcDatabase.h" *************** *** 485,488 **** --- 485,511 ---- } + void tc3DViewer::SetDatabaseView(bool state) + { + databaseViewEnabled = state; + } + + void tc3DViewer::SetDatabaseViewClass(const std::string& databaseClass) + { + // clear previous objects from databaseViewGroup + size_t nChildren = databaseViewGroup->getNumChildren(); + databaseViewGroup->removeChild(0, nChildren); + + database::tcDatabaseObject* obj = database::tcDatabase::Get()->GetObject(databaseClass); + if (obj != 0) + { + tc3DModel* model = obj->Get3DModel(); + wxASSERT(model); + osg::ref_ptr<osg::Node> node = model->GetModelNode(); + wxASSERT(node.valid()); + databaseViewGroup->addChild(node.get()); + SetCameraRange(1.5f * node->getBound().radius()); + } + } + /** * *************** *** 961,966 **** guiView->draw(); ! ! if (isActive && sceneView.valid()) { sceneView->update(); --- 984,994 ---- guiView->draw(); ! if (isActive && databaseViewEnabled) ! { ! databaseView->update(); ! databaseView->cull(); ! databaseView->draw(); ! } ! else if (isActive && sceneView.valid()) { sceneView->update(); *************** *** 975,988 **** sceneView->cull(); sceneView->draw(); - - glFinish(); - Swap(); - } - else - { - glFinish(); - Swap(); } lastGameTime = gameTime; } --- 1003,1012 ---- sceneView->cull(); sceneView->draw(); } + + glFinish(); + Swap(); + lastGameTime = gameTime; } *************** *** 1029,1032 **** --- 1053,1072 ---- } + /** + * Version for 3D database object view + */ + void tc3DViewer::UpdateCameraDatabaseView() + { + float camx = cosf(cameraEl)*sinf(cameraAz); + float camy = cosf(cameraEl)*cosf(cameraAz); + float camz = sinf(cameraEl); + cameraPosition = osg::Vec3(camx,camy,camz)*cameraRange; + + cameraTarget = cameraTargetOffset; + + databaseView->setViewMatrixAsLookAt(cameraPosition, cameraTarget, osg::Vec3(0,0,1)); + + } + void tc3DViewer::UpdateCamera() { *************** *** 1187,1191 **** if (gameObj->model->GetNumParents()==0) { ! worldObjects->addChild(gameObj->model->GetNode().get()); } UpdateChildModels(gameObj); --- 1227,1231 ---- if (gameObj->model->GetNumParents()==0) { ! worldObjects->addChild(gameObj->model->GetNode().get()); } UpdateChildModels(gameObj); *************** *** 1363,1366 **** --- 1403,1449 ---- /** + * Creates scene view to display 3D objects for database viewer + */ + void tc3DViewer::InitDatabaseView(const wxPoint& pos, const wxSize& size) + { + databaseView = new osgUtil::SceneView(); + + if (!displaySettings.valid()) + { + wxASSERT(databaseView->getDisplaySettings()==NULL); + displaySettings = new osg::DisplaySettings; + displaySettings->setDepthBuffer(true); + } + + databaseView->setDisplaySettings(displaySettings.get()); + databaseView->setDefaults(); + databaseView->setState(sceneView->getState()); + + + wxWindow* parent = wxWindow::GetParent(); + wxSize parentSize = parent->GetSize(); + int parentHeight = parentSize.GetHeight(); + int correctedY = parentHeight - (pos.y + size.GetHeight()); + + // Update projection matrix + float aspectRatio = (float)size.GetWidth() / (float)size.GetHeight(); + float zmid = sqrtf(zmin*zmax); + databaseView->setProjectionMatrixAsPerspective(45.0, aspectRatio, zmin, zmid); + + + databaseView->setViewport(pos.x, correctedY, size.GetWidth(), size.GetHeight()); + databaseView->setComputeNearFarMode(osgUtil::CullVisitor::DO_NOT_COMPUTE_NEAR_FAR); + databaseView->setLightingMode(osgUtil::SceneView::NO_SCENEVIEW_LIGHT); + databaseView->setCullingMode(osg::CullStack::NO_CULLING); + + // set up the clear mask. + osgUtil::RenderStage *stage = databaseView->getRenderStage(); + stage->setClearMask(GL_DEPTH_BUFFER_BIT); + stage->setClearDepth(1.0f); + + } + + + /** * */ *************** *** 1892,1895 **** --- 1975,1983 ---- static long lastHook = -1; + if (databaseViewEnabled) + { + UpdateCameraDatabaseView(); + return; + } if (lastHook != hookID) *************** *** 2022,2025 **** --- 2110,2115 ---- lookAtTarget = true; usePolarOffset = true; + databaseViewEnabled = false; + cameraLongitude = 0; cameraLatitude = 0; *************** *** 2042,2045 **** --- 2132,2137 ---- InitGuiView(); + InitDatabaseView(pos, size); + osgDB::Registry::instance()->setDataFilePathList("3d"); *************** *** 2080,2083 **** --- 2172,2178 ---- orthoProjection->addChild(hudObjects.get()); + databaseViewGroup = new osg::Group(); + databaseView->setSceneData(databaseViewGroup.get()); + InitState(); |
|
From: Dewitt C. <ddc...@us...> - 2006-03-28 02:44:50
|
Update of /cvsroot/gcblue/gcb_wx/include/graphics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1488/include/graphics Modified Files: tc3DViewer.h tcDatabaseInfoWindow.h tcDatabaseViewer.h Log Message: Index: tcDatabaseInfoWindow.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/graphics/tcDatabaseInfoWindow.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** tcDatabaseInfoWindow.h 27 Mar 2006 01:08:30 -0000 1.2 --- tcDatabaseInfoWindow.h 28 Mar 2006 02:44:45 -0000 1.3 *************** *** 54,58 **** --- 54,63 ---- //virtual void OnRButtonDown(wxMouseEvent& event); + /// set database class name to display info for + void SetDatabaseClassName(const std::string& className); + + /// set id of game object to display info for (must be classified if track) void SetDatabaseObject(long id); + void SetDragable(bool state); Index: tc3DViewer.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/graphics/tc3DViewer.h,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** tc3DViewer.h 22 Mar 2006 01:23:28 -0000 1.13 --- tc3DViewer.h 28 Mar 2006 02:44:45 -0000 1.14 *************** *** 62,69 **** --- 62,71 ---- osg::ref_ptr<osgUtil::SceneView> sceneViewFar; osg::ref_ptr<osgUtil::SceneView> guiView; + osg::ref_ptr<osgUtil::SceneView> databaseView; ///< for viewing database objects osg::ref_ptr<osg::DisplaySettings> displaySettings; osg::ref_ptr<osg::NodeVisitor> updateVisitor; osg::ref_ptr<osg::NodeVisitor> updateVisitorFar; + osg::ref_ptr<osgUtil::CullVisitor> cullVisitor; osg::ref_ptr<osg::NodeVisitor> guiUpdateVisitor; *************** *** 71,74 **** --- 73,77 ---- osg::ref_ptr<osg::FrameStamp> frameStampFar; osg::ref_ptr<osg::FrameStamp> guiFrameStamp; + osg::ref_ptr<osgText::Text> viewerText; ///< text for debug/basic viewer info display osg::ref_ptr<osg::MatrixTransform> guiObjects; *************** *** 81,84 **** --- 84,89 ---- osg::ref_ptr<osg::Group> rootnode; osg::ref_ptr<osg::Group> rootnodeFar; + osg::ref_ptr<osg::Group> databaseViewGroup; + osg::ref_ptr<osgParticle::ParticleSystemUpdater> particleSystemUpdater; *************** *** 152,155 **** --- 157,162 ---- void SetCameraEl(float el); void SetCameraRange(float range_m); + void SetDatabaseView(bool state); + void SetDatabaseViewClass(const std::string& databaseClass); void SetFogMode(int mode); void SetShakeAirCamera(bool state); *************** *** 181,184 **** --- 188,193 ---- bool useRelativeChildPos; ///< true to add children as children of parent transform group bool shakeAirCamera; ///< true to shake camera for air objects to simulate turbulence + bool databaseViewEnabled; ///< true for special view mode with database model as target + tcSimState *simState; int mnWidth; *************** *** 231,238 **** --- 240,249 ---- void InitSceneView(wxPoint pos, wxSize size); void InitSceneViewFar(wxPoint pos, wxSize size); + void InitDatabaseView(const wxPoint& pos, const wxSize& size); void InitState(); void InitText(); void SetOrigin(double lon, double lat); ///< sets origin of 3D world coordinates void UpdateCamera(); + void UpdateCameraDatabaseView(); void UpdateChildModels(tcGameObject *gameObj); bool UpdateOrigin(); Index: tcDatabaseViewer.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/graphics/tcDatabaseViewer.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** tcDatabaseViewer.h 27 Mar 2006 01:08:30 -0000 1.1 --- tcDatabaseViewer.h 28 Mar 2006 02:44:45 -0000 1.2 *************** *** 36,39 **** --- 36,40 ---- class tcDatabaseInfoWindow; + class tc3DViewer; namespace osg *************** *** 64,68 **** --- 65,71 ---- void OnLButtonDown(wxMouseEvent& event); void OnMouseMove(wxMouseEvent& event); + void SelectDisplayClass(const std::string& className); void SetClassificationMask(unsigned int mask); + void Set3DViewer(tc3DViewer* viewer_); tcDatabaseViewer(wxWindow *parent, *************** *** 76,83 **** private: unsigned int classificationMask; ///< mask for current platform type on browse list ! long displayId; ///< id of current platform displayed ! std::string displayName; ///< class name of current platform displayed std::vector<BrowseItem> browseInfo; tcDatabaseInfoWindow* databaseInfoWindow; const wxRealPoint basePosition; --- 79,86 ---- private: unsigned int classificationMask; ///< mask for current platform type on browse list ! std::string displayClassName; ///< class name of current platform displayed std::vector<BrowseItem> browseInfo; tcDatabaseInfoWindow* databaseInfoWindow; + tc3DViewer* viewer; const wxRealPoint basePosition; |
Update of /cvsroot/gcblue/gcb_wx/include/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18413/include/sim Modified Files: Game.h tcAirfieldObject.h tcCarrierObject.h tcFlightOpsObject.h tcGameObject.h tcLauncher.h tcPlatformObject.h tcSimState.h Log Message: Index: tcSimState.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcSimState.h,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -d -r1.47 -r1.48 *** tcSimState.h 23 Mar 2006 01:12:11 -0000 1.47 --- tcSimState.h 27 Mar 2006 01:08:30 -0000 1.48 *************** *** 191,195 **** void Update(); void UpdateAI(double afSimTime); - void UpdateScoreForDamage(tcGameObject* damager, tcGameObject* damagee, float priorDamage); void UpdateLandings(double afSimTime); void UpdateLandingState(double afSimTime); --- 191,194 ---- Index: tcAirfieldObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcAirfieldObject.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** tcAirfieldObject.h 22 Mar 2006 01:23:29 -0000 1.5 --- tcAirfieldObject.h 27 Mar 2006 01:08:30 -0000 1.6 *************** *** 49,53 **** { public: ! virtual void ApplyDamage(float damage); virtual void Clear(); --- 49,53 ---- { public: ! virtual void ApplyDamage(float damage, tcGameObject* damager); virtual void Clear(); Index: tcPlatformObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcPlatformObject.h,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** tcPlatformObject.h 22 Mar 2006 01:23:29 -0000 1.34 --- tcPlatformObject.h 27 Mar 2006 01:08:30 -0000 1.35 *************** *** 102,106 **** tcCommandObject commandObj; ! virtual void ApplyDamage(float damage); virtual void ApplyRepairs(float repair); ///< called when repairs occur (damage removed) virtual void Clear(); --- 102,106 ---- tcCommandObject commandObj; ! virtual void ApplyDamage(float damage, tcGameObject* damager); virtual void ApplyRepairs(float repair); ///< called when repairs occur (damage removed) virtual void Clear(); Index: tcGameObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcGameObject.h,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** tcGameObject.h 22 Mar 2006 01:23:29 -0000 1.45 --- tcGameObject.h 27 Mar 2006 01:08:30 -0000 1.46 *************** *** 117,125 **** tcKinematics mcKin; ///< position, motion, etc parameters tcTerrainInfo mcTerrain; ///< ground height ASL, water depth - float mfDamageLevel; ///< 0 is no damage, 1 is fully damaged ! virtual void ApplyDamage(float damage); ///< called when new damage occurs virtual void ApplyRepairs(float repair); ///< called when repairs occur (damage removed) ! float RangeTo(tcGameObject& p) const; float BearingTo(tcGameObject& p) const; --- 117,127 ---- tcKinematics mcKin; ///< position, motion, etc parameters tcTerrainInfo mcTerrain; ///< ground height ASL, water depth ! virtual void ApplyDamage(float damage, tcGameObject* damager); ///< called when new damage occurs virtual void ApplyRepairs(float repair); ///< called when repairs occur (damage removed) ! void SelfDestruct(); ! void UpdateScoreForDamage(tcGameObject* damager, float priorDamage); ! float GetDamageLevel() const; ! float RangeTo(tcGameObject& p) const; float BearingTo(tcGameObject& p) const; *************** *** 140,143 **** --- 142,146 ---- GeoPoint RelPosToLatLonAlt(const tsRelativePosition& rel_pos) const; GeoPoint RelPosToLatLonAlt(const float& dx, const float& dy, const float& dz) const; + virtual void PrintToFile(tcFile&); virtual void SaveToFile(tcFile& file); *************** *** 199,202 **** --- 202,206 ---- virtual ~tcGameObject(); protected: + float mfDamageLevel; ///< 0 is no damage, 1 is fully damaged bool recreateFlag; ///< workaround, true to resend create request for obj (multiplayer client only) static tcMapData *mapData; *************** *** 208,212 **** bool IsHooked() const; - void SelfDestruct(); }; #endif \ No newline at end of file --- 212,215 ---- Index: tcLauncher.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcLauncher.h,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** tcLauncher.h 22 Mar 2006 01:23:29 -0000 1.25 --- tcLauncher.h 27 Mar 2006 01:08:30 -0000 1.26 *************** *** 157,160 **** --- 157,162 ---- unsigned char GetStatus() const; void UpdateStatus(); + + void UpdateScoreForDamage(tcGameObject* damager); static void AttachSimState(tcSimState* ss); Index: tcFlightOpsObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcFlightOpsObject.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** tcFlightOpsObject.h 22 Mar 2006 01:23:29 -0000 1.9 --- tcFlightOpsObject.h 27 Mar 2006 01:08:30 -0000 1.10 *************** *** 75,78 **** --- 75,79 ---- void RandInitNear(float afLon_deg, float afLat_deg); + void DestroyAllChildrenAndUpdateScore(tcGameObject* damager); virtual void SetFlightportDefaults(); virtual void Update(double afStatusTime); Index: Game.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/Game.h,v retrieving revision 1.66 retrieving revision 1.67 diff -C2 -d -r1.66 -r1.67 *** Game.h 22 Mar 2006 01:23:29 -0000 1.66 --- Game.h 27 Mar 2006 01:08:30 -0000 1.67 *************** *** 73,76 **** --- 73,77 ---- class tcMapData; class tcBriefingView; + class tcDatabaseViewer; using namespace scriptinterface; *************** *** 103,106 **** --- 104,108 ---- CREDIT, SCENARIOSELECT, + DATABASEVIEW, MESSAGES, NETWORK, *************** *** 181,185 **** tcChatBox* chatBox; ///< popup for multiplayer chat tcDraggedIconDisplay* draggedIconDisplay; ///< display of drag-drop icons ! // interfaces for START game mode (unloaded when game is started) --- 183,187 ---- tcChatBox* chatBox; ///< popup for multiplayer chat tcDraggedIconDisplay* draggedIconDisplay; ///< display of drag-drop icons ! tcDatabaseViewer* databaseViewer; ///< browse database // interfaces for START game mode (unloaded when game is started) *************** *** 285,288 **** --- 287,291 ---- void SwitchToBriefing(wxCommandEvent& event); void SwitchToCredit(wxCommandEvent& event); + void SwitchToDatabaseView(wxCommandEvent& event); void SwitchToDisplaySettings(wxCommandEvent& event); void SwitchToNetwork(wxCommandEvent& event); *************** *** 302,308 **** void InitializeBriefingConsoles(); void InitializeCreditView(); void InitializeDirector(); ! void InitializeDisplaySettingsView(); ! void InitializeGameWindow(); void InitializeMessageCenter(); void InitializeNetworkView(); --- 305,312 ---- void InitializeBriefingConsoles(); void InitializeCreditView(); + void InitializeDatabaseViewer(); void InitializeDirector(); ! void InitializeDisplaySettingsView(); ! void InitializeGameWindow(); void InitializeMessageCenter(); void InitializeNetworkView(); Index: tcCarrierObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcCarrierObject.h,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** tcCarrierObject.h 22 Mar 2006 01:23:29 -0000 1.14 --- tcCarrierObject.h 27 Mar 2006 01:08:30 -0000 1.15 *************** *** 49,53 **** { public: ! virtual void ApplyDamage(float damage); virtual void Clear(); --- 49,53 ---- { public: ! virtual void ApplyDamage(float damage, tcGameObject* damager); virtual void Clear(); |
|
From: Dewitt C. <ddc...@us...> - 2006-03-27 01:08:36
|
Update of /cvsroot/gcblue/gcb_wx/include/graphics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18413/include/graphics Modified Files: tc3DWindow.h tcButton.h tcDatabaseInfoWindow.h tcXmlWindow.h Added Files: tcDatabaseViewer.h Log Message: Index: tcXmlWindow.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/graphics/tcXmlWindow.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** tcXmlWindow.h 22 Mar 2006 01:23:29 -0000 1.7 --- tcXmlWindow.h 27 Mar 2006 01:08:30 -0000 1.8 *************** *** 1,5 **** ! /** @file tcXmlWindow.h */ ! /* ! ** Copyright (C) 2003 Dewitt Colclough (de...@gc...) ** All rights reserved. --- 1,6 ---- ! /** ! ** @file tcXmlWindow.h ! */ ! /* Copyright (C) 2003 Dewitt Colclough (de...@gc...) ** All rights reserved. *************** *** 41,44 **** --- 42,48 ---- { public: + /// find first button with matching command and set force disable state + void SetButtonDisable(long command, bool state); + /// find first button with matching command and change caption void SetButtonCaption(long command, const std::string& caption); Index: tc3DWindow.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/graphics/tc3DWindow.h,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** tc3DWindow.h 22 Mar 2006 01:23:28 -0000 1.24 --- tc3DWindow.h 27 Mar 2006 01:08:30 -0000 1.25 *************** *** 2,6 **** ** @file tc3DWindow.h */ ! /* Copyright (C) 2004 Dewitt Colclough (de...@gc...) ** All rights reserved. --- 2,6 ---- ** @file tc3DWindow.h */ ! /* Copyright (C) 2004-2006 Dewitt Colclough (de...@gc...) ** All rights reserved. *************** *** 54,62 **** } - //namespace osgText - //{ - // class Font; - // class Text; - //} class tcGraphicsEngine; --- 54,57 ---- *************** *** 197,201 **** virtual void SetActive(bool abActive); ! void SetBackground(unsigned int color) {} void SetBackgroundDraw(bool state); void SetResizeable2D(bool abState) {resizeable2DSurface = abState;} ///< @see tc3DWindow::OnSize --- 192,196 ---- virtual void SetActive(bool abActive); ! void SetBackgroundColor(const osg::Vec4& color); void SetBackgroundDraw(bool state); void SetResizeable2D(bool abState) {resizeable2DSurface = abState;} ///< @see tc3DWindow::OnSize *************** *** 222,225 **** --- 217,221 ---- const int geometryRenderBin; + osg::Vec4 backgroundColor; Index: tcDatabaseInfoWindow.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/graphics/tcDatabaseInfoWindow.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** tcDatabaseInfoWindow.h 23 Mar 2006 01:12:12 -0000 1.1 --- tcDatabaseInfoWindow.h 27 Mar 2006 01:08:30 -0000 1.2 *************** *** 55,65 **** void SetDatabaseObject(long id); ! static void SetParent(tc3DWindow* win); ! tcDatabaseInfoWindow(const wxPoint& pos, const wxString& configFile = "xml/database_info.xml", ! const wxString& name = "DatabaseInfo"); virtual ~tcDatabaseInfoWindow(); --- 55,68 ---- void SetDatabaseObject(long id); ! void SetDragable(bool state); static void SetParent(tc3DWindow* win); ! ! ! tcDatabaseInfoWindow(const wxPoint& pos, const wxString& configFile = "xml/database_info.xml", ! const wxString& name = "DatabaseInfo", ! tc3DWindow* hostParent = parent); virtual ~tcDatabaseInfoWindow(); *************** *** 72,75 **** --- 75,79 ---- bool windowDragOn; wxPoint windowDragPoint; + bool isDragable; ///< true if window can be dragged (moved) void DrawDatabaseInfo(); *************** *** 79,88 **** private: bool destroy; ///< workaround to delay destruction of window to safe time ! long objId; ///< id of obj or track to display info for std::string databaseClassName; ///< class name of database object, empty if not looked up yet static tc3DWindow* parent; database::tcDatabaseObject* GetDatabaseObject(); DECLARE_EVENT_TABLE() --- 83,97 ---- private: bool destroy; ///< workaround to delay destruction of window to safe time ! ! long objId; ///< id of obj or track to display info for std::string databaseClassName; ///< class name of database object, empty if not looked up yet + std::vector<osg::ref_ptr<osg::Texture2D> > imageList; ///< images for this db object, loaded as textures + size_t currentImageIdx; ///< index of current image displayed (to cycle through available images) + unsigned int imageTime; ///< time at which current image was first displayed static tc3DWindow* parent; database::tcDatabaseObject* GetDatabaseObject(); + void LoadImageList(); DECLARE_EVENT_TABLE() --- NEW FILE: tcDatabaseViewer.h --- /** ** @file tcDatabaseViewer.h */ /* Copyright (C) 2006 Dewitt Colclough (de...@gc...) ** All rights reserved. ** This file is part of the Global Conflict Blue (GCB) program. ** GCB is free software; you can redistribute it and/or modify ** it under the terms of version 2 of the GNU General Public License as ** published by the Free Software Foundation. ** GCB is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** You should have received a copy of the GNU General Public License ** along with GCB; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _DATABASEVIEWER_H_ #define _DATABASEVIEWER_H_ #if _MSC_VER > 1000 #pragma once #endif #include "wx/wx.h" #include "wx/dir.h" #include <osg/ref_ptr> #include <osg/Vec4> #include "tcXmlWindow.h" #include "tcSound.h" class tcDatabaseInfoWindow; namespace osg { class Texture2D; } /** * Class to browse and view database info on various platforms */ class tcDatabaseViewer : public tcXmlWindow { struct BrowseItem { std::string className; ///< dir name or filename without the .py extension struct { float x; float y; float width; float height; } drawBox; ///< location to draw to screen osg::Vec4 color; enum {OFF = 0, OVER = 1, ON = 2} drawState; }; public: void Draw(); void OnLButtonDown(wxMouseEvent& event); void OnMouseMove(wxMouseEvent& event); void SetClassificationMask(unsigned int mask); tcDatabaseViewer(wxWindow *parent, const wxPoint& pos, const wxSize& size, const wxString& name = "DatabaseViewer"); virtual ~tcDatabaseViewer(); private: unsigned int classificationMask; ///< mask for current platform type on browse list long displayId; ///< id of current platform displayed std::string displayName; ///< class name of current platform displayed std::vector<BrowseItem> browseInfo; tcDatabaseInfoWindow* databaseInfoWindow; const wxRealPoint basePosition; wxPoint mousePosition; void BrowseSurface(wxCommandEvent& event); void BrowseSub(wxCommandEvent& event); void BrowseAir(wxCommandEvent& event); void BrowseHelo(wxCommandEvent& event); void BrowseLand(wxCommandEvent& event); void BrowseMissile(wxCommandEvent& event); void BrowseTorpedo(wxCommandEvent& event); void BrowseBallistic(wxCommandEvent& event); void BuildBrowseInfo(); void InitializeButtons(); void InitializeDatabaseInfoWindow(); bool ProcessMouseClick(std::vector<BrowseItem>& info, wxPoint pos); void UpdateDrawInfo(std::vector<BrowseItem>& info); DECLARE_EVENT_TABLE() }; #endif Index: tcButton.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/graphics/tcButton.h,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** tcButton.h 22 Mar 2006 01:23:28 -0000 1.14 --- tcButton.h 27 Mar 2006 01:08:30 -0000 1.15 *************** *** 52,55 **** --- 52,56 ---- const std::string& overOffImageName, const std::string& overOnImageName); + virtual void SetActive(bool abActive); void SetBackgroundAlpha(float val); void SetCaption(const std::string& s) {caption = s;} *************** *** 58,61 **** --- 59,63 ---- const osg::Vec4& on_color); void SetFontSize(float val); + void SetForceDisable(bool state); void SetOn(bool state) {isButtonOn = state;} void SetSendRedraw(bool state) {sendRedraw = state;} *************** *** 76,80 **** bool sendRedraw; ///< true to send redraw message to parent on button state change float backgroundAlpha; ///< transparency value for solid color background ! osg::Vec4 offColor; osg::Vec4 overColor; --- 78,83 ---- bool sendRedraw; ///< true to send redraw message to parent on button state change float backgroundAlpha; ///< transparency value for solid color background ! bool forceDisable; ///< if true then do not enable button ! osg::Vec4 offColor; osg::Vec4 overColor; |
|
From: Dewitt C. <ddc...@us...> - 2006-03-27 01:08:34
|
Update of /cvsroot/gcblue/gcb_wx/include/database In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18413/include/database Modified Files: tcDatabaseObject.h Log Message: Index: tcDatabaseObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/database/tcDatabaseObject.h,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** tcDatabaseObject.h 23 Mar 2006 01:12:11 -0000 1.28 --- tcDatabaseObject.h 27 Mar 2006 01:08:30 -0000 1.29 *************** *** 34,37 **** --- 34,38 ---- #include "gctypes.h" #include <osg/ref_ptr> + #include <wx/string.h> class tc3DModel; *************** *** 125,133 **** - #define DESCRIPTION_STRING_LENGTH 512 class tcDatabaseObject { public: tcDBString mzClass; ///< name of platform class, e.g. "Spruance" long mnKey; ///< key of this object in map --- 126,134 ---- class tcDatabaseObject { public: + enum {DESCRIPTION_STRING_LENGTH = 512}; tcDBString mzClass; ///< name of platform class, e.g. "Spruance" long mnKey; ///< key of this object in map *************** *** 136,140 **** UINT mnModelType; ///< model class to use, e.g. tcSurfaceObject, tcAirObject float cost; ///< default cost for scoring purposes ! tcDBString mzImageFileName; ///< used for icon file name tcDBString mz3DModelFileName; char mzDescription[DESCRIPTION_STRING_LENGTH]; --- 137,142 ---- UINT mnModelType; ///< model class to use, e.g. tcSurfaceObject, tcAirObject float cost; ///< default cost for scoring purposes ! std::string imageList; ///< semicolon delimited list of image files for DB info window ! tcDBString iconFileName; ///< used for icon file name tcDBString mz3DModelFileName; char mzDescription[DESCRIPTION_STRING_LENGTH]; *************** *** 146,149 **** --- 148,152 ---- virtual tc3DModel* Copy3DModel(); ///< creates copy of model (must be deleted) virtual tc3DModel* Get3DModel(); ///< gets pointer to database model + const wxArrayString& GetParsedImageList(); osg::Geometry* GetIcon(); bool IsLeaf() const; ///< returns true if db obj is a leaf obj *************** *** 171,174 **** --- 174,178 ---- tc3DModel *model; osg::ref_ptr<osg::Geometry> icon; ///< icon for drag/drop container gui + wxArrayString parsedImageList; }; |
|
From: Dewitt C. <ddc...@us...> - 2006-03-27 01:08:24
|
Update of /cvsroot/gcblue/gcb_wx/src/graphics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18363/src/graphics Modified Files: tc3DWindow.cpp tcButton.cpp tcDatabaseInfoWindow.cpp tcStartView.cpp tcXmlWindow.cpp Added Files: tcDatabaseViewer.cpp Log Message: Index: tcStartView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcStartView.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** tcStartView.cpp 23 Mar 2006 01:11:02 -0000 1.12 --- tcStartView.cpp 27 Mar 2006 01:08:17 -0000 1.13 *************** *** 65,69 **** maButton[0].mzCaption = "Select scenario."; maButton[1].mzCaption = "Configure game options."; ! maButton[2].mzCaption = "Browse database (not functional)."; maButton[3].mzCaption = "Show credits."; maButton[4].mzCaption = "Start game."; --- 65,69 ---- maButton[0].mzCaption = "Select scenario."; maButton[1].mzCaption = "Configure game options."; ! maButton[2].mzCaption = "Browse database."; maButton[3].mzCaption = "Show credits."; maButton[4].mzCaption = "Start game."; *************** *** 204,208 **** if ((i == nButton)&&(bButtonOver)) { ! bool bButtonEnabled = (i==4) ? mbPlayEnabled : (i!=2); if ((maButton[i].mnState == 0)&&(bButtonEnabled)) { --- 204,208 ---- if ((i == nButton)&&(bButtonOver)) { ! bool bButtonEnabled = (i==4) ? mbPlayEnabled : true; if ((maButton[i].mnState == 0)&&(bButtonEnabled)) { *************** *** 230,234 **** //TranslatePoint(point); // adjust for flipped up/down bButtonClicked = ButtonContainingPoint(event.GetPosition(), nButton); ! bool bButtonEnabled = (nButton==4) ? mbPlayEnabled : (nButton!=2); if (!bButtonEnabled) {bButtonClicked = false;} --- 230,234 ---- //TranslatePoint(point); // adjust for flipped up/down bButtonClicked = ButtonContainingPoint(event.GetPosition(), nButton); ! bool bButtonEnabled = (nButton==4) ? mbPlayEnabled : true; if (!bButtonEnabled) {bButtonClicked = false;} --- NEW FILE: tcDatabaseViewer.cpp --- /** ** @file tcDatabaseViewer.cpp */ /* Copyright (C) 2006 Dewitt Colclough (de...@gc...) ** All rights reserved. ** This file is part of the Global Conflict Blue (GCB) program. ** GCB is free software; you can redistribute it and/or modify ** it under the terms of version 2 of the GNU General Public License as ** published by the Free Software Foundation. ** GCB is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** You should have received a copy of the GNU General Public License ** along with GCB; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA **/ #include "stdwx.h" #ifndef WX_PRECOMP #include "wx/wx.h" #endif #include "tcDatabaseViewer.h" #include <osg/Texture2D> #include <osg/Vec4> #include "wxcommands.h" #include "common/tinyxml.h" #include "tcButton.h" #include "tcDatabaseObject.h" #include "tcDatabaseIterator.h" #include "tcDatabaseInfoWindow.h" #ifdef _DEBUG #define new DEBUG_NEW #endif BEGIN_EVENT_TABLE(tcDatabaseViewer, tcXmlWindow) EVT_COMMAND(101, wxEVT_COMMAND_BUTTON_CLICKED, tcDatabaseViewer::BrowseSurface) EVT_COMMAND(102, wxEVT_COMMAND_BUTTON_CLICKED, tcDatabaseViewer::BrowseSub) EVT_COMMAND(103, wxEVT_COMMAND_BUTTON_CLICKED, tcDatabaseViewer::BrowseAir) EVT_COMMAND(104, wxEVT_COMMAND_BUTTON_CLICKED, tcDatabaseViewer::BrowseHelo) EVT_COMMAND(105, wxEVT_COMMAND_BUTTON_CLICKED, tcDatabaseViewer::BrowseLand) EVT_COMMAND(106, wxEVT_COMMAND_BUTTON_CLICKED, tcDatabaseViewer::BrowseMissile) EVT_COMMAND(107, wxEVT_COMMAND_BUTTON_CLICKED, tcDatabaseViewer::BrowseTorpedo) EVT_COMMAND(108, wxEVT_COMMAND_BUTTON_CLICKED, tcDatabaseViewer::BrowseBallistic) END_EVENT_TABLE() void tcDatabaseViewer::BrowseSurface(wxCommandEvent& event) { SetClassificationMask(PTYPE_SURFACE); } void tcDatabaseViewer::BrowseSub(wxCommandEvent& event) { SetClassificationMask(PTYPE_SUBMARINE); } void tcDatabaseViewer::BrowseAir(wxCommandEvent& event) { SetClassificationMask(PTYPE_FIXEDWING); } void tcDatabaseViewer::BrowseHelo(wxCommandEvent& event) { SetClassificationMask(PTYPE_HELO); } void tcDatabaseViewer::BrowseLand(wxCommandEvent& event) { SetClassificationMask(PTYPE_FIXED); } void tcDatabaseViewer::BrowseMissile(wxCommandEvent& event) { SetClassificationMask(PTYPE_MISSILE); } void tcDatabaseViewer::BrowseTorpedo(wxCommandEvent& event) { SetClassificationMask(PTYPE_TORPEDO); } void tcDatabaseViewer::BrowseBallistic(wxCommandEvent& event) { SetClassificationMask(PTYPE_BALLISTIC); } /** * Updates browse info data based on classificationMask * Should be called after changing classificationMask */ void tcDatabaseViewer::BuildBrowseInfo() { browseInfo.clear(); database::tcDatabaseIterator iter(classificationMask); for (iter.First(); !iter.IsDone(); iter.Next()) { database::tcDatabaseObject* obj = iter.Get(); wxASSERT(obj); wxASSERT(obj->mnKey != -1); BrowseItem item; item.className = obj->mzClass.mz; browseInfo.push_back(item); } } /** * */ bool tcDatabaseViewer::ProcessMouseClick(std::vector<BrowseItem>& info, wxPoint pos) { for (size_t n=0; n < info.size(); ++n) { wxRect r(info[n].drawBox.x, info[n].drawBox.y, info[n].drawBox.width, info[n].drawBox.height); if (r.Inside(pos)) { return true; } } return false; } void tcDatabaseViewer::SetClassificationMask(unsigned int mask) { if (mask == classificationMask) return; classificationMask = mask; BuildBrowseInfo(); UpdateDrawInfo(browseInfo); } /** * Update drawing info of browseInfo vector */ void tcDatabaseViewer::UpdateDrawInfo(std::vector<BrowseItem>& info) { float x = 50.0f; float y = 150.0f; float xWidth = 100.0f; float yHeight = 15.0f; for (size_t n=0; n < info.size(); ++n) { BrowseItem& item = info[n]; item.drawBox.x = x; item.drawBox.y = y; item.drawBox.height = yHeight - 2; item.drawBox.width = xWidth; y += yHeight; wxRect r(item.drawBox.x, item.drawBox.y, item.drawBox.width, item.drawBox.height); int oldState = item.drawState; if (item.className == displayName) { item.drawState = BrowseItem::ON; item.color = osg::Vec4(1, 1, 1, 1); if (item.drawState != oldState) tcSound::Get()->PlayEffect("Beep2"); } else if (r.Inside(mousePosition)) { item.drawState = BrowseItem::OVER; item.color = osg::Vec4(0.6, 0.6, 1, 1); if (item.drawState != oldState) tcSound::Get()->PlayEffect("Thuck"); } else { item.drawState = BrowseItem::OFF; item.color = osg::Vec4(0.5, 0.5, 0.5, 1); } } } /** * */ void tcDatabaseViewer::Draw() { DrawChildren(); for (size_t n=0; n<browseInfo.size(); n++) { BrowseItem& item = browseInfo[n]; DrawTextR(item.className.c_str(), item.drawBox.x, item.drawBox.y + item.drawBox.height - 3, defaultFont.get(), item.color, 16.0f, LEFT_BASE_LINE); } DrawBorder(); HideUnusedObjects(); } void tcDatabaseViewer::InitializeButtons() { size_t nButtons = 8; float x = 50.0f; float y = 50.0f; float width = 64.0f; for (size_t n=0; n<nButtons; n++) { tcButton* button = new tcButton(this, wxPoint(x, y), wxSize(width, width)); button->LoadImages("test_button_off.png", "test_button_on.png", "test_button_on.png", "test_button_on.png"); button->SetActive(true); button->SetCommand(101 + n); x += width + 16.0f; } } void tcDatabaseViewer::InitializeDatabaseInfoWindow() { databaseInfoWindow = new tcDatabaseInfoWindow(wxPoint(300, 150), "xml/database_info.xml", "DBViewInfo", this); wxASSERT(databaseInfoWindow != 0); databaseInfoWindow->SetBackgroundColor(osg::Vec4(0.1f, 0.1f, 0.1f, 0.2f)); databaseInfoWindow->SetButtonDisable(86, true); // disable the close button databaseInfoWindow->SetDragable(false); } /** * */ void tcDatabaseViewer::OnMouseMove(wxMouseEvent& event) { mousePosition = event.GetPosition(); UpdateDrawInfo(browseInfo); } /** * */ void tcDatabaseViewer::OnLButtonDown(wxMouseEvent& event) { if (!mbActive) { event.Skip(); return; } mousePosition = event.GetPosition(); if (ProcessMouseClick(browseInfo, mousePosition)) { UpdateDrawInfo(browseInfo); return; } } /** * */ tcDatabaseViewer::tcDatabaseViewer(wxWindow *parent, const wxPoint& pos, const wxSize& size, const wxString& name) : tcXmlWindow(parent, pos, size, "xml/database_viewer.xml", name), basePosition(20, 50), classificationMask(0) { LoadBackgroundImage("start_background_plain.jpg"); if (!config) { fprintf(stderr, "tcDatabaseViewer::tcDatabaseViewer - NULL xml config node\n"); return; } TiXmlNode* root = config->FirstChild("Window"); if (!root) { fprintf(stderr, "tcDatabaseViewer::tcDatabaseViewer - " "Missing top level <Window> tag\n"); return; } SetClassificationMask(PTYPE_SURFACE); InitializeButtons(); InitializeDatabaseInfoWindow(); } tcDatabaseViewer::~tcDatabaseViewer() { } Index: tcDatabaseInfoWindow.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcDatabaseInfoWindow.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** tcDatabaseInfoWindow.cpp 26 Mar 2006 00:32:14 -0000 1.2 --- tcDatabaseInfoWindow.cpp 27 Mar 2006 01:08:17 -0000 1.3 *************** *** 121,125 **** s.Printf("%s", databaseObj->mzDescription); DrawTextR(s.c_str(), textx, texty, ! defaultFont.get(), color, fontSize, LEFT_BASE_LINE, maxWidth, textBox); float imagex = 265.0; --- 121,125 ---- s.Printf("%s", databaseObj->mzDescription); DrawTextR(s.c_str(), textx, texty, ! defaultFont.get(), color, fontSize, LEFT_BASE_LINE, maxWidth - 150.0f, textBox); float imagex = 265.0; *************** *** 128,132 **** if (nImages > 0) { ! DrawImageR(imageList[currentImageIdx].get(), imagex, imagey, 128.0f, 128.0f, ALIGN_BOTTOM_LEFT); // cycle through images --- 128,133 ---- if (nImages > 0) { ! DrawImageR(imageList[currentImageIdx].get(), imagex, imagey, 128.0f, 100.0f, ALIGN_BOTTOM_LEFT); ! DrawRectangleR(imagex, imagey, 128.0f, 100.0f, osg::Vec4(1, 1, 1, 0.5)); // cycle through images *************** *** 227,231 **** isLButtonDown = true; ! if ((point.y <= 20) || (point.y >= mnHeight)) { windowDragOn = true; --- 228,232 ---- isLButtonDown = true; ! if (isDragable && ((point.y <= 20) || (point.y >= mnHeight))) { windowDragOn = true; *************** *** 282,285 **** --- 283,291 ---- } + void tcDatabaseInfoWindow::SetDragable(bool state) + { + isDragable = state; + } + void tcDatabaseInfoWindow::UpdateWindowDrag(const wxPoint& pos) *************** *** 302,313 **** /** ! * static method SetParent must be called first */ ! tcDatabaseInfoWindow::tcDatabaseInfoWindow(const wxPoint& pos, const wxString& configFile, const wxString& name) ! : tcXmlWindow(parent, pos, wxSize(10, 10), configFile, name, parent), destroy(false), drawCount(0), isLButtonDown(false), windowDragOn(false), objId(-1), databaseClassName(""), --- 308,320 ---- /** ! * if hostParent argument is not used then static method SetParent must be called first */ ! tcDatabaseInfoWindow::tcDatabaseInfoWindow(const wxPoint& pos, const wxString& configFile, const wxString& name, tc3DWindow* hostParent) ! : tcXmlWindow(hostParent, pos, wxSize(10, 10), configFile, name, hostParent), destroy(false), drawCount(0), isLButtonDown(false), windowDragOn(false), + isDragable(true), objId(-1), databaseClassName(""), *************** *** 317,324 **** { ! wxASSERT(parent != 0); // put gui window on top ! SetBaseRenderBin(parent->GetBaseRenderBin() + windowLayer*10); wxWindow::Raise(); --- 324,331 ---- { ! wxASSERT(hostParent != 0); // put gui window on top ! SetBaseRenderBin(hostParent->GetBaseRenderBin() + windowLayer*10); wxWindow::Raise(); Index: tcXmlWindow.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcXmlWindow.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** tcXmlWindow.cpp 23 Mar 2006 01:11:02 -0000 1.8 --- tcXmlWindow.cpp 27 Mar 2006 01:08:17 -0000 1.9 *************** *** 135,138 **** --- 135,155 ---- } + + void tcXmlWindow::SetButtonDisable(long command, bool state) + { + for (unsigned int n=0; n<children.size(); n++) + { + if (tcButton* button = dynamic_cast<tcButton*>(children[n])) + { + if (button->GetCommand() == command) + { + button->SetForceDisable(state); + return; + } + } + + } + } + /** * This allows a window to change the caption of a button based on game state Index: tcButton.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcButton.cpp,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** tcButton.cpp 23 Mar 2006 01:11:02 -0000 1.21 --- tcButton.cpp 27 Mar 2006 01:08:17 -0000 1.22 *************** *** 177,180 **** --- 177,192 ---- } + void tcButton::SetActive(bool abActive) + { + if (forceDisable) + { + tc3DWindow::SetActive(false); + } + else + { + tc3DWindow::SetActive(abActive); + } + } + /** * *************** *** 204,207 **** --- 216,223 ---- } + void tcButton::SetForceDisable(bool state) + { + forceDisable = state; + } /** *************** *** 220,224 **** fontSize(12.0f), sendRedraw(false), ! backgroundAlpha(1.0f) { --- 236,241 ---- fontSize(12.0f), sendRedraw(false), ! backgroundAlpha(1.0f), ! forceDisable(false) { *************** *** 338,353 **** offColor(0, 0, 0, 1), overColor(0.4, 1, 0.4, 1), ! onColor(1, 1, 1, 1) { - - caption = "NULL"; - command = -1; - isButtonOn = false; - isMouseOver = false; - soundEffect = ""; - fontSize = 16.0f; - sendRedraw = false; - backgroundAlpha = 1.0f; - ref_count++; --- 355,369 ---- offColor(0, 0, 0, 1), overColor(0.4, 1, 0.4, 1), ! onColor(1, 1, 1, 1), ! caption("NULL"), ! command(-1), ! isButtonOn(false), ! isMouseOver(false), ! soundEffect(""), ! fontSize(16.0f), ! sendRedraw(false), ! backgroundAlpha(1.0f), ! forceDisable(false) { ref_count++; Index: tc3DWindow.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tc3DWindow.cpp,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** tc3DWindow.cpp 26 Mar 2006 00:32:14 -0000 1.34 --- tc3DWindow.cpp 27 Mar 2006 01:08:17 -0000 1.35 *************** *** 722,725 **** --- 722,726 ---- { backgroundColor = color; + UpdateBackgroundQuad(); } |
|
From: Dewitt C. <ddc...@us...> - 2006-03-27 01:08:23
|
Update of /cvsroot/gcblue/gcb_wx/src/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18363/src/sim Modified Files: Game.cpp Log Message: Index: Game.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/Game.cpp,v retrieving revision 1.151 retrieving revision 1.152 diff -C2 -d -r1.151 -r1.152 *** Game.cpp 23 Mar 2006 01:11:02 -0000 1.151 --- Game.cpp 27 Mar 2006 01:08:17 -0000 1.152 *************** *** 4,8 **** /* Copyright (C) 2003-2005 Dewitt Colclough (de...@gc...) ** All rights reserved. ! ** ** This file is part of the Global Conflict Blue (GCB) program. ** GCB is free software; you can redistribute it and/or modify --- 4,8 ---- /* Copyright (C) 2003-2005 Dewitt Colclough (de...@gc...) ** All rights reserved. ! ** This file is part of the Global Conflict Blue (GCB) program. ** GCB is free software; you can redistribute it and/or modify *************** *** 66,70 **** #include "tcDatabaseInfoWindow.h" #include "tcGenericDBObject.h" ! #if defined(_MSC_VER) --- 66,70 ---- #include "tcDatabaseInfoWindow.h" #include "tcGenericDBObject.h" ! #include "tcDatabaseViewer.h" #if defined(_MSC_VER) *************** *** 92,95 **** --- 92,96 ---- EVT_COMMAND(ID_STARTVIEW, wxEVT_COMMAND_BUTTON_CLICKED , tcGame::SwitchToStart) EVT_COMMAND(ID_CREDITVIEW, wxEVT_COMMAND_BUTTON_CLICKED , tcGame::SwitchToCredit) + EVT_COMMAND(ID_DATABASEVIEW, wxEVT_COMMAND_BUTTON_CLICKED , tcGame::SwitchToDatabaseView) EVT_COMMAND(ID_DISPLAYSETTINGS, wxEVT_COMMAND_BUTTON_CLICKED , tcGame::SwitchToDisplaySettings) EVT_COMMAND(ID_OPTIONSVIEW, wxEVT_COMMAND_BUTTON_CLICKED , tcGame::SwitchToOptions) *************** *** 401,404 **** --- 402,411 ---- } + void tcGame::SwitchToDatabaseView(wxCommandEvent& event) + { + meScreenMode = DATABASEVIEW; + } + + void tcGame::SwitchToDisplaySettings(wxCommandEvent& event) { *************** *** 526,538 **** InitializeGameWindow(); - - /* - test3DWindow = - new tc3DWindow(viewer, wxPoint(0, 0), wxSize(150, 80), "Test3DWindow"); - test3DWindow->SetActive(true); - */ - - /* start view has to be initialized first so that we can - share its 2D surface with the other windows */ InitializeCreditView(); InitializeDisplaySettingsView(); --- 533,536 ---- *************** *** 590,593 **** --- 588,593 ---- tcLauncherState::mpDatabase = database; + InitializeDatabaseViewer(); + /* ** Initialize mcMapData * **/ mapData->AttachOptions(tcOptions::Get()); *************** *** 865,868 **** --- 865,886 ---- /** + * Initializes the database viewer + */ + void tcGame::InitializeDatabaseViewer() + { + wxASSERT(glCanvas); + + databaseViewer = + new tcDatabaseViewer(glCanvas, wxPoint(0,0), frameSize, "DatabaseViewer"); + + if (databaseViewer == 0) + { + throw exception(); + } + + databaseViewer->SetActive(false); + } + + /** * Initializes tcDirector object */ *************** *** 912,916 **** /** * Initializes the Select Scenario View screen. - * */ void tcGame::InitializeScenarioSelectView() --- 930,933 ---- *************** *** 1464,1468 **** optionsView->SetActive(false); creditView->SetActive(false); ! displaySettingsView->SetActive(false); scenarioSelectView->SetActive(false); messageCenter->SetActive(false); --- 1481,1486 ---- optionsView->SetActive(false); creditView->SetActive(false); ! databaseViewer->SetActive(false); ! displaySettingsView->SetActive(false); scenarioSelectView->SetActive(false); messageCenter->SetActive(false); *************** *** 1487,1490 **** --- 1505,1512 ---- creditView->Draw(); break; + case DATABASEVIEW: + databaseViewer->SetActive(true); + databaseViewer->Draw(); + break; case OPTIONS: optionsView->SetActive(true); *************** *** 1604,1607 **** --- 1626,1630 ---- briefingView->SetActive(false); chatBox->SetActive(false); + databaseViewer->SetActive(false); displaySettingsView->SetActive(false); hookInfo->SetActive(false); *************** *** 1711,1715 **** { briefingView->SetActive(true); - briefingView->Draw(); } --- 1734,1737 ---- *************** *** 1717,1721 **** { optionsView->SetActive(true); - optionsView->Draw(); } --- 1739,1742 ---- *************** *** 1723,1727 **** { messageCenter->SetActive(true); - messageCenter->Draw(); } --- 1744,1747 ---- *************** *** 1729,1739 **** { networkView->SetActive(true); - networkView->Draw(); } else if (meScreenMode == DISPLAYSETTINGS) { displaySettingsView->SetActive(true); - displaySettingsView->Draw(); } --- 1749,1762 ---- { networkView->SetActive(true); networkView->Draw(); } + else if (meScreenMode == DATABASEVIEW) + { + databaseViewer->SetActive(true); + databaseViewer->Draw(); + } else if (meScreenMode == DISPLAYSETTINGS) { displaySettingsView->SetActive(true); displaySettingsView->Draw(); } |
|
From: Dewitt C. <ddc...@us...> - 2006-03-26 00:34:15
|
Update of /cvsroot/gcblue/gcb_wx/docs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4808/docs Modified Files: CHANGES.txt Log Message: Index: CHANGES.txt =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/docs/CHANGES.txt,v retrieving revision 1.52 retrieving revision 1.53 diff -C2 -d -r1.52 -r1.53 *** CHANGES.txt 22 Mar 2006 01:22:26 -0000 1.52 --- CHANGES.txt 26 Mar 2006 00:34:02 -0000 1.53 *************** *** 3,7 **** 0.8.3 --------------------------------------------------------------------- ! *** 2006-03-08 through 2006-03-21 *** - Upgraded to OSG 1.0 - Upgraded code for vc8 compiler --- 3,7 ---- 0.8.3 --------------------------------------------------------------------- ! *** 2006-03-08 through 2006-03-25 *** - Upgraded to OSG 1.0 - Upgraded code for vc8 compiler *************** *** 10,13 **** --- 10,15 ---- - Added unit cost to database. This will act as a default scoring value for kill/loss adjustments. Also can be used for purchase cost in multiplayer. + - Added score features to establish value for objectives and track kill/loss balance + - Database info popup now shows photos of platform (if available) |
Update of /cvsroot/gcblue/gcb_wx/src/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3422/src/sim Modified Files: tcAirObject.cpp tcAirfieldObject.cpp tcCarrierObject.cpp tcESMSensor.cpp tcFlightOpsObject.cpp tcGameObject.cpp tcGoal.cpp tcGoalTracker.cpp tcLauncher.cpp tcMissileObject.cpp tcOpticalSensor.cpp tcPlatformObject.cpp tcRadar.cpp tcSimState.cpp tcSonobuoy.cpp tcSubObject.cpp tcTorpedoObject.cpp Log Message: Index: tcSimState.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcSimState.cpp,v retrieving revision 1.95 retrieving revision 1.96 diff -C2 -d -r1.95 -r1.96 *** tcSimState.cpp 23 Mar 2006 01:11:02 -0000 1.95 --- tcSimState.cpp 26 Mar 2006 00:32:15 -0000 1.96 *************** *** 2,6 **** ** @file tcSimState.cpp */ ! /* Copyright (C) 2003-2005 Dewitt Colclough (de...@gc...) ** All rights reserved. ** --- 2,6 ---- ** @file tcSimState.cpp */ ! /* Copyright (C) 2003-2006 Dewitt Colclough (de...@gc...) ** All rights reserved. ** *************** *** 28,32 **** #include "simmath.h" #include "aerror.h" ! #include "ATLComTime.h" #include <vector> #include "tcFile.h" --- 28,32 ---- #include "simmath.h" #include "aerror.h" ! #include <wx/datetime.h> #include <vector> #include "tcFile.h" *************** *** 444,464 **** if (trueRange2 < 0.00001440f) // 12.0 m range { ! bool alreadyDestroyed = target->mfDamageLevel >= 1.0f; float fDamage = missile->mpDBObject->mfDamage; float damageFraction = GetFractionalDamage(fDamage, target); ! float priorTargetDamage = target->mfDamageLevel; ! float priorWeaponDamage = missile->mfDamageLevel; ! ! target->mfDamageLevel += damageFraction; ! missile->mfDamageLevel += 1.0f; // missile destroys itself on impact ! ! UpdateScoreForDamage(0, missile, priorWeaponDamage); if (damageFraction > 0) { ! target->ApplyDamage(damageFraction); ! ! UpdateScoreForDamage(missile, target, priorTargetDamage); if (mpUserInfo->IsOwnAlliance(target->GetAlliance())) --- 444,456 ---- if (trueRange2 < 0.00001440f) // 12.0 m range { ! bool alreadyDestroyed = target->GetDamageLevel() >= 1.0f; float fDamage = missile->mpDBObject->mfDamage; float damageFraction = GetFractionalDamage(fDamage, target); ! missile->ApplyDamage(1.0f, 0); // missile destroys itself on impact if (damageFraction > 0) { ! target->ApplyDamage(damageFraction, missile); if (mpUserInfo->IsOwnAlliance(target->GetAlliance())) *************** *** 528,546 **** if (trueRange2 < 144.0f) // 12.0 m "range", dz not counted as heavily { ! float priorTargetDamage = target->mfDamageLevel; ! bool alreadyDestroyed = target->mfDamageLevel >= 1.0f; float fDamage = torp->mpDBObject->mfDamage; float damageFraction = GetFractionalDamage(fDamage, target); - target->mfDamageLevel += damageFraction; ! float priorWeaponDamage = torp->mfDamageLevel; ! torp->mfDamageLevel += 1.0f; // torp destroys itself on impact ! UpdateScoreForDamage(0, torp, priorWeaponDamage); if (damageFraction > 0) { ! target->ApplyDamage(damageFraction); ! ! UpdateScoreForDamage(torp, target, priorTargetDamage); if (mpUserInfo->IsOwnAlliance(target->GetAlliance())) --- 520,532 ---- if (trueRange2 < 144.0f) // 12.0 m "range", dz not counted as heavily { ! bool alreadyDestroyed = target->GetDamageLevel() >= 1.0f; float fDamage = torp->mpDBObject->mfDamage; float damageFraction = GetFractionalDamage(fDamage, target); ! torp->ApplyDamage(damageFraction, 0); if (damageFraction > 0) { ! target->ApplyDamage(damageFraction, torp); if (mpUserInfo->IsOwnAlliance(target->GetAlliance())) *************** *** 630,644 **** if (range_m <= damage_range_m) { - float priorTargetDamage = target->mfDamageLevel; float damageFraction = GetFractionalDamage(fDamage, target); ! bool alreadyDestroyed = target->mfDamageLevel >= 1.0f; ! target->mfDamageLevel += damageFraction; ! if (damageFraction > 0) { ! target->ApplyDamage(damageFraction); - UpdateScoreForDamage(weapon, target, priorTargetDamage); #ifdef _DEBUG tcString s; --- 616,626 ---- if (range_m <= damage_range_m) { float damageFraction = GetFractionalDamage(fDamage, target); ! bool alreadyDestroyed = target->GetDamageLevel() >= 1.0f; if (damageFraction > 0) { ! target->ApplyDamage(damageFraction, weapon); #ifdef _DEBUG tcString s; *************** *** 689,696 **** } - float priorWeaponDamage = weapon->mfDamageLevel; - weapon->mfDamageLevel += 1.0f; - UpdateScoreForDamage(0, weapon, priorWeaponDamage); } --- 671,676 ---- } + weapon->ApplyDamage(1.0, 0); } *************** *** 714,718 **** if (trueRange2 < 2500.0f) // 50.0 m range { - float priorTargetDamage = target->mfDamageLevel; float fDamage = weapon->GetDamage(); float damageFraction = GetFractionalDamage(fDamage, target); --- 694,697 ---- *************** *** 720,734 **** if (randf() < 0.3f) damageFraction = 0; // additional miss chance ! bool alreadyDestroyed = target->mfDamageLevel >= 1.0f; ! target->mfDamageLevel += damageFraction; ! float priorWeaponDamage = weapon->mfDamageLevel; ! weapon->mfDamageLevel += 1.0f; // destroys itself on impact ! UpdateScoreForDamage(0, weapon, priorWeaponDamage); if (damageFraction > 0) { ! target->ApplyDamage(damageFraction); ! UpdateScoreForDamage(weapon, target, priorTargetDamage); if (mpUserInfo->IsOwnAlliance(target->GetAlliance())) --- 699,709 ---- if (randf() < 0.3f) damageFraction = 0; // additional miss chance ! bool alreadyDestroyed = target->GetDamageLevel() >= 1.0f; ! weapon->ApplyDamage(1.0f, 0); if (damageFraction > 0) { ! target->ApplyDamage(damageFraction, weapon); if (mpUserInfo->IsOwnAlliance(target->GetAlliance())) *************** *** 879,911 **** } - /** - * Score is scaled to units of $1000. Partial damage gets up to 50% of the value of the object. Full - * damage gets the remaining 50% - * Call after damage has been applied to damagee - */ - void tcSimState::UpdateScoreForDamage(tcGameObject* damager, tcGameObject* damagee, float priorDamage) - { - wxASSERT(damagee); - - if (damagee == 0) return; - if (priorDamage >= 1.0f) return; // already destroyed - - float& damageLevel = damagee->mfDamageLevel; - if (damageLevel <= priorDamage) return; // no damage - - float newDamage = damageLevel - priorDamage; - float damageCredit = 0.0005f * newDamage * damagee->mpDBObject->GetCost(); - - if (damageLevel >= 1.0f) - { - damageCredit += 0.0005f * damagee->mpDBObject->GetCost(); - } - - if (damager != 0) - { - tcGoalTracker::Get()->AdjustAllianceScore(damager->GetAlliance(), damageCredit); - } - tcGoalTracker::Get()->AdjustAllianceScore(damagee->GetAlliance(), -damageCredit); - } /** --- 854,857 ---- *************** *** 1222,1229 **** std::string damageString = "reports light damage"; ! if (obj->mfDamageLevel >= 1.0) damageString = "destroyed"; ! else if (obj->mfDamageLevel >= 0.5) damageString = "reports heavy damage"; ! else if (obj->mfDamageLevel >= 0.2) damageString = "reports moderate damage"; wxString s = wxString::Format("%s: %s (%s) %s\n", --- 1168,1176 ---- std::string damageString = "reports light damage"; ! float damageLevel = obj->GetDamageLevel(); + if (damageLevel >= 1.0) damageString = "destroyed"; + else if (damageLevel >= 0.5) damageString = "reports heavy damage"; + else if (damageLevel >= 0.2) damageString = "reports moderate damage"; wxString s = wxString::Format("%s: %s (%s) %s\n", *************** *** 1902,1911 **** try { ! COleDateTime current; ! current = COleDateTime::GetCurrentTime(); ! tcString str = current.Format(_T("Randomly generated on %A, %B %d, %Y %H:%M:%S")); ! sprintf(msScenarioInfo.mzDescription,"%s",str.GetBuffer()); ! strcpy(msScenarioInfo.mzName,"RANDOM-TEST"); } catch (...) --- 1849,1859 ---- try { ! wxDateTime current = wxDateTime::Now(); ! wxString s = wxString::Format("Randomly generated on %s", ! current.Format().c_str()); ! //tcString str = current.Format(_T("Randomly generated on %A, %B %d, %Y %H:%M:%S")); ! sprintf_s(msScenarioInfo.mzDescription, 1024, "%s", s.c_str()); ! strcpy(msScenarioInfo.mzName, "RANDOM-TEST"); } catch (...) *************** *** 1996,2003 **** UINT platform_type; ! if (mpDatabase == NULL) {return;} ! CTime ctime = CTime::GetCurrentTime(); ! srand((nSeedCount++) + ctime.GetMinute()*ctime.GetSecond()); int rand_num = rand() % 3; --- 1944,1956 ---- UINT platform_type; + wxASSERT(mpDatabase); + if (mpDatabase == 0) return; ! if (nSeedCount == 0) ! { ! nSeedCount++; ! wxDateTime t = wxDateTime::Now(); ! srand(t.GetMinute() * t.GetSecond()); ! } int rand_num = rand() % 3; Index: tcMissileObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcMissileObject.cpp,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** tcMissileObject.cpp 23 Mar 2006 01:11:02 -0000 1.33 --- tcMissileObject.cpp 26 Mar 2006 00:32:15 -0000 1.34 *************** *** 311,328 **** if ((mcTerrain.mfHeight_m >= mcKin.mfAlt_m) || seaSurfaceCrash) { ! mfDamageLevel = 1.0f; tcString s; s.Format("Object %s crashed at time %.1f lon %.3f, lat %.3f", mzUnit.mz,afStatusTime,mcKin.mfLon_rad*C_180OVERPI,mcKin.mfLat_rad*C_180OVERPI); WTL(s.GetBuffer()); - simState->UpdateScoreForDamage(0, this, priorDamage); } if ((msKState.mfFlightTime > 20.0f)&&(msKState.mfSpeed_mps < mpDBObject->mfShutdownSpeed_mps)) { ! mfDamageLevel = 1.0f; // self-destruct tcString s; s.Format("Object %s shut down at time %.1f lon %.3f, lat %.3f", mzUnit.mz,afStatusTime,mcKin.mfLon_rad*C_180OVERPI,mcKin.mfLat_rad*C_180OVERPI); WTL(s.GetBuffer()); - simState->UpdateScoreForDamage(0, this, priorDamage); } --- 311,326 ---- if ((mcTerrain.mfHeight_m >= mcKin.mfAlt_m) || seaSurfaceCrash) { ! ApplyDamage(1.0f, 0); tcString s; s.Format("Object %s crashed at time %.1f lon %.3f, lat %.3f", mzUnit.mz,afStatusTime,mcKin.mfLon_rad*C_180OVERPI,mcKin.mfLat_rad*C_180OVERPI); WTL(s.GetBuffer()); } if ((msKState.mfFlightTime > 20.0f)&&(msKState.mfSpeed_mps < mpDBObject->mfShutdownSpeed_mps)) { ! ApplyDamage(1.0f, 0); tcString s; s.Format("Object %s shut down at time %.1f lon %.3f, lat %.3f", mzUnit.mz,afStatusTime,mcKin.mfLon_rad*C_180OVERPI,mcKin.mfLat_rad*C_180OVERPI); WTL(s.GetBuffer()); } Index: tcGoal.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcGoal.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** tcGoal.cpp 23 Mar 2006 01:11:02 -0000 1.10 --- tcGoal.cpp 26 Mar 2006 00:32:15 -0000 1.11 *************** *** 588,592 **** goalState = FAILED; } ! else if (obj->mfDamageLevel >= 1.0) { goalState = FAILED; --- 588,592 ---- goalState = FAILED; } ! else if (obj->GetDamageLevel() >= 1.0) { goalState = FAILED; Index: tcLauncher.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcLauncher.cpp,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** tcLauncher.cpp 23 Mar 2006 01:11:02 -0000 1.35 --- tcLauncher.cpp 26 Mar 2006 00:32:15 -0000 1.36 *************** *** 36,39 **** --- 36,40 ---- #include "tcRadar.h" #include "tcSimState.h" + #include "tcGoalTracker.h" #include <iostream> #include "common/tcObjStream.h" *************** *** 686,689 **** --- 687,712 ---- } + + /** + * Call after damage to launcher. This assumes all items in launcher are + * destroyed. + */ + void tcLauncher::UpdateScoreForDamage(tcGameObject* damager) + { + if (!isDamaged) return; + + float cost = 0; + if (mpChildDBObj) + { + cost = float(mnCurrent) * mpChildDBObj->GetCost(); + } + + if (damager != 0) + { + tcGoalTracker::Get()->AdjustAllianceScore(damager->GetAlliance(), cost); + } + tcGoalTracker::Get()->AdjustAllianceScore(parent->GetAlliance(), -cost); + } + void tcLauncher::UpdateStatus() { Index: tcPlatformObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcPlatformObject.cpp,v retrieving revision 1.60 retrieving revision 1.61 diff -C2 -d -r1.60 -r1.61 *** tcPlatformObject.cpp 23 Mar 2006 01:11:02 -0000 1.60 --- tcPlatformObject.cpp 26 Mar 2006 00:32:15 -0000 1.61 *************** *** 412,417 **** * @param fractional amount of new damage */ ! void tcPlatformObject::ApplyDamage(float damage) { float scaledDamage = (mfDamageLevel <= 0.5f) ? (0.4f * damage) : damage; --- 412,422 ---- * @param fractional amount of new damage */ ! void tcPlatformObject::ApplyDamage(float damage, tcGameObject* damager) { + float priorDamage = mfDamageLevel; + mfDamageLevel += damage; + + UpdateScoreForDamage(damager, priorDamage); + float scaledDamage = (mfDamageLevel <= 0.5f) ? (0.4f * damage) : damage; *************** *** 425,428 **** --- 430,434 ---- { launcher->SetDamaged(true); + launcher->UpdateScoreForDamage(damager); } } *************** *** 452,455 **** --- 458,464 ---- void tcPlatformObject::ApplyRepairs(float repair) { + mfDamageLevel -= repair; + if (mfDamageLevel == 0) mfDamageLevel = 0; + float scaledRepairs = (mfDamageLevel <= 0.5f) ? (0.5f * repair) : repair; Index: tcTorpedoObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcTorpedoObject.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** tcTorpedoObject.cpp 23 Mar 2006 01:11:02 -0000 1.17 --- tcTorpedoObject.cpp 26 Mar 2006 00:32:15 -0000 1.18 *************** *** 325,334 **** if (mcTerrain.mfHeight_m >= mcKin.mfAlt_m) { ! mfDamageLevel = 1.0f; tcString s; s.Format("Torpedo %s hit bottom at time %.1f lon %.3f, lat %.3f", mzUnit.mz,afStatusTime,mcKin.mfLon_rad*C_180OVERPI,mcKin.mfLat_rad*C_180OVERPI); WTL(s.GetBuffer()); - simState->UpdateScoreForDamage(0, this, priorDamage); } --- 325,333 ---- if (mcTerrain.mfHeight_m >= mcKin.mfAlt_m) { ! ApplyDamage(1.0f, 0); tcString s; s.Format("Torpedo %s hit bottom at time %.1f lon %.3f, lat %.3f", mzUnit.mz,afStatusTime,mcKin.mfLon_rad*C_180OVERPI,mcKin.mfLat_rad*C_180OVERPI); WTL(s.GetBuffer()); } *************** *** 339,348 **** if (battery_kJ <= 0) { ! mfDamageLevel = 1.0f; // self-destruct tcString s; s.Format("Torpedo %s shut down at time %.1f lon %.3f, lat %.3f", mzUnit.mz,afStatusTime,mcKin.mfLon_rad*C_180OVERPI,mcKin.mfLat_rad*C_180OVERPI); WTL(s.GetBuffer()); - simState->UpdateScoreForDamage(0, this, priorDamage); } --- 338,346 ---- if (battery_kJ <= 0) { ! ApplyDamage(1.0f, 0); // self-destruct tcString s; s.Format("Torpedo %s shut down at time %.1f lon %.3f, lat %.3f", mzUnit.mz,afStatusTime,mcKin.mfLon_rad*C_180OVERPI,mcKin.mfLat_rad*C_180OVERPI); WTL(s.GetBuffer()); } Index: tcESMSensor.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcESMSensor.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** tcESMSensor.cpp 23 Mar 2006 01:11:02 -0000 1.17 --- tcESMSensor.cpp 26 Mar 2006 00:32:15 -0000 1.18 *************** *** 291,295 **** (t - mcTrack.mfTimestamp) > 300.0) // set high for now to coast { ! parent->mfDamageLevel += 1.0f; mcTrack.mnID = NULL_INDEX; --- 291,295 ---- (t - mcTrack.mfTimestamp) > 300.0) // set high for now to coast { ! parent->SelfDestruct(); mcTrack.mnID = NULL_INDEX; Index: tcGameObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcGameObject.cpp,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** tcGameObject.cpp 12 Dec 2005 02:37:01 -0000 1.42 --- tcGameObject.cpp 26 Mar 2006 00:32:15 -0000 1.43 *************** *** 2,7 **** ** @file tcGameObject.cpp */ ! /* ! ** Copyright (C) 2003-2005 Dewitt Colclough (de...@gc...) ** All rights reserved. --- 2,6 ---- ** @file tcGameObject.cpp */ ! /* Copyright (C) 2003-2006 Dewitt Colclough (de...@gc...) ** All rights reserved. *************** *** 33,36 **** --- 32,36 ---- #include "tcSimState.h" #include "tcScenarioLogger.h" + #include "tcGoalTracker.h" #include "common/tcStream.h" #include "common/tcObjStream.h" *************** *** 89,93 **** void tcGameObject::SelfDestruct() { ! mfDamageLevel += 1.0f; } --- 89,96 ---- void tcGameObject::SelfDestruct() { ! float priorDamage = mfDamageLevel; ! mfDamageLevel = 1.0f; ! ! UpdateScoreForDamage(0, priorDamage); } *************** *** 490,495 **** ! void tcGameObject::ApplyDamage(float damage) { } --- 493,502 ---- ! void tcGameObject::ApplyDamage(float damage, tcGameObject* damager) { + float priorDamage = mfDamageLevel; + mfDamageLevel += damage; + + UpdateScoreForDamage(damager, priorDamage); } *************** *** 575,578 **** --- 582,634 ---- /** + * Score is units of $. Partial damage gets up to 50% of the value of the object. Full + * damage gets the remaining 50% + * Call after damage has been applied to damagee + */ + void tcGameObject::UpdateScoreForDamage(tcGameObject* damager, float priorDamage) + { + if (priorDamage >= 1.0f) return; // already destroyed + + float& damageLevel = mfDamageLevel; + if (damageLevel <= priorDamage) return; // no damage + if (damageLevel > 1.0f) damageLevel = 1.0f; + + float cost = mpDBObject->GetCost(); + float newDamage = damageLevel - priorDamage; + float damageCredit = 0.5f * newDamage * cost; + + if (damageLevel >= 1.0f) + { + damageCredit += 0.5f * cost; + } + + if (damager != 0) + { + tcGoalTracker::Get()->AdjustAllianceScore(damager->GetAlliance(), damageCredit); + } + tcGoalTracker::Get()->AdjustAllianceScore(GetAlliance(), -damageCredit); + + #ifdef _DEBUG + wxString s; + if (damager != 0) + { + s.Printf("%s damaged by %s, %s adjustment for alliance %d\n", mzUnit.mz, damager->mzUnit.mz, + tcDatabaseObject::CostToString(damageCredit), damager->GetAlliance()); + fprintf(stdout, s.c_str()); + } + s.Printf("%s damaged, %s adjustment for alliance %d\n\n", mzUnit.mz, + tcDatabaseObject::CostToString(-damageCredit), GetAlliance()); + fprintf(stdout, s.c_str()); + + #endif + } + + float tcGameObject::GetDamageLevel() const + { + return mfDamageLevel; + } + + + /** * Loads state from command stream */ Index: tcAirObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcAirObject.cpp,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** tcAirObject.cpp 23 Mar 2006 01:11:02 -0000 1.30 --- tcAirObject.cpp 26 Mar 2006 00:32:15 -0000 1.31 *************** *** 190,196 **** if ((mcKin.mfAlt_m <= 0) || (mcTerrain.mfHeight_m >= mcKin.mfAlt_m)) { ! float priorDamage = mfDamageLevel; ! mfDamageLevel = 1.0f; ! simState->UpdateScoreForDamage(0, this, priorDamage); } } --- 190,194 ---- if ((mcKin.mfAlt_m <= 0) || (mcTerrain.mfHeight_m >= mcKin.mfAlt_m)) { ! ApplyDamage(1.0f, 0); } } Index: tcSubObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcSubObject.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** tcSubObject.cpp 23 Mar 2006 01:11:02 -0000 1.16 --- tcSubObject.cpp 26 Mar 2006 00:32:15 -0000 1.17 *************** *** 343,347 **** if (mcTerrain.mfHeight_m >= mcKin.mfAlt_m) { ! mfDamageLevel = 1.0f; } --- 343,347 ---- if (mcTerrain.mfHeight_m >= mcKin.mfAlt_m) { ! ApplyDamage(1.0f, 0); } Index: tcOpticalSensor.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcOpticalSensor.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** tcOpticalSensor.cpp 23 Mar 2006 01:11:02 -0000 1.10 --- tcOpticalSensor.cpp 26 Mar 2006 00:32:15 -0000 1.11 *************** *** 241,245 **** (t - mcTrack.mfTimestamp) > 7.0) { ! parent->mfDamageLevel = 1.0f; mcTrack.mnID = NULL_INDEX; if(simState->mpUserInfo->IsOwnAlliance(parent->GetAlliance())) --- 241,245 ---- (t - mcTrack.mfTimestamp) > 7.0) { ! parent->SelfDestruct(); mcTrack.mnID = NULL_INDEX; if(simState->mpUserInfo->IsOwnAlliance(parent->GetAlliance())) Index: tcFlightOpsObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcFlightOpsObject.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** tcFlightOpsObject.cpp 10 Dec 2005 16:52:03 -0000 1.13 --- tcFlightOpsObject.cpp 26 Mar 2006 00:32:15 -0000 1.14 *************** *** 388,391 **** --- 388,412 ---- /** + * Call before ::Clear() to update damage level of all children and + * adjust game score for destroying all child objects + */ + void tcFlightOpsObject::DestroyAllChildrenAndUpdateScore(tcGameObject* damager) + { + unsigned nChildren = flight_deck.GetCount(); + + for (unsigned short k=0; k < nChildren; k++) + { + tcAirState* airState = flight_deck.GetAirState(k); + tcGameObject* obj = airState->obj; + wxASSERT(obj); + + obj->ApplyDamage(1.0, damager); + } + + } + + + + /** * Set up default spots and capacities for carrier flightport. */ Index: tcGoalTracker.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcGoalTracker.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** tcGoalTracker.cpp 23 Mar 2006 01:11:02 -0000 1.10 --- tcGoalTracker.cpp 26 Mar 2006 00:32:15 -0000 1.11 *************** *** 332,336 **** if (tcGoal* allianceGoal = allianceGoals[alliance]) { ! const char* offsetString = tcDatabaseObject::CostToString(1000.0f*GetAllianceOffset(alliance)); float score = GetAllianceScore(alliance) * (100.0 / perfectScore); --- 332,336 ---- if (tcGoal* allianceGoal = allianceGoals[alliance]) { ! const char* offsetString = tcDatabaseObject::CostToString(GetAllianceOffset(alliance)); float score = GetAllianceScore(alliance) * (100.0 / perfectScore); Index: tcAirfieldObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcAirfieldObject.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** tcAirfieldObject.cpp 18 Dec 2005 04:10:33 -0000 1.8 --- tcAirfieldObject.cpp 26 Mar 2006 00:32:15 -0000 1.9 *************** *** 114,125 **** ! void tcAirfieldObject::ApplyDamage(float damage) { if (mfDamageLevel >= 1.0f) { tcFlightOpsObject::Clear(); // destroy all captive entities } - - tcPlatformObject::ApplyDamage(damage); } --- 114,126 ---- ! void tcAirfieldObject::ApplyDamage(float damage, tcGameObject* damager) { + tcPlatformObject::ApplyDamage(damage, damager); + if (mfDamageLevel >= 1.0f) { + tcFlightOpsObject::DestroyAllChildrenAndUpdateScore(damager); tcFlightOpsObject::Clear(); // destroy all captive entities } } Index: tcSonobuoy.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcSonobuoy.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** tcSonobuoy.cpp 23 Mar 2006 01:11:02 -0000 1.4 --- tcSonobuoy.cpp 26 Mar 2006 00:32:15 -0000 1.5 *************** *** 157,163 **** if (batteryTimeRemaining_s <= 0) { ! float priorDamage = tcGameObject::mfDamageLevel; ! tcGameObject::mfDamageLevel += 1.0; // destroy buoy ! simState->UpdateScoreForDamage(0, this, priorDamage); } --- 157,161 ---- if (batteryTimeRemaining_s <= 0) { ! ApplyDamage(1.0f, 0); } Index: tcCarrierObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcCarrierObject.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** tcCarrierObject.cpp 11 Dec 2005 00:34:28 -0000 1.13 --- tcCarrierObject.cpp 26 Mar 2006 00:32:15 -0000 1.14 *************** *** 116,127 **** ! void tcCarrierObject::ApplyDamage(float damage) { if (mfDamageLevel >= 1.0f) { tcFlightOpsObject::Clear(); // destroy all captive entities } - - tcPlatformObject::ApplyDamage(damage); } --- 116,128 ---- ! void tcCarrierObject::ApplyDamage(float damage, tcGameObject* damager) { + tcPlatformObject::ApplyDamage(damage, damager); + if (mfDamageLevel >= 1.0f) { + tcFlightOpsObject::DestroyAllChildrenAndUpdateScore(damager); tcFlightOpsObject::Clear(); // destroy all captive entities } } Index: tcRadar.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcRadar.cpp,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** tcRadar.cpp 23 Mar 2006 01:11:02 -0000 1.36 --- tcRadar.cpp 26 Mar 2006 00:32:15 -0000 1.37 *************** *** 539,543 **** // shut down missile if target doesn't exist or can't detect { ! parent->mfDamageLevel = 1.0f; mcTrack.mnID = -1; if(simState->mpUserInfo->IsOwnAlliance(parent->GetAlliance())) --- 539,543 ---- // shut down missile if target doesn't exist or can't detect { ! parent->SelfDestruct(); mcTrack.mnID = -1; if(simState->mpUserInfo->IsOwnAlliance(parent->GetAlliance())) |
|
From: Dewitt C. <ddc...@us...> - 2006-03-26 00:32:36
|
Update of /cvsroot/gcblue/gcb_wx/src/graphics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3422/src/graphics Modified Files: tc3DViewer.cpp tc3DWindow.cpp tcDatabaseInfoWindow.cpp tcHookInfo.cpp tcOOBView.cpp Log Message: Index: tcHookInfo.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcHookInfo.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** tcHookInfo.cpp 23 Mar 2006 01:11:02 -0000 1.18 --- tcHookInfo.cpp 26 Mar 2006 00:32:14 -0000 1.19 *************** *** 390,394 **** /*** damage ***/ ! float damageLevelPercent = 100.0f * pHookedObj->mfDamageLevel; if (damageLevelPercent > 100.0f) damageLevelPercent = 100.0f; --- 390,394 ---- /*** damage ***/ ! float damageLevelPercent = 100.0f * pHookedObj->GetDamageLevel(); if (damageLevelPercent > 100.0f) damageLevelPercent = 100.0f; Index: tc3DViewer.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tc3DViewer.cpp,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** tc3DViewer.cpp 23 Mar 2006 01:11:02 -0000 1.30 --- tc3DViewer.cpp 26 Mar 2006 00:32:14 -0000 1.31 *************** *** 2,6 **** ** @file tc3DViewer.cpp */ ! /* Copyright (C) 2003-2004 Dewitt Colclough (de...@gc...) ** All rights reserved. --- 2,6 ---- ** @file tc3DViewer.cpp */ ! /* Copyright (C) 2003-2006 Dewitt Colclough (de...@gc...) ** All rights reserved. Index: tc3DWindow.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tc3DWindow.cpp,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** tc3DWindow.cpp 23 Mar 2006 01:11:02 -0000 1.33 --- tc3DWindow.cpp 26 Mar 2006 00:32:14 -0000 1.34 *************** *** 352,356 **** osg::Vec4Array* colors = new osg::Vec4Array; ! colors->push_back(osg::Vec4(1.0f, 1.0f, 1.0f, 1.0f)); backgroundQuad->setColorArray(colors); backgroundQuad->setColorBinding(osg::Geometry::BIND_OVERALL); --- 352,356 ---- osg::Vec4Array* colors = new osg::Vec4Array; ! colors->push_back(backgroundColor); backgroundQuad->setColorArray(colors); backgroundQuad->setColorBinding(osg::Geometry::BIND_OVERALL); *************** *** 717,720 **** --- 717,728 ---- /** + * Sets color of background quad + */ + void tc3DWindow::SetBackgroundColor(const osg::Vec4& color) + { + backgroundColor = color; + } + + /** * @param state true to enable background drawing, false to disable */ *************** *** 737,740 **** --- 745,749 ---- //root->removeDrawable(backgroundQuad.get()); } + UpdateBackgroundQuad(); } *************** *** 1531,1539 **** osg::Image* image = LoadImage(fileName); ! osg::Texture2D* tex = new osg::Texture2D; ! tex->setDataVariance(osg::Object::STATIC); ! tex->setImage(image); ! return tex; } --- 1540,1556 ---- osg::Image* image = LoadImage(fileName); ! if (image != 0) ! { ! osg::Texture2D* tex = new osg::Texture2D; ! tex->setDataVariance(osg::Object::STATIC); ! tex->setImage(image); ! return tex; ! } ! else ! { ! wxASSERT(false); ! return 0; ! } } *************** *** 2213,2216 **** --- 2230,2234 ---- fontSizeLarge(18.0), fontSizeSmall(9.0), + backgroundColor(1.0f, 1.0f, 1.0f, 1.0f), hostParent(graphicsHost), blendingOn(true), Index: tcOOBView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcOOBView.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** tcOOBView.cpp 23 Mar 2006 01:11:02 -0000 1.12 --- tcOOBView.cpp 26 Mar 2006 00:32:14 -0000 1.13 *************** *** 113,117 **** info.maFollowers.clear(); info.mbRadiating = platformObj->IsRadiating(); ! info.mfDamage_fract = platformObj->mfDamageLevel; if (platformObj->msFormationParameters.mbFormation) { --- 113,117 ---- info.maFollowers.clear(); info.mbRadiating = platformObj->IsRadiating(); ! info.mfDamage_fract = platformObj->GetDamageLevel(); if (platformObj->msFormationParameters.mbFormation) { Index: tcDatabaseInfoWindow.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcDatabaseInfoWindow.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** tcDatabaseInfoWindow.cpp 23 Mar 2006 01:11:02 -0000 1.1 --- tcDatabaseInfoWindow.cpp 26 Mar 2006 00:32:14 -0000 1.2 *************** *** 31,34 **** --- 31,35 ---- #include "tcSimState.h" #include "common/tinyxml.h" + #include "tcTime.h" #include <osg/Geometry> *************** *** 69,77 **** DrawChildren(); ! if (!IsBackgroundEnabled()) ! { ! DrawRectangleR(0, 0, mnWidth, mnHeight, osg::Vec4(0.2, 0.2, 0.2, 0.7f), ! FILL_ON); ! } DrawDatabaseInfo(); --- 70,78 ---- DrawChildren(); ! //if (!IsBackgroundEnabled()) ! //{ ! // DrawRectangleR(0, 0, mnWidth, mnHeight, osg::Vec4(0.15, 0.15, 0.15, 1.0f), ! // FILL_ON); ! //} DrawDatabaseInfo(); *************** *** 122,125 **** --- 123,141 ---- defaultFont.get(), color, fontSize, LEFT_BASE_LINE, maxWidth, textBox); + float imagex = 265.0; + float imagey = 10.0; + size_t nImages = imageList.size(); + if (nImages > 0) + { + DrawImageR(imageList[currentImageIdx].get(), imagex, imagey, 128.0f, 128.0f, ALIGN_BOTTOM_LEFT); + + // cycle through images + unsigned int t = tcTime::Get()->Get30HzCount(); + if (t - imageTime > 90) + { + currentImageIdx = (currentImageIdx + 1) % nImages; + imageTime = t; + } + } *************** *** 175,178 **** --- 191,210 ---- } + void tcDatabaseInfoWindow::LoadImageList() + { + imageList.clear(); + + database::tcDatabaseObject* databaseObject = GetDatabaseObject(); + if (databaseObject == 0) return; + + wxArrayString parsedImageList = databaseObject->GetParsedImageList(); + for (size_t n=0; n<parsedImageList.size(); n++) + { + wxString& fileName = parsedImageList[n]; + osg::ref_ptr<osg::Texture2D> tex = tc3DWindow::LoadTexture(fileName.c_str()); + if (tex.valid()) imageList.push_back(tex); + } + } + /** * Close and destroy window at next safe opportunity *************** *** 243,246 **** --- 275,283 ---- objId = id; databaseClassName = ""; + + currentImageIdx = 0; + imageTime = tcTime::Get()->Get30HzCount(); + + LoadImageList(); } *************** *** 274,278 **** windowDragOn(false), objId(-1), ! databaseClassName("") { --- 311,318 ---- windowDragOn(false), objId(-1), ! databaseClassName(""), ! currentImageIdx(0), ! imageTime(0) ! { *************** *** 313,317 **** */ ! SetActive(true); --- 353,358 ---- */ ! SetBackgroundColor(osg::Vec4(0.2f, 0.2f, 0.2f, 0.5f)); ! SetBackgroundDraw(true); SetActive(true); |
|
From: Dewitt C. <ddc...@us...> - 2006-03-26 00:32:30
|
Update of /cvsroot/gcblue/gcb_wx/src/network In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3422/src/network Modified Files: tcMultiplayerInterface.cpp Log Message: Index: tcMultiplayerInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/network/tcMultiplayerInterface.cpp,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** tcMultiplayerInterface.cpp 23 Mar 2006 01:11:02 -0000 1.33 --- tcMultiplayerInterface.cpp 26 Mar 2006 00:32:14 -0000 1.34 *************** *** 873,877 **** { obj->ApplyRepairs(2.0f); - obj->mfDamageLevel = 0; msg = wxString::Format("*** Entity %d repaired", id); } --- 873,876 ---- |
|
From: Dewitt C. <ddc...@us...> - 2006-03-26 00:32:30
|
Update of /cvsroot/gcblue/gcb_wx/src/database In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3422/src/database Modified Files: tcDatabaseObject.cpp Log Message: Index: tcDatabaseObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/database/tcDatabaseObject.cpp,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** tcDatabaseObject.cpp 23 Mar 2006 01:11:02 -0000 1.20 --- tcDatabaseObject.cpp 26 Mar 2006 00:32:14 -0000 1.21 *************** *** 220,223 **** --- 220,246 ---- /** + * @return string array with parsed filenames of images for this db object + * Database image files are stored in the images\db folder + */ + const wxArrayString& tcDatabaseObject::GetParsedImageList() + { + if ((parsedImageList.size() > 0) || (imageList.size() < 3)) + { + return parsedImageList; + } + + wxString s(imageList.c_str()); + while (!s.IsEmpty()) + { + wxString fileName = s.BeforeFirst(';'); + fileName.Prepend("db\\"); + parsedImageList.Add(fileName); + s = s.AfterFirst(';'); + } + return parsedImageList; + + } + + /** * workaround for write serialization issue * @return true if db obj is a leaf obj *************** *** 247,253 **** wxString fileWithPath; ! if (strlen(mzImageFileName.mz) > 4) { ! fileWithPath.Printf("icons\\%s", mzImageFileName.mz); } else --- 270,276 ---- wxString fileWithPath; ! if (strlen(iconFileName.mz) > 4) { ! fileWithPath.Printf("icons\\%s", iconFileName.mz); } else *************** *** 269,273 **** mnKey,mnModelType,mnType,mnClassID); file.WriteString(s.GetBuffer()); ! s.Format(" imagefile:%s \n",mzImageFileName.mz); file.WriteString(s.GetBuffer()); } --- 292,296 ---- mnKey,mnModelType,mnType,mnClassID); file.WriteString(s.GetBuffer()); ! s.Format(" imagefile:%s \n",iconFileName.mz); file.WriteString(s.GetBuffer()); } *************** *** 278,282 **** file.Read(&mnType,sizeof(mnType)); mzClass.Serialize(file,mbLoad); ! mzImageFileName.Serialize(file,mbLoad); if (anVersion >= VERSION_1_0_2) { mz3DModelFileName.Serialize(file,mbLoad); --- 301,305 ---- file.Read(&mnType,sizeof(mnType)); mzClass.Serialize(file,mbLoad); ! iconFileName.Serialize(file,mbLoad); if (anVersion >= VERSION_1_0_2) { mz3DModelFileName.Serialize(file,mbLoad); *************** *** 289,293 **** file.Write(&mnType,sizeof(mnType)); mzClass.Serialize(file,mbLoad); ! mzImageFileName.Serialize(file,mbLoad); if (anVersion >= VERSION_1_0_2) { mz3DModelFileName.Serialize(file,mbLoad); --- 312,316 ---- file.Write(&mnType,sizeof(mnType)); mzClass.Serialize(file,mbLoad); ! iconFileName.Serialize(file,mbLoad); if (anVersion >= VERSION_1_0_2) { mz3DModelFileName.Serialize(file,mbLoad); *************** *** 306,310 **** *csv >> mnModelType; *csv >> mnType; ! *csv >> s; mzImageFileName = s.c_str(); *csv >> s; mz3DModelFileName = s.c_str(); --- 329,333 ---- *csv >> mnModelType; *csv >> mnType; ! *csv >> s; iconFileName = s.c_str(); *csv >> s; mz3DModelFileName = s.c_str(); *************** *** 326,330 **** *csv << long(mnModelType); *csv << long(mnType); ! *csv << std::string(mzImageFileName.mz); *csv << std::string(mz3DModelFileName.mz); size_t len = strlen(mzDescription); --- 349,353 ---- *csv << long(mnModelType); *csv << long(mnType); ! *csv << std::string(iconFileName.mz); *csv << std::string(mz3DModelFileName.mz); size_t len = strlen(mzDescription); *************** *** 351,355 **** node->SetAttribute("modelType", int(mnModelType)); node->SetAttribute("funcType", int(mnType)); ! node->SetAttribute("image", mzImageFileName.mz); node->SetAttribute("model3D", mz3DModelFileName.mz); TiXmlNode* descriptionNode = node->InsertEndChild(TiXmlElement("notes")); --- 374,378 ---- node->SetAttribute("modelType", int(mnModelType)); node->SetAttribute("funcType", int(mnType)); ! node->SetAttribute("image", iconFileName.mz); node->SetAttribute("model3D", mz3DModelFileName.mz); TiXmlNode* descriptionNode = node->InsertEndChild(TiXmlElement("notes")); *************** *** 363,367 **** *csv << "Model class id"; // model type *csv << "Functional class id"; // functional classification ! *csv << "ImageFileName"; *csv << "3DModelFileName"; *csv << "Description"; --- 386,390 ---- *csv << "Model class id"; // model type *csv << "Functional class id"; // functional classification ! *csv << "IconFileName"; *csv << "3DModelFileName"; *csv << "Description"; *************** *** 381,385 **** columnString += "ClassificationId number(3),"; columnString += "Cost number(7),"; ! columnString += "ImageFileName varchar(30)," ; columnString += "ModelFileName varchar(30),"; columnString += "Description varchar(255)"; --- 404,409 ---- columnString += "ClassificationId number(3),"; columnString += "Cost number(7),"; ! columnString += "ImageList varchar(30)," ; ! columnString += "IconFileName varchar(30)," ; columnString += "ModelFileName varchar(30),"; columnString += "Description varchar(255)"; *************** *** 393,397 **** mnType = entry.GetInt("ClassificationId"); cost = entry.GetDouble("Cost"); ! mzImageFileName = entry.GetString("ImageFileName").c_str(); mz3DModelFileName = entry.GetString("ModelFileName").c_str(); --- 417,422 ---- mnType = entry.GetInt("ClassificationId"); cost = entry.GetDouble("Cost"); ! imageList = entry.GetString("ImageList").c_str(); ! iconFileName = entry.GetString("IconFileName").c_str(); mz3DModelFileName = entry.GetString("ModelFileName").c_str(); *************** *** 404,413 **** void tcDatabaseObject::WriteSql(std::string& valueString) { ! wxString str = wxString::Format("'%s',%d,%d,%f,'%s','%s','%s'", mzClass.mz, mnModelType, mnType, cost, ! mzImageFileName.mz, mz3DModelFileName.mz, mzDescription); --- 429,439 ---- void tcDatabaseObject::WriteSql(std::string& valueString) { ! wxString str = wxString::Format("'%s',%d,%d,%f,'%s','%s','%s','%s'", mzClass.mz, mnModelType, mnType, cost, ! imageList.c_str(), ! iconFileName.mz, mz3DModelFileName.mz, mzDescription); *************** *** 418,433 **** ! tcDatabaseObject::tcDatabaseObject() { - mzClass = "UNDEFINED"; - cost = 0; - mzImageFileName = "NONE"; - mz3DModelFileName = ""; strcpy(mzDescription,"No description is available."); - mnKey = 0; - mnModelType = MTYPE_OBJECT; - mnClassID = DTYPE_OBJECT; - mnType = PTYPE_UNKNOWN; - model = 0; } --- 444,459 ---- ! tcDatabaseObject::tcDatabaseObject() : ! mzClass("UNDEFINED"), ! cost(0), ! iconFileName(""), ! mz3DModelFileName(""), ! mnKey(0), ! mnModelType(MTYPE_OBJECT), ! mnClassID(DTYPE_OBJECT), ! mnType(PTYPE_UNKNOWN), ! model(0) { strcpy(mzDescription,"No description is available."); } *************** *** 435,440 **** mzClass(obj.mzClass), cost(obj.cost), ! mzImageFileName(obj.mzImageFileName), ! mz3DModelFileName(obj.mz3DModelFileName) { mnKey = obj.mnKey; --- 461,468 ---- mzClass(obj.mzClass), cost(obj.cost), ! imageList(obj.imageList), ! iconFileName(obj.iconFileName), ! mz3DModelFileName(obj.mz3DModelFileName), ! parsedImageList(obj.parsedImageList) { mnKey = obj.mnKey; *************** *** 443,447 **** mnModelType = obj.mnModelType; ! strcpy(mzDescription, obj.mzDescription); // BAD, assumes obj has legal string model = 0; // model not copied } --- 471,475 ---- mnModelType = obj.mnModelType; ! strncpy(mzDescription, obj.mzDescription, DESCRIPTION_STRING_LENGTH-1); model = 0; // model not copied } |
|
From: Dewitt C. <ddc...@us...> - 2006-03-26 00:32:29
|
Update of /cvsroot/gcblue/gcb_wx/src/scriptinterface In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3422/src/scriptinterface Modified Files: tcPlatformInterface.cpp tcScenarioInterface.cpp Log Message: Index: tcPlatformInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcPlatformInterface.cpp,v retrieving revision 1.59 retrieving revision 1.60 diff -C2 -d -r1.59 -r1.60 *** tcPlatformInterface.cpp 23 Mar 2006 01:11:02 -0000 1.59 --- tcPlatformInterface.cpp 26 Mar 2006 00:32:15 -0000 1.60 *************** *** 297,301 **** track.engaged.clear(); track.intercepts.clear(); ! track.assessedDamage = pGameObj->mfDamageLevel; --- 297,301 ---- track.engaged.clear(); track.intercepts.clear(); ! track.assessedDamage = pGameObj->GetDamageLevel(); Index: tcScenarioInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcScenarioInterface.cpp,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** tcScenarioInterface.cpp 23 Mar 2006 01:11:02 -0000 1.38 --- tcScenarioInterface.cpp 26 Mar 2006 00:32:15 -0000 1.39 *************** *** 300,304 **** if (unit.speed < 0) {unit.speed = 0;} kin.mfSpeed_kts = unit.speed; ! gameObj->mfDamageLevel = 0; gameObj->SetAlliance(alliance); gameObj->mfStatusTime = 0; // for lack of a better time --- 300,304 ---- if (unit.speed < 0) {unit.speed = 0;} kin.mfSpeed_kts = unit.speed; ! gameObj->SetAlliance(alliance); gameObj->mfStatusTime = 0; // for lack of a better time |
|
From: Dewitt C. <ddc...@us...> - 2006-03-26 00:31:29
|
Update of /cvsroot/gcblue/gcb_wx/xml In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2777/xml Added Files: database_info.xml Log Message: --- NEW FILE: database_info.xml --- <Window Width="420" Height="260"> <Button X="402" Y="2" Width="16" Height="16" Command="86" Caption=""> <Image Off="close.png" On="close.png" /> </Button> </Window> |
|
From: Dewitt C. <ddc...@us...> - 2006-03-23 01:12:19
|
Update of /cvsroot/gcblue/gcb_wx/include/scriptinterface In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11430/include/scriptinterface Modified Files: tcScenarioInterface.h Log Message: Index: tcScenarioInterface.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/scriptinterface/tcScenarioInterface.h,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** tcScenarioInterface.h 22 Mar 2006 01:23:29 -0000 1.26 --- tcScenarioInterface.h 23 Mar 2006 01:12:11 -0000 1.27 *************** *** 129,132 **** --- 129,133 ---- void SetAllianceGoal(int alliance, tcGoal& goal); void SetDateTime(int year, int month, int day, int hour, int min, int sec); + void SetPerfectScore(float score); void SetScenarioDescription(std::string s); void SetScenarioLoaded(bool state); |
|
From: Dewitt C. <ddc...@us...> - 2006-03-23 01:12:19
|
Update of /cvsroot/gcblue/gcb_wx/include/database In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11430/include/database Modified Files: tcDatabaseObject.h Added Files: tcECMDBObject.h Log Message: Index: tcDatabaseObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/database/tcDatabaseObject.h,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** tcDatabaseObject.h 22 Mar 2006 01:23:28 -0000 1.27 --- tcDatabaseObject.h 23 Mar 2006 01:12:11 -0000 1.28 *************** *** 142,145 **** --- 142,146 ---- static void AttachDatabase(tcDatabase *db) {database = db;} virtual const char* GetClassName() {return "Object";} ///< returns class name of database object + float GetCost() const {return cost;} const char* GetCostString() const; ///< return cost as string virtual tc3DModel* Copy3DModel(); ///< creates copy of model (must be deleted) *************** *** 160,164 **** void WriteSql(std::string& valueString); ! static int WriteCSVHeader(CsvTranslator* csv); ///< writes column headings --- 161,165 ---- void WriteSql(std::string& valueString); ! static const char* CostToString(float cost_); static int WriteCSVHeader(CsvTranslator* csv); ///< writes column headings --- NEW FILE: tcECMDBObject.h --- /** ** @file tcECMDBObject.h */ /* Copyright (C)2006 Dewitt Colclough (de...@gc...) ** All rights reserved. ** This file is part of the Global Conflict Blue (GCB) program. ** GCB is free software; you can redistribute it and/or modify ** it under the terms of version 2 of the GNU General Public License as ** published by the Free Software Foundation. ** GCB is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** You should have received a copy of the GNU General Public License ** along with GCB; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _ECMDBOBJECT_H_ #define _ECMDBOBJECT_H_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 #include "tcSensorDBObject.h" #include "database/tcSqlReader.h" namespace database { class tcSqlReader; /** * Electronic Counter Measures (ECM) modeled as type of "sensor" object */ class tcECMDBObject : public tcSensorDBObject { public: std::string ecmType; ///< "Jammer" "Deception" float ERP_dBW; ///< [dBW] effective radiated power (assume bandwidth matched to target radars) float effectivenessRating; ///< 0 - 1.0 bool isEffectiveVsSurveillance; bool isEffectiveVsSeeker; virtual tcSensorState* CreateSensor(tcGameObject* parent); ///< factory method virtual const char* GetClassName() {return "ECM";} ///< returns class name of database object bool IsLeaf() const; ///< returns true if db obj is a leaf obj virtual void PrintToFile(tcFile& file); int Serialize(tcFile& file, bool mbLoad, UINT32 anVersion); int SerializeCSV(CsvTranslator* csv, bool mbLoad); ///< CSV serialization virtual void SerializeXml(TiXmlElement* node, bool load); ///< XML serialization static int WriteCSVHeader(CsvTranslator* csv); ///< writes column headings tcECMDBObject(); tcECMDBObject(tcECMDBObject& obj); ///< copy constructor virtual ~tcECMDBObject(); static void AddSqlColumns(std::string& columnString); void ReadSql(tcSqlReader& entry); void WriteSql(std::string& valueString); }; } // namespace database #endif |
|
From: Dewitt C. <ddc...@us...> - 2006-03-23 01:12:17
|
Update of /cvsroot/gcblue/gcb_wx/include/graphics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11430/include/graphics Added Files: tcDatabaseInfoWindow.h tcShaderControl.h Log Message: --- NEW FILE: tcShaderControl.h --- /* ** @file tcShaderControl.h */ /* Copyright (C) 2006 Dewitt Colclough (de...@gc...) ** All rights reserved. ** This file is part of the Global Conflict Blue (GCB) program. ** GCB is free software; you can redistribute it and/or modify ** it under the terms of version 2 of the GNU General Public License as ** published by the Free Software Foundation. ** GCB is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** You should have received a copy of the GNU General Public License ** along with GCB; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _SHADERCONTROL_H_ #define _SHADERCONTROL_H_ #ifdef WIN32 #pragma once #endif #include <osg/ref_ptr> #include <osg/Program> #include <osg/Shader> #include <osg/Uniform> #include <osg/Texture2D> /** * Singleton class to add and manage shaders * May want to distribute shader control, using this class for static helper methods only? * * Started with OSG shader example by Mike Weiblen */ class tcShaderControl { public: void AddTerrainElevationShader(osg::StateSet* ss); void AddTestShader(osg::StateSet* ss); void AddWaterShader(osg::StateSet* ss); static tcShaderControl* Get(); ///< singleton accessor static void LoadShaderSource(osg::Shader* shader, const std::string& fileName); private: std::vector< osg::ref_ptr<osg::Program> > programList; osg::ref_ptr<osg::Texture2D> water1; osg::ref_ptr<osg::Texture2D> water2; osg::ref_ptr<osg::Texture2D> seaTexture; osg::ref_ptr<osg::Texture2D> coastTexture; osg::ref_ptr<osg::Texture2D> sandTexture; osg::ref_ptr<osg::Texture2D> grassTexture; osg::ref_ptr<osg::Texture2D> mountainTexture; void LoadTextures(); tcShaderControl(); ~tcShaderControl(); }; #endif --- NEW FILE: tcDatabaseInfoWindow.h --- /** ** @file tcDatabaseInfoWindow.h */ /* Copyright (C) 2006 Dewitt Colclough (de...@gc...) ** All rights reserved. ** This file is part of the Global Conflict Blue (GCB) program. ** GCB is free software; you can redistribute it and/or modify ** it under the terms of version 2 of the GNU General Public License as ** published by the Free Software Foundation. ** GCB is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** You should have received a copy of the GNU General Public License ** along with GCB; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _TCDATABASEINFOWINDOW_H_ #define _TCDATABASEINFOWINDOW_H_ #if _MSC_VER > 1000 #pragma once #endif #include "tcXmlWindow.h" namespace database { class tcDatabaseObject; } /** * Window class to display info for database object */ class tcDatabaseInfoWindow : public tcXmlWindow { public: virtual void DestroyWindow(); virtual void Draw(); //virtual void OnChar(wxKeyEvent& event); virtual void OnCloseCommand(wxCommandEvent& event); //virtual void OnEnterWindow(wxMouseEvent& event); virtual void OnLButtonDown(wxMouseEvent& event); virtual void OnLButtonUp(wxMouseEvent& event); virtual void OnLeaveWindow(wxMouseEvent& event); virtual void OnMouseMove(wxMouseEvent& event); //virtual void OnRButtonDown(wxMouseEvent& event); void SetDatabaseObject(long id); static void SetParent(tc3DWindow* win); tcDatabaseInfoWindow(const wxPoint& pos, const wxString& configFile = "xml/database_info.xml", const wxString& name = "DatabaseInfo"); virtual ~tcDatabaseInfoWindow(); protected: unsigned int drawCount; // params for window drag (move this function to base class?) bool isLButtonDown; bool windowDragOn; wxPoint windowDragPoint; void DrawDatabaseInfo(); bool FinishDestroy(); void UpdateWindowDrag(const wxPoint& pos); private: bool destroy; ///< workaround to delay destruction of window to safe time long objId; ///< id of obj or track to display info for std::string databaseClassName; ///< class name of database object, empty if not looked up yet static tc3DWindow* parent; database::tcDatabaseObject* GetDatabaseObject(); DECLARE_EVENT_TABLE() }; #endif |
|
From: Dewitt C. <ddc...@us...> - 2006-03-23 01:12:16
|
Update of /cvsroot/gcblue/gcb_wx/include/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11430/include/sim Modified Files: tcGoal.h tcGoalTracker.h tcSimState.h Added Files: tcECM.h Log Message: Index: tcGoal.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcGoal.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** tcGoal.h 22 Mar 2006 01:23:29 -0000 1.8 --- tcGoal.h 23 Mar 2006 01:12:11 -0000 1.9 *************** *** 67,73 **** virtual void Update(); ///< updates goal state using on simState virtual void WriteStatus(std::stringstream& stream, unsigned int level = 0); virtual void SaveToPython(scriptinterface::tcScenarioLogger& logger); ! virtual tcGoal* Clone(); tcGoal(); tcGoal(const tcGoal& goal); --- 67,76 ---- virtual void Update(); ///< updates goal state using on simState virtual void WriteStatus(std::stringstream& stream, unsigned int level = 0); + virtual void WriteStatusB(std::stringstream& stream); virtual void SaveToPython(scriptinterface::tcScenarioLogger& logger); ! virtual float GetNetScore() const; ! void SetScores(float fail, float pass); virtual tcGoal* Clone(); + tcGoal(); tcGoal(const tcGoal& goal); *************** *** 75,78 **** --- 78,83 ---- protected: const std::string indentString; + float failScore; + float passScore; }; *************** *** 94,99 **** --- 99,107 ---- void RemoveGoal(int idx) {children.erase(children.begin() + idx);} void SetLogic(int logic) {logicType = logic;} + virtual float GetNetScore() const; + virtual void Update(); ///< updates goal state using on simState virtual void WriteStatus(std::stringstream& stream, unsigned int level = 0); + virtual void WriteStatusB(std::stringstream& stream); virtual void SaveToPython(scriptinterface::tcScenarioLogger& logger); *************** *** 120,123 **** --- 128,132 ---- virtual void Update(); ///< updates goal state using on simState virtual void WriteStatus(std::stringstream& stream, unsigned int level = 0); + virtual void WriteStatusB(std::stringstream& stream); virtual void SaveToPython(scriptinterface::tcScenarioLogger& logger); *************** *** 138,141 **** --- 147,151 ---- virtual void Update(); virtual void WriteStatus(std::stringstream& stream, unsigned int level = 0); + virtual void WriteStatusB(std::stringstream& stream); virtual void SaveToPython(scriptinterface::tcScenarioLogger& logger); *************** *** 155,158 **** --- 165,169 ---- virtual void Update(); virtual void WriteStatus(std::stringstream& stream, unsigned int level = 0); + virtual void WriteStatusB(std::stringstream& stream); virtual void SaveToPython(scriptinterface::tcScenarioLogger& logger); --- NEW FILE: tcECM.h --- /** ** @file tcECM.h */ /* Copyright (C) 2006 Dewitt Colclough (de...@gc...) ** All rights reserved. ** This file is part of the Global Conflict Blue (GCB) program. ** GCB is free software; you can redistribute it and/or modify ** it under the terms of version 2 of the GNU General Public License as ** published by the Free Software Foundation. ** GCB is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** You should have received a copy of the GNU General Public License ** along with GCB; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA **/ #ifndef _tcECM_H_ #define _tcECM_H_ #if _MSC_VER > 1000 #pragma once #endif #include "tcSensorState.h" #include "tcDatabase.h" #include "tcECMDBObject.h" #include <vector> class tcGameObject; class tcRadar; class tcStream; using namespace database; /** * For safe access of tcRadar* pointer */ class RadarInterface { public: long id; ///< platform id unsigned idx; ///< sensor index tcRadar* GetRadar(); ///< returns 0 if platform or sensor doesn't exist anymore RadarInterface(long id_, unsigned idx_); RadarInterface(const RadarInterface& src); RadarInterface(); ~RadarInterface(); }; /** * */ class tcECM : public tcSensorState { public: tcECMDBObject* mpDBObj; virtual bool InitFromDatabase(long key); ///< initializes sensor using database data at key virtual bool IsECM() const; void Serialize(tcFile& file, bool mbLoad); virtual void SetActive(bool active); virtual void Update(double t); tcECM& operator=(tcECM& ss); //virtual tcStream& operator<<(tcStream& stream); //virtual tcStream& operator>>(tcStream& stream); tcECM* Clone(); tcECM(); tcECM(tcECMDBObject* dbObj); virtual ~tcECM(); private: std::vector<RadarInterface> jamList; ///< radars jammed on previous update void AddOrUpdateJammerToTarget(tcRadar* targetRadar, unsigned sensorIdx, float powerDensity_dB, float jammerBearing_rad); void ClearJamList(); void UpdateBarrage(); void UpdateBarrageTarget(tcGameObject* target); void UpdateBarrageTargetRadar(tcRadar* radar, unsigned sensorIdx); }; #endif Index: tcGoalTracker.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcGoalTracker.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** tcGoalTracker.h 11 Dec 2005 00:34:28 -0000 1.5 --- tcGoalTracker.h 23 Mar 2006 01:12:11 -0000 1.6 *************** *** 24,37 **** MAX_ALLIANCES = 32 ///< goaltracker supports alliances from 0 to MAX_ALLIANCES-1 }; ! std::map<int,tcGoal*> allianceGoals; ///< map of victory goal trees, indexed by alliance void Clear(); const std::string& GetAllianceGoalStatusDescription(int alliance); bool HasAllianceFailed(int alliance); bool HasAllianceSucceeded(int alliance); bool HasStatusChanged(int alliance); void LogAllianceGoalStatus(std::string fileName, int alliance); tcGoal* GetAllianceGoal(int alliance); void SetAllianceGoal(int alliance, tcGoal* goal); void Update(double currentTime); void WriteStatus(std::stringstream& stream, int alliance); --- 24,47 ---- MAX_ALLIANCES = 32 ///< goaltracker supports alliances from 0 to MAX_ALLIANCES-1 }; ! std::map<int, tcGoal*> allianceGoals; ///< map of victory goal trees, indexed by alliance ! std::map<int, float> allianceScoreOffset; ///< score offset for alliance not including goal net score void Clear(); const std::string& GetAllianceGoalStatusDescription(int alliance); + + bool HasAllianceFailed(int alliance); bool HasAllianceSucceeded(int alliance); bool HasStatusChanged(int alliance); void LogAllianceGoalStatus(std::string fileName, int alliance); + tcGoal* GetAllianceGoal(int alliance); void SetAllianceGoal(int alliance, tcGoal* goal); + + float GetAllianceOffset(int alliance); + float GetAllianceScore(int alliance); + void AdjustAllianceScore(int alliance, float offset); + void SetPerfectScore(float score); + void Update(double currentTime); void WriteStatus(std::stringstream& stream, int alliance); *************** *** 48,51 **** --- 58,62 ---- const double updateInterval; ///< game time between updates std::map<int, int> previousGoalStatus; ///< status at last update + float perfectScore; ///< score for 100 points // variables for multiplayer client Index: tcSimState.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcSimState.h,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** tcSimState.h 22 Mar 2006 01:23:29 -0000 1.46 --- tcSimState.h 23 Mar 2006 01:12:11 -0000 1.47 *************** *** 2,6 **** ** @file tcSimState.h */ ! /* Copyright (C) 2003-2005 Dewitt Colclough (de...@gc...) ** All rights reserved. --- 2,6 ---- ** @file tcSimState.h */ ! /* Copyright (C) 2003-2006 Dewitt Colclough (de...@gc...) ** All rights reserved. *************** *** 191,194 **** --- 191,195 ---- void Update(); void UpdateAI(double afSimTime); + void UpdateScoreForDamage(tcGameObject* damager, tcGameObject* damagee, float priorDamage); void UpdateLandings(double afSimTime); void UpdateLandingState(double afSimTime); *************** *** 216,219 **** --- 217,221 ---- void EvaluateTorpedoHit(tcTorpedoObject* torp, tcGameObject* target); float GetFractionalDamage(float afDamage, tcGameObject *apGameObj); + void PerformAutoEngage(tcGameObject* apGameObj, double afTime); void PlayEntitySoundEffect(tcGameObject* obj, const std::string& effect); |
|
From: Dewitt C. <ddc...@us...> - 2006-03-23 01:11:47
|
Update of /cvsroot/gcblue/gcb_wx/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11281/scripts Modified Files: AI.py HotKey.py Log Message: Index: AI.py =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/scripts/AI.py,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** AI.py 10 Sep 2005 21:48:58 -0000 1.24 --- AI.py 23 Mar 2006 01:11:43 -0000 1.25 *************** *** 283,287 **** TI.SetUpdateInterval(30) else: ! TI.SetUpdateInterval(5) if (engage_mode == 1): # turn to target --- 283,291 ---- TI.SetUpdateInterval(30) else: ! if (closest_range < 20): ! TI.SetUpdateInterval(1) ! else: ! TI.SetUpdateInterval(5) ! UI.SetAllSensorState(1) if (engage_mode == 1): # turn to target *************** *** 503,506 **** --- 507,511 ---- # overwhelmingly engaged, and not a stale track # returns -1 if none + # modified to avoid wasting all missiles on first target of stream raid def GetImmediateTarget(UI): *************** *** 521,524 **** --- 526,530 ---- best_target = -1 best_launcher = -1 + best_engaged_count = 99 for n in range(0, nTracks): *************** *** 526,532 **** track_id = track_info.ID staleness = current_time - track_info.Time bearing_only = track_info.IsBearingOnly() engaged_count = track_info.GetEngagedCount() ! if (track_info.IsAir() or track_info.IsMissile() or track_info.IsSub()): max_engaged_count = 2 else: --- 532,540 ---- track_id = track_info.ID staleness = current_time - track_info.Time + is_destroyed = track_info.IsDestroyed() bearing_only = track_info.IsBearingOnly() engaged_count = track_info.GetEngagedCount() ! is_air_target = track_info.IsAir() or track_info.IsMissile() ! if (is_air_target or track_info.IsSub()): max_engaged_count = 2 else: *************** *** 534,538 **** #UI.DisplayMessage('Track %d, %.0f/%d/%d' % (track_id, staleness, bearing_only, engaged_count)) ! if ((engaged_count < max_engaged_count) and (staleness < 15.0) and (not bearing_only)): UI.SetTarget(track_id) launcher_info = UI.GetBestLauncher() --- 542,546 ---- #UI.DisplayMessage('Track %d, %.0f/%d/%d' % (track_id, staleness, bearing_only, engaged_count)) ! if ((engaged_count < max_engaged_count) and (staleness < 15.0) and (not bearing_only) and (not is_destroyed)): UI.SetTarget(track_id) launcher_info = UI.GetBestLauncher() *************** *** 542,549 **** target_range = UI.GetRangeToTarget() launch_range = launcher_info.Range_km # reference max range, use for launch decision ! if ((target_range <= launch_range) and (target_range < best_range)): best_range = target_range best_target = track_id best_launcher = launcher_idx UI.SetTarget(best_target) --- 550,572 ---- target_range = UI.GetRangeToTarget() launch_range = launcher_info.Range_km # reference max range, use for launch decision ! ! is_better = (target_range <= launch_range) and (engaged_count < best_engaged_count) ! is_better = is_better or ((engaged_count == best_engaged_count) and (target_range < best_range)) ! ! if (is_better): best_range = target_range best_target = track_id best_launcher = launcher_idx + best_engaged_count = engaged_count + + # Clear best if there is another unengaged air target close to the launch zone + near_launch_range = (target_range > launch_range) and (target_range < 1.75*launch_range) + if (near_launch_range and is_air_target and (launcher_idx == best_launcher) and \ + (best_engaged_count > 0) and (engaged_count == 0)): + best_range = 1e6 + best_target = -1 + best_launcher = -1 + best_engaged_count = 99 + UI.SetTarget(best_target) Index: HotKey.py =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/scripts/HotKey.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** HotKey.py 10 Sep 2005 21:48:58 -0000 1.6 --- HotKey.py 23 Mar 2006 01:11:43 -0000 1.7 *************** *** 20,23 **** --- 20,25 ---- elif (key == 'h'): UnitInfo.GetUserInput('SetHeading','Heading') + elif (key == 'i'): + UnitInfo.SendCommand('ShowPlatformDatabaseInfo') elif (key == 'f'): UnitInfo.SendCommand('ShowFlightPanel') *************** *** 42,43 **** --- 44,49 ---- msg = 'unrecognized key: %s' % key UnitInfo.DisplayMessage(msg) + + # Keys for non-platform object hooked, or not own alliance + # This needs to be reworked + #def ProcessHotKeyOther(key): |
|
From: Dewitt C. <ddc...@us...> - 2006-03-23 01:11:28
|
Update of /cvsroot/gcblue/gcb_wx In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11234 Modified Files: GCblue.vcproj Log Message: vc8 updates Index: GCblue.vcproj =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/GCblue.vcproj,v retrieving revision 1.102 retrieving revision 1.103 diff -C2 -d -r1.102 -r1.103 *** GCblue.vcproj 8 Mar 2006 01:10:52 -0000 1.102 --- GCblue.vcproj 23 Mar 2006 01:11:25 -0000 1.103 *************** *** 2,13 **** <VisualStudioProject ProjectType="Visual C++" ! Version="7.10" Name="GCblue" ProjectGUID="{76C3883D-96DD-4A32-91C5-2ADA4CA505E7}" ! Keyword="Win32Proj"> <Platforms> <Platform ! Name="Win32"/> </Platforms> [...4103 lines suppressed...] ! RelativePath=".\include\ai\ScriptedTask.h" ! > </File> <File ! RelativePath=".\include\ai\ScriptedTaskInterface.h" ! > </File> <File ! RelativePath=".\include\ai\SelfPreservation.h" ! > </File> <File ! RelativePath=".\include\ai\Task.h" ! > </File> <File ! RelativePath=".\include\ai\tcAIData.h" ! > </File> </Filter> |
Update of /cvsroot/gcblue/gcb_wx/src/database In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10630/src/database Modified Files: CsvTranslator.cpp tcAccountDatabase.cpp tcAirDBObject.cpp tcBallisticDBObject.cpp tcDBString.cpp tcDatabase.cpp tcDatabaseIterator.cpp tcDatabaseObject.cpp tcESMDBObject.cpp tcFixedDBObject.cpp tcFlightportDBObject.cpp tcGenericDBObject.cpp tcItemDBObject.cpp tcLauncherDBObject.cpp tcMissileDBObject.cpp tcOpticalDBObject.cpp tcRadarDBObject.cpp tcSensorDBObject.cpp tcSensorPlatformDBObject.cpp tcSonarDBObject.cpp tcSonobuoyDBObject.cpp tcSqlReader.cpp tcStoresDBObject.cpp tcSubDBObject.cpp tcTorpedoDBObject.cpp tcWeaponDBObject.cpp Added Files: tcECMDBObject.cpp Log Message: vc8 updates Index: tcSubDBObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/database/tcSubDBObject.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** tcSubDBObject.cpp 14 Jul 2005 23:42:21 -0000 1.3 --- tcSubDBObject.cpp 23 Mar 2006 01:11:02 -0000 1.4 *************** *** 2,6 **** ** @file tcSubDBObject.cpp */ ! /* Copyright (C) 2005 Dewitt Colclough (de...@tw...) ** All rights reserved. --- 2,6 ---- ** @file tcSubDBObject.cpp */ ! /* Copyright (C) 2005 Dewitt Colclough (de...@gc...) ** All rights reserved. Index: CsvTranslator.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/database/CsvTranslator.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** CsvTranslator.cpp 12 Jun 2005 20:46:57 -0000 1.8 --- CsvTranslator.cpp 23 Mar 2006 01:11:02 -0000 1.9 *************** *** 5,9 **** ** by Brian W. Kernighan and Rob Pike, Copyright(C) 1999 Lucent Technologies ** ! ** Copyright (C) 2003 Dewitt Colclough (de...@tw...) ** All rights reserved. --- 5,9 ---- ** by Brian W. Kernighan and Rob Pike, Copyright(C) 1999 Lucent Technologies ** ! ** Copyright (C) 2003 Dewitt Colclough (de...@gc...) ** All rights reserved. Index: tcESMDBObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/database/tcESMDBObject.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** tcESMDBObject.cpp 1 Jun 2005 00:13:29 -0000 1.10 --- tcESMDBObject.cpp 23 Mar 2006 01:11:02 -0000 1.11 *************** *** 2,6 **** ** @file tcESMDBObject.cpp */ ! /* Copyright (C) 2003-2004 Dewitt Colclough (de...@tw...) ** All rights reserved. --- 2,6 ---- ** @file tcESMDBObject.cpp */ ! /* Copyright (C) 2003-2004 Dewitt Colclough (de...@gc...) ** All rights reserved. Index: tcMissileDBObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/database/tcMissileDBObject.cpp,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** tcMissileDBObject.cpp 18 Dec 2005 04:10:33 -0000 1.21 --- tcMissileDBObject.cpp 23 Mar 2006 01:11:02 -0000 1.22 *************** *** 3,7 **** */ /* ! ** Copyright (C) 2003-2004 Dewitt Colclough (de...@tw...) ** All rights reserved. --- 3,7 ---- */ /* ! ** Copyright (C) 2003-2004 Dewitt Colclough (de...@gc...) ** All rights reserved. Index: tcAirDBObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/database/tcAirDBObject.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** tcAirDBObject.cpp 1 Jun 2005 00:13:29 -0000 1.15 --- tcAirDBObject.cpp 23 Mar 2006 01:11:02 -0000 1.16 *************** *** 2,6 **** ** @file tcAirDBObject.cpp */ ! /* Copyright (C) 2003-2005 Dewitt Colclough (de...@tw...) ** All rights reserved. --- 2,6 ---- ** @file tcAirDBObject.cpp */ ! /* Copyright (C) 2003-2005 Dewitt Colclough (de...@gc...) ** All rights reserved. Index: tcSensorDBObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/database/tcSensorDBObject.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** tcSensorDBObject.cpp 28 Jun 2005 02:51:34 -0000 1.14 --- tcSensorDBObject.cpp 23 Mar 2006 01:11:02 -0000 1.15 *************** *** 2,6 **** ** @file tcSensorDBObject.cpp */ ! /* Copyright (C) 2003-2004 Dewitt Colclough (de...@tw...) ** All rights reserved. --- 2,6 ---- ** @file tcSensorDBObject.cpp */ ! /* Copyright (C) 2003-2004 Dewitt Colclough (de...@gc...) ** All rights reserved. Index: tcTorpedoDBObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/database/tcTorpedoDBObject.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** tcTorpedoDBObject.cpp 1 Jun 2005 00:13:29 -0000 1.3 --- tcTorpedoDBObject.cpp 23 Mar 2006 01:11:02 -0000 1.4 *************** *** 2,6 **** ** @file tcTorpedoDBObject.cpp */ ! /* Copyright (C) 2004 Dewitt Colclough (de...@tw...) ** All rights reserved. --- 2,6 ---- ** @file tcTorpedoDBObject.cpp */ ! /* Copyright (C) 2004 Dewitt Colclough (de...@gc...) ** All rights reserved. Index: tcDatabaseObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/database/tcDatabaseObject.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** tcDatabaseObject.cpp 12 Jun 2005 20:46:57 -0000 1.19 --- tcDatabaseObject.cpp 23 Mar 2006 01:11:02 -0000 1.20 *************** *** 2,6 **** ** @file tcDatabaseObject.cpp */ ! /* Copyright (C) 2003-2004 Dewitt Colclough (de...@tw...) ** All rights reserved. --- 2,6 ---- ** @file tcDatabaseObject.cpp */ ! /* Copyright (C) 2003-2006 Dewitt Colclough (de...@gc...) ** All rights reserved. *************** *** 112,115 **** --- 112,117 ---- /***************************** tcDatabaseObject ***********************************/ + + /** * *************** *** 159,162 **** --- 161,209 ---- } } + + /** + * Static method to convert dollar amount into string + */ + const char* tcDatabaseObject::CostToString(float cost_) + { + static wxString s; + + float abs_cost = fabsf(cost_); + + if (abs_cost == 0) + { + s = ""; + } + else if (abs_cost >= 1e9) + { + s.Printf("$%.1fB", 1e-9 * abs_cost); + } + else if (abs_cost >= 1e6) + { + s.Printf("$%.1fM", 1e-6 * abs_cost); + } + else if (abs_cost >= 1e3) + { + s.Printf("$%.1fK", 1e-3 * abs_cost); + } + else + { + s.Printf("$%.0f", abs_cost); + } + + if (cost_ < 0) + { + s.Prepend("-"); + } + + return s.c_str(); + + } + + const char* tcDatabaseObject::GetCostString() const + { + return CostToString(cost); + } + /** *************** *** 333,336 **** --- 380,384 ---- columnString += "ModelClassId number(3),"; columnString += "ClassificationId number(3),"; + columnString += "Cost number(7),"; columnString += "ImageFileName varchar(30)," ; columnString += "ModelFileName varchar(30),"; *************** *** 344,347 **** --- 392,396 ---- mnType = entry.GetInt("ClassificationId"); + cost = entry.GetDouble("Cost"); mzImageFileName = entry.GetString("ImageFileName").c_str(); mz3DModelFileName = entry.GetString("ModelFileName").c_str(); *************** *** 355,362 **** void tcDatabaseObject::WriteSql(std::string& valueString) { ! wxString str = wxString::Format("'%s',%d,%d,'%s','%s','%s'", mzClass.mz, mnModelType, mnType, mzImageFileName.mz, mz3DModelFileName.mz, --- 404,412 ---- void tcDatabaseObject::WriteSql(std::string& valueString) { ! wxString str = wxString::Format("'%s',%d,%d,%f,'%s','%s','%s'", mzClass.mz, mnModelType, mnType, + cost, mzImageFileName.mz, mz3DModelFileName.mz, *************** *** 371,374 **** --- 421,425 ---- { mzClass = "UNDEFINED"; + cost = 0; mzImageFileName = "NONE"; mz3DModelFileName = ""; *************** *** 383,386 **** --- 434,438 ---- tcDatabaseObject::tcDatabaseObject(const tcDatabaseObject& obj) : mzClass(obj.mzClass), + cost(obj.cost), mzImageFileName(obj.mzImageFileName), mz3DModelFileName(obj.mz3DModelFileName) Index: tcDBString.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/database/tcDBString.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** tcDBString.cpp 12 Jun 2005 20:46:57 -0000 1.8 --- tcDBString.cpp 23 Mar 2006 01:11:02 -0000 1.9 *************** *** 2,6 **** ** tcDBString.cpp ** ! ** Copyright (C) 2003 Dewitt Colclough (de...@tw...) ** All rights reserved. --- 2,6 ---- ** tcDBString.cpp ** ! ** Copyright (C) 2003 Dewitt Colclough (de...@gc...) ** All rights reserved. *************** *** 114,117 **** --- 114,122 ---- } + const char* tcDBString::c_str() + { + return mz; + } + tcDBString& tcDBString::operator= (tcDBString& c) { Index: tcItemDBObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/database/tcItemDBObject.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** tcItemDBObject.cpp 12 Jun 2005 20:46:58 -0000 1.1 --- tcItemDBObject.cpp 23 Mar 2006 01:11:02 -0000 1.2 *************** *** 2,6 **** ** @file tcItemDBObject.cpp */ ! /* Copyright (C) 2005 Dewitt Colclough (de...@tw...) ** All rights reserved. --- 2,6 ---- ** @file tcItemDBObject.cpp */ ! /* Copyright (C) 2005 Dewitt Colclough (de...@gc...) ** All rights reserved. Index: tcStoresDBObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/database/tcStoresDBObject.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** tcStoresDBObject.cpp 12 Jun 2005 20:46:58 -0000 1.4 --- tcStoresDBObject.cpp 23 Mar 2006 01:11:02 -0000 1.5 *************** *** 2,6 **** ** @file tcStoresDBObject.cpp */ ! /* Copyright (C) 2004 Dewitt Colclough (de...@tw...) ** All rights reserved. --- 2,6 ---- ** @file tcStoresDBObject.cpp */ ! /* Copyright (C) 2004 Dewitt Colclough (de...@gc...) ** All rights reserved. Index: tcWeaponDBObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/database/tcWeaponDBObject.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** tcWeaponDBObject.cpp 1 Jun 2005 00:13:29 -0000 1.8 --- tcWeaponDBObject.cpp 23 Mar 2006 01:11:02 -0000 1.9 *************** *** 2,6 **** ** @file tcWeaponDBObject.cpp */ ! /* Copyright (C) 2003-2004 Dewitt Colclough (de...@tw...) ** All rights reserved. --- 2,6 ---- ** @file tcWeaponDBObject.cpp */ ! /* Copyright (C) 2003-2004 Dewitt Colclough (de...@gc...) ** All rights reserved. Index: tcOpticalDBObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/database/tcOpticalDBObject.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** tcOpticalDBObject.cpp 1 Jun 2005 00:13:29 -0000 1.3 --- tcOpticalDBObject.cpp 23 Mar 2006 01:11:02 -0000 1.4 *************** *** 3,7 **** */ /* ! ** Copyright (C) 2003-2004 Dewitt Colclough (de...@tw...) ** All rights reserved. --- 3,7 ---- */ /* ! ** Copyright (C) 2003-2004 Dewitt Colclough (de...@gc...) ** All rights reserved. Index: tcLauncherDBObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/database/tcLauncherDBObject.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** tcLauncherDBObject.cpp 25 Jun 2005 22:10:34 -0000 1.17 --- tcLauncherDBObject.cpp 23 Mar 2006 01:11:02 -0000 1.18 *************** *** 2,6 **** ** @file tcLauncherDBObject.cpp */ ! /* Copyright (C) 2003-2005 Dewitt Colclough (de...@tw...) ** All rights reserved. --- 2,6 ---- ** @file tcLauncherDBObject.cpp */ ! /* Copyright (C) 2003-2005 Dewitt Colclough (de...@gc...) ** All rights reserved. Index: tcGenericDBObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/database/tcGenericDBObject.cpp,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** tcGenericDBObject.cpp 18 Dec 2005 18:48:17 -0000 1.24 --- tcGenericDBObject.cpp 23 Mar 2006 01:11:02 -0000 1.25 *************** *** 2,6 **** ** @file tcGenericDBObject.cpp */ ! /* Copyright (C) 2003-2005 Dewitt Colclough (de...@tw...) ** All rights reserved. --- 2,6 ---- ** @file tcGenericDBObject.cpp */ ! /* Copyright (C) 2003-2005 Dewitt Colclough (de...@gc...) ** All rights reserved. *************** *** 46,49 **** --- 46,54 ---- { + tcDatabaseObject* tcGenericDBObject::AsDatabaseObject() + { + return this; + } + /** * Update calculated parameters based on database values Index: tcDatabase.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/database/tcDatabase.cpp,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** tcDatabase.cpp 16 Sep 2005 00:16:08 -0000 1.32 --- tcDatabase.cpp 23 Mar 2006 01:11:02 -0000 1.33 *************** *** 2,6 **** ** @file tcDatabase.cpp */ ! /* Copyright (C) 2003-2005 Dewitt Colclough (de...@tw...) ** All rights reserved. ** --- 2,6 ---- ** @file tcDatabase.cpp */ ! /* Copyright (C) 2003-2005 Dewitt Colclough (de...@gc...) ** All rights reserved. ** *************** *** 44,47 **** --- 44,48 ---- #include "tcOpticalDBObject.h" #include "tcESMDBObject.h" + #include "tcECMDBObject.h" #include "tcSonarDBObject.h" #include "tcFixedDBObject.h" *************** *** 278,281 **** --- 279,289 ---- else serializer.Save(); } + // tcECMDBObject + { + tcDBObjSerializerSql<tcECMDBObject> + serializer(this, sqlConnection, "ecm"); + if (load) serializer.Load(); + else serializer.Save(); + } // tcSonarDBObject { Index: tcSensorPlatformDBObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/database/tcSensorPlatformDBObject.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** tcSensorPlatformDBObject.cpp 1 Jun 2005 00:13:29 -0000 1.2 --- tcSensorPlatformDBObject.cpp 23 Mar 2006 01:11:02 -0000 1.3 *************** *** 2,6 **** ** @file tcSensorPlatformDBObject.cpp */ ! /* Copyright (C) 2005 Dewitt Colclough (de...@tw...) ** All rights reserved. --- 2,6 ---- ** @file tcSensorPlatformDBObject.cpp */ ! /* Copyright (C) 2005 Dewitt Colclough (de...@gc...) ** All rights reserved. Index: tcSqlReader.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/database/tcSqlReader.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** tcSqlReader.cpp 16 Sep 2005 00:16:08 -0000 1.6 --- tcSqlReader.cpp 23 Mar 2006 01:11:02 -0000 1.7 *************** *** 2,6 **** ** @file tcSqlReader.cpp */ ! /* Copyright (C) 2004 Dewitt Colclough (de...@tw...) ** All rights reserved. ** --- 2,6 ---- ** @file tcSqlReader.cpp */ ! /* Copyright (C) 2004 Dewitt Colclough (de...@gc...) ** All rights reserved. ** Index: tcBallisticDBObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/database/tcBallisticDBObject.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** tcBallisticDBObject.cpp 1 Jun 2005 00:13:29 -0000 1.11 --- tcBallisticDBObject.cpp 23 Mar 2006 01:11:02 -0000 1.12 *************** *** 2,6 **** ** @file tcBallisticDBObject.cpp */ ! /* Copyright (C) 2004 Dewitt Colclough (de...@tw...) ** All rights reserved. --- 2,6 ---- ** @file tcBallisticDBObject.cpp */ ! /* Copyright (C) 2004 Dewitt Colclough (de...@gc...) ** All rights reserved. Index: tcSonobuoyDBObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/database/tcSonobuoyDBObject.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** tcSonobuoyDBObject.cpp 1 Jun 2005 00:13:29 -0000 1.2 --- tcSonobuoyDBObject.cpp 23 Mar 2006 01:11:02 -0000 1.3 *************** *** 2,6 **** ** @file tcSonobuoyDBObject.cpp */ ! /* Copyright (C) 2005 Dewitt Colclough (de...@tw...) ** All rights reserved. --- 2,6 ---- ** @file tcSonobuoyDBObject.cpp */ ! /* Copyright (C) 2005 Dewitt Colclough (de...@gc...) ** All rights reserved. Index: tcDatabaseIterator.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/database/tcDatabaseIterator.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** tcDatabaseIterator.cpp 1 Jun 2005 00:13:29 -0000 1.2 --- tcDatabaseIterator.cpp 23 Mar 2006 01:11:02 -0000 1.3 *************** *** 2,6 **** ** @file tcDatabaseIterator.cpp */ ! /* Copyright (C) 2004 Dewitt Colclough (de...@tw...) ** All rights reserved. --- 2,6 ---- ** @file tcDatabaseIterator.cpp */ ! /* Copyright (C) 2004 Dewitt Colclough (de...@gc...) ** All rights reserved. Index: tcAccountDatabase.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/database/tcAccountDatabase.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** tcAccountDatabase.cpp 16 Sep 2005 00:16:08 -0000 1.3 --- tcAccountDatabase.cpp 23 Mar 2006 01:11:02 -0000 1.4 *************** *** 2,6 **** ** @file tcAccountDatabase.cpp */ ! /* Copyright (C) 2005 Dewitt Colclough (de...@tw...) ** All rights reserved. ** --- 2,6 ---- ** @file tcAccountDatabase.cpp */ ! /* Copyright (C) 2005 Dewitt Colclough (de...@gc...) ** All rights reserved. ** *************** *** 73,77 **** } ! catch (exception& ex) { wxMessageBox(ex.what(), "Error", wxICON_ERROR); --- 73,77 ---- } ! catch (std::exception& ex) { wxMessageBox(ex.what(), "Error", wxICON_ERROR); *************** *** 221,225 **** md5 = new CMD5; } ! catch (exception& ex) { fprintf(stderr, "%s\n", ex.what()); --- 221,225 ---- md5 = new CMD5; } ! catch (std::exception& ex) { fprintf(stderr, "%s\n", ex.what()); *************** *** 328,332 **** accountDatabase->executenonquery(s.c_str()); } ! catch (exception& ex) { fprintf(stderr, "UpdateDatabaseEntry - %s (%s)\n", ex.what(), s.c_str()); --- 328,332 ---- accountDatabase->executenonquery(s.c_str()); } ! catch (std::exception& ex) { fprintf(stderr, "UpdateDatabaseEntry - %s (%s)\n", ex.what(), s.c_str()); *************** *** 360,364 **** accountDatabase->executenonquery(s.c_str()); } ! catch (exception& ex) { fprintf(stderr, "test UpdateDatabaseEntry - %s (%s)\n", ex.what(), s.c_str()); --- 360,364 ---- accountDatabase->executenonquery(s.c_str()); } ! catch (std::exception& ex) { fprintf(stderr, "test UpdateDatabaseEntry - %s (%s)\n", ex.what(), s.c_str()); Index: tcRadarDBObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/database/tcRadarDBObject.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** tcRadarDBObject.cpp 28 Jun 2005 02:51:34 -0000 1.17 --- tcRadarDBObject.cpp 23 Mar 2006 01:11:02 -0000 1.18 *************** *** 2,6 **** ** @file tcRadarDBObject.cpp */ ! /* Copyright (C) 2003-2004 Dewitt Colclough (de...@tw...) ** All rights reserved. --- 2,6 ---- ** @file tcRadarDBObject.cpp */ ! /* Copyright (C) 2003-2004 Dewitt Colclough (de...@gc...) ** All rights reserved. Index: tcSonarDBObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/database/tcSonarDBObject.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** tcSonarDBObject.cpp 28 Jun 2005 02:51:34 -0000 1.4 --- tcSonarDBObject.cpp 23 Mar 2006 01:11:02 -0000 1.5 *************** *** 2,6 **** ** @file tcSonarDBObject.cpp */ ! /* Copyright (C) 2004 Dewitt Colclough (de...@tw...) ** All rights reserved. --- 2,6 ---- ** @file tcSonarDBObject.cpp */ ! /* Copyright (C) 2004 Dewitt Colclough (de...@gc...) ** All rights reserved. --- NEW FILE: tcECMDBObject.cpp --- /** ** @file tcECMDBObject.cpp */ /* Copyright (C) 2006 Dewitt Colclough (de...@gc...) ** All rights reserved. ** This file is part of the Global Conflict Blue (GCB) program. ** GCB is free software; you can redistribute it and/or modify ** it under the terms of version 2 of the GNU General Public License as ** published by the Free Software Foundation. ** GCB is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** You should have received a copy of the GNU General Public License ** along with GCB; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "stdwx.h" #if _MSC_VER > 1000 #pragma warning(disable:4786) // suppress warning for STL bug in VC6, see Q167355 in the MSDN Library. #endif // _MSC_VER > 1000 #include "tcECMDBObject.h" #include "tcECM.h" #include "CsvTranslator.h" #include <sstream> #ifdef _DEBUG #define new DEBUG_NEW #endif using namespace std; namespace database { tcSensorState* tcECMDBObject::CreateSensor(tcGameObject* parent) { tcECM* ecm = new tcECM(this); ecm->SetParent(parent); return ecm; } /** * workaround for write serialization issue * @return true if db obj is a leaf obj */ bool tcECMDBObject::IsLeaf() const { return mnClassID == DTYPE_ECM; } void tcECMDBObject::PrintToFile(tcFile& file) { //char zBuff[128]; tcSensorDBObject::PrintToFile(file); } int tcECMDBObject::Serialize(tcFile& file, bool mbLoad, UINT32 anVersion) { return tcSensorDBObject::Serialize(file,mbLoad,anVersion); } int tcECMDBObject::SerializeCSV(CsvTranslator *csv, bool mbLoad) { tcSensorDBObject::SerializeCSV(csv, mbLoad); if (mbLoad) { } else { csv->WriteLine(); } return 1; } /** * Loads/saves XML data for database object * @param load true to load, false to save */ void tcECMDBObject::SerializeXml(TiXmlElement* node, bool load) { if (load) return; // write only for now wxASSERT(node); tcSensorDBObject::SerializeXml(node, load); } int tcECMDBObject::WriteCSVHeader(database::CsvTranslator *csv) { tcSensorDBObject::WriteCSVHeader(csv); csv->WriteLine(); return 1; } /** * Adds sql column definitions to columnString. This is used for * SQL create table command */ void tcECMDBObject::AddSqlColumns(std::string& columnString) { tcSensorDBObject::AddSqlColumns(columnString); columnString += ","; columnString += "EcmType varchar(30),"; columnString += "ERP_dBW number(3),"; columnString += "EffectivenessRating number(5),"; columnString += "IsEffectiveVsSurveillance number(1),"; columnString += "IsEffectiveVsSeeker number(1)"; } void tcECMDBObject::ReadSql(tcSqlReader& entry) { tcSensorDBObject::ReadSql(entry); ecmType = entry.GetString("EcmType").c_str(); ERP_dBW = entry.GetDouble("ERP_dBW"); effectivenessRating = entry.GetDouble("EffectivenessRating"); isEffectiveVsSurveillance = entry.GetInt("IsEffectiveVsSurveillance") != 0; isEffectiveVsSeeker = entry.GetInt("IsEffectiveVsSeeker") != 0; } void tcECMDBObject::WriteSql(std::string& valueString) { tcSensorDBObject::WriteSql(valueString); std::stringstream s; s << ","; s << "'" << ecmType.c_str() << "',"; s << ERP_dBW << ","; s << effectivenessRating << ","; s << (long)isEffectiveVsSurveillance << ","; s << (long)isEffectiveVsSeeker; valueString += s.str(); } tcECMDBObject::tcECMDBObject() : tcSensorDBObject(), ecmType("Undefined"), ERP_dBW(0), effectivenessRating(0.5f), isEffectiveVsSurveillance(false), isEffectiveVsSeeker(false) { mzClass = "Default ECM"; mnClassID = DTYPE_ECM; mfMaxRange_km = 100.0f; mfRefRange_km = 80.0f; mfFieldOfView_deg = 360.0f; mfScanPeriod_s = 4.0f; } tcECMDBObject::tcECMDBObject(tcECMDBObject& obj) : tcSensorDBObject(obj) { mnClassID = DTYPE_ECM; } tcECMDBObject::~tcECMDBObject() { } } Index: tcFixedDBObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/database/tcFixedDBObject.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** tcFixedDBObject.cpp 1 Jun 2005 00:13:29 -0000 1.9 --- tcFixedDBObject.cpp 23 Mar 2006 01:11:02 -0000 1.10 *************** *** 2,6 **** ** tcFixedDBObject.cpp ** ! ** Copyright (C) 2003 Dewitt Colclough (de...@tw...) ** All rights reserved. --- 2,6 ---- ** tcFixedDBObject.cpp ** ! ** Copyright (C) 2003 Dewitt Colclough (de...@gc...) ** All rights reserved. Index: tcFlightportDBObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/database/tcFlightportDBObject.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** tcFlightportDBObject.cpp 1 Jun 2005 00:13:29 -0000 1.8 --- tcFlightportDBObject.cpp 23 Mar 2006 01:11:02 -0000 1.9 *************** *** 1,4 **** /* ! ** Copyright (C) 2003 Dewitt Colclough (de...@tw...) ** All rights reserved. --- 1,4 ---- /* ! ** Copyright (C) 2003 Dewitt Colclough (de...@gc...) ** All rights reserved. |
|
From: Dewitt C. <ddc...@us...> - 2006-03-23 01:11:22
|
Update of /cvsroot/gcblue/gcb_wx/src/scriptinterface In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10630/src/scriptinterface Modified Files: tcFlightPortInterface.cpp tcGroupInterface.cpp tcPanelInterface.cpp tcPlatformInterface.cpp tcPlatformInterfaceExtension.cpp tcPlatformInterfaceExtensionB.cpp tcPythonInterface.cpp tcScenarioInterface.cpp tcSimPythonInterface.cpp tcSubInterface.cpp tcTrackInterface.cpp Log Message: vc8 updates Index: tcPlatformInterfaceExtension.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcPlatformInterfaceExtension.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** tcPlatformInterfaceExtension.cpp 1 Jun 2005 00:13:32 -0000 1.17 --- tcPlatformInterfaceExtension.cpp 23 Mar 2006 01:11:02 -0000 1.18 *************** *** 1,4 **** /* ! ** Copyright (C) 2003 Dewitt Colclough (de...@tw...) ** All rights reserved. --- 1,4 ---- /* ! ** Copyright (C) 2003 Dewitt Colclough (de...@gc...) ** All rights reserved. *************** *** 44,48 **** void tcPlatformInterface::InitPythonClassesA() { ! object class_track = class_<tcTrack>("tcTrack") .def_readwrite("Alt",&tcTrack::mfAlt_m) .def_readwrite("Lat",&tcTrack::mfLat_rad) --- 44,48 ---- void tcPlatformInterface::InitPythonClassesA() { ! class_<tcTrack>("tcTrack") .def_readwrite("Alt",&tcTrack::mfAlt_m) .def_readwrite("Lat",&tcTrack::mfLat_rad) *************** *** 66,70 **** ; ! object class_smtrack = class_<tcSensorMapTrack>("tcSMTrack") .def_readwrite("Alt",&tcSensorMapTrack::mfAlt_m) .def_readwrite("Lat",&tcSensorMapTrack::mfLat_rad) --- 66,70 ---- ; ! class_<tcSensorMapTrack>("tcSMTrack") .def_readwrite("Alt",&tcSensorMapTrack::mfAlt_m) .def_readwrite("Lat",&tcSensorMapTrack::mfLat_rad) *************** *** 77,80 **** --- 77,81 ---- .def_readonly("Time", &tcSensorMapTrack::mfTimestamp) .def("IsAir", &tcSensorMapTrack::IsAir) + .def("IsDestroyed", &tcSensorMapTrack::IsDestroyed) .def("IsMissile", &tcSensorMapTrack::IsMissile) .def("IsSurface", &tcSensorMapTrack::IsSurface) *************** *** 131,134 **** --- 132,138 ---- .def_readonly("SectorCenter", &tcLauncherInfo::sectorCenter) .def_readonly("SectorWidth", &tcLauncherInfo::sectorWidth) + .def_readonly("FireControlTracks", &tcLauncherInfo::fireControlTracks) + .def_readonly("MaxFireControlTracks", &tcLauncherInfo::maxFireControlTracks) + .def("IsValid", &tcLauncherInfo::IsValid) ; Index: tcScenarioInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcScenarioInterface.cpp,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** tcScenarioInterface.cpp 14 Jan 2006 17:13:59 -0000 1.37 --- tcScenarioInterface.cpp 23 Mar 2006 01:11:02 -0000 1.38 *************** *** 2,6 **** ** tcScenarioInterface.cpp ** ! ** Copyright (C) 2003 Dewitt Colclough (de...@tw...) ** All rights reserved. --- 2,6 ---- ** tcScenarioInterface.cpp ** ! ** Copyright (C) 2003 Dewitt Colclough (de...@gc...) ** All rights reserved. *************** *** 153,159 **** // Interface class management methods ! void tcScenarioInterface::AddGoalClasses(boost::python::dict *dictionary) { ! InitGoalPython(dictionary); } --- 153,159 ---- // Interface class management methods ! void tcScenarioInterface::AddGoalClasses() { ! InitGoalPython(); } *************** *** 208,211 **** --- 208,212 ---- .def("SetAllianceGoal",&tcScenarioInterface::SetAllianceGoal) .def("SetDateTime",&tcScenarioInterface::SetDateTime) + .def("SetPerfectScore",&tcScenarioInterface::SetPerfectScore) .def("SetScenarioDescription",&tcScenarioInterface::SetScenarioDescription) .def("SetScenarioLoaded",&tcScenarioInterface::SetScenarioLoaded) *************** *** 619,622 **** --- 620,628 ---- } + void tcScenarioInterface::SetPerfectScore(float score) + { + tcGoalTracker::Get()->SetPerfectScore(score); + } + void tcScenarioInterface::SetScenarioDescription(std::string s) { Index: tcTrackInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcTrackInterface.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** tcTrackInterface.cpp 10 Sep 2005 21:47:38 -0000 1.10 --- tcTrackInterface.cpp 23 Mar 2006 01:11:02 -0000 1.11 *************** *** 2,6 **** ** tcTrackInterface.cpp ** ! ** Copyright (C) 2003 Dewitt Colclough (de...@tw...) ** All rights reserved. --- 2,6 ---- ** tcTrackInterface.cpp ** ! ** Copyright (C) 2003 Dewitt Colclough (de...@gc...) ** All rights reserved. Index: tcFlightPortInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcFlightPortInterface.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** tcFlightPortInterface.cpp 22 Jun 2005 01:22:08 -0000 1.8 --- tcFlightPortInterface.cpp 23 Mar 2006 01:11:02 -0000 1.9 *************** *** 2,6 **** ** @file tcFlightPortInterface.cpp */ ! /* Copyright (C) 2003 Dewitt Colclough (de...@tw...) ** All rights reserved. --- 2,6 ---- ** @file tcFlightPortInterface.cpp */ ! /* Copyright (C) 2003 Dewitt Colclough (de...@gc...) ** All rights reserved. Index: tcPlatformInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcPlatformInterface.cpp,v retrieving revision 1.58 retrieving revision 1.59 diff -C2 -d -r1.58 -r1.59 *** tcPlatformInterface.cpp 14 Jan 2006 17:13:59 -0000 1.58 --- tcPlatformInterface.cpp 23 Mar 2006 01:11:02 -0000 1.59 *************** *** 2,6 **** ** @file tcPlatformInterface.cpp */ ! /* Copyright (C) 2003-2005 Dewitt Colclough (de...@tw...) ** All rights reserved. --- 2,6 ---- ** @file tcPlatformInterface.cpp */ ! /* Copyright (C) 2003-2005 Dewitt Colclough (de...@gc...) ** All rights reserved. *************** *** 523,526 **** --- 523,529 ---- info.sectorWidth = C_180OVERPI * pLauncher->GetSectorWidth(); + info.fireControlTracks = pLauncher->GetFireControlTrackCount(); + info.maxFireControlTracks = pLauncher->GetMaxFireControlTracks(); + info.maxDepth_m = 0; *************** *** 572,576 **** } else if ((pLauncher->meLaunchMode == SEEKER_TRACK)|| ! (pLauncher->meLaunchMode == FC_TRACK)) { info.mnLaunchMode = 1; --- 575,580 ---- } else if ((pLauncher->meLaunchMode == SEEKER_TRACK)|| ! (pLauncher->meLaunchMode == FC_TRACK) || ! (pLauncher->meLaunchMode == TARGET_ONLY)) { info.mnLaunchMode = 1; Index: tcPlatformInterfaceExtensionB.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcPlatformInterfaceExtensionB.cpp,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** tcPlatformInterfaceExtensionB.cpp 12 Dec 2005 02:37:01 -0000 1.29 --- tcPlatformInterfaceExtensionB.cpp 23 Mar 2006 01:11:02 -0000 1.30 *************** *** 2,6 **** ** @file tcPlatformInterfaceExtensionB.cpp */ ! /* Copyright (C) 2003-2005 Dewitt Colclough (de...@tw...) ** All rights reserved. --- 2,6 ---- ** @file tcPlatformInterfaceExtensionB.cpp */ ! /* Copyright (C) 2003-2005 Dewitt Colclough (de...@gc...) ** All rights reserved. Index: tcSimPythonInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcSimPythonInterface.cpp,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** tcSimPythonInterface.cpp 18 Dec 2005 04:10:33 -0000 1.42 --- tcSimPythonInterface.cpp 23 Mar 2006 01:11:02 -0000 1.43 *************** *** 302,307 **** try { ! handle<>( PyRun_String(azCommand ! , Py_file_input, mpDictionary->ptr(), mpDictionary->ptr()) ); } catch(error_already_set) --- 302,307 ---- try { ! handle<> ignored( PyRun_String(azCommand ! , Py_file_input, main_namespace.ptr(), main_namespace.ptr()) ); } catch(error_already_set) *************** *** 326,330 **** { handle<>( PyRun_String(azCommand ! , Py_file_input, mpDictionary->ptr(), mpDictionary->ptr()) ); } catch (error_already_set) --- 326,330 ---- { handle<>( PyRun_String(azCommand ! , Py_file_input, main_namespace.ptr(), main_namespace.ptr()) ); } catch (error_already_set) *************** *** 394,398 **** { handle<>( PyRun_String("Menu.BuildGroupMenu(UserMenu, GroupInfo)" ! , Py_file_input, mpDictionary->ptr(), mpDictionary->ptr()) ); } catch(error_already_set) --- 394,398 ---- { handle<>( PyRun_String("Menu.BuildGroupMenu(UserMenu, GroupInfo)" ! , Py_file_input, main_namespace.ptr(), main_namespace.ptr()) ); } catch(error_already_set) *************** *** 411,415 **** { handle<>( PyRun_String("Menu.BuildUnitMenu(UserMenu, HookedUnitInfo)" ! , Py_file_input, mpDictionary->ptr(), mpDictionary->ptr()) ); } catch(error_already_set) --- 411,415 ---- { handle<>( PyRun_String("Menu.BuildUnitMenu(UserMenu, HookedUnitInfo)" ! , Py_file_input, main_namespace.ptr(), main_namespace.ptr()) ); } catch(error_already_set) *************** *** 428,432 **** { handle<>( PyRun_String("Menu.BuildUnitEditMenu(UserMenu, HookedUnitInfo)" ! , Py_file_input, mpDictionary->ptr(), mpDictionary->ptr()) ); } catch(error_already_set) --- 428,432 ---- { handle<>( PyRun_String("Menu.BuildUnitEditMenu(UserMenu, HookedUnitInfo)" ! , Py_file_input, main_namespace.ptr(), main_namespace.ptr()) ); } catch(error_already_set) *************** *** 482,487 **** try { ! handle<>( PyRun_String(commandtext ! , Py_file_input, mpDictionary->ptr(), mpDictionary->ptr()) ); return 0; } --- 482,487 ---- try { ! handle<> ignored( PyRun_String(commandtext ! , Py_file_input, main_namespace.ptr(), main_namespace.ptr()) ); return 0; } *************** *** 1001,1009 **** { handle<>( PyRun_String("import AI\n" ! , Py_file_input, mpDictionary->ptr(), mpDictionary->ptr()) ); handle<>( PyRun_String("import Menu\n" ! , Py_file_input, mpDictionary->ptr(), mpDictionary->ptr()) ); handle<>( PyRun_String("print ''\nprint 'Re-imported modules'\n" ! , Py_file_input, mpDictionary->ptr(), mpDictionary->ptr()) ); } catch (error_already_set) --- 1001,1009 ---- { handle<>( PyRun_String("import AI\n" ! , Py_file_input, main_namespace.ptr(),main_namespace.ptr()) ); handle<>( PyRun_String("import Menu\n" ! , Py_file_input, main_namespace.ptr(), main_namespace.ptr()) ); handle<>( PyRun_String("print ''\nprint 'Re-imported modules'\n" ! , Py_file_input, main_namespace.ptr(), main_namespace.ptr()) ); } catch (error_already_set) *************** *** 1137,1141 **** handle<>( PyRun_String("hello = file('settest.txt', 'a')\n" "hello.write('Y is ' + str(Y) + '\\n')\n" ! "hello.close()", Py_file_input,mpDictionary->ptr(), mpDictionary->ptr()) ); } catch (error_already_set) --- 1137,1141 ---- handle<>( PyRun_String("hello = file('settest.txt', 'a')\n" "hello.write('Y is ' + str(Y) + '\\n')\n" ! "hello.close()", Py_file_input, main_namespace.ptr(), main_namespace.ptr()) ); } catch (error_already_set) *************** *** 1180,1188 **** "myout.truncate(0)\n" "myerr.truncate(0)\n" ! , Py_file_input, mpDictionary->ptr(), mpDictionary->ptr()) ); if (showPythonErrors) { ! handle<> errorTextHandle(borrowed(PyDict_GetItemString(mpDictionary->ptr(), "ErrorText"))); str textObject(errorTextHandle); --- 1180,1188 ---- "myout.truncate(0)\n" "myerr.truncate(0)\n" ! , Py_file_input, main_namespace.ptr(), main_namespace.ptr()) ); if (showPythonErrors) { ! handle<> errorTextHandle(borrowed(PyDict_GetItemString(main_namespace.ptr(), "ErrorText"))); str textObject(errorTextHandle); *************** *** 1306,1310 **** object scenarioInterfaceType = tcScenarioInterface::GetInterface(); ! tcScenarioInterface::AddGoalClasses(mpDictionary); ScenarioInterface = scenarioInterfaceType(); scenarioInterface = extract<tcScenarioInterface*>(ScenarioInterface); --- 1306,1310 ---- object scenarioInterfaceType = tcScenarioInterface::GetInterface(); ! tcScenarioInterface::AddGoalClasses(); ScenarioInterface = scenarioInterfaceType(); scenarioInterface = extract<tcScenarioInterface*>(ScenarioInterface); *************** *** 1316,1334 **** // add PlatformInterface to python environment as global var // called "UnitInfo" ! PyDict_SetItemString(mpDictionary->ptr(), "UnitInfo", PlatformInterface.ptr()); ! PyDict_SetItemString(mpDictionary->ptr(), "HookedUnitInfo", HookedPlatformInterface.ptr()); ! PyDict_SetItemString(mpDictionary->ptr(), "UserMenu", MenuInterface.ptr()); ! PyDict_SetItemString(mpDictionary->ptr(), "UserPanel", PanelInterface.ptr()); ! PyDict_SetItemString(mpDictionary->ptr(), "FlightPortInfo", FlightPortInterface.ptr()); ! PyDict_SetItemString(mpDictionary->ptr(), "HookedTrackInfo", TrackInterface.ptr()); ! PyDict_SetItemString(mpDictionary->ptr(), "ScenarioManager", ScenarioInterface.ptr()); ! PyDict_SetItemString(mpDictionary->ptr(), "GroupInfo", GroupInterface.ptr()); ! PyDict_SetItemString(mpDictionary->ptr(), "TaskInterface", TaskInterfaceObject.ptr()); ! PyDict_SetItemString(mpDictionary->ptr(), "Y", PyInt_FromLong(2)); /* dict['Y']=2 */ // import AI script try { ! handle<>( PyRun_String("import sys\n" "import StringIO\n" "myout = StringIO.StringIO()\n" --- 1316,1334 ---- // add PlatformInterface to python environment as global var // called "UnitInfo" ! PyDict_SetItemString(main_namespace.ptr(), "UnitInfo", PlatformInterface.ptr()); ! PyDict_SetItemString(main_namespace.ptr(), "HookedUnitInfo", HookedPlatformInterface.ptr()); ! PyDict_SetItemString(main_namespace.ptr(), "UserMenu", MenuInterface.ptr()); ! PyDict_SetItemString(main_namespace.ptr(), "UserPanel", PanelInterface.ptr()); ! PyDict_SetItemString(main_namespace.ptr(), "FlightPortInfo", FlightPortInterface.ptr()); ! PyDict_SetItemString(main_namespace.ptr(), "HookedTrackInfo", TrackInterface.ptr()); ! PyDict_SetItemString(main_namespace.ptr(), "ScenarioManager", ScenarioInterface.ptr()); ! PyDict_SetItemString(main_namespace.ptr(), "GroupInfo", GroupInterface.ptr()); ! PyDict_SetItemString(main_namespace.ptr(), "TaskInterface", TaskInterfaceObject.ptr()); ! PyDict_SetItemString(main_namespace.ptr(), "Y", PyInt_FromLong(2)); /* dict['Y']=2 */ // import AI script try { ! handle<> ignored( PyRun_String("import sys\n" "import StringIO\n" "myout = StringIO.StringIO()\n" *************** *** 1342,1354 **** "outfile.close()\n" "errfile.close()\n" ! , Py_file_input, mpDictionary->ptr(), mpDictionary->ptr()) ); ! handle<>( PyRun_String("import AI\n" ! , Py_file_input, mpDictionary->ptr(), mpDictionary->ptr()) ); ! handle<>( PyRun_String("import Menu\n" ! , Py_file_input, mpDictionary->ptr(), mpDictionary->ptr()) ); ! handle<>( PyRun_String("print globals()\n" ! , Py_file_input, mpDictionary->ptr(), mpDictionary->ptr()) ); } catch (error_already_set) --- 1342,1354 ---- "outfile.close()\n" "errfile.close()\n" ! , Py_file_input, main_namespace.ptr(), main_namespace.ptr()) ); ! handle<> ignored2( PyRun_String("import AI\n" ! , Py_file_input, main_namespace.ptr(), main_namespace.ptr()) ); ! handle<> ignored3( PyRun_String("import Menu\n" ! , Py_file_input, main_namespace.ptr(), main_namespace.ptr()) ); ! handle<> ignored4( PyRun_String("print globals()\n" ! , Py_file_input, main_namespace.ptr(), main_namespace.ptr()) ); } catch (error_already_set) *************** *** 1371,1375 **** { /*** print standard error to file ***/ ! handle<>( PyRun_String( "outfile = file('log\\pyout.txt', 'a')\n" "errfile = file('log\\pyerr.txt', 'a')\n" --- 1371,1375 ---- { /*** print standard error to file ***/ ! handle<> ignored( PyRun_String( "outfile = file('log\\pyout.txt', 'a')\n" "errfile = file('log\\pyerr.txt', 'a')\n" *************** *** 1378,1382 **** "outfile.close()\n" "errfile.close()\n" ! , Py_file_input, mpDictionary->ptr(), mpDictionary->ptr()) ); } --- 1378,1382 ---- "outfile.close()\n" "errfile.close()\n" ! , Py_file_input, main_namespace.ptr(), main_namespace.ptr()) ); } Index: tcSubInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcSubInterface.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** tcSubInterface.cpp 14 Jul 2005 23:42:23 -0000 1.6 --- tcSubInterface.cpp 23 Mar 2006 01:11:02 -0000 1.7 *************** *** 2,6 **** ** @file tcSubInterface.cpp */ ! /* Copyright (C) 2004 Dewitt Colclough (de...@tw...) ** All rights reserved. --- 2,6 ---- ** @file tcSubInterface.cpp */ ! /* Copyright (C) 2004 Dewitt Colclough (de...@gc...) ** All rights reserved. Index: tcGroupInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcGroupInterface.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** tcGroupInterface.cpp 1 Jun 2005 00:13:32 -0000 1.3 --- tcGroupInterface.cpp 23 Mar 2006 01:11:02 -0000 1.4 *************** *** 2,6 **** ** @file tcGroupInterface.cpp */ ! /* Copyright (C) 2004 Dewitt Colclough (de...@tw...) ** All rights reserved. --- 2,6 ---- ** @file tcGroupInterface.cpp */ ! /* Copyright (C) 2004 Dewitt Colclough (de...@gc...) ** All rights reserved. Index: tcPanelInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcPanelInterface.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** tcPanelInterface.cpp 1 Jun 2005 00:13:32 -0000 1.6 --- tcPanelInterface.cpp 23 Mar 2006 01:11:02 -0000 1.7 *************** *** 2,6 **** ** tcPanelInterface.cpp ** ! ** Copyright (C) 2003 Dewitt Colclough (de...@tw...) ** All rights reserved. --- 2,6 ---- ** tcPanelInterface.cpp ** ! ** Copyright (C) 2003 Dewitt Colclough (de...@gc...) ** All rights reserved. Index: tcPythonInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcPythonInterface.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** tcPythonInterface.cpp 25 Jun 2005 22:10:36 -0000 1.9 --- tcPythonInterface.cpp 23 Mar 2006 01:11:02 -0000 1.10 *************** *** 2,6 **** ** tcPythonInterface.cpp ** ! ** Copyright (C) 2003 Dewitt Colclough (de...@tw...) ** All rights reserved. --- 2,6 ---- ** tcPythonInterface.cpp ** ! ** Copyright (C) 2003 Dewitt Colclough (de...@gc...) ** All rights reserved. *************** *** 94,98 **** tcTest::mpOutside = &outside; ! PyDict_SetItemString(mpDictionary->ptr(), "Y", PyInt_FromLong(2)); /* dict['Y']=2 */ object class_a = class_<tcTest>("test") --- 94,98 ---- tcTest::mpOutside = &outside; ! PyDict_SetItemString(main_namespace.ptr(), "Y", PyInt_FromLong(2)); /* dict['Y']=2 */ object class_a = class_<tcTest>("test") *************** *** 107,111 **** instance_a.attr("x") = 77; ! PyDict_SetItemString(mpDictionary->ptr(), "A", instance_a.ptr()); try { --- 107,111 ---- instance_a.attr("x") = 77; ! PyDict_SetItemString(main_namespace.ptr(), "A", instance_a.ptr()); try { *************** *** 119,123 **** "outfile.write('A.geto(1) is '+str(A.geto(1))+'\\n')\n" "outfile.close()\n" ! , Py_file_input, mpDictionary->ptr(), mpDictionary->ptr()) ); handle<>( PyRun_String( --- 119,123 ---- "outfile.write('A.geto(1) is '+str(A.geto(1))+'\\n')\n" "outfile.close()\n" ! , Py_file_input, main_namespace.ptr(), main_namespace.ptr()) ); handle<>( PyRun_String( *************** *** 125,129 **** "A.setytox2()\n" "A.setx(A.geto(1))\n" ! , Py_file_input, mpDictionary->ptr(), mpDictionary->ptr()) ); } catch(error_already_set) { --- 125,129 ---- "A.setytox2()\n" "A.setx(A.geto(1))\n" ! , Py_file_input, main_namespace.ptr(), main_namespace.ptr()) ); } catch(error_already_set) { *************** *** 160,167 **** ! tcPythonInterface::tcPythonInterface(void) { Py_Initialize(); // untested code: char *path, *newpath; --- 160,173 ---- ! tcPythonInterface::tcPythonInterface() { Py_Initialize(); + + + main_module = object(handle<>(borrowed(PyImport_AddModule("__main__")))); + + main_namespace = main_module.attr("__dict__"); + // untested code: char *path, *newpath; *************** *** 186,191 **** /* create fresh dictionary */ ! mpDictionary = new dict(handle<>(borrowed(PyDict_New()))); ! PyDict_SetItemString(mpDictionary->ptr(), "__builtins__", PyEval_GetBuiltins()); } --- 192,197 ---- /* create fresh dictionary */ ! //mpDictionary = new dict(handle<>(borrowed(PyDict_New()))); ! PyDict_SetItemString(main_namespace.ptr(), "__builtins__", PyEval_GetBuiltins()); } *************** *** 204,208 **** ); */ ! if (mpDictionary != NULL) {delete mpDictionary;} Py_Finalize(); } --- 210,214 ---- ); */ ! Py_Finalize(); } |
|
From: Dewitt C. <ddc...@us...> - 2006-03-23 01:11:21
|
Update of /cvsroot/gcblue/gcb_wx/src/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10630/src/common Modified Files: AError.cpp math_constants.cpp nsNav.cpp simmath.cpp tcFile.cpp tcObjStream.cpp tcOggStreamer.cpp tcOptions.cpp tcOptionsView.cpp tcRect.cpp tcSound.cpp tcSoundConsole.cpp tcStream.cpp tcString.cpp util.cpp Log Message: vc8 updates Index: tcSoundConsole.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/common/tcSoundConsole.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** tcSoundConsole.cpp 2 Jan 2006 15:40:52 -0000 1.14 --- tcSoundConsole.cpp 23 Mar 2006 01:11:01 -0000 1.15 *************** *** 1,5 **** /** @file tcSoundConsole.cpp */ /* ! ** Copyright (C) 2003 Dewitt Colclough (de...@tw...) ** All rights reserved. --- 1,5 ---- /** @file tcSoundConsole.cpp */ /* ! ** Copyright (C) 2003 Dewitt Colclough (de...@gc...) ** All rights reserved. Index: AError.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/common/AError.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** AError.cpp 8 Aug 2004 00:31:33 -0000 1.8 --- AError.cpp 23 Mar 2006 01:11:01 -0000 1.9 *************** *** 1,4 **** /* ! ** Copyright (C) 2003 Dewitt Colclough (de...@tw...) ** All rights reserved. --- 1,4 ---- /* ! ** Copyright (C) 2003 Dewitt Colclough (de...@gc...) ** All rights reserved. Index: tcOggStreamer.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/common/tcOggStreamer.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** tcOggStreamer.cpp 8 Apr 2005 01:54:11 -0000 1.18 --- tcOggStreamer.cpp 23 Mar 2006 01:11:01 -0000 1.19 *************** *** 2,6 **** ** @file tcOggStreamer.cpp */ ! /* Copyright (C) 2003-2005 Dewitt Colclough (de...@tw...) ** All rights reserved. --- 2,6 ---- ** @file tcOggStreamer.cpp */ ! /* Copyright (C) 2003-2005 Dewitt Colclough (de...@gc...) ** All rights reserved. Index: tcSound.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/common/tcSound.cpp,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** tcSound.cpp 26 Jul 2005 00:37:03 -0000 1.34 --- tcSound.cpp 23 Mar 2006 01:11:01 -0000 1.35 *************** *** 2,6 **** ** @file tcSound.cpp */ ! /* Copyright (C) 2003-2005 Dewitt Colclough (de...@tw...) ** All rights reserved. --- 2,6 ---- ** @file tcSound.cpp */ ! /* Copyright (C) 2003-2005 Dewitt Colclough (de...@gc...) ** All rights reserved. Index: tcRect.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/common/tcRect.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** tcRect.cpp 14 Nov 2004 22:52:20 -0000 1.1 --- tcRect.cpp 23 Mar 2006 01:11:01 -0000 1.2 *************** *** 2,6 **** ** @file tcRect.cpp */ ! /* Copyright (C) 2003 Dewitt Colclough (de...@tw...) ** All rights reserved. --- 2,6 ---- ** @file tcRect.cpp */ ! /* Copyright (C) 2003 Dewitt Colclough (de...@gc...) ** All rights reserved. Index: tcString.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/common/tcString.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** tcString.cpp 14 Sep 2004 02:01:46 -0000 1.4 --- tcString.cpp 23 Mar 2006 01:11:01 -0000 1.5 *************** *** 2,6 **** ** tcString.cpp ** ! ** Copyright (C) 2003 Dewitt Colclough (de...@tw...) ** All rights reserved. --- 2,6 ---- ** tcString.cpp ** ! ** Copyright (C) 2003 Dewitt Colclough (de...@gc...) ** All rights reserved. Index: simmath.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/common/simmath.cpp,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** simmath.cpp 10 Sep 2005 21:47:38 -0000 1.29 --- simmath.cpp 23 Mar 2006 01:11:01 -0000 1.30 *************** *** 2,6 **** ** @file simmath.cpp */ ! /* Copyright (C) 2003 Dewitt Colclough (de...@tw...) ** All rights reserved. --- 2,6 ---- ** @file simmath.cpp */ ! /* Copyright (C) 2003 Dewitt Colclough (de...@gc...) ** All rights reserved. *************** *** 20,23 **** --- 20,24 ---- */ + #pragma warning (disable : 4996) // 'strdup' was declared deprecated #include "simmath.h" *************** *** 27,30 **** --- 28,32 ---- + void ConformLonLatRad(float &lon_rad, float &lat_rad) { if (lon_rad < -C_PI) {lon_rad = -C_PI;} Index: tcOptionsView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/common/tcOptionsView.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** tcOptionsView.cpp 27 Jan 2005 01:01:47 -0000 1.14 --- tcOptionsView.cpp 23 Mar 2006 01:11:01 -0000 1.15 *************** *** 2,6 **** ** @file tcOptionsView.cpp */ ! /* Copyright (C) 2003-2004 Dewitt Colclough (de...@tw...) ** All rights reserved. --- 2,6 ---- ** @file tcOptionsView.cpp */ ! /* Copyright (C) 2003-2004 Dewitt Colclough (de...@gc...) ** All rights reserved. *************** *** 62,66 **** void tcOptionsView::Draw() { ! static nTestCount = 0; --- 62,66 ---- void tcOptionsView::Draw() { ! static int nTestCount = 0; *************** *** 105,109 **** } ! for(i=0; i<mpOptions->mnNumOptions; i++) { for(int j=0; j<mpOptions->maOptionInfo[i].mnStateCount; j++) --- 105,109 ---- } ! for(int i=0; i<mpOptions->mnNumOptions; i++) { for(int j=0; j<mpOptions->maOptionInfo[i].mnStateCount; j++) *************** *** 242,246 **** mnXStart = 100; ! mnYStart = 150; for(int i=0; i<tcOptions::N_OPTIONS; i++) --- 242,246 ---- mnXStart = 100; ! mnYStart = 100; for(int i=0; i<tcOptions::N_OPTIONS; i++) Index: util.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/common/util.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** util.cpp 8 Aug 2004 00:31:33 -0000 1.3 --- util.cpp 23 Mar 2006 01:11:01 -0000 1.4 *************** *** 1,4 **** /* ! ** Copyright (C) 2003 Dewitt Colclough (de...@tw...) ** All rights reserved. --- 1,4 ---- /* ! ** Copyright (C) 2003 Dewitt Colclough (de...@gc...) ** All rights reserved. Index: tcStream.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/common/tcStream.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** tcStream.cpp 10 Sep 2005 21:47:38 -0000 1.13 --- tcStream.cpp 23 Mar 2006 01:11:01 -0000 1.14 *************** *** 2,6 **** ** @file tcStream.cpp ** ! ** Copyright (C) 2004 Dewitt Colclough (de...@tw...) ** All rights reserved. --- 2,6 ---- ** @file tcStream.cpp ** ! ** Copyright (C) 2004 Dewitt Colclough (de...@gc...) ** All rights reserved. Index: tcOptions.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/common/tcOptions.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** tcOptions.cpp 20 Jul 2005 16:24:54 -0000 1.18 --- tcOptions.cpp 23 Mar 2006 01:11:01 -0000 1.19 *************** *** 2,6 **** ** @file tcOptions.cpp */ ! /* Copyright (C) 2003-2004 Dewitt Colclough (de...@tw...) ** All rights reserved. --- 2,6 ---- ** @file tcOptions.cpp */ ! /* Copyright (C) 2003-2004 Dewitt Colclough (de...@gc...) ** All rights reserved. *************** *** 95,99 **** oi.meType = tsOptionInfo::OT_RADIOBUTTON; oi.mnStateCount = 2; ! oi.mnValue = 1; oi.mpAssociated = &mbUseNTDS; oi.mzCaption[0] = "Icon (2525B) symbols"; --- 95,99 ---- oi.meType = tsOptionInfo::OT_RADIOBUTTON; oi.mnStateCount = 2; ! oi.mnValue = 0; oi.mpAssociated = &mbUseNTDS; oi.mzCaption[0] = "Icon (2525B) symbols"; *************** *** 123,126 **** --- 123,142 ---- oi.mnStateCount = 2; oi.mnValue = 1; + oi.mpAssociated = &terrainShaderOn; + oi.mzCaption[0] = "Terrain shader OFF"; + oi.mzCaption[1] = "Terrain shader ON"; + AddOption(oi); + + oi.meType = tsOptionInfo::OT_RADIOBUTTON; + oi.mnStateCount = 2; + oi.mnValue = 1; + oi.mpAssociated = &shadersOn; + oi.mzCaption[0] = "Shaders OFF"; + oi.mzCaption[1] = "Shaders ON"; + AddOption(oi); + + oi.meType = tsOptionInfo::OT_RADIOBUTTON; + oi.mnStateCount = 2; + oi.mnValue = 1; oi.mpAssociated = &useFarSceneView; oi.mzCaption[0] = "Faster sceneview"; *************** *** 276,280 **** } } ! /******************************************************************************/ tcOptions::tcOptions() { --- 292,299 ---- } } ! ! /** ! * ! */ tcOptions::tcOptions() { *************** *** 305,329 **** } - /* test code - SetOptionString("testOption", "This is a test option 1 2 3"); - fprintf(stdout, "TEST STRING: [%s]\n", GetOptionString("testOption")); - - SetOptionString("testOption", "This is the modified test option 4 5 6"); - fprintf(stdout, "TEST STRING2: [%s]\n", GetOptionString("testOption")); - - TiXmlNode* node = rootNode->InsertEndChild(TiXmlElement("Test")); - node->InsertEndChild(TiXmlText("This is some example text")); - TiXmlNode* testNode = rootNode->FirstChild("Test"); - TiXmlNode* childNode = testNode->FirstChild(); - if (childNode) - { - fprintf(stdout, "TEST VALUE: [%s]\n", childNode->Value()); - } - */ Init(); // initializes binary options data } ! /******************************************************************************/ tcOptions::~tcOptions() { --- 324,334 ---- } Init(); // initializes binary options data } ! /** ! * ! */ tcOptions::~tcOptions() { Index: tcObjStream.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/common/tcObjStream.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** tcObjStream.cpp 17 Apr 2005 22:35:30 -0000 1.2 --- tcObjStream.cpp 23 Mar 2006 01:11:01 -0000 1.3 *************** *** 2,6 **** ** @file tcObjStream.cpp ** ! ** Copyright (C) 2004 Dewitt Colclough (de...@tw...) ** All rights reserved. --- 2,6 ---- ** @file tcObjStream.cpp ** ! ** Copyright (C) 2004 Dewitt Colclough (de...@gc...) ** All rights reserved. Index: tcFile.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/common/tcFile.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** tcFile.cpp 10 Dec 2005 16:52:02 -0000 1.6 --- tcFile.cpp 23 Mar 2006 01:11:01 -0000 1.7 *************** *** 1,4 **** /* ! ** Copyright (C) 2003 Dewitt Colclough (de...@tw...) ** All rights reserved. --- 1,4 ---- /* ! ** Copyright (C) 2003 Dewitt Colclough (de...@gc...) ** All rights reserved. Index: math_constants.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/common/math_constants.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** math_constants.cpp 1 Jun 2005 00:13:28 -0000 1.5 --- math_constants.cpp 23 Mar 2006 01:11:01 -0000 1.6 *************** *** 1,4 **** /* ! ** Copyright (C) 2003 Dewitt Colclough (de...@tw...) ** All rights reserved. --- 1,4 ---- /* ! ** Copyright (C) 2003 Dewitt Colclough (de...@gc...) ** All rights reserved. Index: nsNav.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/common/nsNav.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** nsNav.cpp 1 Jun 2005 00:13:28 -0000 1.8 --- nsNav.cpp 23 Mar 2006 01:11:01 -0000 1.9 *************** *** 1,4 **** /* ! ** Copyright (C) 2003 Dewitt Colclough (de...@tw...) ** All rights reserved. --- 1,4 ---- /* ! ** Copyright (C) 2003 Dewitt Colclough (de...@gc...) ** All rights reserved. |
|
From: Dewitt C. <ddc...@us...> - 2006-03-23 01:11:20
|
Update of /cvsroot/gcblue/gcb_wx/src/sqlite In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10630/src/sqlite Modified Files: sqlite3x_reader.cpp Log Message: vc8 updates Index: sqlite3x_reader.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sqlite/sqlite3x_reader.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** sqlite3x_reader.cpp 16 Sep 2005 21:58:05 -0000 1.1 --- sqlite3x_reader.cpp 23 Mar 2006 01:11:02 -0000 1.2 *************** *** 109,113 **** if(!this->cmd) throw database_error("reader is closed"); if((index)>(this->cmd->argc-1)) throw std::out_of_range("index out of range"); ! return std::string((const char*)sqlite3_column_text(this->cmd->stmt, index), sqlite3_column_bytes(this->cmd->stmt, index)); } --- 109,123 ---- if(!this->cmd) throw database_error("reader is closed"); if((index)>(this->cmd->argc-1)) throw std::out_of_range("index out of range"); ! ! const char* s = (const char*)sqlite3_column_text(this->cmd->stmt, index); //, sqlite3_column_bytes(this->cmd->stmt, index)); ! if (s != 0) ! { ! return std::string(s); ! } ! else ! { ! fprintf(stderr, "(Known bug)sqlite3_reader::getstring -- Bad column index (%d)\n", index); ! return std::string(""); ! } } |