Micropolis
micropolis.cpp File Reference

Primary implementation file for the Micropolis game engine. More...

#include "micropolis.h"

Go to the source code of this file.

Macros

#define CLIPPER_LOOP_BODY(CODE)
 
#define HEAT
 
#define ECOMASK   0x3fc
 
#define ECO
 

Functions

static bool testDirectory (const std::string &dir, const std::string &envVar)
 

Detailed Description

Primary implementation file for the Micropolis game engine.

This file contains the core implementation of the Micropolis game engine. It includes the main class constructor, destructor, initialization and destruction functions, and other essential methods that underpin the game's functionality. The file covers various aspects of the game such as simulation control, disaster handling, sound effects, and map manipulation.

Definition in file micropolis.cpp.

Macro Definition Documentation

◆ CLIPPER_LOOP_BODY

#define CLIPPER_LOOP_BODY (   CODE)
Value:
src = cellSrc; dst = cellDst; \
for (x = 0; x < WORLD_W;) { \
short nw, n, ne, w, c, e, sw, s, se; \
src = cellSrc + (x * SRCCOL); \
dst = cellDst + (x * DSTCOL); \
w = src[0]; c = src[SRCCOL]; e = src[2 * SRCCOL]; \
sw = src[1]; s = src[SRCCOL + 1]; se = src[(2 * SRCCOL) + 1]; \
for (y = 0; y < WORLD_H; y++) { \
nw = w; w = sw; sw = src[2]; \
n = c; c = s; s = src[SRCCOL + 2]; \
ne = e; e = se; se = src[(2 * SRCCOL) + 2]; \
{ CODE } \
src++; dst++; \
} \
x++; \
src = cellSrc + ((x + 1) * SRCCOL) - 3; \
dst = cellDst + ((x + 1) * DSTCOL) - 1; \
nw = src[1]; n = src[SRCCOL + 1]; ne = src[(2 * SRCCOL) + 1]; \
w = src[2]; c = src[SRCCOL + 2]; e = src[(2 * SRCCOL) + 2]; \
for (y = WORLD_H - 1; y >= 0; y--) { \
sw = w; w = nw; nw = src[0]; \
s = c; c = n; n = src[SRCCOL]; \
se = e; e = ne; ne = src[2 * SRCCOL]; \
{ CODE } \
src--; dst--; \
} \
x++; \
}
static const int WORLD_H
Definition: map_type.h:95
static const int WORLD_W
Definition: map_type.h:90

◆ HEAT

#define HEAT
Value:
a += nw + n + ne + w + e + sw + s + se + fl; \
dst[0] = ((a >> 3) & LOMASK) | ANIMBIT | BURNBIT | BULLBIT; \
a &= 7;
@ BURNBIT
bit 13, tile can be lit.
Definition: tool.h:122
@ LOMASK
Mask for the Tiles part of the tile.
Definition: tool.h:129
@ BULLBIT
bit 12, tile is bulldozable.
Definition: tool.h:123
@ ANIMBIT
bit 11, tile is animated.
Definition: tool.h:124

Function Documentation

◆ testDirectory()

static bool testDirectory ( const std::string &  dir,
const std::string &  envVar 
)
static

Check whether dir points to a directory. If not, report an error.

Parameters
dirDirectory to search.
envVarEnvironment variable controlling searchpath of the directory.
Returns
Directory has been found.

Definition at line 724 of file micropolis.cpp.