2004-05-29 22:56:24 +02:00
|
|
|
#ifndef _MAPWRITER_H
|
|
|
|
#define _MAPWRITER_H
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
#include "MapIO.h"
|
|
|
|
#include "CStr.h"
|
|
|
|
#include "FilePacker.h"
|
|
|
|
|
2004-07-31 17:57:18 +02:00
|
|
|
class CLightEnv;
|
|
|
|
class CTerrain;
|
|
|
|
class CUnitManager;
|
2006-03-21 21:55:45 +01:00
|
|
|
class CCamera;
|
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
|
2006-03-21 21:55:45 +01:00
|
|
|
void SaveMap(const char* filename, CTerrain *pTerr, CUnitManager *pUnitMan, CLightEnv *pLightEnv, CCamera *pCamera);
|
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-03-21 21:55:45 +01:00
|
|
|
static void RewriteAllMaps(CTerrain *pTerrain, CUnitManager *pUnitMan, CLightEnv *pLightEnv, CCamera *pCamera);
|
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-03-21 21:55:45 +01:00
|
|
|
void PackMap(CFilePacker& packer, CTerrain *pTerr, CUnitManager *pUnitMan, CLightEnv *pLightEnv);
|
2004-05-29 22:56:24 +02:00
|
|
|
// PackTerrain: pack the terrain onto the end of the data stream
|
2004-07-31 17:57:18 +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
|
2004-07-31 17:57:18 +02:00
|
|
|
void EnumTerrainTextures(CTerrain *pTerrain, std::vector<CStr>& textures,
|
|
|
|
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
|
2006-03-21 21:55:45 +01:00
|
|
|
void WriteXML(const char* filename, CUnitManager* pUnitMan, CLightEnv *pLightEnv, CCamera *pCamera);
|
2004-05-29 22:56:24 +02:00
|
|
|
};
|
|
|
|
|
2004-06-02 17:03:17 +02:00
|
|
|
#endif
|