Micropolis
|
File I/O operations for Micropolis game engine. More...
#include "micropolis.h"
Go to the source code of this file.
Macros | |
#define | SWAP_SHORTS(buf, len) swap_shorts(buf, len) |
#define | HALF_SWAP_LONGS(buf, len) half_swap_longs(buf, len) |
Functions | |
static void | swap_shorts (short *buf, int len) |
static void | half_swap_longs (long *buf, int len) |
static bool | load_short (short *buf, int len, FILE *f) |
static bool | save_short (short *buf, int len, FILE *f) |
File I/O operations for Micropolis game engine.
Implements file loading and saving functionalities for the Micropolis game engine. It includes endianess conversions for data compatibility between different architectures, loading and saving city files, handling scenario files, and various utility functions to support file I/O operations. It also includes functions to report file operations to the front-end.
Definition in file fileio.cpp.
#define HALF_SWAP_LONGS | ( | buf, | |
len | |||
) | half_swap_longs(buf, len) |
Convert an array of long values between MAC and Intel endian formats.
buf | Array with longs. |
len | Number of long values in the array. |
Definition at line 99 of file fileio.cpp.
#define SWAP_SHORTS | ( | buf, | |
len | |||
) | swap_shorts(buf, len) |
Convert an array of short values between MAC and Intel endian formats.
buf | Array with shorts. |
len | Number of short values in the array. |
Definition at line 92 of file fileio.cpp.
|
static |
Swap upper and lower words of all longs in the array.
buf | Array with longs. |
len | Number of long values in the array. |
Definition at line 123 of file fileio.cpp.
|
static |
Load an array of short values from file to memory.
Convert to the correct processor architecture, if necessary.
buf | Buffer to put the loaded short values in. |
len | Number of short values to load. |
f | File handle of the file to load from. |
Definition at line 171 of file fileio.cpp.
References SWAP_SHORTS.
Referenced by Micropolis::loadFileData().
|
static |
Save an array of short values from memory to file.
Convert to the correct endianness first, if necessary.
buf | Buffer containing the short values to save. |
len | Number of short values to save. |
f | File handle of the file to save to. |
Definition at line 194 of file fileio.cpp.
References SWAP_SHORTS.
Referenced by Micropolis::saveFile().
|
static |
Swap upper and lower byte of all shorts in the array.
buf | Array with shorts. |
len | Number of short values in the array. |
Definition at line 106 of file fileio.cpp.