SBSPSS/Utils/MapEdit/Map.h

82 lines
1.5 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-12-01 22:08:54 +01:00
BOOL operator==(sMapElem const &v1) // Doesnt Check flags
{
return(Set==v1.Set && Tile==v1.Tile);
}
2000-11-02 16:46:17 +01:00
};
2000-11-17 00:08:54 +01:00
enum
{
MapElemFlagMirrorX= 1<<0,
MapElemFlagMirrorY= 1<<1,
};
2000-11-02 16:46:17 +01:00
/*****************************************************************************/
2000-12-06 20:29:40 +01:00
class CFile;
class CPoint;
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);
2000-11-29 18:07:57 +01:00
void Set(int X,int Y,sMapElem &Blk,BOOL Force=FALSE);
void Set(int X,int Y,CMap &Blk,BOOL Force=FALSE);
void Set(CMap &Src,int StartX,int StartY,int Width,int Height,BOOL Force=FALSE);
2000-11-17 22:36:13 +01:00
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-29 18:07:57 +01:00
void DeleteSet(int Set);
void RemapSet(int Old,int New);
2000-11-20 21:33:42 +01:00
2000-12-11 22:29:59 +01:00
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