version 1.36 | | version 1.37 |
---|
| | |
/* | | /* |
* static char *rcsid_weather_c = | | * static char *rcsid_weather_c = |
* "$Id: weather.c,v 1.36 2005/03/24 21:07:47 tchize Exp $"; | | * "$Id: weather.c,v 1.37 2005/04/14 19:15:42 ryo_saeba Exp $"; |
*/ | | */ |
/* | | /* |
CrossFire, A Multiplayer game for X-windows | | CrossFire, A Multiplayer game for X-windows |
| | |
{ | | { |
int x, y, tx, ty, nx, ny, ax, ay, j; | | int x, y, tx, ty, nx, ny, ax, ay, j; |
int spwtx, spwty; | | int spwtx, spwty; |
char *mapname; | | const char *mapname; |
long int elev; | | long int elev; |
int water, space; | | int water, space; |
mapstruct *m; | | mapstruct *m; |
| | |
* value is the name of the map that corner resides in. | | * value is the name of the map that corner resides in. |
*/ | | */ |
| | |
char *weathermap_to_worldmap_corner(int wx, int wy, int *x, int *y, int dir) | | const char *weathermap_to_worldmap_corner(int wx, int wy, int *x, int *y, int dir) |
{ | | { |
int spwtx, spwty; | | int spwtx, spwty; |
int tx, ty, nx, ny; | | int tx, ty, nx, ny; |
char *mapname; | | static char mapname[ MAX_BUF ]; |
| | |
spwtx = (settings.worldmaptilesx * settings.worldmaptilesizex) / WEATHERMAPTILESX; | | spwtx = (settings.worldmaptilesx * settings.worldmaptilesizex) / WEATHERMAPTILESX; |
spwty = (settings.worldmaptilesy * settings.worldmaptilesizey) / WEATHERMAPTILESY; | | spwty = (settings.worldmaptilesy * settings.worldmaptilesizey) / WEATHERMAPTILESY; |
| | |
| | |
nx = (tx / settings.worldmaptilesizex) + settings.worldmapstartx; | | nx = (tx / settings.worldmaptilesizex) + settings.worldmapstartx; |
ny = (ty / settings.worldmaptilesizey) + settings.worldmapstarty; | | ny = (ty / settings.worldmaptilesizey) + settings.worldmapstarty; |
mapname = malloc(sizeof(char) * strlen("world/world_0000_0000")); | | snprintf(mapname, MAX_BUF, "world/world_%d_%d", nx, ny); |
sprintf(mapname, "world/world_%d_%d", nx, ny); | | |
| | |
*x = tx%settings.worldmaptilesizex; | | *x = tx%settings.worldmaptilesizex; |
*y = ty%settings.worldmaptilesizey; | | *y = ty%settings.worldmaptilesizey; |
return(mapname); | | return mapname; |
} | | } |
| | |
/* | | /* |