Added aqua_speed for rite geo 50 tryker
[ryzomcore.git] / nel / tools / 3d / get_neighbors / main.cpp
blob742fc34e525f2e48d10156ff89585df20cc52ccc
1 // NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
2 // Copyright (C) 2010 Winch Gate Property Limited
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
17 #include <stdio.h>
18 #include <stdlib.h>
19 #include <string.h>
20 #include <ctype.h>
23 void nameToXY(const char *str, int &x, int &y)
25 if (strchr(str, '_') == NULL)
27 fprintf(stderr, "invalid zone name %s\n", str);
28 abort();
31 x = 0;
32 y = 0;
34 while (*str != '_')
35 y = y*10 + *(str++)-'0';
36 y--;
38 ++str;
40 x = (toupper(str[0])-'A')*26+(toupper(str[1])-'A');
43 void XYToName(int x, int y, char *str)
45 sprintf(str,"%d_%c%c ", y+1, 'A'+x/26, 'A'+x%26);
48 int main(int argc, char **argv)
50 if (argc != 2)
52 fprintf(stderr, "invalid usage\n");
53 abort();
56 char dump[128];
57 char output[256];
59 output[0] = '\0';
61 int x, y;
62 nameToXY(argv[1], x, y);
64 int i, j;
66 for (i=-1; i<=1; ++i)
68 for (j=-1; j<=1; ++j)
70 XYToName(x+i, y+j, dump);
71 strcat(output, dump);
75 fprintf(stdout, "%s", output);
77 return 0;