webperimental: killstack decides stack protects.
[freeciv.git] / client / gui-stub / gui_main.c
blob3e296be4429d97ffcb1b208b94d7730a8b38dc63
1 /***********************************************************************
2 Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2, or (at your option)
6 any later version.
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12 ***********************************************************************/
14 #ifdef HAVE_CONFIG_H
15 #include <fc_config.h>
16 #endif
18 #include <stdio.h>
20 /* utility */
21 #include "fc_cmdline.h"
22 #include "fciconv.h"
23 #include "log.h"
25 /* gui main header */
26 #include "gui_stub.h"
28 /* client */
29 #include "gui_cbsetter.h"
30 #include "client_main.h"
31 #include "editgui_g.h"
32 #include "options.h"
34 #include "gui_main.h"
36 const char *client_string = "gui-stub";
38 const char * const gui_character_encoding = "UTF-8";
39 const bool gui_use_transliteration = FALSE;
41 /****************************************************************************
42 Called by the tileset code to set the font size that should be used to
43 draw the city names and productions.
44 ****************************************************************************/
45 void gui_set_city_names_font_sizes(int my_city_names_font_size,
46 int my_city_productions_font_size)
48 log_error("Unimplemented set_city_names_font_sizes.");
49 /* PORTME */
52 /**************************************************************************
53 Do any necessary pre-initialization of the UI, if necessary.
54 **************************************************************************/
55 void gui_ui_init(void)
57 /* PORTME */
60 /**************************************************************************
61 Entry point for whole freeciv client program.
62 **************************************************************************/
63 int main(int argc, char **argv)
65 setup_gui_funcs();
66 return client_main(argc, argv);
69 /**************************************************************************
70 Print extra usage information, including one line help on each option,
71 to stderr.
72 **************************************************************************/
73 static void print_usage(const char *argv0)
75 /* PORTME */
76 /* add client-specific usage information here */
77 fc_fprintf(stderr,
78 _("This client has no special command line options\n\n"));
80 /* TRANS: No full stop after the URL, could cause confusion. */
81 fc_fprintf(stderr, _("Report bugs at %s\n"), BUG_URL);
84 /**************************************************************************
85 Parse and enact any client-specific options.
86 **************************************************************************/
87 static void parse_options(int argc, char **argv)
89 int i = 1;
91 while (i < argc) {
92 if (is_option("--help", argv[i])) {
93 print_usage(argv[0]);
94 exit(EXIT_SUCCESS);
95 } else {
96 fc_fprintf(stderr, _("Unrecognized option: \"%s\"\n"), argv[i]);
97 exit(EXIT_FAILURE);
100 i++;
104 /**************************************************************************
105 The main loop for the UI. This is called from main(), and when it
106 exits the client will exit.
107 **************************************************************************/
108 void gui_ui_main(int argc, char *argv[])
110 parse_options(argc, argv);
112 /* PORTME */
113 fc_fprintf(stderr, "Freeciv rules!\n");
115 /* Main loop here */
117 start_quitting();
120 /****************************************************************************
121 Extra initializers for client options.
122 ****************************************************************************/
123 void gui_options_extra_init(void)
125 /* Nothing to do. */
128 /**************************************************************************
129 Do any necessary UI-specific cleanup
130 **************************************************************************/
131 void gui_ui_exit()
133 /* PORTME */
136 /**************************************************************************
137 Return our GUI type
138 **************************************************************************/
139 enum gui_type gui_get_gui_type(void)
141 return GUI_STUB;
144 /**************************************************************************
145 Update the connected users list at pregame state.
146 **************************************************************************/
147 void gui_real_conn_list_dialog_update(void)
149 /* PORTME */
152 /**************************************************************************
153 Make a bell noise (beep). This provides low-level sound alerts even
154 if there is no real sound support.
155 **************************************************************************/
156 void gui_sound_bell(void)
158 /* PORTME */
161 /**************************************************************************
162 Wait for data on the given socket. Call input_from_server() when data
163 is ready to be read.
165 This function is called after the client succesfully has connected
166 to the server.
167 **************************************************************************/
168 void gui_add_net_input(int sock)
170 /* PORTME */
173 /**************************************************************************
174 Stop waiting for any server network data. See add_net_input().
176 This function is called if the client disconnects from the server.
177 **************************************************************************/
178 void gui_remove_net_input(void)
180 /* PORTME */
183 /**************************************************************************
184 Set one of the unit icons (specified by idx) in the information area
185 based on punit.
187 punit is the unit the information should be taken from. Use NULL to
188 clear the icon.
190 idx specified which icon should be modified. Use idx == -1 to indicate
191 the icon for the active unit. Or idx in [0..num_units_below - 1] for
192 secondary (inactive) units on the same tile.
193 **************************************************************************/
194 void gui_set_unit_icon(int idx, struct unit *punit)
196 /* PORTME */
199 /**************************************************************************
200 Most clients use an arrow (e.g., sprites.right_arrow) to indicate when
201 the units_below will not fit. This function is called to activate or
202 deactivate the arrow.
204 Is disabled by default.
205 **************************************************************************/
206 void gui_set_unit_icons_more_arrow(bool onoff)
208 /* PORTME */
211 /****************************************************************************
212 Called when the set of units in focus (get_units_in_focus()) changes.
213 Standard updates like update_unit_info_label() are handled in the platform-
214 independent code, so some clients will not need to do anything here.
215 ****************************************************************************/
216 void gui_real_focus_units_changed(void)
218 /* PORTME */
221 /****************************************************************************
222 Enqueue a callback to be called during an idle moment. The 'callback'
223 function should be called sometimes soon, and passed the 'data' pointer
224 as its data.
225 ****************************************************************************/
226 void gui_add_idle_callback(void (callback)(void *), void *data)
228 /* PORTME */
230 /* This is a reasonable fallback if it's not ported. */
231 log_error("Unimplemented add_idle_callback.");
232 (callback)(data);
235 /****************************************************************************
236 Stub for editor function
237 ****************************************************************************/
238 void gui_editgui_tileset_changed(void)
241 /****************************************************************************
242 Stub for editor function
243 ****************************************************************************/
244 void gui_editgui_refresh(void)
247 /****************************************************************************
248 Stub for editor function
249 ****************************************************************************/
250 void gui_editgui_popup_properties(const struct tile_list *tiles, int objtype)
253 /****************************************************************************
254 Stub for editor function
255 ****************************************************************************/
256 void gui_editgui_popdown_all(void)
259 /****************************************************************************
260 Stub for editor function
261 ****************************************************************************/
262 void gui_editgui_notify_object_changed(int objtype, int object_id, bool removal)
265 /****************************************************************************
266 Stub for editor function
267 ****************************************************************************/
268 void gui_editgui_notify_object_created(int tag, int id)
271 /**************************************************************************
272 Updates a gui font style.
273 **************************************************************************/
274 void gui_gui_update_font(const char *font_name, const char *font_value)
276 /* PORTME */
279 /**************************************************************************
280 Insert build information to help
281 **************************************************************************/
282 void gui_insert_client_build_info(char *outbuf, size_t outlen)
284 /* PORTME */
287 /**************************************************************************
288 Make dynamic adjustments to first-launch default options.
289 **************************************************************************/
290 void gui_adjust_default_options(void)
292 /* Nothing in case of this gui */