1 /* -*- Mode: C++; c-basic-offset: 2; tab-width: 2; indent-tabs-mode: nil -*-
2  *
3  * Quadra, an action puzzle game
4  * Copyright (C) 1998-2000  Ludus Design
5  * Copyright (C) 2006 Pierre Phaneuf <pphaneuf@users.sourceforge.net>
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20  */
21 
22 #ifndef _HEADER_CFGFILE
23 #define _HEADER_CFGFILE
24 
25 #include <time.h>
26 #include "types.h"
27 
28 class Config {
29 	int version;
30 public:
31 	const static int game_version;
32 	static int net_version;
33 	const static int major, minor, patchlevel;
34 	static char user_name[];
35 	int warning;
36 	/*
37    * WARNING: Everything in the following structs is pretty much set
38    *          in stone. A full understanding of cfgfile.cpp is needed
39    *          to change anything.
40    */
41 	struct {
42 		int xlanguage;
43 		int setup_player, cdmusic;
44 		Byte multi_level, unlock_theme;
45 		int port_number, mouse_speed;
46 		Byte pane[3];
47 		Byte update_rate;
48 		char book[10][256];
49 		char game_name[32];
50 		char game_server_address[256];
51 		int game_type, level_up, level_start, combo_min, game_end, game_end_value, game_public;
52 	} info;
53 	struct {
54 		char name[40];
55 		int color, shadow, smooth, repeat;
56 		int key[5];
57 	} player[3];
58 	//The 'stuff' things are for future expansion
59 	struct {
60 		int handicap;
61 		char ngPasswd[64];
62 		char ngTeam[40];
63 		char filler1[24];
64 		char ngTeamPasswd[64];
65 		int key[2];
66 		int h_repeat, v_repeat;
67 		int continuous;
68 		int whole_bunch_of_stuff[11];
69 	} player2[3];
70 	struct {
71 		char proxy_address[128];
72 	} info2;
73   struct {
74     time_t last_update;
75     char last_modified[64];
76     char default_game_server_address[256];
77     char latest_version[256];
78   } info3;
79 	char fname[1024];
80 	Config();
81 	virtual ~Config();
82 	void default_config();
83 	void read();
84 	void write();
85 
86 	//Get the hash value for a player
87 	void get_player_hash(Byte* buf, unsigned qplayer);
88 	//Get the hash value for a player's team
89 	void get_team_hash(Byte* buf, unsigned qplayer);
90 };
91 
92 extern Config config;
93 
94 #endif
95