Main Page   Data Structures   File List   Data Fields   Globals   Related Pages  

linux-gtk/savegame_fe.c File Reference

front end for performing savegames More...

#include <gtk/gtk.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <main.h>
#include <globals.h>
#include <handler.h>
#include <ui.h>
#include <simulation.h>
#include <netinet/in.h>
#include <inttypes.h>
#include <strings.h>
#include <savegame_fe.h>
#include <savegame_be.h>
#include <compilerpragmas.h>
#include <uibits.h>

Go to the source code of this file.

Data Structures

struct  city_listselect
 private city list selection object More...

struct  ng_form_tag
 new game form entities More...


Functions

void free_listselect (struct city_listselect *sel)
 free the list selection strucure

void ImportOneFromGame (GtkWidget *widget, gint response, gpointer data)
 load one of the palm games from the pdb file

void lsrow_activated (gpointer data)
 row double clicked function

void loadCities (savegame_t *sg)
 load the cities

void doOpen (gchar *filename)
 load a game

void open_afile (GtkObject *sel, gpointer data)
 open a savegame

void free_object (GtkObject *obj, gpointer data)
 free the widget and the data pointer

void opengame_handler (void)
 handle an open choice

gint close_newgame (GtkWidget *widget, gpointer data)
 deal with the closing of the newgame form

void newgame_handler (void)
 handle a new game menu choice

void store_filename (GtkWidget *sel, gpointer data)
 set the save game name

void savegameas_handler (void)
 handle a savegame as menu choice

void savegame_handler (void)
 handle a save choice


Variables

ng_form_tag ng
 new game form entities


Detailed Description

front end for performing savegames

Does all the gtk-related processing for the savegames. The idea is to separate the front end from the back end, allowing us to use a common set of routines to read and write savegames on unix platforms.

Definition in file savegame_fe.c.


Function Documentation

gint close_newgame GtkWidget *    widget,
gpointer    data
[static]
 

deal with the closing of the newgame form

Parameters:
widget  unused
data  unused

Definition at line 237 of file savegame_fe.c.

References ng_form_tag::form, and ng.

Referenced by newgame_handler().

void doOpen gchar *    filename [static]
 

load a game

Called by the open dialog handler.

Parameters:
filename  the file name

Definition at line 150 of file savegame_fe.c.

References DrawGame(), loadCities(), MapHasJumped(), PostLoadGame(), savegame_citycount(), savegame_close(), savegame_getcity(), savegame_open(), and setCityFileName().

Referenced by open_afile().

void free_listselect struct city_listselect   sel [static]
 

free the list selection strucure

Parameters:
sel  the city celection structure

Definition at line 46 of file savegame_fe.c.

References savegame_close(), city_listselect::sg, and city_listselect::store.

Referenced by ImportOneFromGame().

void free_object GtkObject *    obj,
gpointer    data
[static]
 

free the widget and the data pointer

Parameters:
obj  unused
data  the object to destroy

Definition at line 196 of file savegame_fe.c.

Referenced by opengame_handler().

void ImportOneFromGame GtkWidget *    widget,
gint    response,
gpointer    data
[static]
 

load one of the palm games from the pdb file

The OK button was clicked on the list of games from the list of the palm cities.

Parameters:
widget  the dialog
response  the response button clicked on the dialog
data  the city structure

Definition at line 64 of file savegame_fe.c.

References DrawGame(), free_listselect(), city_listselect::list, MapHasJumped(), PostLoadGame(), savegame_getcity(), and city_listselect::sg.

Referenced by loadCities(), and lsrow_activated().

void loadCities savegame_t *    sg [static]
 

load the cities

Parameters:
sg  the savegame

Definition at line 108 of file savegame_fe.c.

References city_listselect::dlg, ImportOneFromGame(), city_listselect::list, lsrow_activated(), savegame_citycount(), city_listselect::sg, and city_listselect::store.

Referenced by doOpen().

void lsrow_activated gpointer    data [static]
 

row double clicked function

happens when a row is double clicked. We emulate clicking the OK response in the dialog.

Parameters:
data  the struct city_listselect *

Definition at line 96 of file savegame_fe.c.

References city_listselect::dlg, and ImportOneFromGame().

Referenced by loadCities().

void newgame_handler void   
 

handle a new game menu choice

Todo:
save the game before starting a new one

Definition at line 248 of file savegame_fe.c.

References ng_form_tag::cityName, close_newgame(), create_right_label(), ng_form_tag::form, and ng.

void open_afile GtkObject *    sel,
gpointer    data
[static]
 

open a savegame

Parameters:
sel  unused
data  the filename from the selection dialog

Definition at line 182 of file savegame_fe.c.

References doOpen().

Referenced by opengame_handler().

void opengame_handler void   
 

handle an open choice

Todo:
save any game in progress

Definition at line 207 of file savegame_fe.c.

References free_object(), and open_afile().

void store_filename GtkWidget *    sel,
gpointer    data
 

set the save game name

Parameters:
sel  unused
data  the file selection dialog that caused this

Definition at line 289 of file savegame_fe.c.

References save_defaultfilename(), and setCityFileName().

Referenced by savegameas_handler().


Generated on Mon Aug 30 19:44:17 2004 for pocketcity by doxygen1.2.18