1
0
forked from mirrors/0ad

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.
This commit is contained in:
Ykkrosh
2007-02-04 14:56:38 +00:00
parent 221e4c8e23
commit 7130b389db
10 changed files with 15 additions and 81 deletions
-51
View File
@@ -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<CCinemaPath> paths;
CStr name;
size_t numPaths;
CVector3D startRotation;
float timescale;
unpacker.UnpackString(name);
unpacker.UnpackRaw(&timescale, 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<numPaths; ++i )
{
TNSpline spline;
size_t numNodes;
CCinemaData data;
if ( i != 0 )
unpacker.UnpackRaw(&data.m_TotalRotation, sizeof(CVector3D));
unpacker.UnpackRaw(&data.m_Mode, sizeof(data.m_Mode));
unpacker.UnpackRaw(&data.m_Style, sizeof(data.m_Style));
unpacker.UnpackRaw(&data.m_Growth, sizeof(data.m_Growth));
unpacker.UnpackRaw(&data.m_Switch, sizeof(data.m_Switch));
unpacker.UnpackRaw(&numNodes, sizeof(size_t));
data.m_GrowthCount = data.m_Growth;
for ( size_t j=0; j < numNodes; ++j )
{
CVector3D position;
float distance;
unpacker.UnpackRaw(&position, sizeof(position));
unpacker.UnpackRaw(&distance, sizeof(distance));
spline.AddNode(position, distance);
}
trackObj.AddPath(data, spline);
}
m_Tracks[CStrW(name)] = trackObj;
}
return 0;
}
// ApplyData: take all the input data, and rebuild the scene from it
int CMapReader::ApplyData()
-2
View File
@@ -62,8 +62,6 @@ private:
std::vector<Handle> m_TerrainTextures;
// tile descriptions for each tile
std::vector<STileDesc> m_Tiles;
// cinematic tracks used by cinema manager
std::map<CStrW, CCinemaTrack> m_Tracks;
// list of object types used by map
std::vector<CStr> m_ObjectTypes;
// descriptions for each objects
+4 -13
View File
@@ -1,21 +1,12 @@
#include "precompiled.h"
#include "ObjectManager.h"
#include <algorithm>
#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"
+2 -3
View File
@@ -4,12 +4,12 @@
#include <vector>
#include <map>
#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<u8> ActorVariation;
};
public:
-5
View File
@@ -6,7 +6,6 @@
#include <boost/shared_ptr.hpp>
#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; }
-6
View File
@@ -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"
+1
View File
@@ -1,6 +1,7 @@
#include "precompiled.h"
#include "FormationManager.h"
#include "FormationCollection.h"
#include "Entity.h"
#include "ps/CStr.h"
#include "Formation.h"
-1
View File
@@ -6,7 +6,6 @@
#define FORMATIONMANAGER_INCLUDED
#include "ps/Singleton.h"
#include "FormationCollection.h"
#include "scripting/DOMEvent.h"
#define g_FormationManager CFormationManager::GetSingleton()
@@ -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));
@@ -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"