1 /* ---------------------------------------------------------------------- *
2  * ldsvgui.c
3  * This file is part of lincity.
4  * Lincity is copyright (c) I J Peters 1995-1997, (c) Greg Sharp 1997-2001.
5  * ---------------------------------------------------------------------- */
6 #include "lcconfig.h"
7 #include <stdio.h>
8 #include <stdlib.h>
9 #include "lcstring.h"
10 #include "ldsvgui.h"
11 #include "lcintl.h"
12 #include "screen.h"
13 #include "pbar.h"
14 #include "module_buttons.h"
15 #include "fileutil.h"
16 
17 /* this is for OS/2 - RVI */
18 #ifdef __EMX__
19 #include <sys/select.h>
20 #include <X11/Xlibint.h>      /* required for __XOS2RedirRoot */
21 #define chown(x,y,z)
22 #define OS2_DEFAULT_LIBDIR "/XFree86/lib/X11/lincity"
23 #endif
24 
25 #include <sys/types.h>
26 #include <sys/stat.h>
27 #include <fcntl.h>
28 
29 #if defined (TIME_WITH_SYS_TIME)
30 #include <time.h>
31 #include <sys/time.h>
32 #else
33 #if defined (HAVE_SYS_TIME_H)
34 #include <sys/time.h>
35 #else
36 #include <time.h>
37 #endif
38 #endif
39 
40 #if defined (WIN32)
41 #include <winsock.h>
42 #if defined (__BORLANDC__)
43 #include <dir.h>
44 #include <dirent.h>
45 #include <dos.h>
46 #endif
47 #include <io.h>
48 #include <direct.h>
49 #include <process.h>
50 #endif
51 
52 #if defined (HAVE_DIRENT_H)
53 #include <dirent.h>
54 #define NAMLEN(dirent) strlen((dirent)->d_name)
55 #else
56 #define dirent direct
57 #define NAMLEN(dirent) (dirent)->d_namlen
58 #if defined (HAVE_SYS_NDIR_H)
59 #include <sys/ndir.h>
60 #endif
61 #if defined (HAVE_SYS_DIR_H)
62 #include <sys/dir.h>
63 #endif
64 #if defined (HAVE_NDIR_H)
65 #include <ndir.h>
66 #endif
67 #endif
68 
69 #include <ctype.h>
70 #include "common.h"
71 #ifdef LC_X11
72 #include <X11/cursorfont.h>
73 #endif
74 #include "lctypes.h"
75 #include "lin-city.h"
76 #include "cliglobs.h"
77 #include "engglobs.h"
78 #include "ldsvguts.h"
79 #include "fileutil.h"
80 #include "mouse.h"
81 #include "stats.h"
82 
83 /* ---------------------------------------------------------------------- *
84  * Private Fn Prototypes
85  * ---------------------------------------------------------------------- */
86 int verify_city (char *cname);
87 void input_network_host (char *s);
88 void input_network_port (char *s);
89 
90 /* ---------------------------------------------------------------------- *
91  * Private Global Variables
92  * ---------------------------------------------------------------------- */
93 #if defined (WIN32)
94 char LIBDIR[_MAX_PATH];
95 #elif defined (__EMX__)
96 #ifdef LIBDIR
97 #undef LIBDIR   /* yes, I know I shouldn't ;-) */
98 #endif
99 char LIBDIR[256];
100 #endif
101 
102 extern char *lc_save_dir;
103 extern char save_names[10][42];
104 
105 /* ---------------------------------------------------------------------- *
106  * Public Functions
107  * ---------------------------------------------------------------------- */
108 void
draw_prefs_cb(void)109 draw_prefs_cb (void)
110 {
111     Rect* mw = &scr.main_win;
112     int x, y;
113     char* graphic;
114 
115     x = mw->x + 50;
116     y = mw->y + 30;
117     graphic = overwrite_transport_flag ?
118 	    checked_box_graphic : unchecked_box_graphic;
119     Fgl_putbox (x, y, 16, 16, graphic);
120 
121     y += 16;
122     graphic = suppress_popups ? unchecked_box_graphic : checked_box_graphic;
123     Fgl_putbox (x, y, 16, 16, graphic);
124 
125     y += 16;
126     graphic = time_multiplex_stats ?
127 	    checked_box_graphic : unchecked_box_graphic;
128     Fgl_putbox (x, y, 16, 16, graphic);
129 
130 #if defined (LC_X11)
131     y += 16;
132     graphic = confine_flag ? checked_box_graphic : unchecked_box_graphic;
133     Fgl_putbox (x, y, 16, 16, graphic);
134 #endif
135 }
136 
137 void
do_prefs_buttons(int x,int y)138 do_prefs_buttons (int x, int y)
139 {
140     int outx, outy, outh, outw;
141     Rect* mw = &scr.main_win;
142     if (x > mw->x + 50 && x < mw->x + 50 + 16) {
143         if (y > mw->y + 30 && y < mw->y + 30 + 16) {
144 	    hide_mouse ();
145 	    overwrite_transport_flag = !overwrite_transport_flag;
146 	    draw_prefs_cb ();
147 	    redraw_mouse ();
148 	} else if (y > mw->y + 30 + 16 && y < mw->y + 30 + 2*16) {
149 	    hide_mouse ();
150 	    suppress_popups = !suppress_popups;
151 	    draw_prefs_cb ();
152 	    redraw_mouse ();
153 	} else if (y > mw->y + 30 + 2*16 && y < mw->y + 30 + 3*16) {
154 	    hide_mouse ();
155 	    time_multiplex_stats = !time_multiplex_stats;
156 	    draw_prefs_cb ();
157 	    redraw_mouse ();
158 #if defined (LC_X11)
159 	} else if (y > mw->y + 30 + 3*16 && y < mw->y + 30 + 4*16) {
160 	    hide_mouse ();
161 	    confine_flag = !confine_flag;
162 	    draw_prefs_cb ();
163 	    set_pointer_confinement ();
164 	    redraw_mouse ();
165 #endif
166 	}
167     }
168     outx = 370;
169     outy = 387;
170     outh = 12;
171     outw = 3*8 + 4;
172     if (x > mw->x + outx && x < mw->x + outx + outw &&
173 	y > mw->y + outy && y < mw->y + outy + outh)
174     {
175 	close_prefs_screen ();
176 	refresh_main_screen ();
177     }
178 }
179 
180 void
do_prefs_mouse(int x,int y,int mbutton)181 do_prefs_mouse (int x, int y, int mbutton)
182 {
183     Rect* mw = &scr.main_win;
184     if (mouse_in_rect(mw, x, y)) {
185 	do_prefs_buttons (x, y);
186 	return;
187     }
188     /* If the user clicks outside of main window, cancel prefs?? */
189     close_prefs_screen ();
190     refresh_main_screen ();
191 }
192 
193 void
do_prefs_screen(void)194 do_prefs_screen (void)
195 {
196     int x,y,w,h;
197     Rect* mw = &scr.main_win;
198 
199     prefs_drawn_flag = 1;
200 
201     hide_mouse ();
202     Fgl_fillbox (mw->x, mw->y, mw->w, mw->h, LOAD_BG_COLOUR);
203     Fgl_setfontcolors (LOAD_BG_COLOUR, TEXT_FG_COLOUR);
204     Fgl_write (mw->x + 80, mw->y + 4*8, _("Transport overwrite"));
205     Fgl_write (mw->x + 80, mw->y + 6*8, _("Popup info to dialog boxes"));
206     Fgl_write (mw->x + 80, mw->y + 8*8, _("Time multiplexed stats windows"));
207 #if defined (LC_X11)
208     Fgl_write (mw->x + 80, mw->y + 10*8, _("Confine X pointer"));
209 #endif
210 
211     x = 370;
212     y = 387;
213     h = 12;
214     w = 3*8 + 4;
215     Fgl_hline (mw->x + x, mw->y + y,
216 	       mw->x + x + w, HELPBUTTON_COLOUR);
217     Fgl_hline (mw->x + x, mw->y + y + h,
218 	       mw->x + x + w, HELPBUTTON_COLOUR);
219     Fgl_line (mw->x + x, mw->y + y,
220 	      mw->x + x, mw->y + y + h, HELPBUTTON_COLOUR);
221     Fgl_line (mw->x + x + w, mw->y + y,
222 	      mw->x + x + w, mw->y + y + h, HELPBUTTON_COLOUR);
223     Fgl_write (mw->x + x + 2, mw->y + y + 2, _("OUT"));
224 
225     draw_prefs_cb ();
226 
227     redraw_mouse ();
228 }
229 
230 void
close_prefs_screen(void)231 close_prefs_screen (void)
232 {
233     save_lincityrc();
234 
235     prefs_flag = 0;
236     prefs_drawn_flag = 0;
237 #ifdef USE_EXPANDED_FONT
238     Fgl_setwritemode (WRITEMODE_OVERWRITE | FONT_EXPANDED);
239 #else
240     Fgl_setfontcolors (TEXT_BG_COLOUR, TEXT_FG_COLOUR);
241 #endif
242 }
243 
244 #if defined (NETWORK_ENABLE)
245 void
do_network_screen(void)246 do_network_screen (void)
247 {
248     Rect* mw = &scr.main_win;
249     char s[200], t[200];
250     unsigned short p;
251     hide_mouse ();
252     Fgl_fillbox (mw->x, mw->y, mw->w, mw->h
253 		 ,SAVE_BG_COLOUR);
254     Fgl_setfontcolors (SAVE_BG_COLOUR, TEXT_FG_COLOUR);
255     Fgl_write (mw->x + 100, mw->y + 15, "Connect to network game");
256     Fgl_write (mw->x + 100, mw->y + 25, "Select host and port");
257 
258 #if !defined (WIN32)
259     redraw_mouse ();
260 #endif
261 
262     strcpy (s, DEFAULT_SOCK_HOST);
263     input_network_host (s);
264     sprintf (t, "%d", DEFAULT_SOCK_PORT);
265     input_network_port (t);
266     p = (unsigned short) atoi (t);
267     join_network_game (s,p);
268 
269     db_flag = 0;
270     cs_mouse_handler (0, -1, 0);
271     cs_mouse_handler (0, 1, 0);
272     hide_mouse ();
273     Fgl_setfontcolors (TEXT_BG_COLOUR, TEXT_FG_COLOUR);
274     refresh_main_screen ();
275     redraw_mouse ();
276 }
277 #endif
278 
279 void
do_save_city()280 do_save_city ()
281 {
282     Rect* mw = &scr.main_win;
283     char s[200], c;
284     hide_mouse ();
285     Fgl_fillbox (mw->x, mw->y, mw->w, mw->h
286 		 ,SAVE_BG_COLOUR);
287     Fgl_setfontcolors (SAVE_BG_COLOUR, TEXT_FG_COLOUR);
288     Fgl_write (mw->x + 100, mw->y + 15, _("Save a scene"));
289     Fgl_write (mw->x + 8, mw->y + 35
290 	       ,_("Choose the number of the scene you want to save"));
291     Fgl_write (mw->x + 110, mw->y + 210
292 	       ,_("Press space to cancel."));
293     draw_save_dir (SAVE_BG_COLOUR);
294     db_flag = 1;
295 #ifdef LC_X11
296     redraw_mouse ();
297     cs_mouse_handler (0, -1, 0);
298     cs_mouse_handler (0, 1, 0);
299     do
300     {
301 	call_event ();
302 	c = x_key_value;
303     }
304     while (c == 0);
305     x_key_value = 0;
306 #elif defined (WIN32)
307     while (0 == (c = GetKeystroke ()));	/* Wait for keystroke */
308     redraw_mouse ();
309 #else
310     c = getchar ();
311     redraw_mouse ();
312 #endif
313     if (c > '0' && c <= '9')
314     {
315 	Fgl_write (mw->x + 40, mw->y + 300
316 		   ,_("Type comment for the saved scene"));
317 	Fgl_write (mw->x + 16, mw->y + 310
318 		   ,_("The comment may be up to 40 characters"));
319 	Fgl_write (mw->x + 40, mw->y + 320
320 		   ,_("and may contain spaces or % . - + ,"));
321 	strcpy (s, &(save_names[c - '0'][2]));
322 	input_save_filename (s);
323 	remove_scene (save_names[c - '0']);
324 	sprintf (save_names[c - '0'], "%d_", c - '0');
325 	strcat (save_names[c - '0'], s);
326 	Fgl_fillbox (mw->x + 5, mw->y + 300
327 		     ,360, 30, SAVE_BG_COLOUR);
328 	Fgl_write (mw->x + 70, mw->y + 310
329 		   ,_("Saving city scene... please wait"));
330 	save_city (save_names[c - '0']);
331     }
332     db_flag = 0;
333     cs_mouse_handler (0, -1, 0);
334     cs_mouse_handler (0, 1, 0);
335     hide_mouse ();
336     Fgl_setfontcolors (TEXT_BG_COLOUR, TEXT_FG_COLOUR);
337     save_flag = 0;
338     refresh_main_screen ();
339     redraw_mouse ();
340 }
341 
342 void
load_opening_city(char * s)343 load_opening_city (char *s)
344 {
345   char *cname = (char *) malloc (strlen (opening_path) + strlen (s) + 2);
346   sprintf (cname, "%s%c%s", opening_path, PATH_SLASH, s);
347   load_city (cname);
348   free (cname);
349 
350   strcpy (given_scene, s);
351   db_flag = 0;
352   cs_mouse_handler (0, -1, 0);
353   cs_mouse_handler (0, 1, 0);
354   /* GCS:  Should I hide_mouse() here, as is done in do_load_city above? */
355   hide_mouse ();
356   Fgl_setfontcolors (TEXT_BG_COLOUR, TEXT_FG_COLOUR);
357   refresh_main_screen ();
358   suppress_ok_buttons = 1;
359   update_avail_modules (0);
360   suppress_ok_buttons = 0;
361   /* GCS: ?? */
362   redraw_mouse ();
363 }
364 
365 void
do_load_city(void)366 do_load_city (void)
367 {
368     Rect* mw = &scr.main_win;
369     char c;
370     hide_mouse ();
371     Fgl_fillbox (mw->x, mw->y, mw->w, mw->h
372 		 ,LOAD_BG_COLOUR);
373     Fgl_setfontcolors (LOAD_BG_COLOUR, TEXT_FG_COLOUR);
374     Fgl_write (mw->x + 140, mw->y + 15, _("Load a file"));
375     Fgl_write (mw->x + 40, mw->y + 35
376 	       ,_("Choose the number of the scene you want"));
377     Fgl_write (mw->x + 40, mw->y + 50
378 	       ,_("Entries coloured red are either not there,"));
379     Fgl_write (mw->x + 44, mw->y + 60
380 	       ,_("or they are from an earlier version, they"));
381     Fgl_write (mw->x + 110, mw->y + 70
382 	       ,_("might not load properly."));
383     Fgl_write (mw->x + 110, mw->y + 210
384 	       ,_("Press space to cancel."));
385     draw_save_dir (LOAD_BG_COLOUR);
386     db_flag = 1;
387 
388     do {
389 #ifdef LC_X11
390 	redraw_mouse ();
391 	cs_mouse_handler (0, -1, 0);
392 	cs_mouse_handler (0, 1, 0);
393 	do {
394 	    call_event ();
395 	    c = x_key_value;
396 	} while (c == 0);
397 	x_key_value = 0;
398 #elif defined (WIN32)
399 	while (0 == (c = GetKeystroke ()));	/* Wait for keystroke */
400 	redraw_mouse ();
401 #else
402 	c = getchar ();
403 	redraw_mouse ();
404 #endif
405 	if (c > '0' && c <= '9') {
406 	    if (strlen (save_names[c - '0']) < 1) {
407 		redraw_mouse ();
408 		if (yn_dial_box (_("No scene."),
409 				 _("There is no save scene with this number."),
410 				 _("Do you want to"),
411 				 _("try again?")) != 0)
412 		    c = 0;
413 		else
414 		    c = ' ';
415 		hide_mouse ();
416 	    }
417 	}
418     } while (c==0);
419 
420     redraw_mouse ();
421     if (c > '0' && c <= '9') {
422 	if (yn_dial_box (_("Loading Scene")
423 			 ,_("Do you want to load the scene")
424 			 ,save_names[c - '0']
425 			 ,_("and forget the current game?")) != 0)
426 	{
427 	    Fgl_write (mw->x + 70, mw->y + 310
428 		       ,_("Loading scene...  please wait"));
429 	    load_saved_city (save_names[c - '0']);
430 	    refresh_pbars();
431 	}
432     }
433     db_flag = 0;
434     cs_mouse_handler (0, -1, 0);
435     cs_mouse_handler (0, 1, 0);
436     hide_mouse ();
437     Fgl_setfontcolors (TEXT_BG_COLOUR, TEXT_FG_COLOUR);
438     load_flag = 0;
439     refresh_main_screen ();
440     suppress_ok_buttons = 1;
441     update_avail_modules (0);
442     suppress_ok_buttons = 0;
443     redraw_mouse ();
444 }
445 
446 void
draw_save_dir(int bg_colour)447 draw_save_dir (int bg_colour)
448 {
449     Rect* mw = &scr.main_win;
450     char *s, s2[200];
451     int i, j, l;
452 #if defined (WIN32)
453     char filespec[4];
454 #if defined(_MSC_VER)
455     struct _finddata_t fileinfo;
456 #elif defined (__BORLANDC__)
457     struct ffblk fileinfo;
458 #endif
459     long fh;
460 #else
461     struct dirent *ep;
462     DIR *dp;
463 #endif
464     if ((s = (char *) malloc (lc_save_dir_len + strlen (LC_SAVE_DIR) + 64)) == 0)
465 	malloc_failure ();
466     strcpy (s, lc_save_dir);
467     if (!directory_exists (s))
468     {
469 	printf (_("Couldn't find the save directory %s\n"), s);
470 	free (s);
471 	return;
472     }
473     /* GCS FIX:  Technically speaking, there is a race condition here. */
474 #if defined (WIN32)
475     _chdir (s);
476 #else
477     dp = opendir (s);
478 #endif
479     for (i = 1; i < 10; i++)
480     {
481 	save_names[i][0] = 0;
482 #if defined (WIN32)
483 	sprintf (filespec, "%d_*", i);
484 #if defined (_MSC_VER)
485 	fh = _findfirst (filespec, &fileinfo);
486 #elif defined (__BORLANDC__)
487 	fh = findfirst (filespec, &fileinfo, FA_ARCH);
488 #endif
489 	if (fh != -1)
490 	{
491 #else
492 	    while ((ep = readdir (dp)))	/* extra brackets to stop warning */
493 
494 	    {
495 		if (*(ep->d_name) == (i + '0')
496 		    && *((ep->d_name) + 1) == '_')
497 		{
498 #endif
499 		    sprintf (s2, "%2d ", i);
500 #if defined (WIN32)
501 #if defined (_MSC_VER)
502 		    strncpy (save_names[i], fileinfo.name, 40);
503 #elif defined (__BORLANDC__)
504 		    strncpy (save_names[i], fileinfo.ff_name, 40);
505 #endif
506 #else /* UNIX */
507 		    strncpy (save_names[i], ep->d_name, 40);
508 #endif
509 		    if (strlen (save_names[i]) > 2)
510 			strncat (s2, &(save_names[i][2]), 40);
511 		    else
512 			strcat (s2, "???");
513 #if defined (WIN32)
514 #if defined (_MSC_VER)
515 		    _findclose (fh);
516 #elif defined (__BORLANDC__)
517 		    findclose(&fileinfo);
518 #endif
519 		}
520 #else
521 	    }
522 	}
523 #endif
524 	if (strlen (save_names[i]) < 1)
525 	    sprintf (s2, " %d .....", i);
526 	else
527 	{
528 	    l = strlen (s2);
529 	    for (j = 0; j < l; j++)
530 		if (s2[j] == '_')
531 		    s2[j] = ' ';
532 	}
533 	if (verify_city (save_names[i]) == 0)
534 	    Fgl_setfontcolors (bg_colour, red (28));
535 	else
536 	    Fgl_setfontcolors (bg_colour, green (28));
537 	Fgl_write (mw->x + 24, mw->y + 10 * (10 + i), s2);
538 #if !defined (WIN32)
539 	rewinddir (dp);
540 #endif
541     }
542 #if defined (WIN32)
543     _chdir (LIBDIR);		/* go back... */
544 #else
545     closedir (dp);
546 #endif
547     Fgl_setfontcolors (bg_colour, TEXT_FG_COLOUR);
548     free (s);
549 }
550 
551 void
edit_string(char * s,unsigned int maxlen,int xpos,int ypos)552 edit_string (char* s, unsigned int maxlen, int xpos, int ypos)
553 {
554     char c;
555     int i, t, on;
556     c = 0;
557     s[maxlen+1] = 0;
558     t = strlen (s);
559     for (i = 0; i < t; i++)
560 	if (s[i] == '_')
561 	    s[i] = ' ';
562     while (c != 0xd && c != 0xa)
563     {
564 	Fgl_write (xpos, ypos, s);
565 	Fgl_write (xpos + (strlen (s) * 8), ypos, "_");
566 	on = 1;
567 	get_real_time ();
568 	t = real_time;
569 #ifdef LC_X11
570 	call_event ();
571 	while ((c = x_key_value) == 0)
572 #elif defined (WIN32)
573 	    while ((c = GetKeystroke ()) == 0)
574 #else
575 		while ((c = vga_getkey ()) == 0)
576 #endif
577 		{
578 #ifdef LC_X11
579 		    call_event ();
580 #endif
581 		    get_real_time ();
582 		    if (real_time > t + 200) {
583 			if (on == 1) {
584 			    Fgl_write (xpos + (strlen (s) * 8),
585 				       ypos, " ");
586 			    on = 0;
587 			} else {
588 			    Fgl_write (xpos + (strlen (s) * 8),
589 				       ypos, "_");
590 			    on = 1;
591 			}
592 			get_real_time ();
593 			t = real_time;
594 		    }
595 		}
596 #ifdef LC_X11
597 	x_key_value = 0;
598 #endif
599 	if ((isalnum (c) || c == ' ' || c == '.' || c == '%' || c == ','
600 	     || c == '-' || c == '+') && strlen (s) < maxlen)
601 	{
602 	    t = strlen (s);
603 	    s[t] = c;
604 	    s[t + 1] = 0;
605 	}
606 	else if (c == 0x7f && strlen (s) > 0)
607 	{
608 	    Fgl_write (xpos + (strlen (s) * 8), ypos, " ");
609 	    s[strlen (s) - 1] = 0;
610 	}
611     }
612     t = strlen (s);
613     for (i = 0; i < t; i++)
614 	if (s[i] == ' ')
615 	    s[i] = '_';
616 }
617 
618 void
input_save_filename(char * s)619 input_save_filename (char *s)
620 {
621     Rect* mw = &scr.main_win;
622     edit_string (s, 40, mw->x + 24, mw->y + 340);
623 }
624 
625 void
input_network_host(char * s)626 input_network_host (char *s)
627 {
628     Rect* mw = &scr.main_win;
629     Fgl_write (mw->x + 50, mw->y + 240, "Host:");
630     edit_string (s, 40, mw->x + 124, mw->y + 240);
631 }
632 
633 void
input_network_port(char * s)634 input_network_port (char *s)
635 {
636     Rect* mw = &scr.main_win;
637     Fgl_write (mw->x + 50, mw->y + 280, "Port:");
638     edit_string (s, 40, mw->x + 124, mw->y + 280);
639 }
640 
641 
642 void
do_get_nw_server(void)643 do_get_nw_server (void)
644 {
645     Rect* mw = &scr.main_win;
646     char c;
647     hide_mouse ();
648     Fgl_fillbox (mw->x, mw->y, mw->w, mw->h, NW_BG_COLOUR);
649     Fgl_setfontcolors (LOAD_BG_COLOUR, TEXT_FG_COLOUR);
650     Fgl_write (mw->x + 140, mw->y + 15, _("Choose network server"));
651     Fgl_write (mw->x + 40, mw->y + 35
652 	       ,_("Please enter the address and port of the server"));
653     Fgl_write (mw->x + 110, mw->y + 210
654 	       ,_("Press space to cancel."));
655     draw_save_dir (NW_BG_COLOUR);
656     do
657     {
658 #ifdef LC_X11
659 	db_flag = 1;
660 	redraw_mouse ();
661 	cs_mouse_handler (0, -1, 0);
662 	cs_mouse_handler (0, 1, 0);
663 	do
664 	{
665 	    call_event ();
666 	    c = x_key_value;
667 	}
668 	while (c == 0);
669 	x_key_value = 0;
670 #elif defined (WIN32)
671 	while (0 == (c = GetKeystroke ()));	/* Wait for keystroke */
672 #else
673 	c = getchar ();
674 #endif
675 	if (c > '0' && c <= '9')
676 	    if (strlen (save_names[c - '0']) < 1)
677 	    {
678 		redraw_mouse ();
679 		if (yn_dial_box (_("No scene.")
680 				 ,_("There is no save scene with this number.")
681 				 ,_("Do you want to")
682 				 ,_("try again?")) != 0)
683 		    c = 0;
684 		else
685 		    c = ' ';
686 		hide_mouse ();
687 	    }
688     }
689     while ((c <= '0' || c > '9') && c != ' ');
690     redraw_mouse ();
691     if (c > '0' && c <= '9')
692     {
693 	if (yn_dial_box (_("Loading Scene")
694 			 ,_("Do you want to load the scene")
695 			 ,save_names[c - '0']
696 			 ,_("and forget the current game?")) != 0)
697 	{
698 	    Fgl_write (mw->x + 70, mw->y + 310
699 		       ,_("Loading scene...  please wait"));
700 	    load_saved_city (save_names[c - '0']);
701 	}
702     }
703     db_flag = 0;
704     cs_mouse_handler (0, -1, 0);
705     cs_mouse_handler (0, 1, 0);
706     hide_mouse ();
707     Fgl_setfontcolors (TEXT_BG_COLOUR, TEXT_FG_COLOUR);
708     refresh_main_screen ();
709     suppress_ok_buttons = 1;
710     update_avail_modules (0);
711     suppress_ok_buttons = 0;
712     redraw_mouse ();
713 }
714