[dad864]: / map.h  Maximize  Restore  History

Download this file

134 lines (119 with data), 2.3 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
// map.h: interface for the Cmap class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_MAP_H__765880D8_0353_4668_B610_58432EB8A1A2__INCLUDED_)
#define AFX_MAP_H__765880D8_0353_4668_B610_58432EB8A1A2__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
class Cmap
{
private:
int fhandle;
long startpoint;
long maxlen;
long fullsize;
public:
map_mainheader mainheader;
map_header *headers;
map_area **areas;
map_arealink **arealinks;
int mapcount;
int *areacount;
int *linkcount;
Cmap();
virtual ~Cmap();
int adjust_actpoint(long offset);
int WriteMapToFile(int fh, int calculate);
int ReadMapFromFile(int fh, long ml);
inline void KillAreas()
{
int i;
if(areas)
{
for(i=0;i<mapcount;i++)
{
if(areas[i])
{
delete [] areas[i];
areas[i]=NULL;
}
if(areacount) areacount[i]=0;
}
delete [] areas;
areas=NULL;
}
if(areacount)
{
delete [] areacount;
areacount=NULL;
}
}
inline void KillAreas(int map)
{
if(areas)
{
if(areas[map])
{
delete [] areas[map];
areas[map]=NULL;
}
if(areacount) areacount[map]=0;
}
}
inline void KillAreaLinks()
{
int i;
if(arealinks)
{
for(i=0;i<mapcount;i++)
{
if(arealinks[i])
{
delete [] arealinks[i];
arealinks[i]=NULL;
}
if(linkcount) linkcount[i]=0;
}
delete [] arealinks;
arealinks=NULL;
}
if(linkcount)
{
delete [] linkcount;
linkcount=NULL;
}
}
inline void KillAreaLinks(int map)
{
if(arealinks)
{
if(arealinks[map])
{
delete [] arealinks[map];
arealinks[map]=NULL;
}
if(linkcount) linkcount[map]=0;
}
}
inline void KillMaps()
{
KillAreas();
KillAreaLinks();
if(headers)
{
delete [] headers;
headers=NULL;
mapcount=0;
}
}
inline long myseek(long pos)
{
return lseek(fhandle, pos+startpoint,SEEK_SET)-startpoint;
}
inline long actpoint()
{
return tell(fhandle)-startpoint;
}
};
#endif // !defined(AFX_MAP_H__765880D8_0353_4668_B610_58432EB8A1A2__INCLUDED_)