char *rcsid_gtk2_config_c = "$Id: config.c,v 1.2 2005/03/22 07:23:00 mwedel Exp $"; /* Crossfire client, a client program for the crossfire program. Copyright (C) 2005 Mark Wedel & Crossfire Development Team 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 author can be reached via e-mail to crossfire@metalforge.org */ /* This file is here to cover configuration issues. */ #ifdef HAVE_CONFIG_H # include #endif #include #include #include "client.h" #include "interface.h" #include "support.h" #include "main.h" #include "image.h" #include "gtk2proto.h" void load_defaults() { char path[MAX_BUF],inbuf[MAX_BUF],*cp; FILE *fp; int i, val; /* Copy over the want values to use values now */ for (i=0; i200) { LOG(LOG_WARNING,"gtk::load_defaults","Ignoring iconscale value read for gdefaults2 file.\n" "Invalid iconscale range (%d), valid range for -iconscale is 25 through 200", want_config[CONFIG_ICONSCALE]); want_config[CONFIG_ICONSCALE] = use_config[CONFIG_ICONSCALE]; } if (want_config[CONFIG_MAPSCALE]< 25 || want_config[CONFIG_MAPSCALE]>200) { LOG(LOG_WARNING,"gtk::load_defaults","ignoring mapscale value read for gdefaults2 file.\n" "Invalid mapscale range (%d), valid range for -iconscale is 25 through 200", want_config[CONFIG_MAPSCALE]); want_config[CONFIG_MAPSCALE] = use_config[CONFIG_MAPSCALE]; } if (!want_config[CONFIG_LIGHTING]) { LOG(LOG_WARNING,"gtk::load_defaults","No lighting mechanism selected - will not use darkness code"); want_config[CONFIG_DARKNESS] = FALSE; } if (want_config[CONFIG_RESISTS] > 2) { LOG(LOG_WARNING,"gtk::load_defaults","ignoring resists display value read for gdafaults file.\n" "Invalid value (%d), must be one value of 0,1 or 2.", want_config[CONFIG_RESISTS]); want_config[CONFIG_RESISTS] = 0; } /* Make sure the map size os OK */ if (want_config[CONFIG_MAPWIDTH] < 9 || want_config[CONFIG_MAPWIDTH] > MAP_MAX_SIZE) { LOG(LOG_WARNING,"gtk::load_defaults", "Invalid map width (%d) option in gdefaults2. Valid range is 9 to %d", want_config[CONFIG_MAPWIDTH], MAP_MAX_SIZE); want_config[CONFIG_MAPWIDTH] = use_config[CONFIG_MAPWIDTH]; } if (want_config[CONFIG_MAPHEIGHT] < 9 || want_config[CONFIG_MAPHEIGHT] > MAP_MAX_SIZE) { LOG(LOG_WARNING,"gtk::load_defaults", "Invalid map height (%d) option in gdefaults2. Valid range is 9 to %d", want_config[CONFIG_MAPHEIGHT], MAP_MAX_SIZE); want_config[CONFIG_MAPHEIGHT] = use_config[CONFIG_MAPHEIGHT]; } /* Now copy over the values just loaded */ for (i=0; i