| 187 | } |
| 188 | |
| 189 | void PositionToAA11(Vector3Val pos, char* buffer) |
| 190 | { |
| 191 | float sizeLand = LandGrid * LandRange; |
| 192 | |
| 193 | const GridInfo* info = GWorld->GetGridInfo(0); |
| 194 | if (!info) |
| 195 | { |
| 196 | return; |
| 197 | } |
| 198 | |
| 199 | float offsetX = GWorld->GetGridOffsetX(); |
| 200 | float offsetY = GWorld->GetGridOffsetY(); |
| 201 | |
| 202 | *buffer = 0; |
| 203 | for (const char* p = info->format; *p != 0; p++) |
| 204 | { |
| 205 | if (*p == 'X' || *p == 'x') |
| 206 | { |
| 207 | float coefX = sizeLand * info->invStepX; |
| 208 | int x = TO_INT(coefX, (pos.X() - offsetX) * info->invStepX); |
| 209 | BString<32> buf; |
| 210 | GridFormat(buf, info->formatX, coefX >= 0 ? x : x - 1); |
| 211 | strcat(buffer, buf); |
| 212 | } |
| 213 | else if (*p == 'Y' || *p == 'y') |
| 214 | { |
| 215 | float coefY = sizeLand * info->invStepX; |
| 216 | int y = TO_INT(coefY, (sizeLand - pos.Z() - offsetY) * info->invStepY); |
| 217 | BString<32> buf; |
| 218 | GridFormat(buf, info->formatY, coefY >= 0 ? y : y - 1); |
| 219 | strcat(buffer, buf); |
| 220 | } |
| 221 | else |
| 222 | { |
| 223 | AddChar(buffer, *p); |
| 224 | } |
| 225 | } |
| 226 | } |
| 227 | |
| 228 | void MapTypeInfo::Load(const ParamEntry& cls) |
| 229 | { |
no test coverage detected