00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #if !defined (_OPENCITY_MAP_H_)
00021 #define _OPENCITY_MAP_H_ 1
00022
00023 #include "main.h"
00024
00025 #include "persistence.h"
00026
00027 class Layer;
00028
00029
00033 class Map: public Persistence {
00034 public:
00035 Map(
00036 const uint width,
00037 const uint height );
00038
00039 ~Map();
00040
00041
00042
00047 void
00048 SaveTo( std::fstream& rfs );
00049
00050
00051
00056 void
00057 LoadFrom( std::fstream& rfs );
00058
00059
00060
00064 OPENCITY_ERR_CODE
00065 ChangeHeight(
00066 const uint & rcuiW,
00067 const uint & rcuiH,
00068 const OPENCITY_MAP_VARIATION & enumVar );
00069
00070
00071 void
00072 SetLayer(
00073 const Layer* layer );
00074
00075
00076 const OC_BYTE &
00077 GetLinearHeight(
00078 const uint & rcuiIndex ) const;
00079
00080
00081 const uint
00082 GetMaxLinear() const;
00083
00084
00085
00092 void
00093 GetSquareHeight(
00094 const uint & rcuiW,
00095 const uint & rcuiH,
00096 OC_BYTE tabH [] ) const;
00097
00098
00099 const signed char
00100 GetSquareMinHeight(
00101 const uint & rcuiW,
00102 const uint & rcuiL ) const;
00103
00104
00105 const signed char
00106 GetSquareMaxHeight(
00107 const uint & rcuiW,
00108 const uint & rcuiH ) const;
00109
00110
00111 const bool
00112 IsSquarePlane(
00113 const uint & rcuiW,
00114 const uint & rcuiH ) const;
00115
00116
00117 const bool
00118 IsSquareLinearPlane(
00119 const uint & rcuiLinearIndex );
00120
00121
00122
00127 const bool
00128 GetNeighbourWH(
00129 const uint & rcuiMapW,
00130 const uint & rcuiMapH,
00131 uint & ruiNbrW,
00132 uint & ruiNbrH,
00133 const OPENCITY_DIRECTION & enumDir ) const;
00134
00135
00136
00141 void
00142 GetPossibleWH(
00143 uint & rW,
00144 uint & rH,
00145 const int & deltaW,
00146 const int & deltaH ) const;
00147
00148
00149 private:
00150 uint _uiMapWidth;
00151 uint _uiMapHeight;
00152
00153 OC_BYTE* _btabSquareHeight;
00154
00156 const Layer* _pclayer;
00157
00158
00159
00160
00161
00162
00163
00164
00167 void
00168 _Linear2WH(
00169 const uint & linear,
00170 uint & w,
00171 uint & h ) const;
00172
00173
00174
00179 inline uint
00180 _WH2Linear(
00181 const uint & w,
00182 const uint & h,
00183 uint & linear ) const;
00184 };
00185
00186 #endif
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213