/* comefrom: moveWorld doEditWindow scoreDoer doMapInFront graphDoer */
+void
animateTiles(void)
{
unsigned short tilevalue, tileflags;
int dynamicFilter(int c, int r);
-int WireDrawBeegMapRect(SimView *view, short x, short y, short w, short h);
+void
drawBeegMaps()
{
sim_update_editors();
}
+void
MemDrawBeegMapRect(SimView *view, int x, int y, int w, int h)
{
int lineBytes = view->line_bytes;
}
+void
WireDrawBeegMapRect(SimView *view, short x, short y, short w, short h)
{
unsigned short *map;
};
-int (*mapProcs[NMAPS])();
-
-int drawAll(SimView *view);
-int drawRes(SimView *view);
-int drawCom(SimView *view);
-int drawInd(SimView *view);
-int drawPower(SimView *view);
-int drawLilTransMap(SimView *view);
-int drawPopDensity(SimView *view);
-int drawRateOfGrowth(SimView *view);
-int drawTrafMap(SimView *view);
-int drawPolMap(SimView *view);
-int drawCrimeMap(SimView *view);
-int drawLandMap(SimView *view);
-int drawFireRadius(SimView *view);
-int drawPoliceRadius(SimView *view);
-int drawDynamic(SimView *view);
+void (*mapProcs[NMAPS])();
+
+void drawPopDensity(SimView *view);
+void drawRateOfGrowth(SimView *view);
+void drawTrafMap(SimView *view);
+void drawPolMap(SimView *view);
+void drawCrimeMap(SimView *view);
+void drawLandMap(SimView *view);
+void drawFireRadius(SimView *view);
+void drawPoliceRadius(SimView *view);
+void ditherMap(SimView *view);
+void drawRect(SimView *view, int pixel, int solid,
+ int x, int y, int w, int h);
+void maybeDrawRect(SimView *view, int val,
+ int x, int y, int w, int h);
short GetCI(short x)
}
+void
drawPopDensity(SimView *view)
{
short x, y;
}
+void
drawRateOfGrowth(SimView *view)
{
short x, y;
}
+void
drawTrafMap(SimView *view)
{
short x;
}
+void
drawPolMap(SimView *view)
{
short x, y;
}
+void
drawCrimeMap(SimView *view)
{
short x, y;
}
+void
drawLandMap(SimView *view)
{
short x, y;
}
+void
drawFireRadius(SimView *view)
{
short x, y;
}
+void
drawPoliceRadius(SimView *view)
{
short x, y;
}
+void
setUpMapProcs(void)
{
mapProcs[ALMAP] = drawAll;
}
+void
MemDrawMap(SimView *view)
{
(*mapProcs[view->map_state])(view);
}
+void
ditherMap(SimView *view)
{
int i, x, y, width, height;
}
+void
maybeDrawRect(SimView *view, int val,
int x, int y, int w, int h)
{
}
+void
drawRect(SimView *view, int pixel, int solid,
int x, int y, int w, int h)
{
if (w && h) {
int i, j, stipple = (x ^ y) & 1;
+#if 0
unsigned char *data =
view->x->color ? view->data : view->data8;
+#endif
/* In the case of black and white, we use an 8 bit buffer and dither it. */
int pixelBytes =
QUAD line =
view->x->color ? view->line_bytes : view->line_bytes8;
+#if 0
unsigned char *image =
&(data[(line * y) + (x * pixelBytes)]);
+#endif
switch (pixelBytes) {
#define gray25_width 16
#define gray25_height 16
-static unsigned char gray25_bits[] = {
+static char gray25_bits[] = {
0x77, 0x77,
0xdd, 0xdd,
0x77, 0x77,
#define gray50_width 16
#define gray50_height 16
-static unsigned char gray50_bits[] = {
+static char gray50_bits[] = {
0x55, 0x55,
0xaa, 0xaa,
0x55, 0x55,
#define gray75_width 16
#define gray75_height 16
-static unsigned char gray75_bits[] = {
+static char gray75_bits[] = {
0x88, 0x88,
0x22, 0x22,
0x88, 0x88,
#define vert_width 16
#define vert_height 16
-static unsigned char vert_bits[] = {
+static char vert_bits[] = {
0xaa, 0xaa,
0xaa, 0xaa,
0xaa, 0xaa,
#define horiz_width 16
#define horiz_height 16
-static unsigned char horiz_bits[] = {
+static char horiz_bits[] = {
0xff, 0xff,
0x00, 0x00,
0xff, 0xff,
#define diag_width 16
#define diag_height 16
-static unsigned char diag_bits[] = {
+static char diag_bits[] = {
0x55, 0x55,
0xee, 0xee,
0x55, 0x55,
}
+void
GetPixmaps(XDisplay *xd)
{
if (xd->gray25_stipple == None) {
}
+void
GetViewTiles(SimView *view)
{
char name[256];
}
}
- { int x, y, b, tile;
+ { int x, y, tile;
unsigned char *from, *to;
int pixelBytes = view->pixel_bytes;
- int rowBytes = view->x->small_tile_image->bytes_per_line;
if (pixelBytes == 0) {
/* handle the case of monochrome display (8 bit map) */
c = col >>1;
if (((DynamicData[0] > DynamicData[1]) ||
- ((x = PopDensity[c][r]) >= DynamicData[0]) &&
- (x <= DynamicData[1])) &&
+ (((x = PopDensity[c][r]) >= DynamicData[0]) &&
+ (x <= DynamicData[1]))) &&
((DynamicData[2] > DynamicData[3]) ||
- ((x = RateOGMem[c>>2][r>>2]) >= ((2 * DynamicData[2]) - 256)) &&
- (x <= ((2 * DynamicData[3]) - 256))) &&
+ (((x = RateOGMem[c>>2][r>>2]) >= ((2 * DynamicData[2]) - 256)) &&
+ (x <= ((2 * DynamicData[3]) - 256)))) &&
((DynamicData[4] > DynamicData[5]) ||
- ((x = TrfDensity[c][r]) >= DynamicData[4]) &&
- (x <= DynamicData[5])) &&
+ (((x = TrfDensity[c][r]) >= DynamicData[4]) &&
+ (x <= DynamicData[5]))) &&
((DynamicData[6] > DynamicData[7]) ||
- ((x = PollutionMem[c][r]) >= DynamicData[6]) &&
- (x <= DynamicData[7])) &&
+ (((x = PollutionMem[c][r]) >= DynamicData[6]) &&
+ (x <= DynamicData[7]))) &&
((DynamicData[8] > DynamicData[9]) ||
- ((x = CrimeMem[c][r]) >= DynamicData[8]) &&
- (x <= DynamicData[9])) &&
+ (((x = CrimeMem[c][r]) >= DynamicData[8]) &&
+ (x <= DynamicData[9]))) &&
((DynamicData[10] > DynamicData[11]) ||
- ((x = LandValueMem[c][r]) >= DynamicData[10]) &&
- (x <= DynamicData[11])) &&
+ (((x = LandValueMem[c][r]) >= DynamicData[10]) &&
+ (x <= DynamicData[11]))) &&
((DynamicData[12] > DynamicData[13]) ||
- ((x = PoliceMapEffect[c>>2][r>>2]) >= DynamicData[12]) &&
- (x <= DynamicData[13])) &&
+ (((x = PoliceMapEffect[c>>2][r>>2]) >= DynamicData[12]) &&
+ (x <= DynamicData[13]))) &&
((DynamicData[14] > DynamicData[15]) ||
- ((x = FireRate[c>>2][r>>2]) >= DynamicData[14]) &&
- (x <= DynamicData[15]))) {
+ (((x = FireRate[c>>2][r>>2]) >= DynamicData[14]) &&
+ (x <= DynamicData[15])))) {
return 1;
} else {
return 0;
extern SimSprite *MakeSprite();
extern SimSprite *MakeNewSprite();
-extern int setSpeed(short speed);
-extern int setSkips(int skips);
-extern int SetGameLevel(short level);
-extern int SetGameLevelFunds(short level);
-
extern struct XDisplay *XDisplays;
+
+/* Functions referenced from other files */
+/* g_ani.c */
+void animateTiles(void);
+/* g_bigmap.c */
+void WireDrawBeegMapRect(SimView *view, short x, short y, short w, short h);
+void MemDrawBeegMapRect(SimView *view, int x, int y, int w, int h);
+/* g_map.c */
+void setUpMapProcs(void);
+void MemDrawMap(SimView *view);
+/* g_setup.c */
+void GetViewTiles(SimView *view);
+void GetPixmaps(XDisplay *xd);
+/* g_smmaps.c */
+void drawAll(SimView *view);
+void drawRes(SimView *view);
+void drawCom(SimView *view);
+void drawInd(SimView *view);
+void drawLilTransMap(SimView *view);
+void drawPower(SimView *view);
+void drawDynamic(SimView *view);
+/* rand.c */
+int sim_rand(void);
+void sim_srand(u_int seed);
+/* sim.c */
+void sim_exit(int val);
+void sim_update_editors(void);
+void sim_update(void);
+void sim_init(void);
+void sim_really_exit(int val);
+void sim_loop(int doSim);
+/* s_alloc.c */
+void initMapArrays(void);
+/* s_disast.c */
+void DoDisasters(void);
+void DoFlood(void);
+void MakeFlood(void);
+void MakeEarthquake(void);
+void MakeMeltdown(void);
+void MakeFire(void);
+void FireBomb(void);
+/* s_eval.c */
+void EvalInit(void);
+void CityEvaluation(void);
+int GetFire(void);
+int GetUnemployment(void);
+int AverageTrf(void);
+/* s_fileio.c */
+int LoadCity(char *filename);
+void SaveCity(void);
+void SaveCityAs(char *filename);
+void LoadScenario(short s);
+/* s_gen.c */
+void ClearMap(void);
+void SmoothTrees(void);
+void SmoothRiver(void);
+void GenerateSomeCity(int r);
+void ClearUnnatural(void);
+void SmoothWater(void);
+void GenerateNewCity(void);
+/* s_init.c */
+void ResetMapState(void);
+void ResetEditorState(void);
+void InitWillStuff(void);
+/* s_msg.c */
+void SendMessages(void);
+void SendMesAt(short Mnum, short x, short y);
+void ClearMes(void);
+int SendMes(int Mnum);
+void SendMesAt(short Mnum, short x, short y);
+void doMessage(void);
+/* s_power.c */
+void PushPowerStack(void);
+void DoPowerScan(void);
+int MoveMapSim (short MDir);
+/* s_scan.c */
+void FireAnalysis(void);
+void PopDenScan(void);
+void CrimeScan(void);
+void PTLScan(void);
+/* s_sim.c */
+void SimFrame(void);
+void DoSimInit(void);
+void SeedRand(int seed);
+void DoMeltdown(int SX, int SY);
+void FireZone(int Xloc, int Yloc, int ch);
+int Rand16(void);
+int Rand16Signed(void);
+void RandomlySeedRand();
+void RepairZone(short ZCent, short zsize);
+void DoSPZone(short PwrOn);
+void UpdateFundEffects(void);
+/* s_traf.c */
+int FindPRoad(void);
+int MakeTraf(int Zt);
+/* s_zone.c */
+void DoZone(void);
+int SetZPower(void);
+int RZPop(int Ch9);
+int CZPop(int Ch9);
+int IZPop(int Ch9);
+int DoFreePop (void);
+/* w_budget.c */
+void UpdateBudgetWindow(void);
+void InitFundingLevel(void);
+void drawCurrPercents(void);
+void DoBudget(void);
+void drawBudgetWindow(void);
+void DoBudgetFromMenu(void);
+void UpdateBudget(void);
+/* w_con.c */
+int ConnecTile(short x, short y, short *TileAdrPtr, short Command);
+/* w_date.c */
+void date_command_init(void);
+/* w_editor.c */
+void DoUpdateEditor(SimView *view);
+void editor_command_init(void);
+void DoNewEditor(SimView *view);
+/* w_eval.c */
+void scoreDoer(void);
+void ChangeEval(void);
+/* w_graph.c */
+void graphDoer(void);
+void initGraphs(void);
+void ChangeCensus(void);
+void doAllGraphs(void);
+void DestroyGraph(SimGraph *graph);
+void InitGraphMax(void);
+void graph_command_init(void);
+int ConfigureSimGraph(Tcl_Interp *interp, SimGraph *graph, int argc, char **argv, int flags);
+/* w_keys.c */
+void ResetLastKeys(void);
+void doKeyUp(SimView *view, short charCode);
+void doKeyDown(SimView *view, short charCode);
+/* w_map.c */
+int DoUpdateMap(SimView *view);
+void map_command_init(void);
+void DoNewMap(SimView *view);
+/* w_resrc.c */
+void GetIndString(char *str, int id, short num);
+/* w_sim.c */
+void sim_command_init(void);
+/* w_sound.c */
+void InitializeSound(void);
+void MakeSound(char *channel, char *id);
+void MakeSoundOn(SimView *view, char *channel, char *id);
+void SoundOff(void);
+void StartBulldozer(void);
+void StopBulldozer(void);
+void sound_command_init(void);
+/* w_sprite.c */
+void MoveObjects(void);
+void MakeExplosion(int x, int y);
+void MakeExplosionAt(int x, int y);
+void GenerateShip(void);
+void GeneratePlane(int x, int y);
+void GenerateCopter(int x, int y);
+void GenerateTrain(int x, int y);
+void MakeMonster(void);
+void MakeTornado(void);
+void MakeAirCrash(void);
+void DestroyAllSprites(void);
+void DrawObjects(SimView *view);
+void sprite_command_init(void);
+/* w_stubs.c */
+void SetFunds(int dollars);
+void Spend(int dollars);
+void DropFireBombs(void);
+QUAD TickCount(void);
+void GameStarted(void);
+void InitGame(void);
+void ReallyQuit(void);
+/* w_tk.c */
+void tk_main(void);
+void StopEarthquake(void);
+void CancelRedrawView(SimView *view);
+void RedrawMaps(void);
+void EventuallyRedrawView(SimView *view);
+void StopToolkit(void);
+void InvalidateEditors(void);
+int Eval(char *buf);
+void DoEarthQuake(void);
+void Kick(void);
+void InvalidateMaps(void);
+int ConfigureTileView(Tcl_Interp *interp, SimView *view, int argc, char **argv, int flags);
+void DidStopPan(SimView *view);
+void RedrawEditors(void);
+void StartMicropolisTimer(void);
+void StopMicropolisTimer(void);
+/* w_tool.c */
+void ToolDrag(SimView *view, int px, int py);
+void ToolUp(SimView *view, int x, int y);
+void ChalkTo(SimView *view, int x, int y);
+void ChalkStart(SimView *view, int x, int y, int color);
+short tally(short tileValue);
+int bulldozer_tool(SimView *view, short x, short y);
+void setWandState(SimView *view, short state);
+void ToolDown(SimView *view, int x, int y);
+void DoTool(SimView *view, short tool, short x, short y);
+/* w_update.c */
+void DoUpdateHeads(void);
+void UpdateFunds(void);
+void UpdateEvaluation(void);
+void UpdateGraphs(void);
+void UpdateEditors(void);
+void UpdateMaps(void);
+void UpdateHeads(void);
+void doTimeStuff(void);
+/* w_util.c */
+void DoNewGame(void);
+void setCityName(char *name);
+void setAnyCityName(char *name);
+void DoSetMapState(SimView *view, short state);
+void makeDollarDecimalStr(char *numStr, char *dollarStr);
+int CurrentYear(void);
+void SetYear(int year);
+void Pause(void);
+void Resume(void);
+void setSpeed(short speed);
+void setSkips(int skips);
+void SetGameLevel(short level);
+void SetGameLevelFunds(short level);
+/* w_x.c */
+void DoTimeoutListen(void);
+void DoStopMicropolis(void);
+void UpdateFlush(void);
+void DoPanTo(struct SimView *view, int x, int y);
+void DoResizeView(SimView *view, int w, int h);
+void DestroyView(SimView *view);
+void ViewToPixelCoords(SimView *view, int x, int y, int *outx, int *outy);
+void FreeInk(Ink *ink);
+void AddInk(Ink *ink, int x, int y);
+void StartInk(Ink *ink, int x, int y);
+void DoPanBy(struct SimView *view, int dx, int dy);
+void ViewToTileCoords(SimView *view, int x, int y, int *outx, int *outy);
+void EraseOverlay(void);
+SimView *InitNewView(SimView *view, char *title, int class, int w, int h);
+void IncRefDisplay(XDisplay *xd);
+void DecRefDisplay(XDisplay *xd);
#OPTFLAGS = -g
#DEFINES = -DIS_LINUX -DCAM -DNET
-DEFINES = -DIS_LINUX -DNO_AIRCRASH
+DEFINES = -DIS_LINUX #-DNO_AIRCRASH
-CFLAGS += $(OPTFLAGS) $(DEFINES)
+CFLAGS += $(OPTFLAGS) $(DEFINES) -Wall
#LDFLAGS = -Bstatic
LDFLAGS=-L/usr/X11/lib -L/usr/X11R6/lib
static unsigned QUAD next = 1;
int
-sim_rand()
+sim_rand(void)
{
next = next * 1103515245 + 12345;
return ((next % ((SIM_RAND_MAX + 1) <<8)) >>8);
}
void
-sim_srand(seed)
-u_int seed;
+sim_srand(u_int seed)
{
next = seed;
}
short *PowerMap;
-int initMapArrays(void)
+void initMapArrays(void)
{
short i;
unsigned short *auxPtr, *temp1;
short FloodCnt;
short FloodX, FloodY;
+void SetFire(void);
+int Vunerable(int tem);
+void ScenarioDisaster(void);
/* comefrom: Simulate */
+void
DoDisasters(void)
{
/* Chance of disasters at lev 0 1 2 */
/* comefrom: DoDisasters */
+void
ScenarioDisaster(void)
{
- int x, y;
-
switch (DisasterEvent) {
case 1: /* Dullsville */
break;
/* comefrom: ScenarioDisaster */
+void
MakeMeltdown(void)
{
short x, y;
}
-FireBomb()
+void
+FireBomb(void)
{
CrashX = Rand(WORLD_X - 1);
CrashY = Rand(WORLD_Y - 1);
/* comefrom: DoDisasters ScenarioDisaster */
+void
MakeEarthquake(void)
{
register short x, y, z;
/* comefrom: DoDisasters */
+void
SetFire(void)
{
register short x, y, z;
/* comefrom: DoDisasters */
+void
MakeFire(void)
{
short t, x, y, z;
/* comefrom: MakeEarthquake */
+int
Vunerable(int tem)
{
register int tem2;
/* comefrom: DoDisasters ScenarioDisaster */
+void
MakeFlood(void)
{
static short Dx[4] = { 0, 1, 0,-1};
/* comefrom: MapScan */
+void
DoFlood(void)
{
static short Dx[4] = { 0, 1, 0,-1};
short CityScore, deltaCityScore, AverageCityScore;
short TrafficAverage;
+void DoVotes(void);
+void GetScore(void);
+void VoteProblems(void);
+void DoProblems(void);
+void DoPopNum(void);
+void GetAssValue(void);
+
/* comefrom: SpecialInit Simulate */
+void
CityEvaluation(void)
{
EvalValid = 0;
/* comefrom: CityEvaluation SetCommonInits */
+void
EvalInit(void)
{
register short x, z;
/* comefrom: CityEvaluation */
+void
GetAssValue(void)
{
QUAD z;
/* comefrom: CityEvaluation */
+void
DoPopNum(void)
{
QUAD OldCityPop;
/* comefrom: CityEvaluation */
+void
DoProblems(void)
{
register short x, z;
- short ThisProb, Max;
+ short ThisProb = 0, Max;
for (z = 0; z < PROBNUM; z++)
ProblemTable[z] = 0;
/* comefrom: DoProblems */
+void
VoteProblems(void)
{
- register x, z, count;
+ register int x, z, count;
for (z = 0; z < PROBNUM; z++)
ProblemVotes[z] = 0;
/* comefrom: DoProblems */
+int
AverageTrf(void)
{
QUAD TrfTotal;
/* comefrom: DoProblems */
+int
GetUnemployment(void)
{
float r;
/* comefrom: DoProblems GetScore */
+int
GetFire(void)
{
short z;
/* comefrom: CityEvaluation */
+void
GetScore(void)
{
- register x, z;
+ register int x, z;
short OldCityScore;
float SM, TM;
/* comefrom: CityEvaluation */
+void
DoVotes(void)
{
- register z;
+ register int z;
CityYes = 0;
CityNo = 0;
*/
#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)
}
}
+#if 0
static void
_swap_longs(long *buf, int len)
{
buf++;
}
}
+#endif
static void
_half_swap_longs(long *buf, int len)
}
+#if 0
static int
_load_long(long *buf, int len, FILE *f)
{
return 1;
}
+#endif
static int
}
+#if 0
static int
_save_long(long *buf, int len, FILE *f)
{
return 1;
}
+#endif
static
}
+void
LoadScenario(short s)
{
- char *name, *fname;
+ char *name = NULL, *fname = NULL;
if (CityFileName != NULL) {
ckfree(CityFileName);
}
-DidLoadScenario()
+void
+DidLoadScenario(void)
{
Eval("UIDidLoadScenario");
}
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
}
-DidLoadCity()
+void
+DidLoadCity(void)
{
Eval("UIDidLoadCity");
}
+void
DidntLoadCity(char *msg)
{
char buf[1024];
}
-SaveCity()
+void
+SaveCity(void)
{
char msg[256];
}
-DoSaveCityAs()
+void
+DoSaveCityAs(void)
{
Eval("UISaveCityAs");
}
-DidSaveCity()
+void
+DidSaveCity(void)
{
Eval("UIDidSaveCity");
}
+void
DidntSaveCity(char *msg)
{
char buf[1024];
}
+void
SaveCityAs(char *filename)
{
char msg[256];
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
int CurveLevel = -1; /* level for river curviness */
int CreateIsland = -1; /* -1 => 10%, 0 => never, 1 => always */
-
+void DoBRiv(void);
+void DoSRiv(void);
+void BRivPlop(void);
+void SRivPlop(void);
+void DoRivers(void);
+void DoTrees(void);
+void GetRandStart(void);
+void MakeLakes(void);
+void MakeIsland(void);
+void MakeNakedIsland(void);
+void GenerateMap(int r);
+
+
+void
GenerateNewCity(void)
{
GenerateSomeCity(Rand16());
}
+void
GenerateSomeCity(int r)
{
if (CityFileName != NULL) {
}
+int
ERand(short limit)
{
short x, z;
}
+void
GenerateMap(int r)
{
SeedRand(r);
}
+void
ClearMap(void)
{
register short x, y;
}
+void
ClearUnnatural(void)
{
register short x, y;
#define RADIUS 18
-MakeNakedIsland()
+void
+MakeNakedIsland(void)
{
register int x, y;
}
+void
MakeIsland(void)
{
MakeNakedIsland();
}
+void
MakeLakes(void)
{
short Lim1, Lim2, t, z;
}
+void
GetRandStart(void)
{
XStart = 40 + Rand(WORLD_X - 80);
}
+void
MoveMap(short dir)
{
static short DirTab[2][8] = { { 0, 1, 1, 1, 0, -1, -1, -1},
}
+void
TreeSplash(short xloc, short yloc)
{
short dis, dir;
- register short xoff, yoff, z;
+ register short z;
if (TreeLevel < 0) {
dis = Rand(150) + 50;
}
+void
DoTrees(void)
{
short Amount, x, xloc, yloc;
}
+void
SmoothRiver(void)
{
static short DX[4] = {-1, 0, 1, 0};
}
+int
IsTree(int cell)
{
if (((cell & LOMASK) >= WOODS_LOW) &&
}
+void
SmoothTrees(void)
{
static short DX[4] = {-1, 0, 1, 0};
}
+void
DoRivers(void)
{
}
+void
DoBRiv(void)
{
int r1, r2;
}
+void
DoSRiv(void)
{
int r1, r2;
}
+void
PutOnMap(short Mchar, short Xoff, short Yoff)
{
register short Xloc, Yloc, temp;
Yloc = MapY + Yoff;
if (TestBounds(Xloc, Yloc) == FALSE)
return;
- if (temp = Map[Xloc][Yloc]) {
+ if ((temp = Map[Xloc][Yloc])) {
temp = temp & LOMASK;
if (temp == RIVER)
if (Mchar != CHANNEL)
}
+void
BRivPlop(void)
{
static short BRMatrix[9][9] = {
}
+void
SRivPlop(void)
{
static short SRMatrix[6][6] = {
}
-SmoothWater()
+void
+SmoothWater(void)
{
int x, y;
/* comefrom: loadFile bootUp main doMessage */
-InitWillStuff()
+void
+InitWillStuff(void)
{
- register short x, y, z;
+ register short x, y;
RandomlySeedRand();
InitGraphMax();
}
-ResetMapState()
+void
+ResetMapState(void)
{
SimView *view;
}
-ResetEditorState()
+void
+ResetEditorState(void)
{
SimView *view;
short autoGo;
short HaveLastMessage = 0;
char LastMessage[256];
-int DoAutoGoto(short x, short y, char *msg);
-int DoShowPicture(short id);
+
+void DoAutoGoto(short x, short y, char *msg);
+void DoShowPicture(short id);
+void DoLoseGame(void);
+void SetMessageField(char *str);
+void DoScenarioScore(int type);
+void CheckGrowth(void);
+
/* comefrom: Simulate */
+void
SendMessages(void)
{
- register z;
+ register int z;
short PowerPop;
float TM;
/* comefrom: SendMessages */
+void
CheckGrowth(void)
{
QUAD ThisCityPop;
/* comefrom: SendMessages */
+void
DoScenarioScore(int type)
{
short z;
}
+void
ClearMes(void)
{
MessagePort = 0;
/* comefrom: MakeEarthquake MakeFire MakeFire MakeFlood SendMessages
CheckGrowth DoScenarioScore DoPowerScan */
+int
SendMes(int Mnum)
{
if (Mnum < 0) {
}
+void
doMessage(void)
{
char messageStr[256];
}
+void
DoAutoGoto(short x, short y, char *msg)
{
char buf[256];
}
+void
SetMessageField(char *str)
{
char buf[256];
}
+void
DoShowPicture(short id)
{
char buf[256];
}
-DoLoseGame()
+void
+DoLoseGame(void)
{
Eval("UILoseGame");
}
-DoWinGame()
+void
+DoWinGame(void)
{
Eval("UIWinGame");
}
char PowerStackX[PWRSTKSIZE], PowerStackY[PWRSTKSIZE];
QUAD MaxPower, NumPower;
+void PullPowerStack(void);
+
/* comefrom: TestForCond DoPowerScan TryGo */
+int
MoveMapSim (short MDir)
{
switch (MDir) {
/* comefrom: Simulate SpecialInit InitSimMemory */
-DoPowerScan()
+void
+DoPowerScan(void)
{
short ADir;
register int ConNum, Dir, x;
/* comefrom: DoPowerScan DoSPZone */
+void
PushPowerStack(void)
{
if (PowerStackNum < (PWRSTKSIZE - 2)) {
/* comefrom: DoPowerScan */
+void
PullPowerStack(void)
{
if (PowerStackNum > 0) {
short CrimeMaxX, CrimeMaxY;
QUAD DonDither = 0;
+void DistIntMarket(void);
+void SmoothPSMap(void);
+void SmoothFSMap(void);
+void ClrTemArray(void);
+void DoSmooth (void);
+void DoSmooth2 (void);
+void SmoothTerrain(void);
+int GetPValue(int loc);
+int GetDisCC(int x, int y);
+int GetPDen(int Ch9);
+
/* comefrom: Simulate SpecialInit */
+void
FireAnalysis(void) /* Make firerate map from firestation map */
{
- register x,y;
+ register int x,y;
SmoothFSMap();
SmoothFSMap();
/* comefrom: Simulate SpecialInit */
+void
PopDenScan(void) /* sets: PopDensity, , , ComRate */
{
QUAD Xtot, Ytot, Ztot;
/* comefrom: PopDenScan */
+int
GetPDen(int Ch9)
{
register int pop;
if (Ch9 == FREEZ) {
- pop = DoFreePop(Ch9);
+ pop = DoFreePop(/*Ch9*/);
return (pop);
}
if (Ch9 < COMBASE) {
/* comefrom: Simulate SpecialInit */
+void
PTLScan(void) /* Does pollution, terrain, land value */
{
QUAD ptot, LVtot;
zy = y <<1;
for (Mx = zx; Mx <= zx + 1; Mx++)
for (My = zy; My <= zy + 1; My++) {
- if (loc = (Map[Mx][My] & LOMASK)) {
+ if ((loc = (Map[Mx][My] & LOMASK))) {
if (loc < RUBBLE) {
Qtem[x >>1][y >>1] += 15; /* inc terrainMem */
continue;
/* comefrom: PTLScan */
+int
GetPValue(int loc)
{
if (loc < POWERBASE) {
/* comefrom: PTLScan DistIntMarket */
+int
GetDisCC(int x, int y)
{
short xdis, ydis, z;
/* comefrom: Simulate SpecialInit */
+void
CrimeScan(void)
{
short numz;
cmax = 0;
for (x = 0; x < HWLDX; x++)
for (y = 0; y < HWLDY; y++) {
- if (z = LandValueMem[x][y]) {
+ if ((z = LandValueMem[x][y])) {
++numz;
z = 128 - z;
z += PopDensity[x][y];
/* comefrom: PTLScan */
+void
SmoothTerrain(void)
{
if (DonDither & 1) {
}
/* comefrom: PopDenScan */
+void
DoSmooth (void) /* smooths data in tem[x][y] into tem2[x][y] */
{
if (DonDither & 2) {
/* comefrom: PopDenScan */
+void
DoSmooth2 (void) /* smooths data in tem2[x][y] into tem[x][y] */
{
if (DonDither & 4) {
/* comefrom: PopDenScan */
+void
ClrTemArray(void)
{
register short x, y, z;
/* comefrom: FireAnalysis */
+void
SmoothFSMap(void)
{
register short x, y, edge;
/* comefrom: CrimeScan */
+void
SmoothPSMap(void)
{
- register x, y, edge;
+ register int x, y, edge;
for (x = 0; x < SmX; x++)
for (y = 0; y < SmY; y++) {
/* comefrom: PopDenScan */
+void
DistIntMarket(void)
{
register short x, y, z;
short DoInitialEval = 0;
short MeltX, MeltY;
+void CoalSmoke(int mx, int my);
+void DoAirport(void);
+void DrawStadium(int z);
+void DoFire(void);
+int GetBoatDis(void);
+int DoBridge(void);
+void DoRoad(void);
+void DoRadTile(void);
+void DoRail(void);
+void MapScan(int x1, int x2);
+void CollectTax(void);
+void Take2Census(void);
+void TakeCensus(void);
+void ClearCensus(void);
+void SetValves(void);
+void SetCommonInits(void);
+void SimLoadInit(void);
+void InitSimMemory(void);
+void DecROGMem(void);
+void DecTrafficMem(void);
+void Simulate(int mod16);
/* comefrom: doEditWindow scoreDoer doMapInFront graphDoer doNilEvent */
-SimFrame(void)
+void SimFrame(void)
{
- short i;
-
if (SimSpeed == 0)
return;
/* comefrom: SimFrame */
+void
Simulate(int mod16)
{
static short SpdPwr[4] = { 1, 2, 4, 5 };
/* comefrom: Simulate */
+void
DoSimInit(void)
{
Fcycle = 0;
/* comefrom: SimLoadInit */
+void
DoNilPower(void)
{
register short x, y, z;
/* comefrom: Simulate */
+void
DecTrafficMem(void) /* tends to empty TrfDensity */
{
register short x, y, z;
for (x = 0; x < HWLDX; x++)
for (y = 0; y < HWLDY; y++)
- if (z = TrfDensity[x][y]) {
+ if ((z = TrfDensity[x][y])) {
if (z > 24) {
if (z > 200) TrfDensity[x][y] = z - 34;
else TrfDensity[x][y] = z - 24;
/* comefrom: Simulate */
+void
DecROGMem(void) /* tends to empty RateOGMem */
{
register short x, y, z;
/* comefrom: DoSimInit */
+void
InitSimMemory(void)
{
register short x, z;
/* comefrom: DoSimInit */
+void
SimLoadInit(void)
{
static short DisTab[9] = { 0, 2, 10, 5, 20, 3, 5, 5, 2 * 48};
/* comefrom: InitSimMemory SimLoadInit */
+void
SetCommonInits(void)
{
EvalInit();
/* comefrom: Simulate DoSimInit */
+void
SetValves(void)
{
static short TaxTable[21] = {
Births = NormResPop * (.02); /* Birth Rate */
PjResPop = NormResPop + Migration + Births; /* Projected Res.Pop */
- if (temp = (ComHis[1] + IndHis[1])) LaborBase = (ResHis[1] / temp);
+ if ((temp = (ComHis[1] + IndHis[1]))) LaborBase = (ResHis[1] / temp);
else LaborBase = 1;
if (LaborBase > 1.3) LaborBase = 1.3;
if (LaborBase < 0) LaborBase = 0; /* LB > 1 - .1 */
/* comefrom: Simulate DoSimInit */
+void
ClearCensus(void)
{
register short x, y, z;
/* comefrom: Simulate */
+void
TakeCensus(void)
{
short x;
/* comefrom: Simulate */
+void
Take2Census(void) /* Long Term Graphs */
{
short x;
/* comefrom: Simulate */
+void
CollectTax(void)
{
static float RLevels[3] = { 0.7, 0.9, 1.2 };
}
+void
UpdateFundEffects(void)
{
if (RoadFund)
/* comefrom: Simulate DoSimInit */
+void
MapScan(int x1, int x2)
{
register short x, y;
for (x = x1; x < x2; x++) {
for (y = 0; y < WORLD_Y; y++) {
- if (CChr = Map[x][y]) {
+ if ((CChr = Map[x][y])) {
CChr9 = CChr & LOMASK; /* Mask off status bits */
if (CChr9 >= FLOOD) {
SMapX = x;
/* comefrom: MapScan */
+void
DoRail(void)
{
RailTotal++;
/* comefrom: MapScan */
+void
DoRadTile(void)
{
if (!(Rand16() & 4095)) Map[SMapX][SMapY] = 0; /* Radioactive decay */
/* comefrom: MapScan */
+void
DoRoad(void)
{
register short Density, tden, z;
/* comefrom: MapScan */
+int
DoBridge(void)
{
static short HDx[7] = { -2, 2, -2, -1, 0, 1, 2 };
static short VBRTAB2[7] = {
VBRIDGE | BULLBIT, RIVER, VBRIDGE | BULLBIT, VBRIDGE | BULLBIT,
VBRIDGE | BULLBIT, VBRIDGE | BULLBIT, RIVER };
- register z, x, y, MPtem;
+ register int z, x, y, MPtem;
if (CChr9 == BRWV) { /* Vertical bridge close */
if ((!(Rand16() & 3)) &&
/* comefrom: MapScan */
+void
DoFire(void)
{
static short DX[4] = { -1, 0, 1, 0 };
/* comefrom: DoFire MakeFlood */
+void
FireZone(int Xloc, int Yloc, int ch)
{
register short Xtem, Ytem;
/* comefrom: DoSPZone DoHospChur */
+void
RepairZone(short ZCent, short zsize)
{
short cnt;
/* comefrom: DoZone */
+void
DoSPZone(short PwrOn)
{
static short MltdwnTab[3] = { 30000, 20000, 10000 }; /* simadj */
- register z;
+ register int z;
switch (CChr9) {
/* comefrom: DoSPZone */
+void
DrawStadium(int z)
{
register int x, y;
/* comefrom: DoSPZone */
+void
DoAirport(void)
{
if (!(Rand(5))) {
/* comefrom: DoSPZone */
+void
CoalSmoke(int mx, int my)
{
static short SmTb[4] = { COALSMOKE1, COALSMOKE2, COALSMOKE3, COALSMOKE4 };
/* comefrom: DoSPZone MakeMeltdown */
+void
DoMeltdown(int SX, int SY)
{
- register x, y, z, t;
+ register int x, y, z, t;
MeltX = SX; MeltY = SY;
}
+void
RandomlySeedRand()
{
struct timeval time;
SeedRand(time.tv_usec ^ time.tv_sec ^ sim_rand());
}
-
+void
SeedRand(int seed)
{
sim_srand(seed);
short Zsource;
short TrafMaxX, TrafMaxY;
+int GetFromMap(int x);
+int DriveDone(void);
+int TryGo(int z);
+int RoadTest(int x);
+void PullPos(void);
+void SetTrafMem(void);
+int TryDrive(void);
+
/* comefrom: DoIndustrial DoCommercial DoResidential */
+int
MakeTraf(int Zt)
{
short xtem, ytem;
/* comefrom: MakeTraf */
+void
SetTrafMem(void)
{
register short x, z;
/* comefrom: TryGo */
+void
PushPos(void)
{
PosStackN++;
/* comefrom: SetTrafMem */
+void
PullPos(void)
{
SMapX = SMapXStack[PosStackN];
/* comefrom: DoSPZone MakeTraf */
+int
FindPRoad(void) /* look for road on edges of zone */
{
static short PerimX[12] = {-1, 0, 1, 2, 2, 2, 1, 0,-1,-2,-2,-2};
}
+int
FindPTele(void) /* look for telecommunication on edges of zone */
{
static short PerimX[12] = {-1, 0, 1, 2, 2, 2, 1, 0,-1,-2,-2,-2};
/* comefrom: MakeTraf */
+int
TryDrive(void)
{
short z;
/* comefrom: TryDrive */
+int
TryGo(int z)
{
short x, rdir, realdir;
/* comefrom: TryGo DriveDone */
+int
GetFromMap(int x)
{
switch (x) {
/* comefrom: TryDrive */
+int
DriveDone(void)
{
static short TARGL[3] = {COMBASE, LHTHR, LHTHR};
static short TARGH[3] = {NUCLEAR, PORT, COMBASE}; /* for destinations */
- register short x, z, l, h;
+#if 0
+ register short x;
+#endif
+ register short z, l, h;
/* unwound -Don */
#if 0
/* comefrom: TryGo FindPRoad */
+int
RoadTest(int x)
{
x = x & LOMASK;
/* Zone Stuff */
-
-DoZone(void)
+void ZonePlop (int base);
+void IndPlop (int Den, int Value);
+void ComPlop (int Den, int Value);
+void ResPlop (int Den, int Value);
+int EvalLot (int x, int y);
+void BuildHouse(int value);
+void DoIndOut(int pop, int value);
+void DoComOut(int pop, int value);
+void DoResOut(int pop, int value);
+void IncROG(int amount);
+void DoIndIn(int pop, int value);
+void DoComIn(int pop, int value);
+void DoResIn(int pop, int value);
+void MakeHosp(void);
+void DoResidential(int ZonePwrFlg);
+int EvalRes (int traf);
+int EvalCom (int traf);
+int GetCRVal(void);
+void DoCommercial(int ZonePwrFlg);
+void DoIndustrial(int ZonePwrFlg);
+int EvalInd (int traf);
+void DoHospChur(void);
+
+
+void DoZone(void)
{
short ZonePwrFlg;
}
+void
DoHospChur(void)
{
if (CChr9 == HOSPITAL) {
#define ASCBIT (ANIMBIT | CONDBIT | BURNBIT)
#define REGBIT (CONDBIT | BURNBIT)
+void
SetSmoke(int ZonePower)
{
static short AniThis[8] = { T, F, T, T, F, F, T, T };
static short DX1[8] = { -1, 0, 1, 0, 0, 0, 0, 1 };
static short DY1[8] = { -1, 0, -1, -1, 0, 0, -1, -1 };
+#if 0
static short DX2[8] = { -1, 0, 1, 1, 0, 0, 1, 1 };
static short DY2[8] = { -1, 0, 0, -1, 0, 0, -1, 0 };
+#endif
static short AniTabA[8] = { 0, 0, 32, 40, 0, 0, 48, 56 };
static short AniTabB[8] = { 0, 0, 36, 44, 0, 0, 52, 60 };
static short AniTabC[8] = { IND1, 0, IND2, IND4, 0, 0, IND6, IND8 };
}
+void
DoIndustrial(int ZonePwrFlg)
{
short tpop, zscore, TrfGood;
}
+void
DoCommercial(int ZonePwrFlg)
{
register short tpop, TrfGood;
}
+void
DoResidential(int ZonePwrFlg)
{
short tpop, zscore, locvalve, value, TrfGood;
}
+void
MakeHosp(void)
{
if (NeedHosp > 0) {
}
+int
GetCRVal(void)
{
register short LVal;
}
+void
DoResIn(int pop, int value)
{
short z;
}
+void
DoComIn(int pop, int value)
{
register short z;
}
+void
DoIndIn(int pop, int value)
{
if (pop < 4) {
}
+void
IncROG(int amount)
{
RateOGMem[SMapX>>3][SMapY>>3] += amount<<2;
}
+void
DoResOut(int pop, int value)
{
static short Brdr[9] = {0,3,6,1,4,7,2,5,8};
}
+void
DoComOut(int pop, int value)
{
if (pop > 1) {
}
+void
DoIndOut(int pop, int value)
{
if (pop > 1) {
}
+int
RZPop(int Ch9)
{
short CzDen;
}
+int
CZPop(int Ch9)
{
short CzDen;
}
+int
IZPop(int Ch9)
{
short CzDen;
}
+void
BuildHouse(int value)
{
short z, score, hscore, BestLoc;
}
+void
ResPlop (int Den, int Value)
{
short base;
}
+void
ComPlop (int Den, int Value)
{
short base;
}
+void
IndPlop (int Den, int Value)
{
short base;
}
+int
EvalLot (int x, int y)
{
short z, score;
}
+void
ZonePlop (int base)
{
short z, x;
int yy = SMapY + Zy[z];
if (TestBounds(xx, yy)) {
x = Map[xx][yy] & LOMASK;
- if ((x >= FLOOD) && (x < ROADBASE)) return (FALSE);
+ if ((x >= FLOOD) && (x < ROADBASE)) return;
}
}
for (z = 0; z < 9; z++) {
}
+int
EvalRes (int traf)
{
register short Value;
}
+int
EvalCom (int traf)
{
short Value;
}
+int
EvalInd (int traf)
{
if (traf < 0) return (-1000);
}
+int
DoFreePop (void)
{
short count;
}
+int
SetZPower(void) /* set bit in MapWord depending on powermap */
{
+#if 0
short z;
+#endif
QUAD PowerWrd;
/* TestPowerBit was taking alot of time so I inlined it. -Don */
*/
#include "sim.h"
+void signal_init();
+void sim_update_evaluations(void);
+void sim_update_editors(void);
+void sim_update_budgets(void);
+void sim_update_graphs(void);
+void sim_update_maps(void);
/* Sim City */
int ExitReturn = 0;
+void
sim_exit(int val)
{
tkMustExit = 1;
}
-sim_really_exit(int val)
+void sim_really_exit(int val)
{
DoStopMicropolis();
}
+void
signal_init()
{
signal(SIGHUP, (void (*)())SignalExitHandler);
void
-sim_update()
+sim_update(void)
{
gettimeofday(&now_time, NULL);
}
+void
sim_update_editors(void)
{
SimView *view;
}
+void
sim_update_maps(void)
{
SimView *view;
}
+void
sim_update_graphs(void)
{
graphDoer();
}
+void
sim_update_budgets(void)
{
if ((sim_skips != 0) &&
}
+void
sim_update_evaluations(void)
{
if ((sim_skips != 0) &&
void
sim_heat(void)
{
- int x, y, l, r, u, d;
+ int x, y;
static int a = 0;
short *src, *dst;
register int fl = heat_flow;
}
}
-
void
sim_timeout_loop(short doSim)
{
}
+void
sim_loop(int doSim)
{
#ifdef CAM
QUAD fireMaxValue;
int MustDrawCurrPercents = 0;
int MustDrawBudgetWindow = 0;
-int SetBudget(char *flowStr, char *previousStr,
- char *currentStr, char *collectedStr, short tax);
+
+void SetBudget(char *flowStr, char *previousStr,
+ char *currentStr, char *collectedStr, short tax);
+void SetBudgetValues(char *roadGot, char *roadWant,
+ char *policeGot, char *policeWant,
+ char *fireGot, char *fireWant);
+void ShowBudgetWindowAndStartWaiting(void);
+void DoBudgetNow(int fromMenu);
void InitFundingLevel(void)
}
-DoBudget()
+void
+DoBudget(void)
{
DoBudgetNow(0);
}
-DoBudgetFromMenu()
+void
+DoBudgetFromMenu(void)
{
DoBudgetNow(1);
}
+void
DoBudgetNow(int fromMenu)
{
QUAD yumDuckets;
}
+void
drawBudgetWindow(void)
{
MustDrawBudgetWindow = 1;
}
+void
ReallyDrawBudgetWindow(void)
{
short cashFlow, cashFlow2;
sprintf(flowStr, "+%s", dollarStr);
}
- sprintf(numStr, "%d", TotalFunds);
+ sprintf(numStr, "%ld", TotalFunds);
makeDollarDecimalStr(numStr, previousStr);
- sprintf(numStr, "%d", cashFlow2 + TotalFunds);
+ sprintf(numStr, "%ld", cashFlow2 + TotalFunds);
makeDollarDecimalStr(numStr, currentStr);
- sprintf(numStr, "%d", TaxFund);
+ sprintf(numStr, "%ld", TaxFund);
makeDollarDecimalStr(numStr, collectedStr);
SetBudget(flowStr, previousStr, currentStr, collectedStr, CityTax);
}
+void
drawCurrPercents(void)
{
MustDrawCurrPercents = 1;
}
+void
ReallyDrawCurrPercents(void)
{
char num[256];
char fireWant[256], policeWant[256], roadWant[256];
char fireGot[256], policeGot[256], roadGot[256];
- sprintf(num, "%d", fireMaxValue);
+ sprintf(num, "%ld", fireMaxValue);
makeDollarDecimalStr(num, fireWant);
- sprintf(num, "%d", policeMaxValue);
+ sprintf(num, "%ld", policeMaxValue);
makeDollarDecimalStr(num, policeWant);
- sprintf(num, "%d", roadMaxValue);
+ sprintf(num, "%ld", roadMaxValue);
makeDollarDecimalStr(num, roadWant);
sprintf(num, "%d", (int)(fireMaxValue * firePercent));
}
-UpdateBudgetWindow()
+void
+UpdateBudgetWindow(void)
{
if (MustDrawCurrPercents) {
ReallyDrawCurrPercents();
}
-UpdateBudget()
+void
+UpdateBudget(void)
{
drawCurrPercents();
drawBudgetWindow();
}
-ShowBudgetWindowAndStartWaiting()
+void
+ShowBudgetWindowAndStartWaiting(void)
{
Eval("UIShowBudgetAndWait");
}
+void
SetBudget(char *flowStr, char *previousStr,
char *currentStr, char *collectedStr, short tax)
{
}
+void
SetBudgetValues(char *roadGot, char *roadWant,
char *policeGot, char *policeWant,
char *fireGot, char *fireWant)
*/
#include "sim.h"
+void _FixSingle(int x, int y, short *TileAdrPtr);
+void _FixZone(int x, int y, short *TileAdrPtr);
+int _LayDoze(int x, int y, short *TileAdrPtr);
+int _LayRoad(int x, int y, short *TileAdrPtr);
+int _LayRail(int x, int y, short *TileAdrPtr);
+int _LayWire(int x, int y, short *TileAdrPtr);
+
short _RoadTable[16] = {
66, 67, 66, 68,
/* comefrom: ConnecTile */
+void
_FixZone(int x, int y, short *TileAdrPtr)
{
_FixSingle(x,y, &TileAdrPtr[0]);
/* comefrom: _FixZone */
+void
_FixSingle(int x, int y, short *TileAdrPtr)
{
short Tile;
Tcl_HashTable DateCmds;
int DateUpdateTime = 200;
+void DoUpdateDate(SimDate *date);
+void DoNewDate(SimDate *date);
+void DoResizeDate(SimDate *date, int w, int h);
+void DestroyDate(SimDate *date);
+void InitNewDate(SimDate *date);
+int ConfigureSimDate(Tcl_Interp *interp, SimDate *date,
+ int argc, char **argv, int flags);
+
#define DEF_DATE_FONT "-Adobe-Helvetica-Bold-R-Normal-*-140-*"
#define DEF_DATE_BG_COLOR "#b0b0b0"
{
SimDate *date = (SimDate *) clientData;
Tk_Window tkwin = date->tkwin;
- Pixmap pm = None;
- Drawable d;
date->flags &= ~VIEW_REDRAW_PENDING;
//fprintf(stderr, "DisplaySimDate cleared VIEW_REDRAW_PENDING\n");
}
+void
EventuallyRedrawDate(SimDate *date)
{
if (!(date->flags & VIEW_REDRAW_PENDING)) {
int DateCmdposition(DATE_ARGS)
{
- int result = TCL_OK;
-
if ((argc != 2) && (argc != 4)) {
return TCL_ERROR;
}
int DateCmdReset(DATE_ARGS)
{
- int range;
-
if (argc != 2) {
Tcl_AppendResult(interp, "wrong # args", (char *) NULL);
return TCL_ERROR;
int DateCmdSet(DATE_ARGS)
{
- int range;
-
if (argc != 4) {
Tcl_AppendResult(interp, "wrong # args", (char *) NULL);
return TCL_ERROR;
return TCL_ERROR;
}
- if (ent = Tcl_FindHashEntry(&DateCmds, argv[1])) {
+ if ((ent = Tcl_FindHashEntry(&DateCmds, argv[1]))) {
cmd = (int (*)())ent->clientData;
Tk_Preserve((ClientData) date);
result = cmd(date, interp, argc, argv);
}
-date_command_init()
+void
+date_command_init(void)
{
- int new;
-
Tcl_CreateCommand(tk_mainInterp, "dateview", DateViewCmd,
(ClientData)MainWindow, (void (*)()) NULL);
}
+void
InitNewDate(SimDate *date)
{
- int d = 8;
- struct XDisplay *xd;
-
date->next = NULL;
/* This stuff was initialized in our caller (DateCmd) */
}
+void
DestroyDate(SimDate *date)
{
SimDate **gp;
}
+void
DoResizeDate(SimDate *date, int w, int h)
{
- int resize = 0;
-
date->w_width = w; date->w_height = h;
if (date->pixmap != None) {
}
+void
DoNewDate(SimDate *date)
{
sim->dates++; date->next = sim->date; sim->date = date;
#define BORDER 1
+void
DoUpdateDate(SimDate *date)
{
Display *dpy;
GC gc;
Pixmap pm;
int *pix;
- int w, h, i, j, x, y;
+ int w, h, x, y;
int tx, ty;
- float sx, sy;
if (!date->visible) {
return;
extern Tk_ConfigSpec TileViewConfigSpecs[];
+void ClipTheOverlay(SimView *view);
+void DrawTheOverlay(SimView *view, GC gc, Pixmap pm, int color,
+ int top, int bottom, int left, int right,
+ int onoverlay);
+void DrawOverlay(SimView *view);
+void DrawCursor(SimView *view);
+void DrawPending(SimView *view);
+void DrawOutside(SimView *view);
+void HandleAutoGoto(SimView *view);
+
int EditorCmdconfigure(VIEW_ARGS)
{
int EditorCmdTweakCursor(VIEW_ARGS)
{
- int x, y;
-
XWarpPointer (view->x->dpy, None, None, 0, 0, 0, 0, 0, 0);
return TCL_OK;
int EditorCmdFollow(VIEW_ARGS)
{
- int id;
SimSprite *sprite;
if ((argc != 2) && (argc != 3)) {
int EditorCmdWriteJpeg(VIEW_ARGS)
{
+#if 0
int val;
char *fileName = argv[2];
+#endif
if (argc != 3) {
return TCL_ERROR;
}
-editor_command_init()
+void
+editor_command_init(void)
{
- int new;
extern int TileViewCmd(CLIENT_ARGS);
Tcl_CreateCommand(tk_mainInterp, "editorview", TileViewCmd,
return TCL_ERROR;
}
- if (ent = Tcl_FindHashEntry(&EditorCmds, argv[1])) {
+ if ((ent = Tcl_FindHashEntry(&EditorCmds, argv[1]))) {
cmd = (int (*)())ent->clientData;
Tk_Preserve((ClientData) view);
result = cmd(view, interp, argc, argv);
/*************************************************************************/
+void
DoNewEditor(SimView *view)
{
sim->editors++; view->next = sim->editor; sim->editor = view;
}
+void
DoUpdateEditor(SimView *view)
{
int dx, dy, i;
view->skips)) {
if (sim_skips) {
if (sim_skip > 0) {
- return 0;
+ return;
}
} else {
if (view->skip > 0) {
--view->skip;
- return 0;
+ return;
} else {
view->skip = view->skips;
}
}
+void
HandleAutoGoto(SimView *view)
{
if (view->follow != NULL) {
view->auto_going &&
(view->tool_mode == 0)) {
int dx, dy;
- int panx, pany, speed;
+ int speed;
double dist, sloth;
speed = view->auto_speed;
}
}
+void
DrawOutside(SimView *view)
{
Pixmap pm = view->pixmap2;
char CursorDashes[] = { 4, 4 };
+void
DrawPending(SimView *view)
{
Pixmap pm = view->pixmap2;
}
+void
DrawCursor(SimView *view)
{
Pixmap pm = Tk_WindowId(view->tkwin);
}
+void
TimeElapsed(struct timeval *elapsed,
struct timeval *start,
struct timeval *finish)
+void
DrawOverlay(SimView *view)
{
int width = view->w_width;
}
+void
DrawTheOverlay(SimView *view, GC gc, Pixmap pm, int color,
int top, int bottom, int left, int right,
int onoverlay)
}
+void
ClipTheOverlay(SimView *view)
{
if (view->x->color) {
*/
#include "sim.h"
+void SetEvaluation(char *changed, char *score,
+ char *ps0, char *ps1, char *ps2, char *ps3,
+ char *pv0, char *pv1, char *pv2, char *pv3,
+ char *pop, char *delta, char *assessed_dollars,
+ char *cityclass, char *citylevel,
+ char *goodyes, char *goodno, char *title);
+
char *cityClassStr[6] = {
"VILLAGE", "TOWN", "CITY", "CAPITAL", "METROPOLIS", "MEGALOPOLIS"
/* comefrom: DoSubUpDate scoreDoer */
+void
doScoreCard(void)
{
char title[256],
sprintf(prob1, "%d%%", ProblemVotes[ProblemOrder[1]]);
sprintf(prob2, "%d%%", ProblemVotes[ProblemOrder[2]]);
sprintf(prob3, "%d%%", ProblemVotes[ProblemOrder[3]]);
- sprintf(pop, "%d", CityPop);
- sprintf(delta, "%d", deltaCityPop);
- sprintf(assessed, "%d", CityAssValue);
+ sprintf(pop, "%ld", CityPop);
+ sprintf(delta, "%ld", deltaCityPop);
+ sprintf(assessed, "%ld", CityAssValue);
makeDollarDecimalStr(assessed, assessed_dollars);
sprintf(score, "%d", CityScore);
}
-ChangeEval()
+void
+ChangeEval(void)
{
EvalChanged = 1;
}
+void
scoreDoer(void)
{
if (EvalChanged) {
}
+void
SetEvaluation(char *changed, char *score,
char *ps0, char *ps1, char *ps2, char *ps3,
char *pv0, char *pv1, char *pv2, char *pv3,
Tcl_HashTable GraphCmds;
int GraphUpdateTime = 100;
+void DoUpdateGraph(SimGraph *graph);
+void DoNewGraph(SimGraph *graph);
+void DoResizeGraph(SimGraph *graph, int w, int h);
+void InitNewGraph(SimGraph *graph);
+
#define DEF_GRAPH_FONT "-Adobe-Helvetica-Bold-R-Normal-*-140-*"
#define DEF_GRAPH_BG_COLOR "#b0b0b0"
{
SimGraph *graph = (SimGraph *) clientData;
Tk_Window tkwin = graph->tkwin;
- Pixmap pm = None;
- Drawable d;
graph->flags &= ~VIEW_REDRAW_PENDING;
}
+void
EventuallyRedrawGraph(SimGraph *graph)
{
if (!(graph->flags & VIEW_REDRAW_PENDING)) {
int GraphCmdposition(GRAPH_ARGS)
{
- int result = TCL_OK;
-
if ((argc != 2) && (argc != 4)) {
return TCL_ERROR;
}
return TCL_ERROR;
}
- if (ent = Tcl_FindHashEntry(&GraphCmds, argv[1])) {
+ if ((ent = Tcl_FindHashEntry(&GraphCmds, argv[1]))) {
cmd = (int (*)())ent->clientData;
Tk_Preserve((ClientData) graph);
result = cmd(graph, interp, argc, argv);
};
-graph_command_init()
+void
+graph_command_init(void)
{
- int new;
-
Tcl_CreateCommand(tk_mainInterp, "graphview", GraphViewCmd,
(ClientData)MainWindow, (void (*)()) NULL);
/* comefrom: InitWillStuff */
+void
InitGraphMax(void)
{
- register x;
+ register int x;
ResHisMax = 0;
ComHisMax = 0;
}
+void
InitNewGraph(SimGraph *graph)
{
- int d = 8;
- struct XDisplay *xd;
-
graph->next = NULL;
graph->range = 10;
graph->mask = ALL_HISTORIES;
}
+void
DestroyGraph(SimGraph *graph)
{
SimGraph **gp;
}
+void
DoResizeGraph(SimGraph *graph, int w, int h)
{
- int resize = 0;
-
graph->w_width = w; graph->w_height = h;
if (graph->pixmap != None) {
}
+void
DoNewGraph(SimGraph *graph)
{
sim->graphs++; graph->next = sim->graph; sim->graph = graph;
#define BORDER 5
+void
DoUpdateGraph(SimGraph *graph)
{
Display *dpy;
static void StartTrackInterval _ANSI_ARGS_((Interval *intervalPtr,
int value));
static int ValueToPixel _ANSI_ARGS_((Interval *intervalPtr, int value));
+
+static void NotifyInterval(register Interval *intervalPtr);
\f
/*
*--------------------------------------------------------------
register Interval *intervalPtr = (Interval *) clientData;
register Tk_Window tkwin = intervalPtr->tkwin;
int tickRightEdge, valueRightEdge, labelLeftEdge, intervalLeftEdge;
- int totalPixels, x, y, width, height, tickValue, min, max;
+ int totalPixels, x, width, height, tickValue, min, max;
int relief;
Tk_3DBorder sliderBorder;
register Interval *intervalPtr = (Interval *) clientData;
register Tk_Window tkwin = intervalPtr->tkwin;
int tickBottom, valueBottom, labelBottom, intervalBottom;
- int totalPixels, x, y, width, height, tickValue, min, max;
+ int totalPixels, y, width, height, tickValue, min, max;
int relief;
Tk_3DBorder sliderBorder;
int value; /* New value for interval. Gets
* adjusted if it's off the interval. */
{
- int result;
- char string[20];
-
if ((value < intervalPtr->fromValue)
^ (intervalPtr->toValue < intervalPtr->fromValue)) {
value = intervalPtr->fromValue;
register Interval *intervalPtr; /* Info about widget. */
int value;
{
- int result;
- char string[20];
int min, max, delta, lastmin, lastmax;
}
-NotifyInterval(intervalPtr)
- register Interval *intervalPtr; /* Info about widget. */
+static void
+NotifyInterval(register Interval *intervalPtr)
{
int result;
char string[256];
*/
-ResetLastKeys()
+void
+ResetLastKeys(void)
{
LastKeys[0] = ' ';
LastKeys[1] = ' ';
/* comefrom: processEvent */
+void
doKeyDown(SimView *view, short charCode)
{
LastKeys[0] = LastKeys[1];
/* comefrom: processEvent */
+void
doKeyUp(SimView *view, short charCode)
{
switch(charCode) {
Ink *NewInk();
+void DrawMapInk(SimView *view);
+void WireDrawMap(SimView *view);
+void DrawMapEditorViews(SimView *view);
+int
MapCmdconfigure(VIEW_ARGS)
{
int result = TCL_OK;
return result;
}
+int
MapCmdposition(VIEW_ARGS)
{
if ((argc != 2) && (argc != 4)) {
return TCL_OK;
}
+int
MapCmdsize(VIEW_ARGS)
{
if ((argc != 2) && (argc != 4)) {
return TCL_OK;
}
+int
MapCmdMapState(VIEW_ARGS)
{
int state;
return TCL_OK;
}
+int
MapCmdShowEditors(VIEW_ARGS)
{
int val;
return TCL_OK;
}
+int
MapCmdPanStart(VIEW_ARGS)
{
int x, y, left, right, top, bottom, width, height;
return TCL_OK;
}
+int
MapCmdPanTo(VIEW_ARGS)
{
int x, y, dx, dy;
return TCL_OK;
}
+int
MapCmdVisible(VIEW_ARGS)
{
int visible;
return TCL_OK;
}
+int
MapCmdViewAt(VIEW_ARGS)
{
int x, y;
}
-map_command_init()
+void
+map_command_init(void)
{
- int new;
extern int TileViewCmd(CLIENT_ARGS);
Tcl_CreateCommand(tk_mainInterp, "mapview", TileViewCmd,
return TCL_ERROR;
}
- if (ent = Tcl_FindHashEntry(&MapCmds, argv[1])) {
+ if ((ent = Tcl_FindHashEntry(&MapCmds, argv[1]))) {
cmd = (int (*)())ent->clientData;
Tk_Preserve((ClientData) view);
result = cmd(view, interp, argc, argv);
/*************************************************************************/
+void
DoNewMap(SimView *view)
{
sim->maps++; view->next = sim->map; sim->map = view;
}
+void
DrawMapEditorViews(SimView *view)
{
Pixmap pm = Tk_WindowId(view->tkwin);
struct SimView *ed;
int left, right, top, bottom, width, height;
- int mine;
XSetLineAttributes(view->x->dpy, view->x->gc, 1,
LineSolid, CapButt, JoinBevel);
struct Pix pix[MAX_PIX];
+int
CompareColor(struct Pix *p1, struct Pix *p2)
{
register char c1 = p1->color, c2 = p2->color;
}
+void
WireDrawMap(SimView *view)
{
- int different, x, y, i, last, pts;
+ int different, x, y;
unsigned char *old, *new;
+#if 0
XPoint *points;
+ int i, last, pts;
+#endif
if (!view->x->color) {
MemDrawMap(view);
}
+void
DrawMapInk(SimView *view)
{
Pixmap pm = view->pixmap2;
- SimView *v;
Ink *ink, *ink2 = NewInk();
int i, X, Y, x, y;
static void EventuallyPopupPieMenu _ANSI_ARGS_((PieMenu *menuPtr));
static void DeferPopupPieMenu _ANSI_ARGS_((PieMenu *menuPtr));
static void ShapePieMenu _ANSI_ARGS_((PieMenu *menuPtr));
+static void LayoutPieMenu(PieMenu *menu);
+static void UpdatePieMenuEntries(PieMenu *menuPtr);
+static int CalcPieMenuItem(PieMenu *menu, int x, int y);
\f
/*
DeferPopupPieMenu(menuPtr);
} else if ((c == 's') && (strncmp(argv[1], "show", length) == 0)
&& (length >= 2)) {
- int index;
-
if (argc != 2) {
Tcl_AppendResult(interp, "wrong # args: should be \"",
argv[0], " show\"", (char *) NULL);
NowPopupPieMenu(menuPtr);
} else if ((c == 'p') && (strncmp(argv[1], "pending", length) == 0)
&& (length >= 2)) {
- int index;
-
if (argc != 2) {
Tcl_AppendResult(interp, "wrong # args: should be \"",
argv[0], " pending\"", (char *) NULL);
(menuPtr->flags & POPUP_PENDING) ? 1 : 0);
} else if ((c == 'd') && (strncmp(argv[1], "defer", length) == 0)
&& (length >= 2)) {
- int index;
-
if (argc != 2) {
Tcl_AppendResult(interp, "wrong # args: should be \"",
argv[0], " defer\"", (char *) NULL);
}
Tk_Release((ClientData) mePtr);
} else if ((c == 'p') && (strncmp(argv[1], "post", length) == 0)) {
- int x, y, ix, iy, tmp, err;
+ int x, y;
+#if 0
+ int ix, iy, tmp, err;
+#endif
Tk_Uid group;
if ((argc != 4) && (argc != 5)) {
register PieMenu *menuPtr = (PieMenu *) clientData;
register Tk_Window tkwin = menuPtr->tkwin;
XFontStruct *fontPtr;
- int index;
menuPtr->flags &= ~REDRAW_PENDING;
if ((menuPtr->tkwin == NULL) || !Tk_IsMapped(menuPtr->tkwin)) {
}
-UpdatePieMenuEntries(menuPtr)
- PieMenu *menuPtr;
+static void
+UpdatePieMenuEntries(PieMenu *menuPtr)
{
register PieMenuEntry *mePtr;
register Tk_Window tkwin = menuPtr->tkwin;
* manual entry for valid .*/
int *indexPtr; /* Where to store converted relief. */
{
- int i, y;
+ int i;
if ((string[0] == 'a') && (strcmp(string, "active") == 0)) {
*indexPtr = menuPtr->active;
* reporting errors. */
register PieMenu *menuPtr; /* Information about menu as a whole. */
{
- char string[30];
- int result, x, y, win_x, win_y;
- unsigned int key_buttons;
- Window root, child;
+ int result;
if (menuPtr->postedPie == NULL) {
return TCL_OK;
}
-int
-CalcPieMenuItem(menu, x, y)
- PieMenu *menu;
- int x, y;
+static int
+CalcPieMenuItem(PieMenu *menu, int x, int y)
{
register PieMenuEntry *it, *last_it;
- int i, j, order, quadrant;
+ int i, order = 0, quadrant;
int numerator, denominator;
int first, last_i, last_order;
}
-LayoutPieMenu(menu)
- PieMenu *menu;
+static void
+LayoutPieMenu(PieMenu *menu)
{
int i;
int total_slice, radius;
#ifdef MSDOS
-#define PATHSTR "%s\\%c%c%c%c.%d"
+#define PATHSTR "%s\\%c%c%c%c.%ld"
#define PERMSTR "rb"
#else
-#define PATHSTR "%s/%c%c%c%c.%d"
+#define PATHSTR "%s/%c%c%c%c.%ld"
#define PERMSTR "r"
#endif
}
+void
GetIndString(char *str, int id, short num)
{
struct StringTable **tp, *st = NULL;
int SimCmdWorldX(ARGS)
{
- int val;
-
if (argc != 2) {
return (TCL_ERROR);
}
int SimCmdWorldY(ARGS)
{
- int val;
-
if (argc != 2) {
return (TCL_ERROR);
}
Kick();
}
- sprintf(interp->result, "%d", TotalFunds);
+ sprintf(interp->result, "%ld", TotalFunds);
return (TCL_OK);
}
int SimCmdFlush(ARGS)
{
- int style;
-
if (argc != 2) {
return (TCL_ERROR);
}
DonDither = dd;
}
- sprintf(interp->result, "%d", DonDither);
+ sprintf(interp->result, "%ld", DonDither);
return (TCL_OK);
}
int SimCmdDynamicData(ARGS)
{
- int index, val;
+ int index;
if ((argc != 3) && (argc != 4)) {
return (TCL_ERROR);
int SimCmdLandValue(ARGS)
{
- int val;
-
if (argc != 2) {
return (TCL_ERROR);
}
int SimCmdTraffic(ARGS)
{
- int val;
-
if (argc != 2) {
return (TCL_ERROR);
}
int SimCmdCrime(ARGS)
{
- int val;
-
if (argc != 2) {
return (TCL_ERROR);
}
int SimCmdUnemployment(ARGS)
{
- int val;
-
if (argc != 2) {
return (TCL_ERROR);
}
int SimCmdFires(ARGS)
{
- int val;
-
if (argc != 2) {
return (TCL_ERROR);
}
int SimCmdPollution(ARGS)
{
- int val;
-
if (argc != 2) {
return (TCL_ERROR);
}
int SimCmdPolMaxX(ARGS)
{
- int val;
-
if (argc != 2) {
return (TCL_ERROR);
}
int SimCmdPolMaxY(ARGS)
{
- int val;
-
if (argc != 2) {
return (TCL_ERROR);
}
int SimCmdTrafMaxX(ARGS)
{
- int val;
-
if (argc != 2) {
return (TCL_ERROR);
}
int SimCmdTrafMaxY(ARGS)
{
- int val;
-
if (argc != 2) {
return (TCL_ERROR);
}
int SimCmdMeltX(ARGS)
{
- int val;
-
if (argc != 2) {
return (TCL_ERROR);
}
int SimCmdMeltY(ARGS)
{
- int val;
-
if (argc != 2) {
return (TCL_ERROR);
}
int SimCmdCrimeMaxX(ARGS)
{
- int val;
-
if (argc != 2) {
return (TCL_ERROR);
}
int SimCmdCrimeMaxY(ARGS)
{
- int val;
-
if (argc != 2) {
return (TCL_ERROR);
}
int SimCmdCenterX(ARGS)
{
- int val;
-
if (argc != 2) {
return (TCL_ERROR);
}
int SimCmdCenterY(ARGS)
{
- int val;
-
if (argc != 2) {
return (TCL_ERROR);
}
int SimCmdFloodX(ARGS)
{
- int val;
-
if (argc != 2) {
return (TCL_ERROR);
}
int SimCmdFloodY(ARGS)
{
- int val;
-
if (argc != 2) {
return (TCL_ERROR);
}
int SimCmdCrashX(ARGS)
{
- int val;
-
if (argc != 2) {
return (TCL_ERROR);
}
int SimCmdCrashY(ARGS)
{
- int val;
-
if (argc != 2) {
return (TCL_ERROR);
}
int SimCmdDollars(ARGS)
{
- int val;
-
if (argc != 2) {
return (TCL_ERROR);
}
int SimCmdVersion(ARGS)
{
- sprintf(interp->result, MicropolisVersion);
+ strcpy(interp->result, MicropolisVersion);
return (TCL_OK);
}
int SimCmdQuoteURL(ARGS)
{
- int result = 1;
char buf[2048];
char *from, *to;
int ch;
return TCL_ERROR;
}
- if (ent = Tcl_FindHashEntry(&SimCmds, argv[1])) {
+ if ((ent = Tcl_FindHashEntry(&SimCmds, argv[1]))) {
cmd = (int (*)())ent->clientData;
result = cmd(interp, argc, argv);
} else {
}
-sim_command_init()
+void
+sim_command_init(void)
{
- int new;
-
Tcl_CreateCommand(tk_mainInterp, "sim", SimCmd,
(ClientData)MainWindow, (void (*)()) NULL);
Mix_Chunk *rumble;
-InitializeSound()
+void
+InitializeSound(void)
{
int reserved_chans;
char buf[256];
}
+void
ShutDownSound()
{
int i;
}
+void
MakeSound(char *channel, char *id)
{
char buf[256];
fprintf(stderr, "Mix_PlayChannel: %s\n", Mix_GetError());
}
+void
StartBulldozer(void)
{
if (!UserSoundOn) return;
}
+void
StopBulldozer(void)
{
if (!UserSoundOn) return;
}
#else /* WITH_SDL_MIXER */
+void
InitializeSound()
{
SoundInitialized = 1;
}
+void
ShutDownSound()
{
SoundInitialized = 0;
}
+void
MakeSound(char *channel, char *id)
{
char filename[256], player[256];
}
}
+void
StartBulldozer(void)
{
MakeSound(0, "Rumble");
}
+void
StopBulldozer(void)
{
}
#endif
+void
MakeSoundOn(SimView *view, char *channel, char *id)
{
if (!UserSoundOn) return;
/* XXX comefrom: doKeyEvent */
+void
SoundOff(void)
{
ShutDownSound();
}
+void
DoStartSound(char *channel, char *id)
{
MakeSound(channel, id);
}
+void
DoStopSound(char *id)
{
StopBulldozer();
}
+int
SoundCmd(CLIENT_ARGS)
{
if (!strcmp(argv[2], "Rumble"))
return 0;
}
+int
DozerCmd(CLIENT_ARGS)
{
StopBulldozer();
return 0;
}
-sound_command_init()
+void
+sound_command_init(void)
{
Tcl_CreateCommand(tk_mainInterp, "playsound", SoundCmd,
(ClientData)NULL, (void (*)()) NULL);
SimSprite *GlobalSprites[OBJN];
SimSprite *NewSprite(char *name, int type, int x, int y);
+void MonsterHere(int x, int y);
+void MakeShipHere(int x, int y);
+void StartFire(int x, int y);
+void OFireZone(int Xloc, int Yloc, int ch);
+void Destroy(int ox, int oy);
+void ExplodeSprite(SimSprite *sprite);
+int CanDriveOn(int x, int y);
+void DoBusSprite(SimSprite *sprite);
+void DoExplosionSprite(SimSprite *sprite);
+void DoTornadoSprite(SimSprite *sprite);
+void DoMonsterSprite(SimSprite *sprite);
+void DoShipSprite(SimSprite *sprite);
+void DoAirplaneSprite(SimSprite *sprite);
+void DoCopterSprite(SimSprite *sprite);
+void DoTrainSprite(SimSprite *sprite);
+void DrawSprite(SimView *view, SimSprite *sprite);
+void InitSprite(SimSprite *sprite, int x, int y);
#define TRA_GROOVE_X -39
return TCL_ERROR;
}
- if (ent = Tcl_FindHashEntry(&SpriteCmds, argv[1])) {
+ if ((ent = Tcl_FindHashEntry(&SpriteCmds, argv[1]))) {
cmd = (int (*)())ent->clientData;
Tk_Preserve((ClientData) sprite);
result = cmd(sprite, interp, argc, argv);
}
-sprite_command_init()
+void
+sprite_command_init(void)
{
int i;
}
+void
InitSprite(SimSprite *sprite, int x, int y)
{
sprite->x = x; sprite->y = y;
}
-DestroyAllSprites()
+void
+DestroyAllSprites(void)
{
SimSprite *sprite;
}
+void
DestroySprite(SimSprite *sprite)
{
SimView *view;
}
+void
DrawObjects(SimView *view)
{
SimSprite *sprite;
}
+void
DrawSprite(SimView *view, SimSprite *sprite)
{
Pixmap pict, mask;
}
+int
TryOther(int Tpoo, int Told, int Tnew)
{
register short z;
}
+int
GetDis(int x1, int y1, int x2, int y2)
{
register short dispX, dispY;
}
-MoveObjects()
+void MoveObjects(void)
{
SimSprite *sprite;
}
+void
DoTrainSprite(SimSprite *sprite)
{
static short Cx[4] = { 0, 16, 0, -16 };
}
+void
DoCopterSprite(SimSprite *sprite)
{
static short CDx[9] = { 0, 0, 3, 5, 3, 0, -3, -5, -3 };
}
+void
DoAirplaneSprite(SimSprite *sprite)
{
static short CDx[12] = { 0, 0, 6, 8, 6, 0, -6, -8, -6, 8, 8, 8 };
}
+void
DoShipSprite(SimSprite *sprite)
{
static short BDx[9] = { 0, 0, 1, 1, 1, 0, -1, -1, -1 };
}
+void
DoMonsterSprite(SimSprite *sprite)
{
static short Gx[5] = { 2, 2, -2, -2, 0 };
}
+void
DoTornadoSprite(SimSprite *sprite)
{
static short CDx[9] = { 2, 3, 2, 0, -2, -3 };
}
+void
DoExplosionSprite(SimSprite *sprite)
{
short x, y;
}
+void
DoBusSprite(SimSprite *sprite)
{
static short Dx[5] = { 0, 1, 0, -1, 0 };
static short Dy[5] = { -1, 0, 1, 0, 0 };
static short Dir2Frame[4] = { 1, 2, 1, 2 };
- register int dir, dir2;
- int c, dx, dy, crossed, tx, ty, otx, oty;
+ int dx, dy, tx, ty, otx, oty;
int turned = 0;
- int speed, z;
+ int speed = 0, z;
#ifdef DEBUGBUS
printf("Bus dir %d turn %d frame %d\n",
}
+void
ExplodeSprite(SimSprite *sprite)
{
int x, y;
}
+void
Destroy(int ox, int oy)
{
short t, z, x, y;
}
+void
OFireZone(int Xloc, int Yloc, int ch)
{
register short Xtem, Ytem;
}
+void
StartFire(int x, int y)
{
- register t, z;
+ register int t, z;
x >>= 4;
y >>= 4;
}
+void
GenerateTrain(int x, int y)
{
if ((TotalPop > 20) &&
}
+void
GenerateBus(int x, int y)
{
if ((GetSprite(BUS) == NULL) &&
}
+void
GenerateShip(void)
{
register short x, y;
}
-MakeShipHere(int x, int y, int z)
+void
+MakeShipHere(int x, int y)
{
MakeSprite(SHI, (x <<4) - (48 - 1), (y <<4));
}
+void
MakeMonster(void)
{
- register x, y, z, done = 0;
+ register int x, y, z, done = 0;
SimSprite *sprite;
if ((sprite = GetSprite(GOD)) != NULL) {
}
+void
MonsterHere(int x, int y)
{
- short z;
-
MakeSprite(GOD, (x <<4) + 48, (y <<4));
ClearMes();
SendMesAt(-21, x + 5, y);
}
+void
GenerateCopter(int x, int y)
{
if (GetSprite(COP) != NULL) return;
}
+void
GeneratePlane(int x, int y)
{
if (GetSprite(AIR) != NULL) return;
}
+void
MakeAirCrash(void)
{
#ifndef NO_AIRCRASH
}
+void
MakeTornado(void)
{
short x, y;
}
+void
MakeExplosion(int x, int y)
{
if ((x >= 0) && (x < WORLD_X) &&
}
+void
MakeExplosionAt(int x, int y)
{
MakeNewSprite(EXP, x - 40, y - 16);
short EvalChanged;
short flagBlink;
+void DoStartScenario(int scenario);
+void DoStartLoad(void);
+void DoReallyStartGame(void);
+void DoPlayNewCity(void);
+
+void
Spend(int dollars)
{
SetFunds(TotalFunds - dollars);
}
+void
SetFunds(int dollars)
{
TotalFunds = dollars;
/* Mac */
-QUAD TickCount()
+QUAD TickCount(void)
{
struct timeval time;
/* w_hlhandlers.c */
-GameStarted()
+void
+GameStarted(void)
{
InvalidateMaps();
InvalidateEditors();
}
-DoPlayNewCity()
+void
+DoPlayNewCity(void)
{
Eval("UIPlayNewCity");
}
-DoReallyStartGame()
+void
+DoReallyStartGame(void)
{
Eval("UIReallyStartGame");
}
-DoStartLoad()
+void
+DoStartLoad(void)
{
Eval("UIStartLoad");
}
+void
DoStartScenario(int scenario)
{
char buf[256];
}
-DropFireBombs()
+void
+DropFireBombs(void)
{
Eval("DropFireBombs");
}
-InitGame()
+void
+InitGame(void)
{
sim_skips = sim_skip = sim_paused = sim_paused_speed = heat_steps = 0;
setSpeed(0);
}
-ReallyQuit()
+void
+ReallyQuit(void)
{
sim_exit(0); // Just sets tkMustExit and ExitReturn
}
int TileViewCmd(CLIENT_ARGS);
-int ConfigureTileView(Tcl_Interp *interp, SimView *view,
- int argc, char **argv, int flags);
static void TileViewEventProc(ClientData clientData, XEvent *eventPtr);
static void DestroyTileView(ClientData clientData);
-
-int ConfigureSimGraph(Tcl_Interp *interp, SimGraph *graph,
- int argc, char **argv, int flags);
-
static void MicropolisTimerProc(ClientData clientData);
int SimCmd(CLIENT_ARGS);
}
-InvalidateMaps()
+void
+InvalidateMaps(void)
{
SimView *view;
}
-InvalidateEditors()
+void
+InvalidateEditors(void)
{
SimView *view;
}
-RedrawMaps()
+void
+RedrawMaps(void)
{
SimView *view;
}
-RedrawEditors()
+void
+RedrawEditors(void)
{
SimView *view;
{
SimView *view = (SimView *) clientData;
Tk_Window tkwin = view->tkwin;
- Pixmap pm = None;
- Drawable d;
view->flags &= ~VIEW_REDRAW_PENDING;
if (view->visible && (tkwin != NULL) && Tk_IsMapped(tkwin)) {
EraserTo
*/
+void
EventuallyRedrawView(SimView *view)
{
if (!(view->flags & VIEW_REDRAW_PENDING)) {
}
+void
CancelRedrawView(SimView *view)
{
if (view->flags & VIEW_REDRAW_PENDING) {
if (view->tool_mode != 0) {
int dx = 0, dy = 0;
- int result, root_x, root_y, x, y;
+ int root_x, root_y, x, y;
unsigned int key_buttons;
Window root, child;
(eventPtr->type == MotionNotify))) {
int last_x = view->tool_x, last_y = view->tool_y,
last_showing = view->tool_showing;
- int x, y, showing, autoscroll;
+ int x, y, showing;
if (eventPtr->type == EnterNotify) {
showing = 1;
}
+#if 0
static void
DelayedMap(ClientData clientData)
{
}
Tk_MapWindow(MainWindow);
}
+#endif
+void
DidStopPan(SimView *view)
{
char buf[256];
}
-StartMicropolisTimer()
+void
+StartMicropolisTimer(void)
{
if (sim_timer_idle == 0) {
sim_timer_idle = 1;
}
-StopMicropolisTimer()
+void
+StopMicropolisTimer(void)
{
if (sim_timer_idle != 0) {
sim_timer_idle = 0;
}
+void
FixMicropolisTimer()
{
if (sim_timer_set) {
- StartMicropolisTimer(NULL);
+ StartMicropolisTimer();
}
}
}
-Kick()
+void
+Kick(void)
{
if (!UpdateDelayed) {
UpdateDelayed = 1;
void
-StopEarthquake()
+StopEarthquake(void)
{
ShakeNow = 0;
if (earthquake_timer_set) {
}
+void
DoEarthQuake(void)
{
MakeSound("city", "Explosion-Low");
}
-StopToolkit()
+void
+StopToolkit(void)
{
if (tk_mainInterp != NULL) {
Eval("catch {DoStopMicropolis}");
}
+int
Eval(char *buf)
{
int result = Tcl_Eval(tk_mainInterp, buf, 0, (char **) NULL);
}
-tk_main()
+void tk_main(void)
{
- char *p, *msg;
- char buf[20];
char initCmd[256];
Tk_3DBorder border;
Ink *NewInk();
-short tally(short tileValue);
-int DoSetWandState(SimView *view, short state);
+void DoSetWandState(SimView *view, short state);
+void DoPendTool(SimView *view, int tool, int x, int y);
+void EraserTo(SimView *view, int x, int y);
+void EraserStart(SimView *view, int x, int y);
+void DoShowZoneStatus(char *str, char *s0, char *s1, char *s2, char *s3, char *s4, int x, int y);
/*************************************************************************/
/* UTILITIES */
+void
setWandState(SimView *view, short state)
{
#if 0
void
check4x4border(short xMap, short yMap)
{
- Ptr tilePtr;
+ short *tilePtr;
short xPos, yPos;
short cnt;
xPos = xMap; yPos = yMap - 1;
for (cnt = 0; cnt < 4; cnt++) {
/* this will do the upper bordering row */
- tilePtr = (Ptr) &Map[xPos][yPos];
+ tilePtr = &Map[xPos][yPos];
ConnecTile(xPos, yPos, tilePtr, 0);
xPos++;
}
xPos = xMap - 1; yPos = yMap;
for (cnt = 0; cnt < 4; cnt++) {
/* this will do the left bordering row */
- tilePtr = (Ptr) &Map[xPos][yPos];
+ tilePtr = &Map[xPos][yPos];
ConnecTile(xPos, yPos, tilePtr, 0);
yPos++;
}
xPos = xMap; yPos = yMap + 4;
for (cnt = 0; cnt < 4;cnt++) {
/* this will do the bottom bordering row */
- tilePtr = (Ptr) &Map[xPos][yPos];
+ tilePtr = &Map[xPos][yPos];
ConnecTile(xPos, yPos, tilePtr, 0);
xPos++;
}
xPos = xMap + 4; yPos = yMap;
for (cnt = 0; cnt < 4; cnt++) {
/* this will do the right bordering row */
- tilePtr = (Ptr) &Map[xPos][yPos];
+ tilePtr = &Map[xPos][yPos];
ConnecTile(xPos, yPos, tilePtr, 0);
yPos++;
}
if (autoBulldoze) {
/* if autoDoze is enabled, add up the cost of bulldozed tiles */
- if (tileValue != 0)
+ if (tileValue != 0) {
if (tally(tileValue)) {
cost++;
} else {
flag = 0;
}
+ }
} else {
/* check and see if the tile is clear or not */
if (tileValue != 0) {
if (z > 100) return (19);
return (18);
}
+ return 0;
}
+void
doZoneStatus(short mapH, short mapV)
{
char localStr[256];
}
+void
DoShowZoneStatus(char *str, char *s0, char *s1, char *s2, char *s3, char *s4,
int x, int y)
{
/* comefrom: processWand */
+void
put3x3Rubble(short x, short y)
{
- register xx, yy, zz;
+ register int xx, yy, zz;
for (xx = x - 1; xx < x + 2; xx++) {
for (yy = y - 1; yy < y + 2; yy++) {
/* comefrom: processWand */
+void
put4x4Rubble(short x, short y)
{
- register xx, yy, zz;
+ register int xx, yy, zz;
for (xx = x - 1; xx < x + 3; xx++) {
for (yy = y - 1; yy < y + 3; yy++) {
/* comefrom: processWand */
+void
put6x6Rubble(short x, short y)
{
- register xx, yy, zz;
+ register int xx, yy, zz;
for (xx = x - 1; xx < x + 5; xx++) {
for (yy = y - 1; yy < y + 5; yy++) {
}
+void
DidTool(SimView *view, char *name, short x, short y)
{
char buf[256];
}
+void
DoSetWandState(SimView *view, short state)
{
char buf[256];
}
+void
ChalkStart(SimView *view, int x, int y, int color)
{
Ink *ink;
}
+void
ChalkTo(SimView *view, int x, int y)
{
+#ifdef MOTIONBUFFER
int x0, y0, lx, ly;
+#endif
Ink *ink = (Ink *)view->track_info;
#ifdef MOTIONBUFFER
}
+int
InkInBox(Ink *ink, int left, int top, int right, int bottom)
{
if ((left <= ink->right) &&
}
+void
EraserStart(SimView *view, int x, int y)
{
EraserTo(view, x, y);
}
+void
EraserTo(SimView *view, int x, int y)
{
- SimView *v;
Ink **ip, *ink;
for (ip = &sim->overlay; *ip != NULL;) {
}
+void
DoTool(SimView *view, short tool, short x, short y)
{
int result;
}
+void
ToolDown(SimView *view, int x, int y)
{
int result;
}
+void
ToolUp(SimView *view, int x, int y)
{
- int result;
-
- result = ToolDrag(view, x, y);
-
- return (result);
+ ToolDrag(view, x, y);
}
+void
ToolDrag(SimView *view, int px, int py)
{
int x, y, dx, dy, adx, ady, lx, ly, dist;
lx = view->last_x >> 4;
ly = view->last_y >> 4;
- reset:
-
dx = x - lx;
dy = y - ly;
}
+void
DoPendTool(SimView *view, int tool, int x, int y)
{
char buf[256];
QUAD LastFunds;
QUAD LastR, LastC, LastI;
+void UpdateOptionsMenu(int options);
+void updateOptions(void);
+void SetDemand(double r, double c, double i);
+void drawValve(void);
+void showValves(void);
+void updateDate(void);
+void ReallyUpdateFunds(void);
+
char *dateStr[12] = {
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
};
-void DoUpdateHeads()
+void DoUpdateHeads(void)
{
showValves();
doTimeStuff();
}
-void UpdateEditors()
+void UpdateEditors(void)
{
InvalidateEditors();
DoUpdateHeads();
}
-void UpdateMaps()
+void UpdateMaps(void)
{
InvalidateMaps();
}
-void UpdateGraphs()
+void UpdateGraphs(void)
{
ChangeCensus();
}
-void UpdateEvaluation()
+void UpdateEvaluation(void)
{
ChangeEval();
}
-void UpdateHeads()
+void UpdateHeads(void)
{
MustUpdateFunds = ValveFlag = 1;
LastCityTime = LastCityYear = LastCityMonth = LastFunds = LastR = -999999;
DoUpdateHeads();
}
+void
UpdateFunds(void)
{
MustUpdateFunds = 1;
}
+void
ReallyUpdateFunds(void)
{
char localStr[256], dollarStr[256], buf[256];
if (TotalFunds != LastFunds) {
LastFunds = TotalFunds;
- sprintf(localStr, "%d", TotalFunds);
+ sprintf(localStr, "%ld", TotalFunds);
makeDollarDecimalStr(localStr, dollarStr);
sprintf(localStr, "Funds: %s", dollarStr);
}
-doTimeStuff(void)
+void
+doTimeStuff(void)
{
// if ((CityTime >> 2) != LastCityTime) {
updateDate();
}
+void
updateDate(void)
{
int y;
}
+void
showValves(void)
{
if (ValveFlag) {
}
+void
drawValve(void)
{
double r, c, i;
}
+void
SetDemand(double r, double c, double i)
{
char buf[256];
}
-updateOptions()
+void
+updateOptions(void)
{
int options;
}
+void
UpdateOptionsMenu(int options)
{
char buf[256];
*/
#include "sim.h"
+void UpdateGameLevel(void);
+
/* comefrom: drawTaxesCollected incBoxValue decBoxValue drawCurrentFunds
drawActualBox UpdateFunds updateCurrentCost */
+void
makeDollarDecimalStr(char *numStr, char *dollarStr)
{
register short leftMostSet;
}
-Pause()
+void
+Pause(void)
{
if (!sim_paused) {
sim_paused_speed = SimMetaSpeed;
}
-Resume()
+void
+Resume(void)
{
if (sim_paused) {
sim_paused = 0;
}
+void
setSpeed(short speed)
{
if (speed < 0) speed = 0;
}
+void
setSkips(int skips)
{
sim_skips = skips;
}
+void
SetGameLevelFunds(short level)
{
switch (level) {
}
+void
SetGameLevel(short level)
{
GameLevel = level;
}
-UpdateGameLevel()
+void
+UpdateGameLevel(void)
{
char buf[256];
}
+void
setCityName(char *name)
{
char *cp = name;
}
+void
setAnyCityName(char *name)
{
char buf[1024];
}
+void
SetYear(int year)
{
// Must prevent year from going negative, since it screws up the non-floored modulo arithmetic.
int
-CurrentYear()
+CurrentYear(void)
{
return (CityTime/48 + StartingYear);
}
+void
DoSetMapState(SimView *view, short state)
{
char buf[256];
}
-DoNewGame()
+void
+DoNewGame(void)
{
Eval("UINewGame");
}
+void
DoGeneratedCityImage(char *name, int time, int pop, char *class, int score)
{
/* XXX: TODO: print city */
}
+void
DoStartElmd()
{
/* XXX: TODO: start elm daemon */
}
+void
DoPopUpMessage(char *msg)
{
char buf[1024];
/* COLOR_BLACK */ 0,
};
+void FreeTiles(SimView *view);
+void AllocTiles(SimView *view);
+void DoAdjustPan(struct SimView *view);
+void
ViewToTileCoords(SimView *view, int x, int y, int *outx, int *outy)
{
x = (view->pan_x - ((view->w_width >>1) - x)) >>4;
}
+void
ViewToPixelCoords(SimView *view, int x, int y, int *outx, int *outy)
{
x = view->pan_x - ((view->w_width >>1) - x);
}
-UpdateFlush()
+void
+UpdateFlush(void)
{
struct XDisplay *xd;
}
-DoStopMicropolis()
+void
+DoStopMicropolis(void)
{
(void)XSetErrorHandler(CatchXError);
}
-DoTimeoutListen()
+void
+DoTimeoutListen(void)
{
while (Tk_DoOneEvent(TK_DONT_WAIT)) ;
}
FindXDisplay(Tk_Window tkwin)
{
XDisplay *xd;
- int d = 8;
- unsigned long valuemask = 0;
- XGCValues values;
- XColor rgb, *color;
+ XColor *color;
Display *dpy = Tk_Display(tkwin);
Screen *screen = Tk_Screen(tkwin);
#ifdef IS_LINUX
(((color->green >> (8 + 2)) & 0x1f) << (5)) | \
(((color->blue >> (8 + 3)) & 0x1f) << (0)); \
} else { \
+ xd->pixels[i] = \
(((color->blue >> (8 + 3)) & 0x1f) << (5 + 5)) | \
(((color->green >> (8 + 2)) & 0x1f) << (5)) | \
(((color->red >> (8 + 3)) & 0x1f) << (0)); \
}
+void
IncRefDisplay(XDisplay *xd)
{
xd->references++;
}
+void
DecRefDisplay(XDisplay *xd)
{
if ((--xd->references) == 0) {
SimView *
InitNewView(SimView *view, char *title, int class, int w, int h)
{
- int type, i;
int test = 1;
- int d = 8;
- unsigned long valuemask = 0;
char *t;
- struct XDisplay *xd;
- XGCValues values;
- XColor rgb, *color;
t = (char *)ckalloc(strlen(title) + 1);
strcpy(t, title);
}
+void
DestroyView(SimView *view)
{
SimView **vp;
}
+void
DoResizeView(SimView *view, int w, int h)
{
int resize = 0;
if (!GotXError) {
attached = 1;
view->pixmap = XShmCreatePixmap(view->x->dpy, view->x->root,
- view->data, view->shminfo,
+ (char*)view->data, view->shminfo,
view->m_width, view->m_height,
view->x->depth);
XSync(view->x->dpy, False);
}
+void
DoPanBy(struct SimView *view, int dx, int dy)
{
DoPanTo(view, view->pan_x + dx, view->pan_y + dy);
}
+void
DoPanTo(struct SimView *view, int x, int y)
{
if (view->class != Editor_Class) {
/* #define DEBUG_PAN */
+void
DoAdjustPan(struct SimView *view)
{
int ww2 = view->w_width >>1, wh2 = view->w_height >>1;
int px = view->pan_x, py = view->pan_y;
int last_tile_x = view->tile_x, last_tile_y = view->tile_y;
- int last_tile_width = view->tile_width, last_tile_height = view->tile_height;
int total_width = view->m_width >>4, total_height = view->m_height >>4;
//fprintf(stderr, "DoAdjustPan\n");
}
+void
AllocTiles(SimView *view)
{
int row, col;
}
+void
FreeTiles(SimView *view)
{
int col;
}
+void
FreeInk(Ink *ink)
{
ink->next = OldInk;
}
+void
StartInk(Ink *ink, int x, int y)
{
ink->length = 1;
}
+void
AddInk(Ink *ink, int x, int y)
{
int dx = x - ink->last_x;
ink->points[ink->length].y = dy;
ink->length++;
- ADJUST:
+ /* ADJUST: */
if (x < ink->left)
ink->left = x;
if (x > ink->right)
}
-EraseOverlay()
+void
+EraseOverlay(void)
{
Ink *ink;