Main Page   Data Structures   File List   Data Fields   Globals   Related Pages  

source/handler.c

Go to the documentation of this file.
00001 
00008 #include <config.h>
00009 
00010 #include <handler.h>
00011 #include <drawing.h>
00012 #include <zakdef.h>
00013 #include <locking.h>
00014 #include <ui.h>
00015 #include <globals.h>
00016 #include <handler.h>
00017 #include <build.h>
00018 #include <simulation.h>
00019 #include <compilerpragmas.h>
00020 
00021 /* for the palm */
00022 #ifdef PALM
00023 #include <PalmOS.h>
00024 #include <unix_string.h>
00025 #include <unix_stdlib.h>
00026 #else
00027 #include <string.h>
00028 #include <stdlib.h>
00029 #endif
00030 
00031 void
00032 PCityMain(void)
00033 {
00034         InitWorld();
00035         InitGraphic();
00036         setLoopSeconds(SPEED_PAUSED);
00037 }
00038 
00039 void
00040 setMapSize(UInt8 X, UInt8 Y)
00041 {
00042         setMapVariables(X, Y);
00043 
00044         LockZone(lz_world);
00045         ResizeWorld(WorldSize());
00046         UnlockZone(lz_world);
00047         UIMapResize();
00048 }
00049 
00050 void
00051 PCityShutdown(void)
00052 {
00053         endSimulation();
00054 }
00055 
00062 void
00063 InitGameStruct(void)
00064 {
00065         memset((void *)&vgame, 0, sizeof (vgame));
00066         memset((void *)&game, 0, sizeof (game));
00067         setGameVersion(SAVEGAMEVERSION);
00068         AddGridUpdate(GRID_ALL);
00069         //setTimeElapsed(0);
00070         setMapXPos(50);
00071         setMapYPos(50);
00072         //setDifficultyLevel(0);
00073         setDisasterLevel(1);
00074         setUpkeep(0, 100);
00075         setUpkeep(1, 100);
00076         setUpkeep(2, 100);
00077         setMapSize((Int16)100, (Int16)100);
00078         setTax(8);
00079         //setLoopSeconds(SPEED_PAUSED);
00080         SETAUTOBULLDOZE(1);
00081 }
00082 
00089 void
00090 ConfigureNewGame(void)
00091 {
00092         switch (getDifficultyLevel()) {
00093         case 0:
00094                 setCredits(50000);
00095                 break;
00096         case 1:
00097                 setCredits(30000);
00098                 break;
00099         case 2:
00100                 setCredits(15000);
00101                 break;
00102         default:
00103                 setCredits(10000);
00104                 break;
00105         }
00106         CreateFullRiver();
00107         CreateForests();
00108         DrawGame(1);
00109 }
00110 
00115 void
00116 DrawGame(Int8 full __attribute__((unused)))
00117 {
00118         RedrawAllFields();
00119 }
00120 
00124 void
00125 PostLoadGame(void)
00126 {
00127         memset((void *)&vgame.BuildCount, 0, sizeof (vgame.BuildCount));
00128         setMapVariables(getMapWidth(), getMapHeight());
00129         UpdateVolatiles();
00130         AddGridUpdate(GRID_ALL);
00131         UIMapResize();
00132         UIPostLoadGame();
00133 }

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