SBSPSS/Utils/MapEdit/Map.h

71 lines
1.3 KiB
C
Raw Normal View History

2000-11-02 16:46:17 +01:00
/******************/
/*** Map Stuph ***/
/*****************/
#ifndef __MAP_HEADER__
#define __MAP_HEADER__
#include <Vector>
struct sMapElem
{
2000-11-15 22:22:40 +01:00
int Set;
2000-11-02 16:46:17 +01:00
int Tile;
int Flags;
};
2000-11-17 00:08:54 +01:00
enum
{
MapElemFlagMirrorX= 1<<0,
MapElemFlagMirrorY= 1<<1,
};
2000-11-02 16:46:17 +01:00
/*****************************************************************************/
class CMap
{
public:
CMap(){};
~CMap(){};
2000-11-17 22:36:13 +01:00
int GetWidth();
int GetHeight();
BOOL IsValid() {return(GetHeight());}
2000-11-02 16:46:17 +01:00
2000-11-15 22:22:40 +01:00
void SetSize(int Width,int Height,BOOL Clear=FALSE);
2000-11-03 23:40:41 +01:00
void SetWidth(int Width);
void SetHeight(int Height);
2000-11-15 22:22:40 +01:00
void Clear();
2000-11-17 22:36:13 +01:00
void Delete();
void MirrorX(int Flag);
void MirrorY(int Flag);
2000-11-03 23:40:41 +01:00
2000-11-17 22:36:13 +01:00
sMapElem &Get(int X,int Y);
void Set(int X,int Y,sMapElem &Blk);
void Set(int X,int Y,CMap &Blk);
void Set(CMap &Src,int StartX,int StartY,int Width,int Height);
2000-11-20 17:21:43 +01:00
void Resize(int Width,int Height);
2000-11-17 22:36:13 +01:00
BOOL DoesContainTile(sMapElem &Tile);
2000-11-20 21:33:42 +01:00
void Load(CFile *File,float Version);
void Save(CFile *File);
2000-11-17 22:36:13 +01:00
inline void operator=(CMap &Src)
{
int Width=Src.GetWidth();
int Height=Src.GetHeight();
Delete();
SetSize(Width,Height);
Set(Src,0,0,Width,Height);
}
2000-11-02 16:46:17 +01:00
protected:
std::vector< std::vector<sMapElem> > Map;
};
/*****************************************************************************/
#endif