Main Page | Data Structures | Directories | File List | Data Fields | Globals

ldsvgui.c

Go to the documentation of this file.
00001 /* ---------------------------------------------------------------------- *
00002  * ldsvgui.c
00003  * This file is part of lincity.
00004  * Lincity is copyright (c) I J Peters 1995-1997, (c) Greg Sharp 1997-2001.
00005  * ---------------------------------------------------------------------- */
00006 #include "lcconfig.h"
00007 #include <stdio.h>
00008 #include <stdlib.h>
00009 #include "lcstring.h"
00010 #include "ldsvgui.h"
00011 #include "lcintl.h"
00012 #include "screen.h"
00013 #include "pbar.h"
00014 #include "module_buttons.h"
00015 #include "fileutil.h"
00016 
00017 /* this is for OS/2 - RVI */
00018 #ifdef __EMX__
00019 #include <sys/select.h>
00020 #include <X11/Xlibint.h>      /* required for __XOS2RedirRoot */
00021 #define chown(x,y,z)
00022 #define OS2_DEFAULT_LIBDIR "/XFree86/lib/X11/lincity"
00023 #endif
00024 
00025 #include <sys/types.h>
00026 #include <sys/stat.h>
00027 #include <fcntl.h>
00028 
00029 #if defined (TIME_WITH_SYS_TIME)
00030 #include <time.h>
00031 #include <sys/time.h>
00032 #else
00033 #if defined (HAVE_SYS_TIME_H)
00034 #include <sys/time.h>
00035 #else
00036 #include <time.h>
00037 #endif
00038 #endif
00039 
00040 #if defined (WIN32)
00041 #include <winsock.h>
00042 #if defined (__BORLANDC__)
00043 #include <dir.h>
00044 #include <dirent.h>
00045 #include <dos.h>
00046 #endif
00047 #include <io.h>
00048 #include <direct.h>
00049 #include <process.h>
00050 #endif
00051 
00052 #if defined (HAVE_DIRENT_H)
00053 #include <dirent.h>
00054 #define NAMLEN(dirent) strlen((dirent)->d_name)
00055 #else
00056 #define dirent direct
00057 #define NAMLEN(dirent) (dirent)->d_namlen
00058 #if defined (HAVE_SYS_NDIR_H)
00059 #include <sys/ndir.h>
00060 #endif
00061 #if defined (HAVE_SYS_DIR_H)
00062 #include <sys/dir.h>
00063 #endif
00064 #if defined (HAVE_NDIR_H)
00065 #include <ndir.h>
00066 #endif
00067 #endif
00068 
00069 #include <ctype.h>
00070 #include "common.h"
00071 #ifdef LC_X11
00072 #include <X11/cursorfont.h>
00073 #endif
00074 #include "lctypes.h"
00075 #include "lin-city.h"
00076 #include "cliglobs.h"
00077 #include "engglobs.h"
00078 #include "ldsvguts.h"
00079 #include "fileutil.h"
00080 #include "mouse.h"
00081 #include "stats.h"
00082 
00083 /* ---------------------------------------------------------------------- *
00084  * Private Fn Prototypes
00085  * ---------------------------------------------------------------------- */
00086 int verify_city (char *cname);
00087 void input_network_host (char *s);
00088 void input_network_port (char *s);
00089 
00090 /* ---------------------------------------------------------------------- *
00091  * Private Global Variables
00092  * ---------------------------------------------------------------------- */
00093 #if defined (WIN32)
00094 char LIBDIR[_MAX_PATH];
00095 #elif defined (__EMX__)
00096 #ifdef LIBDIR
00097 #undef LIBDIR   /* yes, I know I shouldn't ;-) */
00098 #endif
00099 char LIBDIR[256];
00100 #endif
00101 
00102 char *lc_save_dir;
00103 char save_names[10][42];
00104 
00105 /* ---------------------------------------------------------------------- *
00106  * Public Functions
00107  * ---------------------------------------------------------------------- */
00108 void
00109 draw_prefs_cb (void)
00110 {
00111     Rect* mw = &scr.main_win;
00112     int x, y;
00113     char* graphic;
00114 
00115     x = mw->x + 50;
00116     y = mw->y + 30;
00117     graphic = overwrite_transport_flag ? 
00118             checked_box_graphic : unchecked_box_graphic;
00119     Fgl_putbox (x, y, 16, 16, graphic);
00120 
00121     y += 16;
00122     graphic = suppress_popups ? unchecked_box_graphic : checked_box_graphic;
00123     Fgl_putbox (x, y, 16, 16, graphic);
00124 
00125     y += 16;
00126     graphic = time_multiplex_stats ? 
00127             checked_box_graphic : unchecked_box_graphic;
00128     Fgl_putbox (x, y, 16, 16, graphic);
00129 
00130 #if defined (LC_X11)
00131     y += 16;
00132     graphic = confine_flag ? checked_box_graphic : unchecked_box_graphic;
00133     Fgl_putbox (x, y, 16, 16, graphic);
00134 #endif
00135 }
00136 
00137 void
00138 do_prefs_buttons (int x, int y)
00139 {
00140     int outx, outy, outh, outw;
00141     Rect* mw = &scr.main_win;
00142     if (x > mw->x + 50 && x < mw->x + 50 + 16) {
00143         if (y > mw->y + 30 && y < mw->y + 30 + 16) {
00144             hide_mouse ();
00145             overwrite_transport_flag = !overwrite_transport_flag;
00146             draw_prefs_cb ();
00147             redraw_mouse ();
00148         } else if (y > mw->y + 30 + 16 && y < mw->y + 30 + 2*16) {
00149             hide_mouse ();
00150             suppress_popups = !suppress_popups;
00151             draw_prefs_cb ();
00152             redraw_mouse ();
00153         } else if (y > mw->y + 30 + 2*16 && y < mw->y + 30 + 3*16) {
00154             hide_mouse ();
00155             time_multiplex_stats = !time_multiplex_stats;
00156             draw_prefs_cb ();
00157             redraw_mouse ();
00158 #if defined (LC_X11)
00159         } else if (y > mw->y + 30 + 3*16 && y < mw->y + 30 + 4*16) {
00160             hide_mouse ();
00161             confine_flag = !confine_flag;
00162             draw_prefs_cb ();
00163             set_pointer_confinement ();
00164             redraw_mouse ();
00165 #endif
00166         }
00167     }
00168     outx = 370;
00169     outy = 387;
00170     outh = 12;
00171     outw = 3*8 + 4;
00172     if (x > mw->x + outx && x < mw->x + outx + outw &&
00173         y > mw->y + outy && y < mw->y + outy + outh)
00174     {
00175         close_prefs_screen ();
00176         refresh_main_screen ();
00177     }
00178 }
00179 
00180 void
00181 do_prefs_mouse (int x, int y, int mbutton)
00182 {
00183     Rect* mw = &scr.main_win;
00184     if (mouse_in_rect(mw, x, y)) {
00185         do_prefs_buttons (x, y);
00186         return;
00187     }
00188     /* If the user clicks outside of main window, cancel prefs?? */
00189     close_prefs_screen ();
00190     refresh_main_screen ();
00191 }
00192 
00193 void
00194 do_prefs_screen (void)
00195 {
00196     int x,y,w,h;
00197     Rect* mw = &scr.main_win;
00198 
00199     prefs_drawn_flag = 1;
00200 
00201     hide_mouse ();
00202     Fgl_fillbox (mw->x, mw->y, mw->w, mw->h, LOAD_BG_COLOUR);
00203     Fgl_setfontcolors (LOAD_BG_COLOUR, TEXT_FG_COLOUR);
00204     Fgl_write (mw->x + 80, mw->y + 4*8, _("Transport overwrite"));
00205     Fgl_write (mw->x + 80, mw->y + 6*8, _("Popup info to dialog boxes"));
00206     Fgl_write (mw->x + 80, mw->y + 8*8, _("Time multiplexed stats windows"));
00207 #if defined (LC_X11)
00208     Fgl_write (mw->x + 80, mw->y + 10*8, _("Confine X pointer"));
00209 #endif
00210 
00211     x = 370;
00212     y = 387;
00213     h = 12;
00214     w = 3*8 + 4;
00215     Fgl_hline (mw->x + x, mw->y + y,
00216                mw->x + x + w, HELPBUTTON_COLOUR);
00217     Fgl_hline (mw->x + x, mw->y + y + h, 
00218                mw->x + x + w, HELPBUTTON_COLOUR);
00219     Fgl_line (mw->x + x, mw->y + y, 
00220               mw->x + x, mw->y + y + h, HELPBUTTON_COLOUR);
00221     Fgl_line (mw->x + x + w, mw->y + y,
00222               mw->x + x + w, mw->y + y + h, HELPBUTTON_COLOUR);
00223     Fgl_write (mw->x + x + 2, mw->y + y + 2, _("OUT"));
00224 
00225     draw_prefs_cb ();
00226 
00227     redraw_mouse ();
00228 }
00229 
00230 void
00231 close_prefs_screen (void)
00232 {
00233     save_lincityrc();
00234 
00235     prefs_flag = 0;
00236     prefs_drawn_flag = 0;
00237 #ifdef USE_EXPANDED_FONT
00238     Fgl_setwritemode (WRITEMODE_OVERWRITE | FONT_EXPANDED);
00239 #else
00240     Fgl_setfontcolors (TEXT_BG_COLOUR, TEXT_FG_COLOUR);
00241 #endif
00242 }
00243 
00244 #if defined (NETWORK_ENABLE)
00245 void
00246 do_network_screen (void)
00247 {
00248     Rect* mw = &scr.main_win;
00249     char s[200], t[200];
00250     unsigned short p;
00251     hide_mouse ();
00252     Fgl_fillbox (mw->x, mw->y, mw->w, mw->h
00253                  ,SAVE_BG_COLOUR);
00254     Fgl_setfontcolors (SAVE_BG_COLOUR, TEXT_FG_COLOUR);
00255     Fgl_write (mw->x + 100, mw->y + 15, "Connect to network game");
00256     Fgl_write (mw->x + 100, mw->y + 25, "Select host and port");
00257 
00258 #if !defined (WIN32)
00259     redraw_mouse ();
00260 #endif
00261 
00262     strcpy (s, DEFAULT_SOCK_HOST);
00263     input_network_host (s);
00264     sprintf (t, "%d", DEFAULT_SOCK_PORT);
00265     input_network_port (t);
00266     p = (unsigned short) atoi (t);
00267     join_network_game (s,p);
00268 
00269     db_flag = 0;
00270     cs_mouse_handler (0, -1, 0);
00271     cs_mouse_handler (0, 1, 0);
00272     hide_mouse ();
00273     Fgl_setfontcolors (TEXT_BG_COLOUR, TEXT_FG_COLOUR);
00274     refresh_main_screen ();
00275     redraw_mouse ();
00276 }
00277 #endif
00278 
00279 void
00280 do_save_city ()
00281 {
00282     Rect* mw = &scr.main_win;
00283     char s[200], c;
00284     hide_mouse ();
00285     Fgl_fillbox (mw->x, mw->y, mw->w, mw->h
00286                  ,SAVE_BG_COLOUR);
00287     Fgl_setfontcolors (SAVE_BG_COLOUR, TEXT_FG_COLOUR);
00288     Fgl_write (mw->x + 100, mw->y + 15, _("Save a scene"));
00289     Fgl_write (mw->x + 8, mw->y + 35
00290                ,_("Choose the number of the scene you want to save"));
00291     Fgl_write (mw->x + 110, mw->y + 210
00292                ,_("Press space to cancel."));
00293     draw_save_dir (SAVE_BG_COLOUR);
00294     db_flag = 1;
00295 #ifdef LC_X11
00296     redraw_mouse ();
00297     cs_mouse_handler (0, -1, 0);
00298     cs_mouse_handler (0, 1, 0);
00299     do
00300     {
00301         call_event ();
00302         c = x_key_value;
00303     }
00304     while (c == 0);
00305     x_key_value = 0;
00306 #elif defined (WIN32)
00307     while (0 == (c = GetKeystroke ())); /* Wait for keystroke */
00308     redraw_mouse ();
00309 #else
00310     c = getchar ();
00311     redraw_mouse ();
00312 #endif
00313     if (c > '0' && c <= '9')
00314     {
00315         Fgl_write (mw->x + 40, mw->y + 300
00316                    ,_("Type comment for the saved scene"));
00317         Fgl_write (mw->x + 16, mw->y + 310
00318                    ,_("The comment may be up to 40 characters"));
00319         Fgl_write (mw->x + 40, mw->y + 320
00320                    ,_("and may contain spaces or % . - + ,"));
00321         strcpy (s, &(save_names[c - '0'][2]));
00322         input_save_filename (s);
00323         remove_scene (save_names[c - '0']);
00324         sprintf (save_names[c - '0'], "%d_", c - '0');
00325         strcat (save_names[c - '0'], s);
00326         Fgl_fillbox (mw->x + 5, mw->y + 300
00327                      ,360, 30, SAVE_BG_COLOUR);
00328         Fgl_write (mw->x + 70, mw->y + 310
00329                    ,_("Saving city scene... please wait"));
00330         save_city (save_names[c - '0']);
00331     }
00332     db_flag = 0;
00333     cs_mouse_handler (0, -1, 0);
00334     cs_mouse_handler (0, 1, 0);
00335     hide_mouse ();
00336     Fgl_setfontcolors (TEXT_BG_COLOUR, TEXT_FG_COLOUR);
00337     save_flag = 0;
00338     refresh_main_screen ();
00339     redraw_mouse ();
00340 }
00341 
00342 void 
00343 load_opening_city (char *s)
00344 {
00345   char *cname = (char *) malloc (strlen (opening_path) + strlen (s) + 2);
00346   sprintf (cname, "%s%c%s", opening_path, PATH_SLASH, s);
00347   load_city (cname);
00348   free (cname);
00349 
00350   strcpy (given_scene, s);
00351   db_flag = 0;
00352   cs_mouse_handler (0, -1, 0);
00353   cs_mouse_handler (0, 1, 0);
00354   /* GCS:  Should I hide_mouse() here, as is done in do_load_city above? */
00355   hide_mouse ();
00356   Fgl_setfontcolors (TEXT_BG_COLOUR, TEXT_FG_COLOUR);
00357   refresh_main_screen ();
00358   suppress_ok_buttons = 1;
00359   update_avail_modules (0);
00360   suppress_ok_buttons = 0;
00361   /* GCS: ?? */
00362   redraw_mouse ();
00363 }
00364 
00365 void
00366 do_load_city (void)
00367 {
00368     Rect* mw = &scr.main_win;
00369     char c;
00370     hide_mouse ();
00371     Fgl_fillbox (mw->x, mw->y, mw->w, mw->h
00372                  ,LOAD_BG_COLOUR);
00373     Fgl_setfontcolors (LOAD_BG_COLOUR, TEXT_FG_COLOUR);
00374     Fgl_write (mw->x + 140, mw->y + 15, _("Load a file"));
00375     Fgl_write (mw->x + 40, mw->y + 35
00376                ,_("Choose the number of the scene you want"));
00377     Fgl_write (mw->x + 40, mw->y + 50
00378                ,_("Entries coloured red are either not there,"));
00379     Fgl_write (mw->x + 44, mw->y + 60
00380                ,_("or they are from an earlier version, they"));
00381     Fgl_write (mw->x + 110, mw->y + 70
00382                ,_("might not load properly."));
00383     Fgl_write (mw->x + 110, mw->y + 210
00384                ,_("Press space to cancel."));
00385     draw_save_dir (LOAD_BG_COLOUR);
00386     db_flag = 1;
00387 
00388     do {
00389 #ifdef LC_X11
00390         redraw_mouse ();
00391         cs_mouse_handler (0, -1, 0);
00392         cs_mouse_handler (0, 1, 0);
00393         do {
00394             call_event ();
00395             c = x_key_value;
00396         } while (c == 0);
00397         x_key_value = 0;
00398 #elif defined (WIN32)
00399         while (0 == (c = GetKeystroke ()));     /* Wait for keystroke */
00400         redraw_mouse ();
00401 #else
00402         c = getchar ();
00403         redraw_mouse ();
00404 #endif
00405         if (c > '0' && c <= '9') {
00406             if (strlen (save_names[c - '0']) < 1) {
00407                 redraw_mouse ();
00408                 if (yn_dial_box (_("No scene."),
00409                                  _("There is no save scene with this number."),
00410                                  _("Do you want to"),
00411                                  _("try again?")) != 0)
00412                     c = 0;
00413                 else
00414                     c = ' ';
00415                 hide_mouse ();
00416             }
00417         }
00418     } while (c==0);
00419 
00420     redraw_mouse ();
00421     if (c > '0' && c <= '9') {
00422         if (yn_dial_box (_("Loading Scene")
00423                          ,_("Do you want to load the scene")
00424                          ,save_names[c - '0']
00425                          ,_("and forget the current game?")) != 0)
00426         {
00427             Fgl_write (mw->x + 70, mw->y + 310
00428                        ,_("Loading scene...  please wait"));
00429             load_saved_city (save_names[c - '0']);
00430             refresh_pbars();
00431         }
00432     }
00433     db_flag = 0;
00434     cs_mouse_handler (0, -1, 0);
00435     cs_mouse_handler (0, 1, 0);
00436     hide_mouse ();
00437     Fgl_setfontcolors (TEXT_BG_COLOUR, TEXT_FG_COLOUR);
00438     load_flag = 0;
00439     refresh_main_screen ();
00440     suppress_ok_buttons = 1;
00441     update_avail_modules (0);
00442     suppress_ok_buttons = 0;
00443     redraw_mouse ();
00444 }
00445 
00446 void
00447 draw_save_dir (int bg_colour)
00448 {
00449     Rect* mw = &scr.main_win;
00450     char *s, s2[200];
00451     int i, j, l;
00452 #if defined (WIN32)
00453     char filespec[4];
00454 #if defined(_MSC_VER)
00455     struct _finddata_t fileinfo;
00456 #elif defined (__BORLANDC__)
00457     struct ffblk fileinfo;
00458 #endif
00459     long fh;
00460 #else
00461     struct dirent *ep;
00462     DIR *dp;
00463 #endif
00464     if ((s = (char *) malloc (lc_save_dir_len + strlen (LC_SAVE_DIR) + 64)) == 0)
00465         malloc_failure ();
00466     strcpy (s, lc_save_dir);
00467     if (!directory_exists (s))
00468     {
00469         printf (_("Couldn't find the save directory %s\n"), s);
00470         free (s);
00471         return;
00472     }
00473     /* GCS FIX:  Technically speaking, there is a race condition here. */
00474 #if defined (WIN32)
00475     _chdir (s);
00476 #else
00477     dp = opendir (s);
00478 #endif
00479     for (i = 1; i < 10; i++)
00480     {
00481         save_names[i][0] = 0;
00482 #if defined (WIN32)
00483         sprintf (filespec, "%d_*", i);
00484 #if defined (_MSC_VER)
00485         fh = _findfirst (filespec, &fileinfo);
00486 #elif defined (__BORLANDC__)
00487         fh = findfirst (filespec, &fileinfo, FA_ARCH);
00488 #endif
00489         if (fh != -1)
00490         {
00491 #else
00492             while ((ep = readdir (dp))) /* extra brackets to stop warning */
00493 
00494             {
00495                 if (*(ep->d_name) == (i + '0')
00496                     && *((ep->d_name) + 1) == '_')
00497                 {
00498 #endif
00499                     sprintf (s2, "%2d ", i);
00500 #if defined (WIN32)
00501 #if defined (_MSC_VER)
00502                     strncpy (save_names[i], fileinfo.name, 40);
00503 #elif defined (__BORLANDC__)
00504                     strncpy (save_names[i], fileinfo.ff_name, 40);
00505 #endif
00506 #else /* UNIX */
00507                     strncpy (save_names[i], ep->d_name, 40);
00508 #endif
00509                     if (strlen (save_names[i]) > 2)
00510                         strncat (s2, &(save_names[i][2]), 40);
00511                     else
00512                         strcat (s2, "???");
00513 #if defined (WIN32)
00514 #if defined (_MSC_VER)
00515                     _findclose (fh);
00516 #elif defined (__BORLANDC__)
00517                     findclose(&fileinfo);
00518 #endif
00519                 }
00520 #else
00521             }
00522         }
00523 #endif
00524         if (strlen (save_names[i]) < 1)
00525             sprintf (s2, " %d .....", i);
00526         else
00527         {
00528             l = strlen (s2);
00529             for (j = 0; j < l; j++)
00530                 if (s2[j] == '_')
00531                     s2[j] = ' ';
00532         }
00533         if (verify_city (save_names[i]) == 0)
00534             Fgl_setfontcolors (bg_colour, red (28));
00535         else
00536             Fgl_setfontcolors (bg_colour, green (28));
00537         Fgl_write (mw->x + 24, mw->y + 10 * (10 + i), s2);
00538 #if !defined (WIN32)
00539         rewinddir (dp);
00540 #endif
00541     }
00542 #if defined (WIN32)
00543     _chdir (LIBDIR);            /* go back... */
00544 #else
00545     closedir (dp);
00546 #endif
00547     Fgl_setfontcolors (bg_colour, TEXT_FG_COLOUR);
00548     free (s);
00549 }
00550 
00551 void
00552 edit_string (char* s, unsigned int maxlen, int xpos, int ypos)
00553 {
00554     char c;
00555     int i, t, on;
00556     c = 0;
00557     s[maxlen+1] = 0;
00558     t = strlen (s);
00559     for (i = 0; i < t; i++)
00560         if (s[i] == '_')
00561             s[i] = ' ';
00562     while (c != 0xd && c != 0xa)
00563     {
00564         Fgl_write (xpos, ypos, s);
00565         Fgl_write (xpos + (strlen (s) * 8), ypos, "_");
00566         on = 1;
00567         get_real_time ();
00568         t = real_time;
00569 #ifdef LC_X11
00570         call_event ();
00571         while ((c = x_key_value) == 0)
00572 #elif defined (WIN32)
00573             while ((c = GetKeystroke ()) == 0)
00574 #else
00575                 while ((c = vga_getkey ()) == 0)
00576 #endif
00577                 {
00578 #ifdef LC_X11
00579                     call_event ();
00580 #endif
00581                     get_real_time ();
00582                     if (real_time > t + 200) {
00583                         if (on == 1) {
00584                             Fgl_write (xpos + (strlen (s) * 8),
00585                                        ypos, " ");
00586                             on = 0;
00587                         } else {
00588                             Fgl_write (xpos + (strlen (s) * 8),
00589                                        ypos, "_");
00590                             on = 1;
00591                         }
00592                         get_real_time ();
00593                         t = real_time;
00594                     }
00595                 }
00596 #ifdef LC_X11
00597         x_key_value = 0;
00598 #endif
00599         if ((isalnum (c) || c == ' ' || c == '.' || c == '%' || c == ','
00600              || c == '-' || c == '+') && strlen (s) < maxlen)
00601         {
00602             t = strlen (s);
00603             s[t] = c;
00604             s[t + 1] = 0;
00605         } 
00606         else if (c == 0x7f && strlen (s) > 0) 
00607         {
00608             Fgl_write (xpos + (strlen (s) * 8), ypos, " ");
00609             s[strlen (s) - 1] = 0;
00610         }
00611     }
00612     t = strlen (s);
00613     for (i = 0; i < t; i++)
00614         if (s[i] == ' ')
00615             s[i] = '_';
00616 }
00617 
00618 void
00619 input_save_filename (char *s)
00620 {
00621     Rect* mw = &scr.main_win;
00622     edit_string (s, 40, mw->x + 24, mw->y + 340);
00623 }
00624 
00625 void
00626 input_network_host (char *s)
00627 {
00628     Rect* mw = &scr.main_win;
00629     Fgl_write (mw->x + 50, mw->y + 240, "Host:");
00630     edit_string (s, 40, mw->x + 124, mw->y + 240);
00631 }
00632 
00633 void
00634 input_network_port (char *s)
00635 {
00636     Rect* mw = &scr.main_win;
00637     Fgl_write (mw->x + 50, mw->y + 280, "Port:");
00638     edit_string (s, 40, mw->x + 124, mw->y + 280);
00639 }
00640 
00641 
00642 void
00643 do_get_nw_server (void)
00644 {
00645     Rect* mw = &scr.main_win;
00646     char c;
00647     hide_mouse ();
00648     Fgl_fillbox (mw->x, mw->y, mw->w, mw->h, NW_BG_COLOUR);
00649     Fgl_setfontcolors (LOAD_BG_COLOUR, TEXT_FG_COLOUR);
00650     Fgl_write (mw->x + 140, mw->y + 15, _("Choose network server"));
00651     Fgl_write (mw->x + 40, mw->y + 35
00652                ,_("Please enter the address and port of the server"));
00653     Fgl_write (mw->x + 110, mw->y + 210
00654                ,_("Press space to cancel."));
00655     draw_save_dir (NW_BG_COLOUR);
00656     do
00657     {
00658 #ifdef LC_X11
00659         db_flag = 1;
00660         redraw_mouse ();
00661         cs_mouse_handler (0, -1, 0);
00662         cs_mouse_handler (0, 1, 0);
00663         do
00664         {
00665             call_event ();
00666             c = x_key_value;
00667         }
00668         while (c == 0);
00669         x_key_value = 0;
00670 #elif defined (WIN32)
00671         while (0 == (c = GetKeystroke ()));     /* Wait for keystroke */
00672 #else
00673         c = getchar ();
00674 #endif
00675         if (c > '0' && c <= '9')
00676             if (strlen (save_names[c - '0']) < 1)
00677             {
00678                 redraw_mouse ();
00679                 if (yn_dial_box (_("No scene.")
00680                                  ,_("There is no save scene with this number.")
00681                                  ,_("Do you want to")
00682                                  ,_("try again?")) != 0)
00683                     c = 0;
00684                 else
00685                     c = ' ';
00686                 hide_mouse ();
00687             }
00688     }
00689     while ((c <= '0' || c > '9') && c != ' ');
00690     redraw_mouse ();
00691     if (c > '0' && c <= '9')
00692     {
00693         if (yn_dial_box (_("Loading Scene")
00694                          ,_("Do you want to load the scene")
00695                          ,save_names[c - '0']
00696                          ,_("and forget the current game?")) != 0)
00697         {
00698             Fgl_write (mw->x + 70, mw->y + 310
00699                        ,_("Loading scene...  please wait"));
00700             load_saved_city (save_names[c - '0']);
00701         }
00702     }
00703     db_flag = 0;
00704     cs_mouse_handler (0, -1, 0);
00705     cs_mouse_handler (0, 1, 0);
00706     hide_mouse ();
00707     Fgl_setfontcolors (TEXT_BG_COLOUR, TEXT_FG_COLOUR);
00708     refresh_main_screen ();
00709     suppress_ok_buttons = 1;
00710     update_avail_modules (0);
00711     suppress_ok_buttons = 0;
00712     redraw_mouse ();
00713 }

Generated on Sun Dec 26 11:23:25 2004 for lincity by  doxygen 1.3.9.1