--- cf.schmorp.de/server/random_maps/decor.C 2006/12/31 19:02:23 1.8 +++ cf.schmorp.de/server/random_maps/decor.C 2007/01/27 02:19:37 1.13 @@ -1,26 +1,26 @@ - /* - CrossFire, A Multiplayer game for X-windows - - Copyright (C) 2002 Mark Wedel & Crossfire Development Team - Copyright (C) 1992 Frank Tore Johansen - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - - The authors can be reached via e-mail at -*/ + * CrossFire, A Multiplayer game for X-windows + * + * Copyright (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team + * Copyright (C) 2002 Mark Wedel & Crossfire Development Team + * Copyright (C) 1992 Frank Tore Johansen + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * The authors can be reached via e-mail at + */ #include @@ -48,23 +48,25 @@ put_decor (maptile *map, char **maze, char *decorstyle, int decor_option, random_map_params *RP) { maptile *decor_map; - char style_name[256]; + char style_name[1024]; sprintf (style_name, "/styles/decorstyles"); decor_map = find_style (style_name, decorstyle, -1); - if (decor_map == NULL) + if (!decor_map) return; + /* pick a random option, only 1 option right now. */ if (decor_option == 0) - decor_option = RANDOM () % NR_DECOR_OPTIONS + 1; + decor_option = rndm (NR_DECOR_OPTIONS) + 1; + switch (decor_option) { case 0: break; case 1: { /* random placement of decor objects. */ - int number_to_place = RANDOM () % ((RP->Xsize * RP->Ysize) / 5); + int number_to_place = rndm (RP->Xsize * RP->Ysize / 5); int failures = 0; object *new_decor_object; @@ -72,8 +74,8 @@ { int x, y; - x = RANDOM () % (RP->Xsize - 2) + 1; - y = RANDOM () % (RP->Ysize - 2) + 1; + x = rndm (RP->Xsize - 2) + 1; + y = rndm (RP->Ysize - 2) + 1; if (maze[x][y] == 0 && obj_count_in_map (map, x, y) < 2) { /* empty */ object *this_object;