Main Page   Data Structures   File List   Data Fields   Globals   Related Pages  

palm/savegame.c File Reference

This file handles savegame front end. More...

#include <PalmOS.h>
#include <StringMgr.h>
#include <unix_string.h>
#include <unix_stdlib.h>
#include <StdIOPalm.h>
#include <stddef.h>
#include <simcity.h>
#include <simcity_resconsts.h>
#include <savegame.h>
#include <savegame_be.h>
#include <logging.h>
#include <globals.h>
#include <zakdef.h>
#include <drawing.h>
#include <build.h>
#include <handler.h>
#include <simulation.h>
#include <resCompat.h>
#include <palmutils.h>
#include <repeathandler.h>

Go to the source code of this file.

Defines

#define LASTGAME   ((UInt16)~0)
 constant for 'add new game'

#define MAXSAVEGAMECOUNT   50
 maximum number of savegames in the Palm OS


Functions

void UpdateSaveGameList (void) SAVE_SECTION
 Update the list of save games.

void CleanSaveGameList (void) SAVE_SECTION
 clean up the savegame list.

void DeleteFromList (void) SAVE_SECTION
 Delete a game from the list of savegames.

int LoadFromList (void) SAVE_SECTION
 Load a game from the list of save games.

FormPtr filesSetup (FormPtr form) SAVE_SECTION
 set up the files form

void cnCreateButtonPressed (void) SAVE_SECTION
 the create button is pressed in the new city form

FormPtr cityNewSetup (FormPtr form) SAVE_SECTION
 Set up the new file form.

void cnFieldContentChanged (UInt16 fieldID) SAVE_SECTION
 deal with the width or height being changed directly

void cnRepeatPressed (EventPtr event) SAVE_SECTION
 deal with the repeat buttons being pressed

int UILoadAutoGame (void)
 Load the game form the auto-save slot.

void UIClearAutoSaveSlot (void)
 Delete the game stored in the auto-save slot.

void UISaveMyCity (void)
 save the city that is currently being used.

void UISaveAutoGame (void)
 Save the autosave game.

Boolean hFilesNew (EventPtr event)
 Handler for the new file form.

Boolean hFiles (EventPtr event)
 Handler for the list of cities dialog.


Variables

char ** citylist
 list of cities n the savegame

buttonmapping_t mapsize_map []
 structure for the map size manipulation


Detailed Description

This file handles savegame front end.

Definition in file savegame.c.


Function Documentation

FormPtr cityNewSetup FormPtr    form [static]
 

Set up the new file form.

Parameters:
form  pointer to the form.
Returns:
the form pointer.

Definition at line 296 of file savegame.c.

References GetObjectPtr(), and UInt16.

Referenced by hFilesNew().

void CleanSaveGameList void    [static]
 

clean up the savegame list.

free the memory that has been allocated in the files form. Makes sure that all the objects allocated have been released.

Definition at line 477 of file savegame.c.

References citylist, FreeCityNames(), and GetObjectPtr().

Referenced by cnCreateButtonPressed(), and hFiles().

void cnFieldContentChanged UInt16    fieldID [static]
 

deal with the width or height being changed directly

Parameters:
fieldID  the field that changed

Definition at line 184 of file savegame.c.

References processRepeater(), and UInt16.

Referenced by hFilesNew().

void cnRepeatPressed EventPtr    event [static]
 

deal with the repeat buttons being pressed

Parameters:
event  the event that came from the repeater

Definition at line 173 of file savegame.c.

References processRepeater(), and UInt16.

Referenced by hFilesNew().

void DeleteFromList void    [static]
 

Delete a game from the list of savegames.

uses the index into the list to choose the city to delete This is agian because the array is unsorted

Definition at line 524 of file savegame.c.

References DeleteGameByName(), GetObjectPtr(), and Int16.

Referenced by hFiles().

FormPtr filesSetup FormPtr    form [static]
 

set up the files form

Parameters:
form  the form to be dealt with
Returns:
the form passed in

Definition at line 392 of file savegame.c.

References UpdateSaveGameList().

Referenced by hFiles().

Boolean hFiles EventPtr    event
 

Handler for the list of cities dialog.

Ensures that the list is populated with all the cities in the save game slots.

Definition at line 323 of file savegame.c.

References CleanSaveGameList(), DeleteFromList(), filesSetup(), formID_pocketCity, Int16, LoadFromList(), and UpdateSaveGameList().

Boolean hFilesNew EventPtr    event
 

Handler for the new file form.

Makes sure that the text field is given focus.

Definition at line 90 of file savegame.c.

References cityNewSetup(), cnCreateButtonPressed(), cnFieldContentChanged(), cnRepeatPressed(), and UInt16.

int LoadFromList void    [static]
 

Load a game from the list of save games.

Uses the index into the array, as the array is unsorted, and maps 1:1 with the underlying savegames

Definition at line 501 of file savegame.c.

References GetObjectPtr(), and LoadGameByName().

Referenced by hFiles().

void UISaveAutoGame void   
 

Save the autosave game.

The autosave slot is simply the name of the current autosave city.

Definition at line 80 of file savegame.c.

References SetAutoSave(), and UISaveMyCity().

void UISaveMyCity void   
 

save the city that is currently being used.

Needs to find the city in the set of saved cities

Definition at line 71 of file savegame.c.

References SaveGameByName().

Referenced by UISaveAutoGame().

void UpdateSaveGameList void    [static]
 

Update the list of save games.

Can be called from 2 contexts ... from the delete items dialog or from the main save game dialog. That's the reason for the check agains the active form and the formID_files pointer

Definition at line 433 of file savegame.c.

References citylist, CityNames(), FreeCityNames(), GetObjectPtr(), and UInt16.

Referenced by cnCreateButtonPressed(), filesSetup(), and hFiles().


Variable Documentation

buttonmapping_t mapsize_map[] [static]
 

Initial value:

 {
        { rbutton_widthdown, rbutton_widthup, fieldID_width, 50, 120, 0, 0 },
        { rbutton_heightdown, rbutton_heightup, fieldID_height, 50, 120, 0, 0 },
        { 0, 0, 0, 0, 0, 0, 0 }
}
structure for the map size manipulation

Definition at line 162 of file savegame.c.


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