From 7130b389dba14aa982b301231d7ad0ca7b6ba1dd Mon Sep 17 00:00:00 2001 From: Ykkrosh Date: Sun, 4 Feb 2007 14:56:38 +0000 Subject: [PATCH] Atlas: Disable selected tool before saving, so unit-placement previews don't get saved as real units. Misc: Removed redundant code. This was SVN commit r4857. --- source/graphics/MapReader.cpp | 51 ------------------- source/graphics/MapReader.h | 2 - source/graphics/ObjectManager.cpp | 17 ++----- source/graphics/ObjectManager.h | 5 +- source/graphics/TextureManager.h | 5 -- source/ps/GameSetup/GameSetup.cpp | 6 --- source/simulation/FormationManager.cpp | 1 + source/simulation/FormationManager.h | 1 - .../AtlasUI/ScenarioEditor/ScenarioEditor.cpp | 7 +++ .../GameInterface/Handlers/ObjectHandlers.cpp | 1 + 10 files changed, 15 insertions(+), 81 deletions(-) diff --git a/source/graphics/MapReader.cpp b/source/graphics/MapReader.cpp index 5850a7d37a..b3ea9567b7 100644 --- a/source/graphics/MapReader.cpp +++ b/source/graphics/MapReader.cpp @@ -182,57 +182,6 @@ int CMapReader::UnpackTerrain() return 0; } -int CMapReader::UnpackCinema() -{ - size_t numTracks; - unpacker.UnpackRaw(&numTracks, (u32)sizeof(size_t)); - - for ( size_t track=0; track < numTracks; ++track ) - { - CCinemaTrack trackObj; - std::vector paths; - CStr name; - size_t numPaths; - CVector3D startRotation; - float timescale; - - unpacker.UnpackString(name); - unpacker.UnpackRaw(×cale, sizeof(float)); - unpacker.UnpackRaw(&numPaths, sizeof(size_t)); - unpacker.UnpackRaw(&startRotation, sizeof(CVector3D)); - - trackObj.SetStartRotation(startRotation); - trackObj.SetTimescale(timescale); - - for ( size_t i=0; i m_TerrainTextures; // tile descriptions for each tile std::vector m_Tiles; - // cinematic tracks used by cinema manager - std::map m_Tracks; // list of object types used by map std::vector m_ObjectTypes; // descriptions for each objects diff --git a/source/graphics/ObjectManager.cpp b/source/graphics/ObjectManager.cpp index b16fba9646..2d6309f977 100644 --- a/source/graphics/ObjectManager.cpp +++ b/source/graphics/ObjectManager.cpp @@ -1,21 +1,12 @@ #include "precompiled.h" #include "ObjectManager.h" -#include + +#include "graphics/ObjectBase.h" +#include "graphics/ObjectEntry.h" #include "ps/CLogger.h" -#include "lib/res/res.h" -#include "lib/timer.h" -#include "ps/VFSUtil.h" -#include "ObjectBase.h" -#include "ObjectEntry.h" -#include "simulation/Entity.h" -#include "simulation/EntityManager.h" -#include "simulation/EntityTemplate.h" -#include "ps/Game.h" -#include "Model.h" -#include "Unit.h" -#include "maths/Matrix3D.h" #include "ps/Profile.h" +#include "ps/VFSUtil.h" #define LOG_CATEGORY "graphics" diff --git a/source/graphics/ObjectManager.h b/source/graphics/ObjectManager.h index b6afec6f12..9a23802bbc 100644 --- a/source/graphics/ObjectManager.h +++ b/source/graphics/ObjectManager.h @@ -4,12 +4,12 @@ #include #include #include "ps/CStr.h" -#include "ObjectBase.h" -class CObjectEntry; class CEntityTemplate; class CMatrix3D; class CMeshManager; +class CObjectBase; +class CObjectEntry; /////////////////////////////////////////////////////////////////////////////////////////// // CObjectManager: manager class for all possible actor types @@ -23,7 +23,6 @@ public: CStr ActorName; std::vector ActorVariation; - }; public: diff --git a/source/graphics/TextureManager.h b/source/graphics/TextureManager.h index 93244a7375..cfca8f15f5 100644 --- a/source/graphics/TextureManager.h +++ b/source/graphics/TextureManager.h @@ -6,7 +6,6 @@ #include #include "lib/res/handle.h" - #include "ps/CStr.h" #include "ps/Singleton.h" @@ -99,10 +98,6 @@ public: // Find or create a new texture group. All terrain groups are owned by the // texturemanager (TerrainTypeManager) CTerrainGroup *FindGroup(const CStr& name); - // Use the default group for all terrain types that don't have their own - // ScEd currently relies on every texture having one group (and is happy ignorant of any - // extra groups that might exist) - CTerrainGroup *GetDefaultGroup(); const TerrainGroupMap &GetGroups() const { return m_TerrainGroups; } diff --git a/source/ps/GameSetup/GameSetup.cpp b/source/ps/GameSetup/GameSetup.cpp index 950668c344..b96acaee84 100644 --- a/source/ps/GameSetup/GameSetup.cpp +++ b/source/ps/GameSetup/GameSetup.cpp @@ -34,15 +34,9 @@ #include "graphics/LightEnv.h" #include "graphics/MapReader.h" #include "graphics/MaterialManager.h" -#include "graphics/MeshManager.h" -#include "graphics/Model.h" -#include "graphics/ObjectManager.h" #include "graphics/ParticleEngine.h" #include "graphics/SkeletonAnimManager.h" -#include "graphics/Terrain.h" #include "graphics/TextureManager.h" -#include "graphics/Unit.h" -#include "graphics/UnitManager.h" #include "renderer/Renderer.h" #include "renderer/VertexBufferManager.h" diff --git a/source/simulation/FormationManager.cpp b/source/simulation/FormationManager.cpp index 430bf807f3..3359d4b149 100644 --- a/source/simulation/FormationManager.cpp +++ b/source/simulation/FormationManager.cpp @@ -1,6 +1,7 @@ #include "precompiled.h" #include "FormationManager.h" +#include "FormationCollection.h" #include "Entity.h" #include "ps/CStr.h" #include "Formation.h" diff --git a/source/simulation/FormationManager.h b/source/simulation/FormationManager.h index c43411d4bf..fbf5394867 100644 --- a/source/simulation/FormationManager.h +++ b/source/simulation/FormationManager.h @@ -6,7 +6,6 @@ #define FORMATIONMANAGER_INCLUDED #include "ps/Singleton.h" -#include "FormationCollection.h" #include "scripting/DOMEvent.h" #define g_FormationManager CFormationManager::GetSingleton() diff --git a/source/tools/atlas/AtlasUI/ScenarioEditor/ScenarioEditor.cpp b/source/tools/atlas/AtlasUI/ScenarioEditor/ScenarioEditor.cpp index 41fa980152..7679943a87 100644 --- a/source/tools/atlas/AtlasUI/ScenarioEditor/ScenarioEditor.cpp +++ b/source/tools/atlas/AtlasUI/ScenarioEditor/ScenarioEditor.cpp @@ -539,6 +539,11 @@ void ScenarioEditor::OnSave(wxCommandEvent& event) { wxBusyInfo busy(_("Saving map")); + // Deactivate tools, so things like unit previews don't get saved. + // (TODO: Would be nicer to leave the tools active, and just not save + // the preview units.) + SetCurrentTool(_T("")); + std::wstring map = m_OpenFilename.c_str(); POST_MESSAGE(SaveMap, (map)); @@ -559,6 +564,8 @@ void ScenarioEditor::OnSaveAs(wxCommandEvent& WXUNUSED(event)) { wxBusyInfo busy(_("Saving map")); + SetCurrentTool(_T("")); + // TODO: Work when the map is not in .../maps/scenarios/ std::wstring map = dlg.GetFilename().c_str(); POST_MESSAGE(SaveMap, (map)); diff --git a/source/tools/atlas/GameInterface/Handlers/ObjectHandlers.cpp b/source/tools/atlas/GameInterface/Handlers/ObjectHandlers.cpp index 01fdc754a2..7798f60c1c 100644 --- a/source/tools/atlas/GameInterface/Handlers/ObjectHandlers.cpp +++ b/source/tools/atlas/GameInterface/Handlers/ObjectHandlers.cpp @@ -8,6 +8,7 @@ #include "graphics/GameView.h" #include "graphics/Model.h" +#include "graphics/ObjectBase.h" #include "graphics/ObjectEntry.h" #include "graphics/ObjectManager.h" #include "graphics/Terrain.h"