2009-04-18 19:00:33 +02:00
|
|
|
/* Copyright (C) 2009 Wildfire Games.
|
|
|
|
* This file is part of 0 A.D.
|
|
|
|
*
|
|
|
|
* 0 A.D. is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* 0 A.D. 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 0 A.D. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2007-05-07 18:33:24 +02:00
|
|
|
#ifndef INCLUDED_MAPWRITER
|
|
|
|
#define INCLUDED_MAPWRITER
|
2004-05-29 22:56:24 +02:00
|
|
|
|
|
|
|
#include <vector>
|
2007-09-03 01:38:58 +02:00
|
|
|
#include <list>
|
2004-05-29 22:56:24 +02:00
|
|
|
#include "MapIO.h"
|
2006-06-02 04:10:27 +02:00
|
|
|
#include "ps/CStr.h"
|
2008-02-04 12:40:42 +01:00
|
|
|
#include "ps/FileIo.h"
|
2004-05-29 22:56:24 +02:00
|
|
|
|
2006-11-24 20:45:04 +01:00
|
|
|
|
2004-07-31 17:57:18 +02:00
|
|
|
class CLightEnv;
|
|
|
|
class CTerrain;
|
|
|
|
class CUnitManager;
|
2006-03-21 21:55:45 +01:00
|
|
|
class CCamera;
|
2006-08-22 04:24:44 +02:00
|
|
|
class CCinemaManager;
|
2006-11-24 20:45:04 +01:00
|
|
|
class CTriggerManager;
|
2006-06-11 09:03:59 +02:00
|
|
|
class WaterManager;
|
2006-06-22 00:37:31 +02:00
|
|
|
class SkyManager;
|
2010-02-08 23:05:05 +01:00
|
|
|
class CSimulation2;
|
|
|
|
class CEntityManager;
|
2006-11-24 20:45:04 +01:00
|
|
|
struct MapTrigger;
|
|
|
|
struct MapTriggerGroup;
|
|
|
|
class XMLWriter_File;
|
2004-07-31 17:57:18 +02:00
|
|
|
|
2004-05-29 22:56:24 +02:00
|
|
|
class CMapWriter : public CMapIO
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
// constructor
|
|
|
|
CMapWriter();
|
|
|
|
// SaveMap: try to save the current map to the given file
|
2009-11-03 22:46:35 +01:00
|
|
|
void SaveMap(const VfsPath& pathname, CTerrain* pTerr, CUnitManager* pUnitMan,
|
2006-11-24 20:45:04 +01:00
|
|
|
WaterManager* pWaterMan, SkyManager* pSkyMan,
|
|
|
|
CLightEnv* pLightEnv, CCamera* pCamera,
|
2010-04-30 01:22:18 +02:00
|
|
|
CCinemaManager* pCinema, CSimulation2* pSimulation2);
|
2004-05-29 22:56:24 +02:00
|
|
|
|
2005-03-29 22:50:04 +02:00
|
|
|
// RewriteAllMaps: for use during development: load/save all maps, to
|
|
|
|
// update them to the newest format.
|
2006-11-24 20:45:04 +01:00
|
|
|
static void RewriteAllMaps(CTerrain* pTerrain, CUnitManager* pUnitMan, WaterManager* pWaterMan,
|
|
|
|
SkyManager* pSkyMan, CLightEnv* pLightEnv, CCamera* pCamera,
|
2010-02-08 23:05:05 +01:00
|
|
|
CCinemaManager* pCinema, CTriggerManager* pTrigMan,
|
|
|
|
CSimulation2* pSimulation2, CEntityManager* pEntityMan);
|
2005-03-29 22:50:04 +02:00
|
|
|
|
2004-05-29 22:56:24 +02:00
|
|
|
private:
|
|
|
|
// PackMap: pack the current world into a raw data stream
|
2006-06-22 00:37:31 +02:00
|
|
|
void PackMap(CFilePacker& packer, CTerrain* pTerrain);
|
2004-05-29 22:56:24 +02:00
|
|
|
// PackTerrain: pack the terrain onto the end of the data stream
|
2006-06-11 09:03:59 +02:00
|
|
|
void PackTerrain(CFilePacker& packer, CTerrain* pTerrain);
|
2004-05-29 22:56:24 +02:00
|
|
|
|
|
|
|
// EnumTerrainTextures: build lists of textures used by map, and indices into this list
|
|
|
|
// for each tile on the terrain
|
2006-06-11 09:03:59 +02:00
|
|
|
void EnumTerrainTextures(CTerrain* pTerrain, std::vector<CStr>& textures,
|
2004-07-31 17:57:18 +02:00
|
|
|
std::vector<STileDesc>& tileIndices);
|
2004-05-29 22:56:24 +02:00
|
|
|
|
2005-01-12 15:31:47 +01:00
|
|
|
// WriteXML: output some other data (entities, etc) in XML format
|
2009-11-03 22:46:35 +01:00
|
|
|
void WriteXML(const VfsPath& pathname, CUnitManager* pUnitMan, WaterManager* pWaterMan,
|
2006-11-24 20:45:04 +01:00
|
|
|
SkyManager* pSkyMan, CLightEnv* pLightEnv, CCamera* pCamera,
|
2010-04-30 01:22:18 +02:00
|
|
|
CCinemaManager* pCinema, CSimulation2* pSimulation2);
|
2010-05-20 20:09:23 +02:00
|
|
|
// void WriteTriggerGroup(XMLWriter_File& xml_file_, const MapTriggerGroup& group,
|
|
|
|
// const std::list<MapTriggerGroup>& groupList);
|
|
|
|
// void WriteTrigger(XMLWriter_File& xml_file_, const MapTrigger& trigger);
|
2004-05-29 22:56:24 +02:00
|
|
|
};
|
|
|
|
|
2004-06-02 17:03:17 +02:00
|
|
|
#endif
|