Main Page   Data Structures   File List   Data Fields   Globals   Related Pages  

nix-common/savegame_be.h File Reference

interface routines to the savegame backend More...

Go to the source code of this file.

Functions

savegame_t * savegame_open (char *filename)
 open a savegame file, breaking it into games

void savegame_close (savegame_t *sg)
 close a previously created savegame structure

int savegame_citycount (savegame_t *sg)
 get the count of the cities in a savegame structure

char * savegame_getcityname (savegame_t *sg, int item)
 get the name of a city in the savegame structure

int savegame_getcity (savegame_t *sg, int item, GameStruct *gs, char **map)
 get a city structure from the savegame structure

int savegame_setcity (savegame_t *sg, int item, GameStruct *gs, char *map)
 store the contents of a city into the savegame structure

int save_game (char *name, GameStruct *gs, char *world)
 save the game into the file specified

int save_defaultfilename (void)
 save the default savegame file and map

int load_defaultfilename (void)
 load the default file name into the default game structures

int save_filename (char *sel, GameStruct *gs, char *world)
 save a filename using the gamestruct and worldptr passed

void NewGame (void)
 Initialize the game structures for a new game.

int setCityFileName (char *name)
 set the city file name

char * getCityFileName (void)
 get the name of default city file


Detailed Description

interface routines to the savegame backend

Definition in file savegame_be.h.


Function Documentation

char* getCityFileName void   
 

get the name of default city file

Returns:
NULL if it's not set.

Definition at line 473 of file savegame_be.c.

Referenced by load_defaultfilename(), save_defaultfilename(), and savegame_handler().

int load_defaultfilename void   
 

load the default file name into the default game structures

Returns:
-1 if something went wrong, 0 otherwise

Definition at line 396 of file savegame_be.c.

References getCityFileName(), savegame_close(), savegame_getcity(), and savegame_open().

int save_defaultfilename void   
 

save the default savegame file and map

Returns:
-1 if something went wrong, 0 otherwise

Definition at line 408 of file savegame_be.c.

References getCityFileName(), and save_filename().

Referenced by savegame_handler(), and store_filename().

int save_filename char *    sel,
GameStruct   gs,
char *    world
 

save a filename using the gamestruct and worldptr passed

Parameters:
sel  the name of the file to save
gs  the gamestruct to save
world  the worldpointer to save
Returns:
-1 on error, 0 otherwise.

Definition at line 414 of file savegame_be.c.

References _game_struct06a::mapx, and _game_struct06a::mapy.

Referenced by save_defaultfilename().

int save_game char *    name,
GameStruct   gs,
char *    world
 

save the game into the file specified

Parameters:
name  the name of the file to save the game to
gs  the structure to save
world  the world to save
Returns:
0 if the file was saved successfully, -1 otherwise

int savegame_citycount savegame_t *    sg
 

get the count of the cities in a savegame structure

Parameters:
sg  the savegame structure
Returns:
the count of the cities, or -1 on error

Definition at line 389 of file savegame_be.c.

Referenced by doOpen(), and loadCities().

void savegame_close savegame_t *    sg
 

close a previously created savegame structure

Parameters:
sg  the gamestructure from an savegame_open call

Definition at line 341 of file savegame_be.c.

Referenced by doOpen(), free_listselect(), and load_defaultfilename().

int savegame_getcity savegame_t *    sg,
int    item,
GameStruct   gs,
char **    map
 

get a city structure from the savegame structure

Parameters:
sg  the savegame structure allocated from savegame_open
item  the index of the savegame to access
gs  the game structure to populate with the world
map  the reference to a pointer that will be allocated and filled with the map. It will be realloced into.
Returns:
0 if the item was copied safely, -1 otherwise
the map parameter will have it's value overwritten, so if you've allocated a pointer into it you need to free it beforehand.

Definition at line 362 of file savegame_be.c.

References _game_struct06a::mapx, and _game_struct06a::mapy.

Referenced by doOpen(), ImportOneFromGame(), and load_defaultfilename().

char* savegame_getcityname savegame_t *    sg,
int    item
 

get the name of a city in the savegame structure

Parameters:
sg  the savegame structure allocated from savegame_open
item  the savegame who's name you want to access
Returns:
a pointer to the savegame, or NULL on error

Definition at line 353 of file savegame_be.c.

savegame_t* savegame_open char *    filename
 

open a savegame file, breaking it into games

Parameters:
filename  the name of the file to open
Returns:
the savegame, or NULL if the file could not be processed.

Definition at line 274 of file savegame_be.c.

References inMem(), and SAVEGAMEVERSION.

Referenced by doOpen(), and load_defaultfilename().

int savegame_setcity savegame_t *    sg,
int    item,
GameStruct   gs,
char *    map
 

store the contents of a city into the savegame structure

Parameters:
sg  the savegame structure
item  the index of the savegame to set
gs  the game structure to store
map  the map to store
Returns:
0 on success, -1 on error

Definition at line 375 of file savegame_be.c.

References _game_struct06a::mapx, and _game_struct06a::mapy.

int setCityFileName char *    name
 

set the city file name

Returns:
-1 if the name was rejected (ended in .pdb)

Definition at line 479 of file savegame_be.c.

Referenced by doOpen(), and store_filename().


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