#include <zone_search.h>
Inheritance diagram for NL3D::CZoneSearch:
Nevrax France
Definition at line 44 of file zone_search.h.
Public Member Functions | |
CZoneSearch () | |
Constructor. | |
void | getListZoneId (uint x, uint y, uint sizeArea, std::vector< uint16 > &l) |
void | getListZoneName (uint x, uint y, uint sizeArea, std::list< std::pair< std::string, uint32 > > &l) |
uint16 | getZoneId (uint x, uint y) const |
std::pair< std::string, uint32 > | getZoneName (uint x, uint y, uint cx, uint cy) |
std::string | getZoneNameFromId (uint16 zoneid) |
void | getZonePos (uint16 zoneId, uint &x, uint &y) const |
Private Attributes | |
uint | _NbZoneX |
uint | _NbZoneY |
Number zones on Y axis of landscape. | |
uint | _SizeZoneX |
uint | _SizeZoneY |
|
Constructor. Constructor : Initialize some privates members Size X is named of AA to ZZ, current size is IB = 26 * 8 + 2 (AA is zone number 1, AZ zone number 26, BA zone number 27...) Number zones on Y axis of landscape Size X of one zone (in meters) Size X of one zone (in meters) Definition at line 43 of file zone_search.cpp. References _NbZoneX, _NbZoneY, _SizeZoneX, and _SizeZoneY.
00044 { 00046 _NbZoneX = 26 * 8 + 2; 00047 00049 _NbZoneY = 297; 00050 00052 _SizeZoneX = 160; 00053 00055 _SizeZoneY = 160; 00056 } |
|
Definition at line 158 of file zone_search.cpp. References _NbZoneX, _NbZoneY, _SizeZoneX, _SizeZoneY, getZoneId(), sint, uint, x, and y. Referenced by NL3D::CZoneManager::checkZonesAround().
00159 { 00160 sint startPosX, startPosY; 00161 uint lastPosX, lastPosY, sizeAreaX, sizeAreaY; 00162 00163 startPosX = x - sizeArea; 00164 startPosY = y - sizeArea; 00165 00166 sizeArea += sizeArea; 00167 sizeAreaX = sizeAreaY = sizeArea; 00168 00169 if(startPosX < 0) 00170 { 00171 sizeAreaX += startPosX; 00172 startPosX = 0; 00173 } 00174 00175 lastPosX = startPosX + sizeAreaX; 00176 if(lastPosX >= (_NbZoneX * _SizeZoneX)) 00177 { 00178 sizeAreaX -= _NbZoneX * _SizeZoneX - lastPosX; 00179 lastPosX = _NbZoneX * _SizeZoneX - 1; 00180 } 00181 00182 if(startPosY < 0) 00183 { 00184 sizeAreaY += startPosY; 00185 startPosY = 0; 00186 } 00187 00188 lastPosY = startPosY + sizeAreaY; 00189 if(lastPosY >= (_NbZoneY * _SizeZoneY)) 00190 { 00191 sizeAreaY -= _NbZoneY * _SizeZoneY - lastPosY; 00192 lastPosY = _NbZoneY * _SizeZoneY - 1; 00193 } 00194 00195 l.clear(); 00196 00197 for(uint i = startPosY; i <= lastPosY; i += _SizeZoneY) 00198 { 00199 for(uint j = startPosX; j <= lastPosX; j += _SizeZoneX) 00200 { 00201 l.push_back(getZoneId(j, i)); 00202 } 00203 } 00204 } |
|
Definition at line 96 of file zone_search.cpp. References _NbZoneX, _NbZoneY, _SizeZoneX, _SizeZoneY, getZoneName(), sint, uint, x, and y.
00097 { 00098 sint startPosX, startPosY; 00099 uint lastPosX, lastPosY, sizeAreaX, sizeAreaY; 00100 00101 startPosX = x - sizeArea; 00102 startPosY = y - sizeArea; 00103 00104 sizeArea += sizeArea; 00105 sizeAreaX = sizeAreaY = sizeArea; 00106 00107 if(startPosX < 0) 00108 { 00109 sizeAreaX += startPosX; 00110 startPosX = 0; 00111 } 00112 00113 lastPosX = startPosX + sizeAreaX; 00114 if(lastPosX >= (_NbZoneX * _SizeZoneX)) 00115 { 00116 sizeAreaX -= _NbZoneX * _SizeZoneX - lastPosX; 00117 lastPosX = _NbZoneX * _SizeZoneX - 1; 00118 } 00119 00120 if(startPosY < 0) 00121 { 00122 sizeAreaY += startPosY; 00123 startPosY = 0; 00124 } 00125 00126 lastPosY = startPosY + sizeAreaY; 00127 if(lastPosY >= (_NbZoneY * _SizeZoneY)) 00128 { 00129 sizeAreaY -= _NbZoneY * _SizeZoneY - lastPosY; 00130 lastPosY = _NbZoneY * _SizeZoneY - 1; 00131 } 00132 00133 l.clear(); 00134 00135 for(uint i = startPosY; i <= lastPosY; i += _SizeZoneY) 00136 { 00137 for(uint j = startPosX; j <= lastPosX; j += _SizeZoneX) 00138 { 00139 l.push_back(getZoneName(j, i, x, y)); 00140 } 00141 } 00142 } |
|
Definition at line 144 of file zone_search.cpp. References _SizeZoneX, _SizeZoneY, uint, uint16, x, and y. Referenced by getListZoneId().
00145 { 00146 uint zoneY = y / _SizeZoneY; 00147 uint zoneX = x / _SizeZoneX; 00148 00149 return (zoneX&255)+(zoneY<<8); 00150 } |
|
Get the zone name corresponding to coordinate
Definition at line 67 of file zone_search.cpp. References _SizeZoneX, _SizeZoneY, uint, uint32, x, and y. Referenced by getListZoneName(), and NL3D::CLandscapeUser::getZoneName().
00068 { 00069 char name[13]; 00070 00071 uint zoneY = y / _SizeZoneY + 1; 00072 uint zoneX = x / _SizeZoneX; 00073 00074 uint zoneCenterY = cy / _SizeZoneY + 1; 00075 uint zoneCenterX = cx / _SizeZoneX; 00076 00077 uint32 distance = (zoneX - zoneCenterX) * (zoneX - zoneCenterX) + (zoneY - zoneCenterY) * (zoneY - zoneCenterY); 00078 00079 char firstLetter = zoneX / 26 + 'A'; 00080 char secondLetter = zoneX % 26 + 'A'; 00081 00082 sprintf(name, "%d_%c%c.zonel", zoneY, firstLetter, secondLetter); 00083 00084 return make_pair<string, uint32>(string(name), distance); 00085 } |
|
Definition at line 206 of file zone_search.cpp. References sint, uint16, x, and y. Referenced by NL3D::CZoneManager::checkZonesAround(), and NL3D::CZoneManager::isWorkComplete().
|
|
Definition at line 152 of file zone_search.cpp. References _SizeZoneY, uint, uint16, x, and y. Referenced by NL3D::CZoneManager::checkZonesAround().
00153 { 00154 x = _SizeZoneY*(zoneId&255); 00155 y = _SizeZoneY*(zoneId>>8); 00156 } |
|
Definition at line 78 of file zone_search.h. Referenced by CZoneSearch(), getListZoneId(), and getListZoneName(). |
|
Number zones on Y axis of landscape.
Definition at line 81 of file zone_search.h. Referenced by CZoneSearch(), getListZoneId(), and getListZoneName(). |
|
Definition at line 84 of file zone_search.h. Referenced by CZoneSearch(), getListZoneId(), getListZoneName(), getZoneId(), and getZoneName(). |
|
Definition at line 87 of file zone_search.h. Referenced by CZoneSearch(), getListZoneId(), getListZoneName(), getZoneId(), getZoneName(), and getZonePos(). |