X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/micropolis/blobdiff_plain/e9c442bbb6d129259d7489eb227dd289c8b3f67c..e049e4ba47308629d2233fdd3f85d49352463d9c:/src/sim/s_fileio.c diff --git a/src/sim/s_fileio.c b/src/sim/s_fileio.c index 37637f7..37c2a98 100644 --- a/src/sim/s_fileio.c +++ b/src/sim/s_fileio.c @@ -61,6 +61,13 @@ */ #include "sim.h" +void DoSaveCityAs(void); +void DidSaveCity(void); +void DidntSaveCity(char *msg); +void DidLoadCity(void); +void DidntLoadCity(char *msg); +void DidLoadScenario(void); + #define SWAP_SHORTS(a,b) _swap_shorts(a,b) #define SWAP_LONGS(a,b) _swap_longs(a,b) @@ -82,6 +89,7 @@ _swap_shorts(short *buf, int len) } } +#if 0 static void _swap_longs(long *buf, int len) { @@ -100,6 +108,7 @@ _swap_longs(long *buf, int len) buf++; } } +#endif static void _half_swap_longs(long *buf, int len) @@ -130,6 +139,7 @@ _load_short(short *buf, int len, FILE *f) } +#if 0 static int _load_long(long *buf, int len, FILE *f) { @@ -140,6 +150,7 @@ _load_long(long *buf, int len, FILE *f) return 1; } +#endif static int @@ -157,6 +168,7 @@ _save_short(short *buf, int len, FILE *f) } +#if 0 static int _save_long(long *buf, int len, FILE *f) { @@ -170,6 +182,7 @@ _save_long(long *buf, int len, FILE *f) return 1; } +#endif static @@ -373,9 +386,10 @@ int saveFile(char *filename) } +void LoadScenario(short s) { - char *name, *fname; + char *name = NULL, *fname = NULL; if (CityFileName != NULL) { ckfree(CityFileName); @@ -468,7 +482,8 @@ LoadScenario(short s) } -DidLoadScenario() +void +DidLoadScenario(void) { Eval("UIDidLoadScenario"); } @@ -485,12 +500,12 @@ int LoadCity(char *filename) CityFileName = (char *)ckalloc(strlen(filename) + 1); strcpy(CityFileName, filename); - if (cp = (char *)rindex(filename, '.')) + if ((cp = (char *)rindex(filename, '.'))) *cp = 0; #ifdef MSDOS - if (cp = (char *)rindex(filename, '\\')) + if ((cp = (char *)rindex(filename, '\\'))) #else - if (cp = (char *)rindex(filename, '/')) + if ((cp = (char *)rindex(filename, '/'))) #endif cp++; else @@ -514,12 +529,14 @@ int LoadCity(char *filename) } -DidLoadCity() +void +DidLoadCity(void) { Eval("UIDidLoadCity"); } +void DidntLoadCity(char *msg) { char buf[1024]; @@ -528,7 +545,8 @@ DidntLoadCity(char *msg) } -SaveCity() +void +SaveCity(void) { char msg[256]; @@ -547,18 +565,21 @@ SaveCity() } -DoSaveCityAs() +void +DoSaveCityAs(void) { Eval("UISaveCityAs"); } -DidSaveCity() +void +DidSaveCity(void) { Eval("UIDidSaveCity"); } +void DidntSaveCity(char *msg) { char buf[1024]; @@ -567,6 +588,7 @@ DidntSaveCity(char *msg) } +void SaveCityAs(char *filename) { char msg[256]; @@ -578,12 +600,12 @@ SaveCityAs(char *filename) strcpy(CityFileName, filename); if (saveFile(CityFileName)) { - if (cp = (char *)rindex(filename, '.')) + if ((cp = (char *)rindex(filename, '.'))) *cp = 0; #ifdef MSDOS - if (cp = (char *)rindex(filename, '\\')) + if ((cp = (char *)rindex(filename, '\\'))) #else - if (cp = (char *)rindex(filename, '/')) + if ((cp = (char *)rindex(filename, '/'))) #endif cp++; else