Mercurial > hg > openttd
changeset 1891:81b2cb2fc036 draft
(svn r2397) - CodeChange: rename all "ttd" files to "openttd" files.
line wrap: on
line diff
--- a/Makefile +++ b/Makefile @@ -679,7 +679,7 @@ C_SOURCES += train_cmd.c C_SOURCES += train_gui.c C_SOURCES += tree_cmd.c -C_SOURCES += ttd.c +C_SOURCES += openttd.c C_SOURCES += tunnelbridge_cmd.c C_SOURCES += unmovable_cmd.c C_SOURCES += vehicle.c @@ -830,7 +830,7 @@ @echo '===> Compiling language $(*F)' $(Q)$(STRGEN) $(STRGEN_FLAGS) $< $(LANG_ERRORS) -winres.o: ttd.rc +winres.o: openttd.rc @echo '===> Compiling resource $<' $(Q)$(WINDRES) -o $@ $<
--- a/ai.c +++ b/ai.c @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "ttd.h" +#include "openttd.h" #include "map.h" #include "tile.h" #include "player.h"
--- a/ai_build.c +++ b/ai_build.c @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "ttd.h" +#include "openttd.h" #include "debug.h" #include "map.h" #include "tile.h"
--- a/ai_new.c +++ b/ai_new.c @@ -16,7 +16,7 @@ */ #include "stdafx.h" -#include "ttd.h" +#include "openttd.h" #include "debug.h" #include "table/strings.h" #include "map.h"
--- a/ai_pathfinder.c +++ b/ai_pathfinder.c @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "ttd.h" +#include "openttd.h" #include "debug.h" #include "map.h" #include "tile.h"
--- a/ai_shared.c +++ b/ai_shared.c @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "ttd.h" +#include "openttd.h" #include "debug.h" #include "map.h" #include "ai.h"
--- a/aircraft_cmd.c +++ b/aircraft_cmd.c @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "ttd.h" +#include "openttd.h" #include "debug.h" #include "table/strings.h" #include "map.h"
--- a/aircraft_gui.c +++ b/aircraft_gui.c @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "ttd.h" +#include "openttd.h" #include "debug.h" #include "table/strings.h" #include "map.h"
--- a/airport.c +++ b/airport.c @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "ttd.h" +#include "openttd.h" #include "debug.h" #include "map.h" #include "airport.h"
--- a/airport_gui.c +++ b/airport_gui.c @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "ttd.h" +#include "openttd.h" #include "table/sprites.h" #include "table/strings.h" #include "map.h"
--- a/aystar.c +++ b/aystar.c @@ -15,7 +15,7 @@ */ #include "stdafx.h" -#include "ttd.h" +#include "openttd.h" #include "aystar.h" // This looks in the Hash if a node exists in ClosedList // If so, it returns the PathNode, else NULL
--- a/bridge_gui.c +++ b/bridge_gui.c @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "ttd.h" +#include "openttd.h" #include "table/strings.h" #include "map.h" #include "window.h"
--- a/callback_table.c +++ b/callback_table.c @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "ttd.h" +#include "openttd.h" #include "functions.h" // If you add a callback for DoCommandP, also add the callback in here
--- a/clear_cmd.c +++ b/clear_cmd.c @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "ttd.h" +#include "openttd.h" #include "table/strings.h" #include "map.h" #include "tile.h"
--- a/command.c +++ b/command.c @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "ttd.h" +#include "openttd.h" #include "table/strings.h" #include "map.h" #include "gui.h"
--- a/console.c +++ b/console.c @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "ttd.h" +#include "openttd.h" #include "table/strings.h" #include "window.h" #include "gui.h"
--- a/console_cmds.c +++ b/console_cmds.c @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "ttd.h" +#include "openttd.h" #include "console.h" #include "debug.h" #include "engine.h"
--- a/debug.c +++ b/debug.c @@ -1,7 +1,7 @@ #include "stdafx.h" #include <stdio.h> #include <stdarg.h> -#include "ttd.h" +#include "openttd.h" #include "console.h" #include "debug.h" #include "string.h"
--- a/dedicated.c +++ b/dedicated.c @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "ttd.h" +#include "openttd.h" #include "debug.h" #include "network.h" #include "hal.h"
--- a/depot.c +++ b/depot.c @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "ttd.h" +#include "openttd.h" #include "depot.h" #include "tile.h" #include "map.h"
--- a/disaster_cmd.c +++ b/disaster_cmd.c @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "ttd.h" +#include "openttd.h" #include "table/strings.h" #include "map.h" #include "tile.h"
--- a/dock_gui.c +++ b/dock_gui.c @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "ttd.h" +#include "openttd.h" #include "table/sprites.h" #include "table/strings.h" #include "map.h"
--- a/dummy_land.c +++ b/dummy_land.c @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "ttd.h" +#include "openttd.h" #include "table/strings.h" #include "viewport.h" #include "command.h"
--- a/economy.c +++ b/economy.c @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "ttd.h" +#include "openttd.h" #include "strings.h" // XXX InjectDParam() #include "table/strings.h" #include "map.h"
--- a/engine.c +++ b/engine.c @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "ttd.h" +#include "openttd.h" #include "debug.h" #include "table/strings.h" #include "engine.h"
--- a/engine_gui.c +++ b/engine_gui.c @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "ttd.h" +#include "openttd.h" #include "table/strings.h" #include "window.h" #include "gui.h"
--- a/fileio.c +++ b/fileio.c @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "ttd.h" +#include "openttd.h" #include "fileio.h" #if defined(UNIX) || defined(__OS2__) #include <ctype.h> // required for tolower()
--- a/gfx.c +++ b/gfx.c @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "ttd.h" +#include "openttd.h" #include "spritecache.h" #include "strings.h" #include "gfx.h"
--- a/graph_gui.c +++ b/graph_gui.c @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "ttd.h" +#include "openttd.h" #include "table/strings.h" #include "window.h" #include "gui.h"
--- a/industry_cmd.c +++ b/industry_cmd.c @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "ttd.h" +#include "openttd.h" #include "table/strings.h" #include "map.h" #include "tile.h"
--- a/industry_gui.c +++ b/industry_gui.c @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "ttd.h" +#include "openttd.h" #include "debug.h" #include "strings.h" #include "table/strings.h"
--- a/intro_gui.c +++ b/intro_gui.c @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "ttd.h" +#include "openttd.h" #include "table/strings.h" #include "window.h" #include "gui.h"
--- a/landscape.c +++ b/landscape.c @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "ttd.h" +#include "openttd.h" #include "map.h" #include "spritecache.h" #include "table/sprites.h"
--- a/main_gui.c +++ b/main_gui.c @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "ttd.h" +#include "openttd.h" #include "spritecache.h" #include "strings.h" #include "table/sprites.h"
--- a/map.c +++ b/map.c @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "ttd.h" +#include "openttd.h" #include "debug.h" #include "functions.h" #include "map.h"
--- a/misc.c +++ b/misc.c @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "ttd.h" +#include "openttd.h" #include "string.h" #include "strings.h" // XXX GetParam* #include "table/strings.h"
--- a/misc_cmd.c +++ b/misc_cmd.c @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "ttd.h" +#include "openttd.h" #include "string.h" #include "table/strings.h" #include "command.h"
--- a/misc_gui.c +++ b/misc_gui.c @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "ttd.h" +#include "openttd.h" #include "debug.h" #include "spritecache.h" #include "strings.h"
--- a/mixer.c +++ b/mixer.c @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "ttd.h" +#include "openttd.h" #include "mixer.h" struct MixerChannel {
--- a/music_gui.c +++ b/music_gui.c @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "ttd.h" +#include "openttd.h" #include "table/strings.h" #include "window.h" #include "gui.h"
--- a/namegen.c +++ b/namegen.c @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "ttd.h" +#include "openttd.h" #include "debug.h" #include "namegen.h" #include "table/namegen.h"
--- a/network_data.h +++ b/network_data.h @@ -1,7 +1,7 @@ #ifndef NETWORK_DATA_H #define NETWORK_DATA_H -#include "ttd.h" +#include "openttd.h" #include "network.h" #include "network_core.h"
--- a/network_gui.c +++ b/network_gui.c @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "ttd.h" +#include "openttd.h" #include "string.h" #include "strings.h" #include "table/sprites.h"
--- a/newgrf.c +++ b/newgrf.c @@ -2,7 +2,7 @@ #include <stdarg.h> -#include "ttd.h" +#include "openttd.h" #include "debug.h" #include "gfx.h" #include "fileio.h"
--- a/news_gui.c +++ b/news_gui.c @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "ttd.h" +#include "openttd.h" #include "strings.h" #include "table/sprites.h" #include "table/strings.h"
--- a/npf.c +++ b/npf.c @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "ttd.h" +#include "openttd.h" #include "debug.h" #include "npf.h" #include "aystar.h"
--- a/npf.h +++ b/npf.h @@ -3,7 +3,7 @@ /* Blaat */ -#include "ttd.h" +#include "openttd.h" #include "aystar.h" #include "vehicle.h"
--- a/oldloader.c +++ b/oldloader.c @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "ttd.h" +#include "openttd.h" #include "table/strings.h" #include "map.h" #include "town.h"
new file mode 100644 --- /dev/null +++ b/openttd.c @@ -0,0 +1,1415 @@ +#include "stdafx.h" +#include "string.h" +#include "table/strings.h" +#include "debug.h" +#include "strings.h" +#include "map.h" +#include "tile.h" + +#define VARDEF +#include "openttd.h" +#include "mixer.h" +#include "spritecache.h" +#include "gfx.h" +#include "gui.h" +#include "station.h" +#include "vehicle.h" +#include "viewport.h" +#include "window.h" +#include "player.h" +#include "command.h" +#include "town.h" +#include "industry.h" +#include "news.h" +#include "engine.h" +#include "sound.h" +#include "economy.h" +#include "fileio.h" +#include "hal.h" +#include "airport.h" +#include "ai.h" +#include "console.h" +#include "screenshot.h" +#include "network.h" +#include "signs.h" +#include "depot.h" +#include "waypoint.h" + +#include <stdarg.h> + +void GenerateWorld(int mode, uint log_x, uint log_y); +void CallLandscapeTick(void); +void IncreaseDate(void); +void RunOtherPlayersLoop(void); +void DoPaletteAnimations(void); +void MusicLoop(void); +void ResetMusic(void); +void InitializeStations(void); +void DeleteAllPlayerStations(void); + +extern void SetDifficultyLevel(int mode, GameOptions *gm_opt); +extern void DoStartupNewPlayer(bool is_ai); +extern void ShowOSErrorBox(const char *buf); + +bool LoadSavegame(const char *filename); + +extern void HalGameLoop(void); + +uint32 _pixels_redrawn; +bool _dbg_screen_rect; +bool disable_computer; // We should get ride of this thing.. is only used for a debug-cheat +static byte _os_version = 0; + +/* TODO: usrerror() for errors which are not of an internal nature but + * caused by the user, i.e. missing files or fatal configuration errors. + * Post-0.4.0 since Celestar doesn't want this in SVN before. --pasky */ + +void CDECL error(const char *s, ...) { + va_list va; + char buf[512]; + va_start(va, s); + vsprintf(buf, s, va); + va_end(va); + + ShowOSErrorBox(buf); + if (_video_driver) + _video_driver->stop(); + + assert(0); + exit(1); +} + +void CDECL ShowInfoF(const char *str, ...) +{ + va_list va; + char buf[1024]; + va_start(va, str); + vsprintf(buf, str, va); + va_end(va); + ShowInfo(buf); +} + +char * CDECL str_fmt(const char *str, ...) +{ + char buf[4096]; + va_list va; + int len; + char *p; + + va_start(va, str); + len = vsprintf(buf, str, va); + va_end(va); + p = malloc(len + 1); + if (p) + memcpy(p, buf, len + 1); + return p; +} + + +// NULL midi driver +static const char *NullMidiStart(const char * const *parm) { return NULL; } +static void NullMidiStop(void) {} +static void NullMidiPlaySong(const char *filename) {} +static void NullMidiStopSong(void) {} +static bool NullMidiIsSongPlaying(void) { return true; } +static void NullMidiSetVolume(byte vol) {} + +const HalMusicDriver _null_music_driver = { + NullMidiStart, + NullMidiStop, + NullMidiPlaySong, + NullMidiStopSong, + NullMidiIsSongPlaying, + NullMidiSetVolume, +}; + +// NULL video driver +static void *_null_video_mem; +static const char *NullVideoStart(const char * const *parm) +{ + _screen.width = _screen.pitch = _cur_resolution[0]; + _screen.height = _cur_resolution[1]; + _null_video_mem = malloc(_cur_resolution[0]*_cur_resolution[1]); + return NULL; +} +static void NullVideoStop(void) { free(_null_video_mem); } +static void NullVideoMakeDirty(int left, int top, int width, int height) {} +static int NullVideoMainLoop(void) +{ + int i = 1000; + do { + GameLoop(); + _screen.dst_ptr = _null_video_mem; + UpdateWindows(); + } while (--i); + return ML_QUIT; +} + +static bool NullVideoChangeRes(int w, int h) { return false; } +static void NullVideoFullScreen(bool fs) {} + +const HalVideoDriver _null_video_driver = { + NullVideoStart, + NullVideoStop, + NullVideoMakeDirty, + NullVideoMainLoop, + NullVideoChangeRes, + NullVideoFullScreen, +}; + +// NULL sound driver +static const char *NullSoundStart(const char * const *parm) { return NULL; } +static void NullSoundStop(void) {} +const HalSoundDriver _null_sound_driver = { + NullSoundStart, + NullSoundStop, +}; + +enum { + DF_PRIORITY_MASK = 0xf, +}; + +typedef struct { + const DriverDesc *descs; + const char *name; + void *var; +} DriverClass; + +static DriverClass _driver_classes[] = { + {_video_driver_descs, "video", &_video_driver}, + {_sound_driver_descs, "sound", &_sound_driver}, + {_music_driver_descs, "music", &_music_driver}, +}; + +static const DriverDesc *GetDriverByName(const DriverDesc *dd, const char *name) +{ + do { + if (!strcmp(dd->name, name)) + return dd; + } while ((++dd)->name); + return NULL; +} + +static const DriverDesc *ChooseDefaultDriver(const DriverDesc *dd) +{ + const DriverDesc *best = NULL; + int best_pri = -1; + do { + if ((int)(dd->flags&DF_PRIORITY_MASK) > best_pri && _os_version >= (byte)dd->flags) { + best_pri = dd->flags&DF_PRIORITY_MASK; + best = dd; + } + } while ((++dd)->name); + return best; +} + + +void *ReadFileToMem(const char *filename, size_t *lenp, size_t maxsize) +{ + FILE *in; + byte *mem; + size_t len; + + in = fopen(filename, "rb"); + if (in == NULL) + return NULL; + + fseek(in, 0, SEEK_END); + len = ftell(in); + fseek(in, 0, SEEK_SET); + if (len > maxsize || (mem = malloc(len + 1)) == NULL) { + fclose(in); + return NULL; + } + mem[len] = 0; + if (fread(mem, len, 1, in) != 1) { + fclose(in); + free(mem); + return NULL; + } + fclose(in); + + *lenp = len; + return mem; +} + +void LoadDriver(int driver, const char *name) +{ + const DriverClass *dc = &_driver_classes[driver]; + const DriverDesc *dd; + const void **var; + const void *drv; + const char *err; + char *parm; + char buffer[256]; + const char *parms[32]; + + parms[0] = NULL; + + if (!*name) { + dd = ChooseDefaultDriver(dc->descs); + } else { + // Extract the driver name and put parameter list in parm + ttd_strlcpy(buffer, name, sizeof(buffer)); + parm = strchr(buffer, ':'); + if (parm) { + uint np = 0; + // Tokenize the parm. + do { + *parm++ = 0; + if (np < lengthof(parms) - 1) + parms[np++] = parm; + while (*parm != 0 && *parm != ',') + parm++; + } while (*parm == ','); + parms[np] = NULL; + } + dd = GetDriverByName(dc->descs, buffer); + if (dd == NULL) + error("No such %s driver: %s\n", dc->name, buffer); + } + var = dc->var; + if (*var != NULL) ((const HalCommonDriver*)*var)->stop(); + *var = NULL; + drv = dd->drv; + if ((err=((const HalCommonDriver*)drv)->start(parms)) != NULL) + error("Unable to load driver %s(%s). The error was: %s\n", dd->name, dd->longname, err); + *var = drv; +} + +static void showhelp(void) +{ + char buf[4096], *p; + const DriverClass *dc = _driver_classes; + const DriverDesc *dd; + int i; + + p = strecpy(buf, + "Command line options:\n" + " -v drv = Set video driver (see below)\n" + " -s drv = Set sound driver (see below)\n" + " -m drv = Set music driver (see below)\n" + " -r res = Set resolution (for instance 800x600)\n" + " -h = Display this help text\n" + " -t date = Set starting date\n" + " -d [[fac=]lvl[,...]]= Debug mode\n" + " -l lng = Select Language\n" + " -e = Start Editor\n" + " -g [savegame] = Start new/save game immediately\n" + " -G seed = Set random seed\n" + " -n [ip#player:port] = Start networkgame\n" + " -D = Start dedicated server\n" + #if !defined(__MORPHOS__) && !defined(__AMIGA__) + " -f = Fork into the background (dedicated only)\n" + #endif + " -i = Force to use the DOS palette (use this if you see a lot of pink)\n" + " -p #player = Player as #player (deprecated) (network only)\n" + " -c config_file = Use 'config_file' instead of 'openttd.cfg'\n", + lastof(buf) + ); + + for(i=0; i!=lengthof(_driver_classes); i++,dc++) { + p += sprintf(p, "List of %s drivers:\n", dc->name); + dd = dc->descs; + do { + p += sprintf(p, "%10s: %s\n", dd->name, dd->longname); + } while ((++dd)->name); + } + + ShowInfo(buf); +} + + +const char *GetDriverParam(const char * const *parm, const char *name) +{ + const char *p; + int len = strlen(name); + while ((p = *parm++) != NULL) { + if (!strncmp(p,name,len)) { + if (p[len] == '=') return p + len + 1; + if (p[len] == 0) return p + len; + } + } + return NULL; +} + +bool GetDriverParamBool(const char * const *parm, const char *name) +{ + const char *p = GetDriverParam(parm, name); + return p != NULL; +} + +int GetDriverParamInt(const char * const *parm, const char *name, int def) +{ + const char *p = GetDriverParam(parm, name); + return p != NULL ? atoi(p) : def; +} + +typedef struct { + char *opt; + int numleft; + char **argv; + const char *options; + char *cont; +} MyGetOptData; + +static void MyGetOptInit(MyGetOptData *md, int argc, char **argv, const char *options) +{ + md->cont = NULL; + md->numleft = argc; + md->argv = argv; + md->options = options; +} + +static int MyGetOpt(MyGetOptData *md) +{ + char *s,*r,*t; + + if ((s=md->cont) != NULL) + goto md_continue_here; + + while(true) { + if (--md->numleft < 0) + return -1; + + s = *md->argv++; + if (*s == '-') { +md_continue_here:; + s++; + if (*s != 0) { + // Found argument, try to locate it in options. + if (*s == ':' || (r = strchr(md->options, *s)) == NULL) { + // ERROR! + return -2; + } + if (r[1] == ':') { + // Item wants an argument. Check if the argument follows, or if it comes as a separate arg. + if (!*(t = s + 1)) { + // It comes as a separate arg. Check if out of args? + if (--md->numleft < 0 || *(t = *md->argv) == '-') { + // Check if item is optional? + if (r[2] != ':') + return -2; + md->numleft++; + t = NULL; + } else { + md->argv++; + } + } + md->opt = t; + md->cont = NULL; + return *s; + } + md->opt = NULL; + md->cont = s; + return *s; + } + } else { + // This is currently not supported. + return -2; + } + } +} + + +static void ParseResolution(int res[2], char *s) +{ + char *t = strchr(s, 'x'); + if (t == NULL) { + ShowInfoF("Invalid resolution '%s'", s); + return; + } + + res[0] = clamp(strtoul(s, NULL, 0), 64, MAX_SCREEN_WIDTH); + res[1] = clamp(strtoul(t + 1, NULL, 0), 64, MAX_SCREEN_HEIGHT); +} + +static void InitializeDynamicVariables(void) +{ + /* Dynamic stuff needs to be initialized somewhere... */ + _station_sort = NULL; + _vehicle_sort = NULL; + _town_sort = NULL; + _industry_sort = NULL; +} + +static void UnInitializeDynamicVariables(void) +{ + /* Dynamic stuff needs to be free'd somewhere... */ + CleanPool(&_town_pool); + CleanPool(&_industry_pool); + CleanPool(&_station_pool); + CleanPool(&_vehicle_pool); + CleanPool(&_sign_pool); + CleanPool(&_order_pool); + + free(_station_sort); + free(_vehicle_sort); + free(_town_sort); + free(_industry_sort); +} + +static void UnInitializeGame(void) +{ + UnInitWindowSystem(); + UnInitNewgrEngines(); + + free(_config_file); +} + +static void LoadIntroGame(void) +{ + char filename[256]; + + _game_mode = GM_MENU; + CLRBITS(_display_opt, DO_TRANS_BUILDINGS); // don't make buildings transparent in intro + _opt_ptr = &_opt_newgame; + + GfxLoadSprites(); + LoadStringWidthTable(); + + // Setup main window + ResetWindowSystem(); + SetupColorsAndInitialWindow(); + + // Generate a world. + sprintf(filename, "%sopntitle.dat", _path.data_dir); + if (SaveOrLoad(filename, SL_LOAD) != SL_OK) { +#if defined SECOND_DATA_DIR + sprintf(filename, "%sopntitle.dat", _path.second_data_dir); + if (SaveOrLoad(filename, SL_LOAD) != SL_OK) +#endif + GenerateWorld(1, 6, 6); // if failed loading, make empty world. + } + + _pause = 0; + _local_player = 0; + MarkWholeScreenDirty(); + + // Play main theme + if (_music_driver->is_song_playing()) ResetMusic(); +} + +extern void DedicatedFork(void); +extern void CheckExternalFiles(void); + +int ttd_main(int argc, char* argv[]) +{ + MyGetOptData mgo; + int i; + bool network = false; + char *network_conn = NULL; + char *language = NULL; + const char *optformat; + char musicdriver[16], sounddriver[16], videodriver[16]; + int resolution[2] = {0,0}; + uint startdate = -1; + bool dedicated; + + musicdriver[0] = sounddriver[0] = videodriver[0] = 0; + + _game_mode = GM_MENU; + _switch_mode = SM_MENU; + _switch_mode_errorstr = INVALID_STRING_ID; + _dedicated_forks = false; + dedicated = false; + _config_file = NULL; + + // The last param of the following function means this: + // a letter means: it accepts that param (e.g.: -h) + // a ':' behind it means: it need a param (e.g.: -m<driver>) + // a '::' behind it means: it can optional have a param (e.g.: -d<debug>) + #if !defined(__MORPHOS__) && !defined(__AMIGA__) && !defined(WIN32) + optformat = "m:s:v:hDfn::l:eit:d::r:g::G:p:c:"; + #else + optformat = "m:s:v:hDn::l:eit:d::r:g::G:p:c:"; // no fork option + #endif + + MyGetOptInit(&mgo, argc-1, argv+1, optformat); + while ((i = MyGetOpt(&mgo)) != -1) { + switch(i) { + case 'm': ttd_strlcpy(musicdriver, mgo.opt, sizeof(musicdriver)); break; + case 's': ttd_strlcpy(sounddriver, mgo.opt, sizeof(sounddriver)); break; + case 'v': ttd_strlcpy(videodriver, mgo.opt, sizeof(videodriver)); break; + case 'D': { + sprintf(musicdriver,"null"); + sprintf(sounddriver,"null"); + sprintf(videodriver,"dedicated"); + dedicated = true; + } break; + case 'f': { + _dedicated_forks = true; + }; break; + case 'n': { + network = true; + if (mgo.opt) + // Optional, you can give an IP + network_conn = mgo.opt; + else + network_conn = NULL; + } break; + case 'r': ParseResolution(resolution, mgo.opt); break; + case 'l': { + language = mgo.opt; + } break; + case 't': { + startdate = atoi(mgo.opt); + } break; + case 'd': { +#if defined(WIN32) + CreateConsole(); +#endif + if (mgo.opt) + SetDebugString(mgo.opt); + } break; + case 'e': _switch_mode = SM_EDITOR; break; + case 'i': _use_dos_palette = true; break; + case 'g': + if (mgo.opt) { + strcpy(_file_to_saveload.name, mgo.opt); + _switch_mode = SM_LOAD; + } else + _switch_mode = SM_NEWGAME; + break; + case 'G': + _random_seeds[0][0] = atoi(mgo.opt); + break; + case 'p': { + int i = atoi(mgo.opt); + // Play as an other player in network games + if (IS_INT_INSIDE(i, 1, MAX_PLAYERS)) _network_playas = i; + break; + } + case 'c': + _config_file = strdup(mgo.opt); + break; + case -2: + case 'h': + showhelp(); + return 0; + } + } + + DeterminePaths(); + CheckExternalFiles(); + +#ifdef UNIX + // We must fork here, or we'll end up without some resources we need (like sockets) + if (_dedicated_forks) + DedicatedFork(); +#endif + + LoadFromConfig(); + CheckConfig(); + LoadFromHighScore(); + + // override config? + if (musicdriver[0]) ttd_strlcpy(_ini_musicdriver, musicdriver, sizeof(_ini_musicdriver)); + if (sounddriver[0]) ttd_strlcpy(_ini_sounddriver, sounddriver, sizeof(_ini_sounddriver)); + if (videodriver[0]) ttd_strlcpy(_ini_videodriver, videodriver, sizeof(_ini_videodriver)); + if (resolution[0]) { _cur_resolution[0] = resolution[0]; _cur_resolution[1] = resolution[1]; } + if (startdate != (uint)-1) _patches.starting_date = startdate; + + if (_dedicated_forks && !dedicated) + _dedicated_forks = false; + + // enumerate language files + InitializeLanguagePacks(); + + // initialize screenshot formats + InitializeScreenshotFormats(); + + // initialize airport state machines + InitializeAirports(); + + /* initialize all variables that are allocated dynamically */ + InitializeDynamicVariables(); + + // Sample catalogue + DEBUG(misc, 1) ("Loading sound effects..."); + _os_version = GetOSVersion(); + MxInitialize(11025); + SoundInitialize("sample.cat"); + + // This must be done early, since functions use the InvalidateWindow* calls + InitWindowSystem(); + + GfxLoadSprites(); + LoadStringWidthTable(); + + DEBUG(misc, 1) ("Loading drivers..."); + LoadDriver(SOUND_DRIVER, _ini_sounddriver); + LoadDriver(MUSIC_DRIVER, _ini_musicdriver); + LoadDriver(VIDEO_DRIVER, _ini_videodriver); // load video last, to prevent an empty window while sound and music loads + _savegame_sort_order = 1; // default sorting of savegames is by date, newest first + +#ifdef ENABLE_NETWORK + // initialize network-core + NetworkStartUp(); +#endif /* ENABLE_NETWORK */ + + _opt_ptr = &_opt_newgame; + + /* XXX - ugly hack, if diff_level is 9, it means we got no setting from the config file */ + if (_opt_newgame.diff_level == 9) + SetDifficultyLevel(0, &_opt_newgame); + + // initialize the ingame console + IConsoleInit(); + InitializeGUI(); + IConsoleCmdExec("exec scripts/autoexec.scr 0"); + + InitPlayerRandoms(); + + GenerateWorld(1, 6, 6); // Make the viewport initialization happy + +#ifdef ENABLE_NETWORK + if ((network) && (_network_available)) { + if (network_conn != NULL) { + const char *port = NULL; + const char *player = NULL; + uint16 rport; + + rport = NETWORK_DEFAULT_PORT; + + ParseConnectionString(&player, &port, network_conn); + + if (player != NULL) _network_playas = atoi(player); + if (port != NULL) rport = atoi(port); + + LoadIntroGame(); + _switch_mode = SM_NONE; + NetworkClientConnectGame(network_conn, rport); + } + } +#endif /* ENABLE_NETWORK */ + + while (_video_driver->main_loop() == ML_SWITCHDRIVER) {} + + JoinOTTDThread(); + IConsoleFree(); + +#ifdef ENABLE_NETWORK + if (_network_available) { + // Shut down the network and close any open connections + NetworkDisconnect(); + NetworkUDPClose(); + NetworkShutDown(); + } +#endif /* ENABLE_NETWORK */ + + _video_driver->stop(); + _music_driver->stop(); + _sound_driver->stop(); + + SaveToConfig(); + SaveToHighScore(); + + // uninitialize airport state machines + UnInitializeAirports(); + + /* uninitialize variables that are allocated dynamic */ + UnInitializeDynamicVariables(); + + /* Close all and any open filehandles */ + FioCloseAll(); + UnInitializeGame(); + + return 0; +} + +static void ShowScreenshotResult(bool b) +{ + if (b) { + SetDParam(0, STR_SPEC_SCREENSHOT_NAME); + ShowErrorMessage(INVALID_STRING_ID, STR_031B_SCREENSHOT_SUCCESSFULLY, 0, 0); + } else { + ShowErrorMessage(INVALID_STRING_ID, STR_031C_SCREENSHOT_FAILED, 0, 0); + } + +} + +static void MakeNewGame(void) +{ + _game_mode = GM_NORMAL; + + // Copy in game options + _opt_ptr = &_opt; + memcpy(_opt_ptr, &_opt_newgame, sizeof(GameOptions)); + + GfxLoadSprites(); + + // Reinitialize windows + ResetWindowSystem(); + LoadStringWidthTable(); + + SetupColorsAndInitialWindow(); + + // Randomize world + GenerateWorld(0, _patches.map_x, _patches.map_y); + + // In a dedicated server, the server does not play + if (_network_dedicated) { + _local_player = OWNER_SPECTATOR; + } else { + // Create a single player + DoStartupNewPlayer(false); + + _local_player = 0; + } + + MarkWholeScreenDirty(); +} + +static void MakeNewEditorWorld(void) +{ + _game_mode = GM_EDITOR; + + // Copy in game options + _opt_ptr = &_opt; + memcpy(_opt_ptr, &_opt_newgame, sizeof(GameOptions)); + + GfxLoadSprites(); + + // Re-init the windowing system + ResetWindowSystem(); + + // Create toolbars + SetupColorsAndInitialWindow(); + + // Startup the game system + GenerateWorld(1, _patches.map_x, _patches.map_y); + + _local_player = OWNER_NONE; + MarkWholeScreenDirty(); +} + +void StartupPlayers(void); +void StartupDisasters(void); + +/** + * Start Scenario starts a new game based on a scenario. + * Eg 'New Game' --> select a preset scenario + * This starts a scenario based on your current difficulty settings + */ +static void StartScenario(void) +{ + _game_mode = GM_NORMAL; + + // invalid type + if (_file_to_saveload.mode == SL_INVALID) { + printf("Savegame is obsolete or invalid format: %s\n", _file_to_saveload.name); + ShowErrorMessage(_error_message, STR_4009_GAME_LOAD_FAILED, 0, 0); + _game_mode = GM_MENU; + return; + } + + GfxLoadSprites(); + + // Reinitialize windows + ResetWindowSystem(); + LoadStringWidthTable(); + + SetupColorsAndInitialWindow(); + + // Load game + if (SaveOrLoad(_file_to_saveload.name, _file_to_saveload.mode) != SL_OK) { + LoadIntroGame(); + ShowErrorMessage(_error_message, STR_4009_GAME_LOAD_FAILED, 0, 0); + } + + _opt_ptr = &_opt; + memcpy(&_opt_ptr->diff, &_opt_newgame.diff, sizeof(GameDifficulty)); + _opt.diff_level = _opt_newgame.diff_level; + + // Inititalize data + StartupPlayers(); + StartupEngines(); + StartupDisasters(); + + _local_player = 0; + + MarkWholeScreenDirty(); +} + +bool SafeSaveOrLoad(const char *filename, int mode, int newgm) +{ + byte ogm = _game_mode; + int r; + + _game_mode = newgm; + r = SaveOrLoad(filename, mode); + if (r == SL_REINIT) { + if (ogm == GM_MENU) + LoadIntroGame(); + else if (ogm == GM_EDITOR) + MakeNewEditorWorld(); + else + MakeNewGame(); + return false; + } else if (r != SL_OK) { + _game_mode = ogm; + return false; + } else + return true; +} + +void SwitchMode(int new_mode) +{ + _in_state_game_loop = true; + +#ifdef ENABLE_NETWORK + // If we are saving something, the network stays in his current state + if (new_mode != SM_SAVE) { + // If the network is active, make it not-active + if (_networking) { + if (_network_server && (new_mode == SM_LOAD || new_mode == SM_NEWGAME)) { + NetworkReboot(); + NetworkUDPClose(); + } else { + NetworkDisconnect(); + NetworkUDPClose(); + } + } + + // If we are a server, we restart the server + if (_is_network_server) { + // But not if we are going to the menu + if (new_mode != SM_MENU) { + NetworkServerStart(); + } else { + // This client no longer wants to be a network-server + _is_network_server = false; + } + } + } +#endif /* ENABLE_NETWORK */ + + switch (new_mode) { + case SM_EDITOR: /* Switch to scenario editor */ + MakeNewEditorWorld(); + break; + + case SM_NEWGAME: /* New Game --> 'Random game' */ +#ifdef ENABLE_NETWORK + if (_network_server) + snprintf(_network_game_info.map_name, 40, "Random"); +#endif /* ENABLE_NETWORK */ + MakeNewGame(); + break; + + case SM_START_SCENARIO: /* New Game --> Choose one of the preset scenarios */ + StartScenario(); + break; + + case SM_LOAD: { /* Load game, Play Scenario */ + _opt_ptr = &_opt; + + _error_message = INVALID_STRING_ID; + if (!SafeSaveOrLoad(_file_to_saveload.name, _file_to_saveload.mode, GM_NORMAL)) { + LoadIntroGame(); + ShowErrorMessage(_error_message, STR_4009_GAME_LOAD_FAILED, 0, 0); + } else { + _local_player = 0; + DoCommandP(0, 0, 0, NULL, CMD_PAUSE); // decrease pause counter (was increased from opening load dialog) +#ifdef ENABLE_NETWORK + if (_network_server) + snprintf(_network_game_info.map_name, 40, "Loaded game"); +#endif /* ENABLE_NETWORK */ + } + break; + } + + case SM_LOAD_SCENARIO: { /* Load scenario from scenario editor */ + int i; + + if (SafeSaveOrLoad(_file_to_saveload.name, _file_to_saveload.mode, GM_EDITOR)) { + _opt_ptr = &_opt; + + _local_player = OWNER_NONE; + _generating_world = true; + // delete all players. + for (i = 0; i != MAX_PLAYERS; i++) { + ChangeOwnershipOfPlayerItems(i, 0xff); + _players[i].is_active = false; + } + _generating_world = false; + // delete all stations owned by a player + DeleteAllPlayerStations(); + +#ifdef ENABLE_NETWORK + if (_network_server) + snprintf(_network_game_info.map_name, 40, "Loaded scenario"); +#endif /* ENABLE_NETWORK */ + } else + ShowErrorMessage(INVALID_STRING_ID, STR_4009_GAME_LOAD_FAILED, 0, 0); + + break; + } + + + case SM_MENU: /* Switch to game intro menu */ + LoadIntroGame(); + break; + + case SM_SAVE: /* Save game */ + if (SaveOrLoad(_file_to_saveload.name, SL_SAVE) != SL_OK) + ShowErrorMessage(INVALID_STRING_ID, STR_4007_GAME_SAVE_FAILED, 0, 0); + else + DeleteWindowById(WC_SAVELOAD, 0); + break; + + case SM_GENRANDLAND: /* Generate random land within scenario editor */ + GenerateWorld(2, _patches.map_x, _patches.map_y); + // XXX: set date + _local_player = OWNER_NONE; + MarkWholeScreenDirty(); + break; + } + + if (_switch_mode_errorstr != INVALID_STRING_ID) + ShowErrorMessage(INVALID_STRING_ID,_switch_mode_errorstr,0,0); + + _in_state_game_loop = false; +} + + +// State controlling game loop. +// The state must not be changed from anywhere +// but here. +// That check is enforced in DoCommand. +void StateGameLoop(void) +{ + // dont execute the state loop during pause + if (_pause) return; + + _in_state_game_loop = true; + // _frame_counter is increased somewhere else when in network-mode + // Sidenote: _frame_counter is ONLY used for _savedump in non-MP-games + // Should that not be deleted? If so, the next 2 lines can also be deleted + if (!_networking) + _frame_counter++; + + if (_savedump_path[0] && (uint)_frame_counter >= _savedump_first && (uint)(_frame_counter -_savedump_first) % _savedump_freq == 0 ) { + char buf[100]; + sprintf(buf, "%s%.5d.sav", _savedump_path, _frame_counter); + SaveOrLoad(buf, SL_SAVE); + if ((uint)_frame_counter >= _savedump_last) exit(1); + } + + if (_game_mode == GM_EDITOR) { + RunTileLoop(); + CallVehicleTicks(); + CallLandscapeTick(); + CallWindowTickEvent(); + NewsLoop(); + } else { + // All these actions has to be done from OWNER_NONE + // for multiplayer compatibility + uint p = _current_player; + _current_player = OWNER_NONE; + + AnimateAnimatedTiles(); + IncreaseDate(); + RunTileLoop(); + CallVehicleTicks(); + CallLandscapeTick(); + + // To bad the AI does not work in multiplayer, because states are not saved + // perfectly + if (!disable_computer && !_networking) + RunOtherPlayersLoop(); + + CallWindowTickEvent(); + NewsLoop(); + _current_player = p; + } + + _in_state_game_loop = false; +} + +static void DoAutosave(void) +{ + char buf[200]; + + if (_patches.keep_all_autosave && _local_player != OWNER_SPECTATOR) { + const Player *p = DEREF_PLAYER(_local_player); + char *s; + sprintf(buf, "%s%s", _path.autosave_dir, PATHSEP); + + SetDParam(0, p->name_1); + SetDParam(1, p->name_2); + SetDParam(2, _date); + s = (char*)GetString(buf + strlen(_path.autosave_dir) + strlen(PATHSEP), STR_4004); + strcpy(s, ".sav"); + } else { /* Save a maximum of 15 autosaves */ + int n = _autosave_ctr; + _autosave_ctr = (_autosave_ctr + 1) & 15; + sprintf(buf, "%s%sautosave%d.sav", _path.autosave_dir, PATHSEP, n); + } + + DEBUG(misc, 2) ("Autosaving to %s", buf); + if (SaveOrLoad(buf, SL_SAVE) != SL_OK) + ShowErrorMessage(INVALID_STRING_ID, STR_AUTOSAVE_FAILED, 0, 0); +} + +static void ScrollMainViewport(int x, int y) +{ + if (_game_mode != GM_MENU) { + Window *w = FindWindowById(WC_MAIN_WINDOW, 0); + assert(w); + + WP(w,vp_d).scrollpos_x += x << w->viewport->zoom; + WP(w,vp_d).scrollpos_y += y << w->viewport->zoom; + } +} + +static const int8 scrollamt[16][2] = { + { 0, 0}, + {-2, 0}, // 1:left + { 0,-2}, // 2:up + {-2,-1}, // 3:left + up + { 2, 0}, // 4:right + { 0, 0}, // 5:left + right + { 2,-1}, // 6:right + up + { 0,-2}, // 7:left + right + up = up + { 0 ,2}, // 8:down + {-2 ,1}, // 9:down+left + { 0, 0}, // 10:impossible + {-2, 0}, // 11:left + up + down = left + { 2, 1}, // 12:down+right + { 0, 2}, // 13:left + right + down = down + { 0,-2}, // 14:left + right + up = up + { 0, 0}, // 15:impossible +}; + +static void HandleKeyScrolling(void) +{ + if (_dirkeys && !_no_scroll) { + int factor = _shift_pressed ? 50 : 10; + ScrollMainViewport(scrollamt[_dirkeys][0] * factor, scrollamt[_dirkeys][1] * factor); + } +} + +void GameLoop(void) +{ + int m; + + // autosave game? + if (_do_autosave) { + _do_autosave = false; + DoAutosave(); + RedrawAutosave(); + } + + // handle scrolling of the main window + if (_dirkeys) HandleKeyScrolling(); + + // make a screenshot? + if ((m=_make_screenshot) != 0) { + _make_screenshot = 0; + switch(m) { + case 1: // make small screenshot + UndrawMouseCursor(); + ShowScreenshotResult(MakeScreenshot()); + break; + case 2: // make large screenshot + ShowScreenshotResult(MakeWorldScreenshot(-(int)MapMaxX() * 32, 0, MapMaxX() * 64, MapSizeY() * 32, 0)); + break; + } + } + + // switch game mode? + if ((m=_switch_mode) != SM_NONE) { + _switch_mode = SM_NONE; + SwitchMode(m); + } + + IncreaseSpriteLRU(); + InteractiveRandom(); + + if (_scroller_click_timeout > 3) + _scroller_click_timeout -= 3; + else + _scroller_click_timeout = 0; + + _caret_timer += 3; + _timer_counter+=8; + CursorTick(); + +#ifdef ENABLE_NETWORK + // Check for UDP stuff + NetworkUDPGameLoop(); + + if (_networking) { + // Multiplayer + NetworkGameLoop(); + } else { + if (_network_reconnect > 0 && --_network_reconnect == 0) { + // This means that we want to reconnect to the last host + // We do this here, because it means that the network is really closed + NetworkClientConnectGame(_network_last_host, _network_last_port); + } + // Singleplayer + StateGameLoop(); + } +#else + StateGameLoop(); +#endif /* ENABLE_NETWORK */ + + if (!_pause && _display_opt&DO_FULL_ANIMATION) + DoPaletteAnimations(); + + if (!_pause || _cheats.build_in_pause.value) + MoveAllTextEffects(); + + InputLoop(); + + MusicLoop(); +} + +void BeforeSaveGame(void) +{ + Window *w = FindWindowById(WC_MAIN_WINDOW, 0); + + if (w != NULL) { + _saved_scrollpos_x = WP(w,vp_d).scrollpos_x; + _saved_scrollpos_y = WP(w,vp_d).scrollpos_y; + _saved_scrollpos_zoom = w->viewport->zoom; + } +} + +static void ConvertTownOwner(void) +{ + uint tile; + + for (tile = 0; tile != MapSize(); tile++) { + if (IsTileType(tile, MP_STREET)) { + if ((_map5[tile] & 0xF0) == 0x10 && _map3_lo[tile] & 0x80) + _map3_lo[tile] = OWNER_TOWN; + + if (_map_owner[tile] & 0x80) + _map_owner[tile] = OWNER_TOWN; + } else if (IsTileType(tile, MP_TUNNELBRIDGE)) { + if (_map_owner[tile] & 0x80) + _map_owner[tile] = OWNER_TOWN; + } + } +} + +// before savegame version 4, the name of the company determined if it existed +static void CheckIsPlayerActive(void) +{ + Player *p; + FOR_ALL_PLAYERS(p) { + if (p->name_1 != 0) { + p->is_active = true; + } + } +} + +// since savegame version 4.1, exclusive transport rights are stored at towns +static void UpdateExclusiveRights(void) +{ + Town *t; + FOR_ALL_TOWNS(t) if (t->xy != 0) { + t->exclusivity=(byte)-1; + } + + /* FIXME old exclusive rights status is not being imported (stored in s->blocked_months_obsolete) + could be implemented this way: + 1.) Go through all stations + Build an array town_blocked[ town_id ][ player_id ] + that stores if at least one station in that town is blocked for a player + 2.) Go through that array, if you find a town that is not blocked for + one player, but for all others, then give him exclusivity. + */ +} + +const byte convert_currency[] = { + 0, 1, 12, 8, 3, + 10, 14, 19, 4, 5, + 9, 11, 13, 6, 17, + 16, 22, 21, 7, 15, + 18, 2, 20, }; + +// since savegame version 4.2 the currencies are arranged differently +static void UpdateCurrencies(void) +{ + _opt.currency = convert_currency[_opt.currency]; +} + +/* Up to revision 1413 the invisible tiles at the southern border have not been + * MP_VOID, even though they should have. This is fixed by this function + */ +static void UpdateVoidTiles(void) +{ + uint i; + + for (i = 0; i < MapMaxY(); ++i) + SetTileType(i * MapSizeX() + MapMaxX(), MP_VOID); + for (i = 0; i < MapSizeX(); ++i) + SetTileType(MapSizeX() * MapMaxY() + i, MP_VOID); +} + +// since savegame version 6.0 each sign has an "owner", signs without owner (from old games are set to 255) +static void UpdateSignOwner(void) +{ + SignStruct *ss; + FOR_ALL_SIGNS(ss) { + ss->owner = OWNER_NONE; // no owner + } +} + +extern void UpdateOldAircraft( void ); +extern void UpdateOilRig( void ); + +bool AfterLoadGame(uint version) +{ + Window *w; + ViewPort *vp; + + // in version 2.1 of the savegame, town owner was unified. + if (version <= 0x200) { + ConvertTownOwner(); + } + + // from version 4.1 of the savegame, exclusive rights are stored at towns + if (version <= 0x400) { + UpdateExclusiveRights(); + } + + // from version 4.2 of the savegame, currencies are in a different order + if (version <= 0x401) { + UpdateCurrencies(); + } + + // from version 6.0 of the savegame, signs have an "owner" + if (version <= 0x600) { + UpdateSignOwner(); + } + + /* In old version there seems to be a problem that water is owned by + OWNER_NONE, not OWNER_WATER.. I can't replicate it for the current + (0x402) version, so I just check when versions are older, and then + walk through the whole map.. */ + if (version <= 0x402) { + TileIndex tile = TILE_XY(0,0); + uint w = MapSizeX(); + uint h = MapSizeY(); + + BEGIN_TILE_LOOP(tile_cur, w, h, tile) + if (IsTileType(tile_cur, MP_WATER) && _map_owner[tile_cur] >= MAX_PLAYERS) + _map_owner[tile_cur] = OWNER_WATER; + END_TILE_LOOP(tile_cur, w, h, tile) + } + + // convert road side to my format. + if (_opt.road_side) _opt.road_side = 1; + + // Load the sprites + GfxLoadSprites(); + + // Update current year + SetDate(_date); + + // reinit the landscape variables (landscape might have changed) + InitializeLandscapeVariables(true); + + // Update all vehicles + AfterLoadVehicles(); + + // Update all waypoints + if (version < 0x0C00) + FixOldWaypoints(); + + UpdateAllWaypointSigns(); + + // in version 2.2 of the savegame, we have new airports + if (version <= 0x201) { + UpdateOldAircraft(); + } + + UpdateAllStationVirtCoord(); + + // Setup town coords + AfterLoadTown(); + UpdateAllSignVirtCoords(); + + // make sure there is a town in the game + if (_game_mode == GM_NORMAL && !ClosestTownFromTile(0, (uint)-1)) + { + _error_message = STR_NO_TOWN_IN_SCENARIO; + return false; + } + + // Initialize windows + ResetWindowSystem(); + SetupColorsAndInitialWindow(); + + w = FindWindowById(WC_MAIN_WINDOW, 0); + + WP(w,vp_d).scrollpos_x = _saved_scrollpos_x; + WP(w,vp_d).scrollpos_y = _saved_scrollpos_y; + + vp = w->viewport; + vp->zoom = _saved_scrollpos_zoom; + vp->virtual_width = vp->width << vp->zoom; + vp->virtual_height = vp->height << vp->zoom; + + + // in version 4.0 of the savegame, is_active was introduced to determine + // if a player does exist, rather then checking name_1 + if (version <= 0x400) { + CheckIsPlayerActive(); + } + + // the void tiles on the southern border used to belong to a wrong class. + if (version <= 0x402) + UpdateVoidTiles(); + + // If Load Scenario / New (Scenario) Game is used, + // a player does not exist yet. So create one here. + // 1 exeption: network-games. Those can have 0 players + // But this exeption is not true for network_servers! + if (!_players[0].is_active && (!_networking || (_networking && _network_server))) + DoStartupNewPlayer(false); + + DoZoomInOutWindow(ZOOM_NONE, w); // update button status + MarkWholeScreenDirty(); + + //In 5.1, Oilrigs have been moved (again) + if (version <= 0x500) { + UpdateOilRig(); + } + + if (version <= 0x600) { + BEGIN_TILE_LOOP(tile, MapSizeX(), MapSizeY(), 0) { + if (IsTileType(tile, MP_HOUSE)) { + _map3_hi[tile] = _map2[tile]; + //XXX magic + SetTileType(tile, MP_VOID); + _map2[tile] = ClosestTownFromTile(tile,(uint)-1)->index; + SetTileType(tile, MP_HOUSE); + } else if (IsTileType(tile, MP_STREET)) { + //XXX magic + SetTileType(tile, MP_VOID); + _map3_hi[tile] |= (_map2[tile] << 4); + if ( _map_owner[tile] == OWNER_TOWN) + _map2[tile] = ClosestTownFromTile(tile,(uint)-1)->index; + else + _map2[tile] = 0; + SetTileType(tile, MP_STREET); + } + } END_TILE_LOOP(tile, MapSizeX(), MapSizeY(), 0); + } + + if (version < 0x900) { + Town *t; + FOR_ALL_TOWNS(t) { + UpdateTownMaxPass(t); + } + } + + return true; +}
new file mode 100644 --- /dev/null +++ b/openttd.dsp @@ -0,0 +1,905 @@ +# Microsoft Developer Studio Project File - Name="openttd" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +CFG=openttd - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "openttd.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "openttd.mak" CFG="openttd - Win32 Checked" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "openttd - Win32 Release" (based on "Win32 (x86) Console Application") +!MESSAGE "openttd - Win32 Debug" (based on "Win32 (x86) Console Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "openttd - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /Gd /Zp4 /W3 /Zi /Ox /Oa /Ow /Og /Oi /Os /Gf /Gy /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "WIN32_EXCEPTION_TRACKER" /D "WIN32_ENABLE_DIRECTMUSIC_SUPPORT" /D "WITH_PNG" /D "WITH_ZLIB" /D "ENABLE_NETWORK" /FAcs /FR /Yu"stdafx.h" /J /FD /c +# SUBTRACT CPP /WX /Ot +# ADD BASE RSC /l 0x809 /d "NDEBUG" +# ADD RSC /l 0x809 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winmm.lib ws2_32.lib libpng.lib zlibstat.lib /nologo /subsystem:windows /map /machine:I386 /opt:nowin98 +# SUBTRACT LINK32 /pdb:none + +!ELSEIF "$(CFG)" == "openttd - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c +# ADD CPP /nologo /MTd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "WITH_PNG" /D "WITH_ZLIB" /D "ENABLE_NETWORK" /YX"stdafx.h" /FD /GZ /c +# SUBTRACT CPP /WX /Fr +# ADD BASE RSC /l 0x809 /d "_DEBUG" +# ADD RSC /l 0x809 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winmm.lib ws2_32.lib libpng.lib zlibstat.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept +# SUBTRACT LINK32 /pdb:none + +!ENDIF + +# Begin Target + +# Name "openttd - Win32 Release" +# Name "openttd - Win32 Debug" + +# Begin Group "Source Files" +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" + +# Begin Source File +SOURCE=.\ai.c +# End Source File + +# Begin Source File +SOURCE=.\ai_build.c +# End Source File + +# Begin Source File +SOURCE=.\ai_new.c +# End Source File + +# Begin Source File +SOURCE=.\ai_pathfinder.c +# End Source File + +# Begin Source File +SOURCE=.\ai_shared.c +# End Source File + +# Begin Source File +SOURCE=.\airport.c +# End Source File + +# Begin Source File +SOURCE=.\aystar.c +# End Source File + +# Begin Source File +SOURCE=.\command.c +# End Source File + +# Begin Source File +SOURCE=.\console.c +# End Source File + +# Begin Source File +SOURCE=.\console_cmds.c +# End Source File + +# Begin Source File +SOURCE=.\debug.c +# End Source File + +# Begin Source File +SOURCE=.\depot.c +# End Source File + +# Begin Source File +SOURCE=.\documentation.txt +# End Source File + +# Begin Source File +SOURCE=.\economy.c +# End Source File + +# Begin Source File +SOURCE=.\engine.c +# End Source File + +# Begin Source File +SOURCE=.\fileio.c +# End Source File + +# Begin Source File +SOURCE=.\gfx.c +# End Source File + +# Begin Source File +SOURCE=.\landscape.c +# End Source File + +# Begin Source File +SOURCE=.\map.c +# End Source File + +# Begin Source File +SOURCE=.\md5.c +# End Source File + +# Begin Source File +SOURCE=.\minilzo.c + +!IF "$(CFG)" == "openttd - Win32 Release" + +# SUBTRACT CPP /YX /Yc /Yu + +!ELSEIF "$(CFG)" == "openttd - Win32 Debug" + +# SUBTRACT CPP /YX + +!ENDIF + +# End Source File + +# Begin Source File +SOURCE=.\misc.c +# End Source File + +# Begin Source File +SOURCE=.\mixer.c +# End Source File + +# Begin Source File +SOURCE=.\namegen.c +# End Source File + +# Begin Source File +SOURCE=.\network.c +# End Source File + +# Begin Source File +SOURCE=.\newgrf.c +# End Source File + +# Begin Source File +SOURCE=.\npf.c +# End Source File + +# Begin Source File +SOURCE=.\oldloader.c +# End Source File + +# Begin Source File +SOURCE=.\pathfind.c +# End Source File + +# Begin Source File +SOURCE=.\pool.c +# End Source File + +# Begin Source File +SOURCE=.\players.c +# End Source File + +# Begin Source File +SOURCE=.\queue.c +# End Source File + +# Begin Source File +SOURCE=.\saveload.c +# End Source File + +# Begin Source File +SOURCE=.\screenshot.c +# End Source File + +# Begin Source File +SOURCE=.\sdl.c +# End Source File + +# Begin Source File +SOURCE=.\settings.c +# End Source File + +# Begin Source File +SOURCE=.\signs.c +# End Source File + +# Begin Source File +SOURCE=.\sound.c +# End Source File + +# Begin Source File +SOURCE=.\sprite.c +# End Source File + +# Begin Source File +SOURCE=.\spritecache.c +# End Source File + +# Begin Source File + +SOURCE=.\StdAfx.c + +!IF "$(CFG)" == "openttd - Win32 Release" + +# ADD CPP /Yc"stdafx.h" + +!ELSEIF "$(CFG)" == "openttd - Win32 Debug" + +!ENDIF + +# End Source File + +# Begin Source File +SOURCE=.\string.c +# End Source File + +# Begin Source File +SOURCE=.\strings.c +# End Source File + +# Begin Source File +SOURCE=.\texteff.c +# End Source File + +# Begin Source File +SOURCE=.\tile.c +# End Source File + +# Begin Source File +SOURCE=.\openttd.c +# End Source File + +# Begin Source File +SOURCE=.\openttd.rc +# End Source File + +# Begin Source File + +SOURCE=.\unix.c + +!IF "$(CFG)" == "openttd - Win32 Release" + +# PROP Exclude_From_Build 1 + +!ELSEIF "$(CFG)" == "openttd - Win32 Debug" + +# PROP Exclude_From_Build 1 + +!ENDIF + +# End Source File + +# Begin Source File +SOURCE=.\vehicle.c +# End Source File + +# Begin Source File +SOURCE=.\vehicle_gui.c +# End Source File + +# Begin Source File +SOURCE=.\viewport.c +# End Source File + +# Begin Source File +SOURCE=.\w32dm.c +# End Source File + +# Begin Source File +SOURCE=.\waypoint.c +# End Source File + +# Begin Source File + +SOURCE=.\w32dm2.cpp + +!IF "$(CFG)" == "openttd - Win32 Release" + +# SUBTRACT CPP /YX /Yc /Yu + +!ELSEIF "$(CFG)" == "openttd - Win32 Debug" + +!ENDIF + +# End Source File + +# Begin Source File +SOURCE=.\widget.c +# End Source File + +# Begin Source File +SOURCE=.\win32.c +# End Source File + +# Begin Source File +SOURCE=.\window.c +# End Source File + +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" + +# Begin Source File +SOURCE=.\ai.h +# End Source File + +# Begin Source File +SOURCE=.\aystar.h +# End Source File + +# Begin Source File +SOURCE=.\command.h +# End Source File + +# Begin Source File +SOURCE=.\console.h +# End Source File + +# Begin Source File +SOURCE=.\debug.h +# End Source File + +# Begin Source File +SOURCE=.\depot.h +# End Source File + +# Begin Source File +SOURCE=.\economy.h +# End Source File + +# Begin Source File +SOURCE=.\engine.h +# End Source File + +# Begin Source File +SOURCE=.\fileio.h +# End Source File + +# Begin Source File +SOURCE=.\functions.h +# End Source File + +# Begin Source File +SOURCE=.\gfx.h +# End Source File + +# Begin Source File +SOURCE=.\gui.h +# End Source File + +# Begin Source File +SOURCE=.\hal.h +# End Source File + +# Begin Source File +SOURCE=.\industry.h +# End Source File + +# Begin Source File +SOURCE=.\macros.h +# End Source File + +# Begin Source File +SOURCE=.\map.h +# End Source File + +# Begin Source File +SOURCE=.\md5.h +# End Source File + +# Begin Source File +SOURCE=.\network.h +# End Source File + +# Begin Source File +SOURCE=.\news.h +# End Source File + +# Begin Source File +SOURCE=.\npf.h +# End Source File + +# Begin Source File +SOURCE=.\pathfind.h +# End Source File + +# Begin Source File +SOURCE=.\pool.h +# End Source File + +# Begin Source File +SOURCE=.\player.h +# End Source File + +# Begin Source File +SOURCE=.\queue.h +# End Source File + +# Begin Source File +SOURCE=.\saveload.h +# End Source File + +# Begin Source File +SOURCE=.\signs.h +# End Source File + +# Begin Source File +SOURCE=.\sound.h +# End Source File + +# Begin Source File +SOURCE=.\station.h +# End Source File + +# Begin Source File +SOURCE=.\string.h +# End Source File + +# Begin Source File +SOURCE=.\strings.h +# End Source File + +# Begin Source File +SOURCE=.\StdAfx.h +# End Source File + +# Begin Source File +SOURCE=.\tile.h +# End Source File + +# Begin Source File +SOURCE=.\town.h +# End Source File + +# Begin Source File +SOURCE=.\openttd.h +# End Source File + +# Begin Source File +SOURCE=.\variables.h +# End Source File + +# Begin Source File +SOURCE=.\vehicle.h +# End Source File + +# Begin Source File +SOURCE=.\vehicle_gui.h +# End Source File + +# Begin Source File +SOURCE=.\viewport.h +# End Source File + +# Begin Source File +SOURCE=.\waypoint.h +# End Source File + +# Begin Source File +SOURCE=.\window.h +# End Source File + +# End Group +# Begin Group "Gui Source codes" + +# PROP Default_Filter "" + +# Begin Source File +SOURCE=.\aircraft_gui.c +# End Source File + +# Begin Source File +SOURCE=.\airport_gui.c +# End Source File + +# Begin Source File +SOURCE=.\bridge_gui.c +# End Source File + +# Begin Source File +SOURCE=.\dock_gui.c +# End Source File + +# Begin Source File +SOURCE=.\engine_gui.c +# End Source File + +# Begin Source File +SOURCE=.\graph_gui.c +# End Source File + +# Begin Source File +SOURCE=.\industry_gui.c +# End Source File + +# Begin Source File +SOURCE=.\intro_gui.c +# End Source File + +# Begin Source File +SOURCE=.\main_gui.c +# End Source File + +# Begin Source File +SOURCE=.\misc_gui.c +# End Source File + +# Begin Source File +SOURCE=.\music_gui.c +# End Source File + +# Begin Source File +SOURCE=.\network_gui.c +# End Source File + +# Begin Source File +SOURCE=.\news_gui.c +# End Source File + +# Begin Source File +SOURCE=.\order_gui.c +# End Source File + +# Begin Source File +SOURCE=.\player_gui.c +# End Source File + +# Begin Source File +SOURCE=.\rail_gui.c +# End Source File + +# Begin Source File +SOURCE=.\road_gui.c +# End Source File + +# Begin Source File +SOURCE=.\roadveh_gui.c +# End Source File + +# Begin Source File +SOURCE=.\settings_gui.c +# End Source File + +# Begin Source File +SOURCE=.\ship_gui.c +# End Source File + +# Begin Source File +SOURCE=.\smallmap_gui.c +# End Source File + +# Begin Source File +SOURCE=.\station_gui.c +# End Source File + +# Begin Source File +SOURCE=.\subsidy_gui.c +# End Source File + +# Begin Source File +SOURCE=.\terraform_gui.c +# End Source File + +# Begin Source File +SOURCE=.\town_gui.c +# End Source File + +# Begin Source File +SOURCE=.\train_gui.c +# End Source File + +# End Group +# Begin Group "Landscape" + +# PROP Default_Filter "" + +# Begin Source File +SOURCE=.\aircraft_cmd.c +# End Source File + +# Begin Source File +SOURCE=.\clear_cmd.c +# End Source File + +# Begin Source File +SOURCE=.\disaster_cmd.c +# End Source File + +# Begin Source File +SOURCE=.\dummy_land.c +# End Source File + +# Begin Source File +SOURCE=.\industry_cmd.c +# End Source File + +# Begin Source File +SOURCE=.\misc_cmd.c +# End Source File + +# Begin Source File +SOURCE=.\order_cmd.c +# End Source File + +# Begin Source File +SOURCE=.\rail_cmd.c +# End Source File + +# Begin Source File +SOURCE=.\road_cmd.c +# End Source File + +# Begin Source File +SOURCE=.\roadveh_cmd.c +# End Source File + +# Begin Source File +SOURCE=.\ship_cmd.c +# End Source File + +# Begin Source File +SOURCE=.\station_cmd.c +# End Source File + +# Begin Source File +SOURCE=.\town_cmd.c +# End Source File + +# Begin Source File +SOURCE=.\train_cmd.c +# End Source File + +# Begin Source File +SOURCE=.\tree_cmd.c +# End Source File + +# Begin Source File +SOURCE=.\tunnelbridge_cmd.c +# End Source File + +# Begin Source File +SOURCE=.\unmovable_cmd.c +# End Source File + +# Begin Source File +SOURCE=.\water_cmd.c +# End Source File + +# End Group +# Begin Group "Tables" + +# PROP Default_Filter "" + +# Begin Source File +SOURCE=.\table\ai_rail.h +# End Source File + +# Begin Source File +SOURCE=.\table\allstrings.h +# End Source File + +# Begin Source File +SOURCE=.\table\animcursors.h +# End Source File + +# Begin Source File +SOURCE=.\table\autorail.h +# End Source File + +# Begin Source File +SOURCE=.\table\build_industry.h +# End Source File + +# Begin Source File +SOURCE=.\table\clear_land.h +# End Source File + +# Begin Source File +SOURCE=.\table\engines.h +# End Source File + +# Begin Source File +SOURCE=.\table\files.h +# End Source File + +# Begin Source File +SOURCE=.\table\genland.h +# End Source File + +# Begin Source File +SOURCE=.\table\industry_land.h +# End Source File + +# Begin Source File +SOURCE=.\table\landscape_const.h +# End Source File + +# Begin Source File +SOURCE=.\table\landscape_sprite.h +# End Source File + +# Begin Source File +SOURCE=.\table\namegen.h +# End Source File + +# Begin Source File +SOURCE=.\table\palettes.h +# End Source File + +# Begin Source File +SOURCE=.\table\road_land.h +# End Source File + +# Begin Source File +SOURCE=.\table\roadveh.h +# End Source File + +# Begin Source File +SOURCE=.\table\sprites.h +# End Source File + +# Begin Source File +SOURCE=.\table\station_land.h +# End Source File + +# Begin Source File +SOURCE=.\table\strings.h +# End Source File + +# Begin Source File +SOURCE=.\table\town_land.h +# End Source File + +# Begin Source File +SOURCE=.\table\track_land.h +# End Source File + +# Begin Source File +SOURCE=.\table\train_cmd.h +# End Source File + +# Begin Source File +SOURCE=.\table\tree_land.h +# End Source File + +# Begin Source File +SOURCE=.\table\tunnel_land.h +# End Source File + +# Begin Source File +SOURCE=.\table\unmovable_land.h +# End Source File + +# Begin Source File +SOURCE=.\table\water_land.h +# End Source File + +# End Group +# Begin Group "Network Source Files" + +# PROP Default_Filter "" + +# Begin Source File +SOURCE=.\callback_table.c +# End Source File + +# Begin Source File +SOURCE=.\dedicated.c +# End Source File + +# Begin Source File +SOURCE=.\network_client.c +# End Source File + +# Begin Source File +SOURCE=.\network_data.c +# End Source File + +# Begin Source File +SOURCE=.\network_gamelist.c +# End Source File + +# Begin Source File +SOURCE=.\network_server.c +# End Source File + +# Begin Source File +SOURCE=.\network_udp.c +# End Source File + +# End Group +# Begin Group "Network Header Files" + +# PROP Default_Filter "" + +# Begin Source File +SOURCE=.\network_client.h +# End Source File + +# Begin Source File +SOURCE=.\network_core.h +# End Source File + +# Begin Source File +SOURCE=.\network_data.h +# End Source File + +# Begin Source File +SOURCE=.\network_gamelist.h +# End Source File + +# Begin Source File +SOURCE=.\network_server.h +# End Source File + +# Begin Source File +SOURCE=.\network_udp.h +# End Source File + +# End Group + +# Begin Source File +SOURCE=.\changelog.txt +# End Source File + +# Begin Source File +SOURCE=.\openttd.ico +# End Source File + +# Begin Source File +SOURCE=.\mainicon.ico +# End Source File + +# Begin Source File +SOURCE=.\ReadMe.txt +# End Source File + +# End Target +# End Project
new file mode 100644 --- /dev/null +++ b/openttd.dsw @@ -0,0 +1,59 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00 +# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! + +############################################################################### + +Project: "langs"=.\langs.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ + Begin Project Dependency + Project_Dep_Name strgen + End Project Dependency +}}} + +############################################################################### + +Project: "strgen"=.\strgen\strgen.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "openttd"=.\openttd.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ + Begin Project Dependency + Project_Dep_Name langs + End Project Dependency +}}} + +############################################################################### + +Global: + +Package=<5> +{{{ +}}} + +Package=<3> +{{{ +}}} + +############################################################################### +
new file mode 100644 --- /dev/null +++ b/openttd.h @@ -0,0 +1,547 @@ +#ifndef TTD_H +#define TTD_H + +#ifndef VARDEF +#define VARDEF extern +#endif + +// use this on non static functions +#define PUBLIC + +typedef struct Rect { + int left,top,right,bottom; +} Rect; + +typedef struct SmallPoint { + int16 x,y; +} SmallPoint; + +typedef struct Point { + int x,y; +} Point; + +typedef struct Pair { + int a; + int b; +} Pair; + +/** + * Is used as a general sortable struct (using qsort and friends). Is used for + * sorting vehicles and stations at the moment + */ +typedef struct SortStruct { + uint32 index; + byte owner; +} SortStruct; + +typedef struct YearMonthDay { + int year, month, day; +} YearMonthDay; + +/* --- 1 Day is 74 ticks --- +* The game's internal structure is dictated by ticks. The date counter (date_fract) is an integer of +* uint16 type, so it can have a max value of 65536. Every tick this variable (date_fract) is +* increased by 885. When it overflows, the new day loop is called. +* * this that means 1 day is : 65536 / 885 = 74 ticks +* * 1 tick is approximately 27ms. +* * 1 day is thus about 2 seconds (74*27 = 1998) on a machine that can run OpenTTD normally +*/ +#define DAY_TICKS 74 +#define MAX_YEAR_BEGIN_REAL 1920 +#define MAX_YEAR_END_REAL 2090 +#define MAX_YEAR_END 170 + +#include "macros.h" + +// Forward declarations of structs. +typedef struct Vehicle Vehicle; +typedef struct Depot Depot; +typedef struct Waypoint Waypoint; +typedef struct Window Window; +typedef struct Station Station; +typedef struct ViewPort ViewPort; +typedef struct Town Town; +typedef struct NewsItem NewsItem; +typedef struct Industry Industry; +typedef struct DrawPixelInfo DrawPixelInfo; +typedef uint16 VehicleID; +typedef byte PlayerID; +typedef byte OrderID; +typedef byte CargoID; +typedef uint16 StringID; +typedef uint16 SpriteID; +typedef uint32 PalSpriteID; + +typedef uint32 WindowNumber; +typedef byte WindowClass; + + +enum GameModes { + GM_MENU, + GM_NORMAL, + GM_EDITOR +}; + +enum SwitchModes { + SM_NONE = 0, + SM_NEWGAME = 1, + SM_EDITOR = 2, + SM_LOAD = 3, + SM_MENU = 4, + SM_SAVE = 5, + SM_GENRANDLAND = 6, + SM_LOAD_SCENARIO = 9, + SM_START_SCENARIO = 10, +}; + +typedef enum TransportTypes { + /* These constants are for now linked to the representation of bridges + * and tunnels, so they can be used by GetTileTrackStatus_TunnelBridge + * to compare against the map5 array. In an ideal world, these + * constants would be used everywhere when accessing tunnels and + * bridges. For now, you should just not change the values for road + * and rail. + */ + TRANSPORT_RAIL = 0, + TRANSPORT_ROAD = 1, + TRANSPORT_WATER, // = 2 + TRANSPORT_MAX // = 3 +} TransportType; + +typedef struct TileInfo { + uint x; + uint y; + uint tileh; + uint type; + uint map5; + uint tile; + uint z; +} TileInfo; + +enum { + NG_EDGE = 1, +}; + +/* Display Options */ +enum { + DO_SHOW_TOWN_NAMES = 1, + DO_SHOW_STATION_NAMES = 2, + DO_SHOW_SIGNS = 4, + DO_FULL_ANIMATION = 8, + DO_TRANS_BUILDINGS = 0x10, + DO_FULL_DETAIL = 0x20, + DO_WAYPOINTS = 0x40, +}; + +/* Landscape types */ +enum { + LT_NORMAL = 0, + LT_HILLY = 1, + LT_DESERT = 2, + LT_CANDY = 3, + + NUM_LANDSCAPE = 4, +}; + +enum { + NUM_PRICES = 49, +}; + +typedef struct Prices { + int32 station_value; + int32 build_rail; + int32 build_road; + int32 build_signals; + int32 build_bridge; + int32 build_train_depot; + int32 build_road_depot; + int32 build_ship_depot; + int32 build_tunnel; + int32 train_station_track; + int32 train_station_length; + int32 build_airport; + int32 build_bus_station; + int32 build_truck_station; + int32 build_dock; + int32 build_railvehicle; + int32 build_railwagon; + int32 aircraft_base; + int32 roadveh_base; + int32 ship_base; + int32 build_trees; + int32 terraform; + int32 clear_1; + int32 purchase_land; + int32 clear_2; + int32 clear_3; + int32 remove_trees; + int32 remove_rail; + int32 remove_signals; + int32 clear_bridge; + int32 remove_train_depot; + int32 remove_road_depot; + int32 remove_ship_depot; + int32 clear_tunnel; + int32 clear_water; + int32 remove_rail_station; + int32 remove_airport; + int32 remove_bus_station; + int32 remove_truck_station; + int32 remove_dock; + int32 remove_house; + int32 remove_road; + int32 running_rail[3]; + int32 aircraft_running; + int32 roadveh_running; + int32 ship_running; + int32 build_industry; +} Prices; + +#define GAME_DIFFICULTY_NUM 18 + +typedef struct GameDifficulty { + int max_no_competitors; + int competitor_start_time; + int number_towns; + int number_industries; + int max_loan; + int initial_interest; + int vehicle_costs; + int competitor_speed; + int competitor_intelligence; + int vehicle_breakdowns; + int subsidy_multiplier; + int construction_cost; + int terrain_type; + int quantity_sea_lakes; + int economy; + int line_reverse_mode; + int disasters; + int town_council_tolerance; // minimum required town ratings to be allowed to demolish stuff +} GameDifficulty; + +enum { + // Temperate + CT_PASSENGERS = 0, + CT_COAL = 1, + CT_MAIL = 2, + CT_OIL = 3, + CT_LIVESTOCK = 4, + CT_GOODS = 5, + CT_GRAIN = 6, + CT_WOOD = 7, + CT_IRON_ORE = 8, + CT_STEEL = 9, + CT_VALUABLES = 10, + CT_FOOD = 11, + + // Arctic + CT_WHEAT = 6, + CT_HILLY_UNUSED = 8, + CT_PAPER = 9, + CT_GOLD = 10, + + // Tropic + CT_RUBBER = 1, + CT_FRUIT = 4, + CT_MAIZE = 6, + CT_COPPER_ORE = 8, + CT_WATER = 9, + CT_DIAMONDS = 10, + + // Toyland + CT_SUGAR = 1, + CT_TOYS = 3, + CT_BATTERIES = 4, + CT_CANDY = 5, + CT_TOFFEE = 6, + CT_COLA = 7, + CT_COTTON_CANDY = 8, + CT_BUBBLES = 9, + CT_PLASTIC = 10, + CT_FIZZY_DRINKS = 11, + + NUM_CARGO = 12, + + CT_INVALID = 0xFF +}; + +typedef uint AcceptedCargo[NUM_CARGO]; + +typedef struct TileDesc { + StringID str; + byte owner; + uint16 build_date; + uint32 dparam[2]; +} TileDesc; + +typedef struct { + int32 left; + int32 top; + byte width_1, width_2; +} ViewportSign; + +typedef int32 CommandProc(int x, int y, uint32 flags, uint32 p1, uint32 p2); + +typedef void DrawTileProc(TileInfo *ti); +typedef uint GetSlopeZProc(TileInfo *ti); +typedef int32 ClearTileProc(uint tile, byte flags); +typedef void GetAcceptedCargoProc(uint tile, AcceptedCargo res); +typedef void GetTileDescProc(uint tile, TileDesc *td); +/* GetTileTrackStatusProcs return a value that contains the possible tracks + * that can be taken on a given tile by a given transport. The return value is + * composed as follows: 0xaabbccdd. ccdd and aabb are bitmasks of trackdirs, + * where bit n corresponds to trackdir n. ccdd are the trackdirs that are + * present in the tile (1==present, 0==not present), aabb is the signal + * status, if applicable (0==green/no signal, 1==red, note that this is + * reversed from map3/2[tile] for railway signals). + * + * The result (let's call it ts) is often used as follows: + * tracks = (byte)(ts | ts >>8) + * This effectively converts the present part of the result (ccdd) to a + * track bitmask, which disregards directions. Normally, this is the same as just + * doing (byte)ts I think, although I am not really sure + * + * A trackdir is combination of a track and a dir, where the lower three bits + * are a track, the fourth bit is the direction. these give 12 (or 14) + * possible options: 0-5 and 8-13, so we need 14 bits for a trackdir bitmask + * above. + */ +typedef uint32 GetTileTrackStatusProc(uint tile, TransportType mode); +typedef void GetProducedCargoProc(uint tile, byte *b); +typedef void ClickTileProc(uint tile); +typedef void AnimateTileProc(uint tile); +typedef void TileLoopProc(uint tile); +typedef void ChangeTileOwnerProc(uint tile, byte old_player, byte new_player); +/* Return value has bit 0x2 set, when the vehicle enters a station. Then, + * result << 8 contains the id of the station entered. If the return value has + * bit 0x8 set, the vehicle could not and did not enter the tile. Are there + * other bits that can be set? */ +typedef uint32 VehicleEnterTileProc(Vehicle *v, uint tile, int x, int y); +typedef void VehicleLeaveTileProc(Vehicle *v, uint tile, int x, int y); +typedef uint GetSlopeTilehProc(TileInfo *ti); + +typedef struct { + DrawTileProc *draw_tile_proc; + GetSlopeZProc *get_slope_z_proc; + ClearTileProc *clear_tile_proc; + GetAcceptedCargoProc *get_accepted_cargo_proc; + GetTileDescProc *get_tile_desc_proc; + GetTileTrackStatusProc *get_tile_track_status_proc; + ClickTileProc *click_tile_proc; + AnimateTileProc *animate_tile_proc; + TileLoopProc *tile_loop_proc; + ChangeTileOwnerProc *change_tile_owner_proc; + GetProducedCargoProc *get_produced_cargo_proc; + VehicleEnterTileProc *vehicle_enter_tile_proc; + VehicleLeaveTileProc *vehicle_leave_tile_proc; + GetSlopeTilehProc *get_slope_tileh_proc; +} TileTypeProcs; + + + +#define MP_SETTYPE(x) ((x+1) << 8) + +enum { + MP_MAP2 = 1<<0, + MP_MAP3LO = 1<<1, + MP_MAP3HI = 1<<2, + MP_MAP5 = 1<<3, + MP_MAPOWNER_CURRENT = 1<<4, + MP_MAPOWNER = 1<<5, + + MP_TYPE_MASK = 0xF << 8, + + MP_MAP2_CLEAR = 1 << 12, + MP_MAP3LO_CLEAR = 1 << 13, + MP_MAP3HI_CLEAR = 1 << 14, + + MP_NODIRTY = 1<<15, +}; + +enum { + WC_MAIN_WINDOW = 0x0, + WC_MAIN_TOOLBAR = 0x1, + WC_STATUS_BAR = 0x2, + WC_BUILD_TOOLBAR = 0x3, + WC_NEWS_WINDOW = 0x4, + WC_TOWN_DIRECTORY = 0x5, + WC_STATION_LIST = 0x6, + WC_TOWN_VIEW = 0x7, + WC_SMALLMAP = 0x8, + WC_TRAINS_LIST = 0x9, + WC_ROADVEH_LIST = 0xA, + WC_SHIPS_LIST = 0xB, + WC_AIRCRAFT_LIST = 0xC, + WC_VEHICLE_VIEW = 0xD, + WC_VEHICLE_DETAILS = 0xE, + WC_VEHICLE_REFIT = 0xF, + WC_VEHICLE_ORDERS = 0x10, + WC_STATION_VIEW = 0x11, + WC_VEHICLE_DEPOT = 0x12, + WC_BUILD_VEHICLE = 0x13, + WC_BUILD_BRIDGE = 0x14, + WC_ERRMSG = 0x15, + WC_ASK_ABANDON_GAME = 0x16, + WC_QUIT_GAME = 0x17, + WC_BUILD_STATION = 0x18, + WC_BUS_STATION = 0x19, + WC_TRUCK_STATION = 0x1A, + WC_BUILD_DEPOT = 0x1B, + WC_DEBUGGER = 0x1C, + WC_COMPANY = 0x1D, + WC_FINANCES = 0x1E, + WC_PLAYER_COLOR = 0x1F, + WC_QUERY_STRING = 0x20, + WC_SAVELOAD = 0x21, + WC_SELECT_GAME = 0x22, + WC_TOOLBAR_MENU = 0x24, + WC_INCOME_GRAPH = 0x25, + WC_OPERATING_PROFIT = 0x26, + WC_TOOLTIPS = 0x27, + WC_INDUSTRY_VIEW = 0x28, + WC_PLAYER_FACE = 0x29, + WC_LAND_INFO = 0x2A, + WC_TOWN_AUTHORITY = 0x2B, + WC_SUBSIDIES_LIST = 0x2C, + WC_GRAPH_LEGEND = 0x2D, + WC_DELIVERED_CARGO = 0x2E, + WC_PERFORMANCE_HISTORY = 0x2F, + WC_COMPANY_VALUE = 0x30, + WC_COMPANY_LEAGUE = 0x31, + WC_BUY_COMPANY = 0x32, + WC_PAYMENT_RATES = 0x33, + WC_SELECT_TUTORIAL = 0x34, + WC_ENGINE_PREVIEW = 0x35, + WC_MUSIC_WINDOW = 0x36, + WC_MUSIC_TRACK_SELECTION = 0x37, + WC_SCEN_LAND_GEN = 0x38, // also used for landscaping toolbar + WC_ASK_RESET_LANDSCAPE = 0x39, + WC_SCEN_TOWN_GEN = 0x3A, + WC_SCEN_INDUSTRY = 0x3B, + WC_SCEN_BUILD_ROAD = 0x3C, + WC_BUILD_TREES = 0x3D, + WC_SEND_NETWORK_MSG = 0x3E, + WC_DROPDOWN_MENU = 0x3F, + WC_BUILD_INDUSTRY = 0x40, + WC_GAME_OPTIONS = 0x41, + WC_NETWORK_WINDOW = 0x42, + WC_INDUSTRY_DIRECTORY = 0x43, + WC_MESSAGE_HISTORY = 0x44, + WC_CHEATS = 0x45, + WC_PERFORMANCE_DETAIL = 0x46, + WC_CONSOLE = 0x47, + WC_EXTRA_VIEW_PORT = 0x48, + WC_CLIENT_LIST = 0x49, + WC_NETWORK_STATUS_WINDOW = 0x4A, + WC_CUSTOM_CURRENCY = 0x4B, + WC_REPLACE_VEHICLE = 0x4C, + WC_HIGHSCORE = 0x4D, + WC_ENDSCREEN = 0x4E, + WC_SIGN_LIST = 0x4F, +}; + + +enum { + EXPENSES_CONSTRUCTION = 0, + EXPENSES_NEW_VEHICLES = 1, + EXPENSES_TRAIN_RUN = 2, + EXPENSES_ROADVEH_RUN = 3, + EXPENSES_AIRCRAFT_RUN = 4, + EXPENSES_SHIP_RUN = 5, + EXPENSES_PROPERTY = 6, + EXPENSES_TRAIN_INC = 7, + EXPENSES_ROADVEH_INC = 8, + EXPENSES_AIRCRAFT_INC = 9, + EXPENSES_SHIP_INC = 10, + EXPENSES_LOAN_INT = 11, + EXPENSES_OTHER = 12, +}; + +// Tile type misc constants, don't know where to put these +enum { + TRACKTYPE_SPRITE_PITCH = 0x52, +}; + + +// special string constants +enum SpecialStrings { + + // special strings for town names. the town name is generated dynamically on request. + SPECSTR_TOWNNAME_START = 0x20C0, + SPECSTR_TOWNNAME_ENGLISH = SPECSTR_TOWNNAME_START, + SPECSTR_TOWNNAME_FRENCH, + SPECSTR_TOWNNAME_GERMAN, + SPECSTR_TOWNNAME_AMERICAN, + SPECSTR_TOWNNAME_LATIN, + SPECSTR_TOWNNAME_SILLY, + SPECSTR_TOWNNAME_SWEDISH, + SPECSTR_TOWNNAME_DUTCH, + SPECSTR_TOWNNAME_FINNISH, + SPECSTR_TOWNNAME_POLISH, + SPECSTR_TOWNNAME_SLOVAKISH, + SPECSTR_TOWNNAME_NORWEGIAN, + SPECSTR_TOWNNAME_HUNGARIAN, + SPECSTR_TOWNNAME_AUSTRIAN, + SPECSTR_TOWNNAME_ROMANIAN, + SPECSTR_TOWNNAME_CZECH, + SPECSTR_TOWNNAME_SWISS, + SPECSTR_TOWNNAME_LAST = SPECSTR_TOWNNAME_SWISS, + + // special strings for player names on the form "TownName transport". + SPECSTR_PLAYERNAME_START = 0x70EA, + SPECSTR_PLAYERNAME_ENGLISH = SPECSTR_PLAYERNAME_START, + SPECSTR_PLAYERNAME_FRENCH, + SPECSTR_PLAYERNAME_GERMAN, + SPECSTR_PLAYERNAME_AMERICAN, + SPECSTR_PLAYERNAME_LATIN, + SPECSTR_PLAYERNAME_SILLY, + SPECSTR_PLAYERNAME_LAST = SPECSTR_PLAYERNAME_SILLY, + + SPECSTR_ANDCO_NAME = 0x70E6, + SPECSTR_PRESIDENT_NAME = 0x70E7, + SPECSTR_SONGNAME = 0x70E8, + + // reserve 32 strings for the *.lng files + SPECSTR_LANGUAGE_START = 0x7100, + SPECSTR_LANGUAGE_END = 0x711f, + + // reserve 32 strings for various screen resolutions + SPECSTR_RESOLUTION_START = 0x7120, + SPECSTR_RESOLUTION_END = 0x713f, + + // reserve 32 strings for screenshot formats + SPECSTR_SCREENSHOT_START = 0x7140, + SPECSTR_SCREENSHOT_END = 0x715F, + + STR_SPEC_SCREENSHOT_NAME = 0xF800, + STR_SPEC_USERSTRING = 0xF801, +}; + +typedef void PlaceProc(uint tile); + +VARDEF byte _savegame_sort_order; + +#define INVALID_UINT_TILE (uint)0xFFFFFFFF +#define INVALID_STRING_ID 0xFFFF + +enum { + MAX_SCREEN_WIDTH = 2048, + MAX_SCREEN_HEIGHT = 1200, +}; + +/* In certain windows you navigate with the arrow keys. Do not scroll the + * gameview when here. Bitencoded variable that only allows scrolling if all + * elements are zero */ +enum { + SCROLL_CON = 0, + SCROLL_EDIT = 1, + SCROLL_SAVE = 2, + SCROLL_CHAT = 4, +}; +VARDEF byte _no_scroll; + +#include "functions.h" +#include "variables.h" + +#endif /* TTD_H */
new file mode 100644 --- /dev/null +++ b/openttd.rc @@ -0,0 +1,158 @@ +//Microsoft Developer Studio generated resource script. +// +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "resource.h" +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +#undef APSTUDIO_HIDDEN_SYMBOLS +#include "afxres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// Neutral (Default) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEUD) +#ifdef _WIN32 +LANGUAGE LANG_NEUTRAL, SUBLANG_DEFAULT +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +100 ICON DISCARDABLE "openttd.ico" +101 ICON DISCARDABLE "mainicon.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +100 DIALOG DISCARDABLE 0, 0, 305, 70 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Fatal Application Failure" +FONT 8, "MS Sans Serif" +BEGIN + PUSHBUTTON "&Close",12,7,49,50,14 + PUSHBUTTON "&Submit report",14,81,49,68,14,WS_DISABLED + PUSHBUTTON "&Emergency save",13,155,49,68,14 + PUSHBUTTON "",15,243,49,55,14,WS_DISABLED + EDITTEXT 11,7,70,291,118,ES_MULTILINE | ES_READONLY | WS_VSCROLL | + WS_HSCROLL | NOT WS_TABSTOP + LTEXT "",10,36,7,262,34 + ICON 100,IDC_STATIC,9,9,20,20 +END + + +#ifndef _MAC +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 0,0,0,0 + PRODUCTVERSION 0,0,0,0 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "000004b0" + BEGIN + VALUE "Comments", "This program is licensed under the GNU General Public License.\0" + VALUE "CompanyName", "OpenTTD Development Team\0" + VALUE "FileDescription", "OpenTTD\0" + VALUE "FileVersion", "0.0.0.0\0" + VALUE "InternalName", "openttd\0" + VALUE "LegalCopyright", "Copyright © OpenTTD Developers 2002-2005. All Rights Reserved.\0" + VALUE "LegalTrademarks", "\0" + VALUE "OriginalFilename", "openttd.exe\0" + VALUE "PrivateBuild", "\0" + VALUE "ProductName", "OpenTTD\0" + VALUE "ProductVersion", "0.0.0.0\0" + VALUE "SpecialBuild", "-\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x0, 1200 + END +END + +#endif // !_MAC + +#endif // Neutral (Default) resources +///////////////////////////////////////////////////////////////////////////// + + +///////////////////////////////////////////////////////////////////////////// +// Swedish resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_SVE) +#ifdef _WIN32 +LANGUAGE LANG_SWEDISH, SUBLANG_DEFAULT +#pragma code_page(1252) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resrc1.h\0" +END + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""resource.h""\r\n" + "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""windows.h""\r\n" + "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""winres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + +#endif // Swedish resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED +
new file mode 100644 --- /dev/null +++ b/openttd.sln @@ -0,0 +1,43 @@ +Microsoft Visual Studio Solution File, Format Version 8.00 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "strgen", "strgen\strgen.vcproj", "{A133A442-BD0A-4ADE-B117-AD7545E4BDD1}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "openttd", "openttd.vcproj", "{668328A0-B40E-4CDB-BD72-D0064424414A}" + ProjectSection(ProjectDependencies) = postProject + {0F066B23-18DF-4284-8265-F4A5E7E3B966} = {0F066B23-18DF-4284-8265-F4A5E7E3B966} + {A133A442-BD0A-4ADE-B117-AD7545E4BDD1} = {A133A442-BD0A-4ADE-B117-AD7545E4BDD1} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "langs", "langs.vcproj", "{0F066B23-18DF-4284-8265-F4A5E7E3B966}" + ProjectSection(ProjectDependencies) = postProject + {A133A442-BD0A-4ADE-B117-AD7545E4BDD1} = {A133A442-BD0A-4ADE-B117-AD7545E4BDD1} + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + Debug = Debug + Release = Release + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {A133A442-BD0A-4ADE-B117-AD7545E4BDD1}.Debug.ActiveCfg = Debug|Win32 + {A133A442-BD0A-4ADE-B117-AD7545E4BDD1}.Debug.Build.0 = Debug|Win32 + {A133A442-BD0A-4ADE-B117-AD7545E4BDD1}.Release.ActiveCfg = Debug|Win32 + {A133A442-BD0A-4ADE-B117-AD7545E4BDD1}.Release.Build.0 = Debug|Win32 + {668328A0-B40E-4CDB-BD72-D0064424414A}.Debug.ActiveCfg = Debug|Win32 + {668328A0-B40E-4CDB-BD72-D0064424414A}.Debug.Build.0 = Debug|Win32 + {668328A0-B40E-4CDB-BD72-D0064424414A}.Release.ActiveCfg = Release|Win32 + {668328A0-B40E-4CDB-BD72-D0064424414A}.Release.Build.0 = Release|Win32 + {0F066B23-18DF-4284-8265-F4A5E7E3B966}.Debug.ActiveCfg = Debug|Win32 + {0F066B23-18DF-4284-8265-F4A5E7E3B966}.Debug.Build.0 = Debug|Win32 + {0F066B23-18DF-4284-8265-F4A5E7E3B966}.Release.ActiveCfg = Debug|Win32 + {0F066B23-18DF-4284-8265-F4A5E7E3B966}.Release.Build.0 = Debug|Win32 + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection + GlobalSection(DPCodeReviewSolutionGUID) = preSolution + DPCodeReviewSolutionGUID = {00000000-0000-0000-0000-000000000000} + EndGlobalSection +EndGlobal
new file mode 100644 --- /dev/null +++ b/openttd.vcproj @@ -0,0 +1,752 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="7.10" + Name="openttd" + SccProjectName="" + SccLocalPath=""> + <Platforms> + <Platform + Name="Win32"/> + </Platforms> + <Configurations> + <Configuration + Name="Release|Win32" + OutputDirectory=".\Release" + IntermediateDirectory=".\Release" + ConfigurationType="1" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="FALSE" + CharacterSet="2" + WholeProgramOptimization="TRUE"> + <Tool + Name="VCCLCompilerTool" + Optimization="3" + GlobalOptimizations="TRUE" + InlineFunctionExpansion="1" + EnableIntrinsicFunctions="TRUE" + FavorSizeOrSpeed="2" + OmitFramePointers="TRUE" + OptimizeForProcessor="1" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WIN32_EXCEPTION_TRACKER;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_ZLIB;WITH_PNG;ENABLE_NETWORK" + StringPooling="TRUE" + ExceptionHandling="FALSE" + RuntimeLibrary="4" + StructMemberAlignment="3" + BufferSecurityCheck="FALSE" + EnableFunctionLevelLinking="TRUE" + DefaultCharIsUnsigned="TRUE" + UsePrecompiledHeader="1" + PrecompiledHeaderThrough="stdafx.h" + PrecompiledHeaderFile=".\Release/openttd.pch" + AssemblerOutput="2" + AssemblerListingLocation=".\Release/" + ObjectFile=".\Release/" + ProgramDataBaseFileName=".\Release/" + BrowseInformation="1" + WarningLevel="3" + WarnAsError="TRUE" + SuppressStartupBanner="TRUE" + DebugInformationFormat="3" + CompileAs="1"/> + <Tool + Name="VCCustomBuildTool"/> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="winmm.lib ws2_32.lib libpng.lib zlibstat.lib" + OutputFile=".\Release/openttd.exe" + LinkIncremental="1" + SuppressStartupBanner="TRUE" + ProgramDatabaseFile=".\Release/openttd.pdb" + GenerateMapFile="TRUE" + MapFileName=".\Release/openttd.map" + SubSystem="2" + OptimizeReferences="2" + OptimizeForWindows98="1" + TargetMachine="1"/> + <Tool + Name="VCMIDLTool" + TypeLibraryName=".\Release/openttd.tlb" + HeaderFileName=""/> + <Tool + Name="VCPostBuildEventTool"/> + <Tool + Name="VCPreBuildEventTool"/> + <Tool + Name="VCPreLinkEventTool"/> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="NDEBUG" + Culture="1053"/> + <Tool + Name="VCWebServiceProxyGeneratorTool"/> + <Tool + Name="VCXMLDataGeneratorTool"/> + <Tool + Name="VCWebDeploymentTool"/> + <Tool + Name="VCManagedWrapperGeneratorTool"/> + <Tool + Name="VCAuxiliaryManagedWrapperGeneratorTool"/> + </Configuration> + <Configuration + Name="Debug|Win32" + OutputDirectory=".\Debug" + IntermediateDirectory=".\Debug" + ConfigurationType="1" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="FALSE" + CharacterSet="2"> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;WITH_ZLIB;WITH_PNG;ENABLE_NETWORK" + BasicRuntimeChecks="3" + RuntimeLibrary="5" + UsePrecompiledHeader="2" + PrecompiledHeaderThrough="stdafx.h" + PrecompiledHeaderFile=".\Debug/openttd.pch" + AssemblerListingLocation=".\Debug/" + ObjectFile=".\Debug/" + ProgramDataBaseFileName=".\Debug/" + WarningLevel="3" + WarnAsError="TRUE" + SuppressStartupBanner="TRUE" + Detect64BitPortabilityProblems="FALSE" + DebugInformationFormat="4" + CallingConvention="0" + CompileAs="1"/> + <Tool + Name="VCCustomBuildTool"/> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="winmm.lib ws2_32.lib libpng.lib zlibstat.lib" + OutputFile=".\Debug/openttd.exe" + LinkIncremental="0" + SuppressStartupBanner="TRUE" + GenerateDebugInformation="TRUE" + ProgramDatabaseFile=".\Debug/openttd.pdb" + SubSystem="2" + TargetMachine="1"/> + <Tool + Name="VCMIDLTool" + TypeLibraryName=".\Debug/openttd.tlb" + HeaderFileName=""/> + <Tool + Name="VCPostBuildEventTool"/> + <Tool + Name="VCPreBuildEventTool"/> + <Tool + Name="VCPreLinkEventTool"/> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="_DEBUG" + Culture="1053"/> + <Tool + Name="VCWebServiceProxyGeneratorTool"/> + <Tool + Name="VCXMLDataGeneratorTool"/> + <Tool + Name="VCWebDeploymentTool"/> + <Tool + Name="VCManagedWrapperGeneratorTool"/> + <Tool + Name="VCAuxiliaryManagedWrapperGeneratorTool"/> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="Source Files" + Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"> + <File + RelativePath="ai.c"> + </File> + <File + RelativePath=".\airport.c"> + </File> + <File + RelativePath=".\aystar.c"> + </File> + <File + RelativePath=".\callback_table.c"> + </File> + <File + RelativePath="command.c"> + </File> + <File + RelativePath=".\console.c"> + </File> + <File + RelativePath=".\console_cmds.c"> + </File> + <File + RelativePath=".\debug.c"> + </File> + <File + RelativePath=".\dedicated.c"> + </File> + <File + RelativePath=".\depot.c"> + </File> + <File + RelativePath="economy.c"> + </File> + <File + RelativePath="engine.c"> + </File> + <File + RelativePath="fileio.c"> + </File> + <File + RelativePath="gfx.c"> + </File> + <File + RelativePath="landscape.c"> + </File> + <File + RelativePath=".\map.c"> + </File> + <File + RelativePath=".\md5.c"> + </File> + <File + RelativePath="minilzo.c"> + <FileConfiguration + Name="Release|Win32"> + <Tool + Name="VCCLCompilerTool" + UsePrecompiledHeader="0"/> + </FileConfiguration> + </File> + <File + RelativePath="misc.c"> + </File> + <File + RelativePath=".\mixer.c"> + </File> + <File + RelativePath="namegen.c"> + </File> + <File + RelativePath="network.c"> + </File> + <File + RelativePath=".\network_client.c"> + </File> + <File + RelativePath=".\network_data.c"> + </File> + <File + RelativePath=".\network_gamelist.c"> + </File> + <File + RelativePath=".\network_server.c"> + </File> + <File + RelativePath=".\network_udp.c"> + </File> + <File + RelativePath=".\newgrf.c"> + </File> + <File + RelativePath=".\npf.c"> + </File> + <File + RelativePath="oldloader.c"> + </File> + <File + RelativePath="pathfind.c"> + </File> + <File + RelativePath="players.c"> + </File> + <File + RelativePath=".\pool.c"> + </File> + <File + RelativePath=".\queue.c"> + </File> + <File + RelativePath="saveload.c"> + </File> + <File + RelativePath=".\screenshot.c"> + </File> + <File + RelativePath="sdl.c"> + </File> + <File + RelativePath=".\settings.c"> + </File> + <File + RelativePath=".\signs.c"> + </File> + <File + RelativePath="sound.c"> + </File> + <File + RelativePath=".\sprite.c"> + </File> + <File + RelativePath="spritecache.c"> + </File> + <File + RelativePath="StdAfx.c"> + </File> + <File + RelativePath=".\string.c"> + </File> + <File + RelativePath="strings.c"> + </File> + <File + RelativePath="texteff.c"> + </File> + <File + RelativePath=".\tile.c"> + </File> + <File + RelativePath="openttd.c"> + </File> + <File + RelativePath="openttd.rc"> + </File> + <File + RelativePath="vehicle.c"> + </File> + <File + RelativePath="viewport.c"> + </File> + <File + RelativePath=".\w32dm.c"> + </File> + <File + RelativePath=".\w32dm2.cpp"> + <FileConfiguration + Name="Release|Win32"> + <Tool + Name="VCCLCompilerTool" + UsePrecompiledHeader="0" + CompileAs="2"/> + </FileConfiguration> + </File> + <File + RelativePath=".\waypoint.c"> + </File> + <File + RelativePath="widget.c"> + </File> + <File + RelativePath="win32.c"> + </File> + <File + RelativePath="window.c"> + </File> + </Filter> + <Filter + Name="Header Files" + Filter="h;hpp;hxx;hm;inl"> + <File + RelativePath=".\airport.h"> + </File> + <File + RelativePath=".\airport_movement.h"> + </File> + <File + RelativePath=".\aystar.h"> + </File> + <File + RelativePath="command.h"> + </File> + <File + RelativePath="console.h"> + </File> + <File + RelativePath="debug.h"> + </File> + <File + RelativePath="depot.h"> + </File> + <File + RelativePath="economy.h"> + </File> + <File + RelativePath="engine.h"> + </File> + <File + RelativePath="fileio.h"> + </File> + <File + RelativePath="functions.h"> + </File> + <File + RelativePath="gfx.h"> + </File> + <File + RelativePath="gui.h"> + </File> + <File + RelativePath="hal.h"> + </File> + <File + RelativePath="industry.h"> + </File> + <File + RelativePath="macros.h"> + </File> + <File + RelativePath=".\map.h"> + </File> + <File + RelativePath="md5.h"> + </File> + <File + RelativePath=".\mixer.h"> + </File> + <File + RelativePath=".\network.h"> + </File> + <File + RelativePath=".\network_client.h"> + </File> + <File + RelativePath=".\network_core.h"> + </File> + <File + RelativePath=".\network_data.h"> + </File> + <File + RelativePath=".\network_gamelist.h"> + </File> + <File + RelativePath=".\network_server.h"> + </File> + <File + RelativePath=".\network_udp.h"> + </File> + <File + RelativePath=".\newgrf.h"> + </File> + <File + RelativePath="news.h"> + </File> + <File + RelativePath=".\npf.h"> + </File> + <File + RelativePath="pathfind.h"> + </File> + <File + RelativePath="player.h"> + </File> + <File + RelativePath=".\pool.h"> + </File> + <File + RelativePath=".\queue.h"> + </File> + <File + RelativePath="saveload.h"> + </File> + <File + RelativePath=".\screenshot.h"> + </File> + <File + RelativePath=".\signs.h"> + </File> + <File + RelativePath="sound.h"> + </File> + <File + RelativePath=".\sprite.h"> + </File> + <File + RelativePath="station.h"> + </File> + <File + RelativePath="StdAfx.h"> + </File> + <File + RelativePath=".\tile.h"> + </File> + <File + RelativePath=".\town.h"> + </File> + <File + RelativePath="openttd.h"> + </File> + <File + RelativePath="variables.h"> + </File> + <File + RelativePath="vehicle.h"> + </File> + <File + RelativePath=".\vehicle_gui.h"> + </File> + <File + RelativePath="viewport.h"> + </File> + <File + RelativePath="waypoint.h"> + </File> + <File + RelativePath="window.h"> + </File> + </Filter> + <Filter + Name="Gui Source codes" + Filter=""> + <File + RelativePath="aircraft_gui.c"> + </File> + <File + RelativePath="airport_gui.c"> + </File> + <File + RelativePath="bridge_gui.c"> + </File> + <File + RelativePath="dock_gui.c"> + </File> + <File + RelativePath="engine_gui.c"> + </File> + <File + RelativePath="graph_gui.c"> + </File> + <File + RelativePath="industry_gui.c"> + </File> + <File + RelativePath="intro_gui.c"> + </File> + <File + RelativePath="main_gui.c"> + </File> + <File + RelativePath="misc_gui.c"> + </File> + <File + RelativePath="music_gui.c"> + </File> + <File + RelativePath=".\network_gui.c"> + </File> + <File + RelativePath="news_gui.c"> + </File> + <File + RelativePath="order_gui.c"> + </File> + <File + RelativePath="player_gui.c"> + </File> + <File + RelativePath="rail_gui.c"> + </File> + <File + RelativePath="road_gui.c"> + </File> + <File + RelativePath="roadveh_gui.c"> + </File> + <File + RelativePath="settings_gui.c"> + </File> + <File + RelativePath="ship_gui.c"> + </File> + <File + RelativePath="smallmap_gui.c"> + </File> + <File + RelativePath="station_gui.c"> + </File> + <File + RelativePath="subsidy_gui.c"> + </File> + <File + RelativePath=".\terraform_gui.c"> + </File> + <File + RelativePath="town_gui.c"> + </File> + <File + RelativePath="train_gui.c"> + </File> + <File + RelativePath=".\vehicle_gui.c"> + </File> + </Filter> + <Filter + Name="Landscape" + Filter=""> + <File + RelativePath="aircraft_cmd.c"> + </File> + <File + RelativePath="clear_cmd.c"> + </File> + <File + RelativePath="disaster_cmd.c"> + </File> + <File + RelativePath="dummy_land.c"> + </File> + <File + RelativePath="industry_cmd.c"> + </File> + <File + RelativePath="misc_cmd.c"> + </File> + <File + RelativePath="order_cmd.c"> + </File> + <File + RelativePath="rail_cmd.c"> + </File> + <File + RelativePath="road_cmd.c"> + </File> + <File + RelativePath="roadveh_cmd.c"> + </File> + <File + RelativePath="ship_cmd.c"> + </File> + <File + RelativePath="station_cmd.c"> + </File> + <File + RelativePath="town_cmd.c"> + </File> + <File + RelativePath="train_cmd.c"> + </File> + <File + RelativePath="tree_cmd.c"> + </File> + <File + RelativePath="tunnelbridge_cmd.c"> + </File> + <File + RelativePath="unmovable_cmd.c"> + </File> + <File + RelativePath="water_cmd.c"> + </File> + </Filter> + <Filter + Name="Tables" + Filter=""> + <File + RelativePath="table\ai_rail.h"> + </File> + <File + RelativePath="table\allstrings.h"> + </File> + <File + RelativePath=".\table\animcursors.h"> + </File> + <File + RelativePath=".\table\autorail.h"> + </File> + <File + RelativePath="table\build_industry.h"> + </File> + <File + RelativePath="table\clear_land.h"> + </File> + <File + RelativePath="table\engines.h"> + </File> + <File + RelativePath="table\genland.h"> + </File> + <File + RelativePath="table\industry_land.h"> + </File> + <File + RelativePath="table\landscape_const.h"> + </File> + <File + RelativePath="table\landscape_sprite.h"> + </File> + <File + RelativePath=".\table\namegen.h"> + </File> + <File + RelativePath="table\palettes.h"> + </File> + <File + RelativePath="table\road_land.h"> + </File> + <File + RelativePath="table\roadveh.h"> + </File> + <File + RelativePath=".\table\sprites.h"> + </File> + <File + RelativePath="table\station_land.h"> + </File> + <File + RelativePath="table\strings.h"> + </File> + <File + RelativePath=".\table\town_land.h"> + </File> + <File + RelativePath="table\track_land.h"> + </File> + <File + RelativePath="table\train_cmd.h"> + </File> + <File + RelativePath="table\tree_land.h"> + </File> + <File + RelativePath="table\tunnel_land.h"> + </File> + <File + RelativePath="table\unmovable_land.h"> + </File> + <File + RelativePath="table\water_land.h"> + </File> + </Filter> + <Filter + Name="AI Files" + Filter=""> + <File + RelativePath=".\ai.h"> + </File> + <File + RelativePath=".\ai_build.c"> + </File> + <File + RelativePath=".\ai_new.c"> + </File> + <File + RelativePath=".\ai_pathfinder.c"> + </File> + <File + RelativePath=".\ai_shared.c"> + </File> + </Filter> + <File + RelativePath="icon1.ico"> + </File> + <File + RelativePath="mainicon.ico"> + </File> + <File + RelativePath="ReadMe.txt"> + </File> + </Files> + <Globals> + </Globals> +</VisualStudioProject>
--- a/order_cmd.c +++ b/order_cmd.c @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "ttd.h" +#include "openttd.h" #include "airport.h" #include "depot.h" #include "table/strings.h"
--- a/order_gui.c +++ b/order_gui.c @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "ttd.h" +#include "openttd.h" #include "table/sprites.h" #include "table/strings.h" #include "map.h"
--- a/pathfind.c +++ b/pathfind.c @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "ttd.h" +#include "openttd.h" #include "map.h" #include "tile.h" #include "pathfind.h"
--- a/player_gui.c +++ b/player_gui.c @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "ttd.h" +#include "openttd.h" #include "table/sprites.h" #include "table/strings.h" #include "window.h"
--- a/players.c +++ b/players.c @@ -2,7 +2,7 @@ * sjdlfkasjdf */ #include "stdafx.h" -#include "ttd.h" +#include "openttd.h" #include "string.h" #include "strings.h" #include "table/strings.h"
--- a/pool.c +++ b/pool.c @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "ttd.h" +#include "openttd.h" #include "debug.h" #include "pool.h"
--- a/queue.c +++ b/queue.c @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "ttd.h" +#include "openttd.h" #include "queue.h" static void Stack_Clear(Queue* q, bool free_values)
--- a/rail_cmd.c +++ b/rail_cmd.c @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "ttd.h" +#include "openttd.h" #include "table/sprites.h" #include "table/strings.h" #include "gfx.h"
--- a/rail_gui.c +++ b/rail_gui.c @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "ttd.h" +#include "openttd.h" #include "table/sprites.h" #include "table/strings.h" #include "map.h"
--- a/road_cmd.c +++ b/road_cmd.c @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "ttd.h" +#include "openttd.h" #include "table/strings.h" #include "map.h" #include "tile.h"
--- a/road_gui.c +++ b/road_gui.c @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "ttd.h" +#include "openttd.h" #include "table/sprites.h" #include "table/strings.h" #include "map.h"
--- a/roadveh_cmd.c +++ b/roadveh_cmd.c @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "ttd.h" +#include "openttd.h" #include "debug.h" #include "table/strings.h" #include "map.h"
--- a/roadveh_gui.c +++ b/roadveh_gui.c @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "ttd.h" +#include "openttd.h" #include "debug.h" #include "table/strings.h" #include "map.h"
--- a/saveload.c +++ b/saveload.c @@ -14,7 +14,7 @@ * @see SaveLoad */ #include "stdafx.h" -#include "ttd.h" +#include "openttd.h" #include "debug.h" #include "vehicle.h" #include "station.h"
--- a/screenshot.c +++ b/screenshot.c @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "ttd.h" +#include "openttd.h" #include "debug.h" #include "strings.h" #include "table/strings.h"
--- a/sdl.c +++ b/sdl.c @@ -1,7 +1,7 @@ #include "stdafx.h" #if defined(WITH_SDL) -#include "ttd.h" +#include "openttd.h" #include "debug.h" #include "gfx.h" #include "mixer.h"
--- a/settings.c +++ b/settings.c @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "ttd.h" +#include "openttd.h" #include "sound.h" #include "string.h" #include "table/currency.h"
--- a/settings_gui.c +++ b/settings_gui.c @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "ttd.h" +#include "openttd.h" #include "string.h" #include "strings.h" // XXX GetCurrentCurrencyRate() #include "table/sprites.h"
--- a/ship_cmd.c +++ b/ship_cmd.c @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "ttd.h" +#include "openttd.h" #include "table/strings.h" #include "map.h" #include "tile.h"
--- a/ship_gui.c +++ b/ship_gui.c @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "ttd.h" +#include "openttd.h" #include "debug.h" #include "table/strings.h" #include "map.h"
--- a/signs.c +++ b/signs.c @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "ttd.h" +#include "openttd.h" #include "table/strings.h" #include "signs.h" #include "saveload.h"
--- a/smallmap_gui.c +++ b/smallmap_gui.c @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "ttd.h" +#include "openttd.h" #include "spritecache.h" #include "table/strings.h" #include "map.h"
--- a/sound.c +++ b/sound.c @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "ttd.h" +#include "openttd.h" #include "map.h" #include "mixer.h" #include "sound.h"
--- a/sprite.c +++ b/sprite.c @@ -2,7 +2,7 @@ #include <stdarg.h> -#include "ttd.h" +#include "openttd.h" #include "sprite.h"
--- a/spritecache.c +++ b/spritecache.c @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "ttd.h" +#include "openttd.h" #include "debug.h" #include "gfx.h" #include "spritecache.h"
--- a/station_cmd.c +++ b/station_cmd.c @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "ttd.h" +#include "openttd.h" #include "debug.h" #include "table/sprites.h" #include "table/strings.h"
--- a/station_gui.c +++ b/station_gui.c @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "ttd.h" +#include "openttd.h" #include "debug.h" #include "strings.h" #include "table/strings.h"
--- a/strings.c +++ b/strings.c @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "ttd.h" +#include "openttd.h" #include "string.h" #include "strings.h" #include "table/strings.h"
--- a/subsidy_gui.c +++ b/subsidy_gui.c @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "ttd.h" +#include "openttd.h" #include "table/strings.h" #include "window.h" #include "gui.h"
--- a/table/namegen.h +++ b/table/namegen.h @@ -1,5 +1,5 @@ #include "../stdafx.h" -#include "../ttd.h" +#include "../openttd.h" static const char *name_original_english_1[] = { "Great ",
--- a/terraform_gui.c +++ b/terraform_gui.c @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "ttd.h" +#include "openttd.h" #include "table/sprites.h" #include "table/strings.h" #include "tile.h"
--- a/texteff.c +++ b/texteff.c @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "ttd.h" +#include "openttd.h" #include "strings.h" #include "gfx.h" #include "viewport.h"
--- a/town_cmd.c +++ b/town_cmd.c @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "ttd.h" +#include "openttd.h" #include "strings.h" #include "table/strings.h" #include "map.h"
--- a/town_gui.c +++ b/town_gui.c @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "ttd.h" +#include "openttd.h" #include "debug.h" #include "strings.h" #include "table/sprites.h"
--- a/train_cmd.c +++ b/train_cmd.c @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "ttd.h" +#include "openttd.h" #include "table/strings.h" #include "map.h" #include "tile.h"
--- a/train_gui.c +++ b/train_gui.c @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "ttd.h" +#include "openttd.h" #include "debug.h" #include "table/strings.h" #include "map.h"
--- a/tree_cmd.c +++ b/tree_cmd.c @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "ttd.h" +#include "openttd.h" #include "table/strings.h" #include "table/tree_land.h" #include "map.h"
deleted file mode 100644 --- a/ttd.c +++ /dev/null @@ -1,1415 +0,0 @@ -#include "stdafx.h" -#include "string.h" -#include "table/strings.h" -#include "debug.h" -#include "strings.h" -#include "map.h" -#include "tile.h" - -#define VARDEF -#include "ttd.h" -#include "mixer.h" -#include "spritecache.h" -#include "gfx.h" -#include "gui.h" -#include "station.h" -#include "vehicle.h" -#include "viewport.h" -#include "window.h" -#include "player.h" -#include "command.h" -#include "town.h" -#include "industry.h" -#include "news.h" -#include "engine.h" -#include "sound.h" -#include "economy.h" -#include "fileio.h" -#include "hal.h" -#include "airport.h" -#include "ai.h" -#include "console.h" -#include "screenshot.h" -#include "network.h" -#include "signs.h" -#include "depot.h" -#include "waypoint.h" - -#include <stdarg.h> - -void GenerateWorld(int mode, uint log_x, uint log_y); -void CallLandscapeTick(void); -void IncreaseDate(void); -void RunOtherPlayersLoop(void); -void DoPaletteAnimations(void); -void MusicLoop(void); -void ResetMusic(void); -void InitializeStations(void); -void DeleteAllPlayerStations(void); - -extern void SetDifficultyLevel(int mode, GameOptions *gm_opt); -extern void DoStartupNewPlayer(bool is_ai); -extern void ShowOSErrorBox(const char *buf); - -bool LoadSavegame(const char *filename); - -extern void HalGameLoop(void); - -uint32 _pixels_redrawn; -bool _dbg_screen_rect; -bool disable_computer; // We should get ride of this thing.. is only used for a debug-cheat -static byte _os_version = 0; - -/* TODO: usrerror() for errors which are not of an internal nature but - * caused by the user, i.e. missing files or fatal configuration errors. - * Post-0.4.0 since Celestar doesn't want this in SVN before. --pasky */ - -void CDECL error(const char *s, ...) { - va_list va; - char buf[512]; - va_start(va, s); - vsprintf(buf, s, va); - va_end(va); - - ShowOSErrorBox(buf); - if (_video_driver) - _video_driver->stop(); - - assert(0); - exit(1); -} - -void CDECL ShowInfoF(const char *str, ...) -{ - va_list va; - char buf[1024]; - va_start(va, str); - vsprintf(buf, str, va); - va_end(va); - ShowInfo(buf); -} - -char * CDECL str_fmt(const char *str, ...) -{ - char buf[4096]; - va_list va; - int len; - char *p; - - va_start(va, str); - len = vsprintf(buf, str, va); - va_end(va); - p = malloc(len + 1); - if (p) - memcpy(p, buf, len + 1); - return p; -} - - -// NULL midi driver -static const char *NullMidiStart(const char * const *parm) { return NULL; } -static void NullMidiStop(void) {} -static void NullMidiPlaySong(const char *filename) {} -static void NullMidiStopSong(void) {} -static bool NullMidiIsSongPlaying(void) { return true; } -static void NullMidiSetVolume(byte vol) {} - -const HalMusicDriver _null_music_driver = { - NullMidiStart, - NullMidiStop, - NullMidiPlaySong, - NullMidiStopSong, - NullMidiIsSongPlaying, - NullMidiSetVolume, -}; - -// NULL video driver -static void *_null_video_mem; -static const char *NullVideoStart(const char * const *parm) -{ - _screen.width = _screen.pitch = _cur_resolution[0]; - _screen.height = _cur_resolution[1]; - _null_video_mem = malloc(_cur_resolution[0]*_cur_resolution[1]); - return NULL; -} -static void NullVideoStop(void) { free(_null_video_mem); } -static void NullVideoMakeDirty(int left, int top, int width, int height) {} -static int NullVideoMainLoop(void) -{ - int i = 1000; - do { - GameLoop(); - _screen.dst_ptr = _null_video_mem; - UpdateWindows(); - } while (--i); - return ML_QUIT; -} - -static bool NullVideoChangeRes(int w, int h) { return false; } -static void NullVideoFullScreen(bool fs) {} - -const HalVideoDriver _null_video_driver = { - NullVideoStart, - NullVideoStop, - NullVideoMakeDirty, - NullVideoMainLoop, - NullVideoChangeRes, - NullVideoFullScreen, -}; - -// NULL sound driver -static const char *NullSoundStart(const char * const *parm) { return NULL; } -static void NullSoundStop(void) {} -const HalSoundDriver _null_sound_driver = { - NullSoundStart, - NullSoundStop, -}; - -enum { - DF_PRIORITY_MASK = 0xf, -}; - -typedef struct { - const DriverDesc *descs; - const char *name; - void *var; -} DriverClass; - -static DriverClass _driver_classes[] = { - {_video_driver_descs, "video", &_video_driver}, - {_sound_driver_descs, "sound", &_sound_driver}, - {_music_driver_descs, "music", &_music_driver}, -}; - -static const DriverDesc *GetDriverByName(const DriverDesc *dd, const char *name) -{ - do { - if (!strcmp(dd->name, name)) - return dd; - } while ((++dd)->name); - return NULL; -} - -static const DriverDesc *ChooseDefaultDriver(const DriverDesc *dd) -{ - const DriverDesc *best = NULL; - int best_pri = -1; - do { - if ((int)(dd->flags&DF_PRIORITY_MASK) > best_pri && _os_version >= (byte)dd->flags) { - best_pri = dd->flags&DF_PRIORITY_MASK; - best = dd; - } - } while ((++dd)->name); - return best; -} - - -void *ReadFileToMem(const char *filename, size_t *lenp, size_t maxsize) -{ - FILE *in; - byte *mem; - size_t len; - - in = fopen(filename, "rb"); - if (in == NULL) - return NULL; - - fseek(in, 0, SEEK_END); - len = ftell(in); - fseek(in, 0, SEEK_SET); - if (len > maxsize || (mem = malloc(len + 1)) == NULL) { - fclose(in); - return NULL; - } - mem[len] = 0; - if (fread(mem, len, 1, in) != 1) { - fclose(in); - free(mem); - return NULL; - } - fclose(in); - - *lenp = len; - return mem; -} - -void LoadDriver(int driver, const char *name) -{ - const DriverClass *dc = &_driver_classes[driver]; - const DriverDesc *dd; - const void **var; - const void *drv; - const char *err; - char *parm; - char buffer[256]; - const char *parms[32]; - - parms[0] = NULL; - - if (!*name) { - dd = ChooseDefaultDriver(dc->descs); - } else { - // Extract the driver name and put parameter list in parm - ttd_strlcpy(buffer, name, sizeof(buffer)); - parm = strchr(buffer, ':'); - if (parm) { - uint np = 0; - // Tokenize the parm. - do { - *parm++ = 0; - if (np < lengthof(parms) - 1) - parms[np++] = parm; - while (*parm != 0 && *parm != ',') - parm++; - } while (*parm == ','); - parms[np] = NULL; - } - dd = GetDriverByName(dc->descs, buffer); - if (dd == NULL) - error("No such %s driver: %s\n", dc->name, buffer); - } - var = dc->var; - if (*var != NULL) ((const HalCommonDriver*)*var)->stop(); - *var = NULL; - drv = dd->drv; - if ((err=((const HalCommonDriver*)drv)->start(parms)) != NULL) - error("Unable to load driver %s(%s). The error was: %s\n", dd->name, dd->longname, err); - *var = drv; -} - -static void showhelp(void) -{ - char buf[4096], *p; - const DriverClass *dc = _driver_classes; - const DriverDesc *dd; - int i; - - p = strecpy(buf, - "Command line options:\n" - " -v drv = Set video driver (see below)\n" - " -s drv = Set sound driver (see below)\n" - " -m drv = Set music driver (see below)\n" - " -r res = Set resolution (for instance 800x600)\n" - " -h = Display this help text\n" - " -t date = Set starting date\n" - " -d [[fac=]lvl[,...]]= Debug mode\n" - " -l lng = Select Language\n" - " -e = Start Editor\n" - " -g [savegame] = Start new/save game immediately\n" - " -G seed = Set random seed\n" - " -n [ip#player:port] = Start networkgame\n" - " -D = Start dedicated server\n" - #if !defined(__MORPHOS__) && !defined(__AMIGA__) - " -f = Fork into the background (dedicated only)\n" - #endif - " -i = Force to use the DOS palette (use this if you see a lot of pink)\n" - " -p #player = Player as #player (deprecated) (network only)\n" - " -c config_file = Use 'config_file' instead of 'openttd.cfg'\n", - lastof(buf) - ); - - for(i=0; i!=lengthof(_driver_classes); i++,dc++) { - p += sprintf(p, "List of %s drivers:\n", dc->name); - dd = dc->descs; - do { - p += sprintf(p, "%10s: %s\n", dd->name, dd->longname); - } while ((++dd)->name); - } - - ShowInfo(buf); -} - - -const char *GetDriverParam(const char * const *parm, const char *name) -{ - const char *p; - int len = strlen(name); - while ((p = *parm++) != NULL) { - if (!strncmp(p,name,len)) { - if (p[len] == '=') return p + len + 1; - if (p[len] == 0) return p + len; - } - } - return NULL; -} - -bool GetDriverParamBool(const char * const *parm, const char *name) -{ - const char *p = GetDriverParam(parm, name); - return p != NULL; -} - -int GetDriverParamInt(const char * const *parm, const char *name, int def) -{ - const char *p = GetDriverParam(parm, name); - return p != NULL ? atoi(p) : def; -} - -typedef struct { - char *opt; - int numleft; - char **argv; - const char *options; - char *cont; -} MyGetOptData; - -static void MyGetOptInit(MyGetOptData *md, int argc, char **argv, const char *options) -{ - md->cont = NULL; - md->numleft = argc; - md->argv = argv; - md->options = options; -} - -static int MyGetOpt(MyGetOptData *md) -{ - char *s,*r,*t; - - if ((s=md->cont) != NULL) - goto md_continue_here; - - while(true) { - if (--md->numleft < 0) - return -1; - - s = *md->argv++; - if (*s == '-') { -md_continue_here:; - s++; - if (*s != 0) { - // Found argument, try to locate it in options. - if (*s == ':' || (r = strchr(md->options, *s)) == NULL) { - // ERROR! - return -2; - } - if (r[1] == ':') { - // Item wants an argument. Check if the argument follows, or if it comes as a separate arg. - if (!*(t = s + 1)) { - // It comes as a separate arg. Check if out of args? - if (--md->numleft < 0 || *(t = *md->argv) == '-') { - // Check if item is optional? - if (r[2] != ':') - return -2; - md->numleft++; - t = NULL; - } else { - md->argv++; - } - } - md->opt = t; - md->cont = NULL; - return *s; - } - md->opt = NULL; - md->cont = s; - return *s; - } - } else { - // This is currently not supported. - return -2; - } - } -} - - -static void ParseResolution(int res[2], char *s) -{ - char *t = strchr(s, 'x'); - if (t == NULL) { - ShowInfoF("Invalid resolution '%s'", s); - return; - } - - res[0] = clamp(strtoul(s, NULL, 0), 64, MAX_SCREEN_WIDTH); - res[1] = clamp(strtoul(t + 1, NULL, 0), 64, MAX_SCREEN_HEIGHT); -} - -static void InitializeDynamicVariables(void) -{ - /* Dynamic stuff needs to be initialized somewhere... */ - _station_sort = NULL; - _vehicle_sort = NULL; - _town_sort = NULL; - _industry_sort = NULL; -} - -static void UnInitializeDynamicVariables(void) -{ - /* Dynamic stuff needs to be free'd somewhere... */ - CleanPool(&_town_pool); - CleanPool(&_industry_pool); - CleanPool(&_station_pool); - CleanPool(&_vehicle_pool); - CleanPool(&_sign_pool); - CleanPool(&_order_pool); - - free(_station_sort); - free(_vehicle_sort); - free(_town_sort); - free(_industry_sort); -} - -static void UnInitializeGame(void) -{ - UnInitWindowSystem(); - UnInitNewgrEngines(); - - free(_config_file); -} - -static void LoadIntroGame(void) -{ - char filename[256]; - - _game_mode = GM_MENU; - CLRBITS(_display_opt, DO_TRANS_BUILDINGS); // don't make buildings transparent in intro - _opt_ptr = &_opt_newgame; - - GfxLoadSprites(); - LoadStringWidthTable(); - - // Setup main window - ResetWindowSystem(); - SetupColorsAndInitialWindow(); - - // Generate a world. - sprintf(filename, "%sopntitle.dat", _path.data_dir); - if (SaveOrLoad(filename, SL_LOAD) != SL_OK) { -#if defined SECOND_DATA_DIR - sprintf(filename, "%sopntitle.dat", _path.second_data_dir); - if (SaveOrLoad(filename, SL_LOAD) != SL_OK) -#endif - GenerateWorld(1, 6, 6); // if failed loading, make empty world. - } - - _pause = 0; - _local_player = 0; - MarkWholeScreenDirty(); - - // Play main theme - if (_music_driver->is_song_playing()) ResetMusic(); -} - -extern void DedicatedFork(void); -extern void CheckExternalFiles(void); - -int ttd_main(int argc, char* argv[]) -{ - MyGetOptData mgo; - int i; - bool network = false; - char *network_conn = NULL; - char *language = NULL; - const char *optformat; - char musicdriver[16], sounddriver[16], videodriver[16]; - int resolution[2] = {0,0}; - uint startdate = -1; - bool dedicated; - - musicdriver[0] = sounddriver[0] = videodriver[0] = 0; - - _game_mode = GM_MENU; - _switch_mode = SM_MENU; - _switch_mode_errorstr = INVALID_STRING_ID; - _dedicated_forks = false; - dedicated = false; - _config_file = NULL; - - // The last param of the following function means this: - // a letter means: it accepts that param (e.g.: -h) - // a ':' behind it means: it need a param (e.g.: -m<driver>) - // a '::' behind it means: it can optional have a param (e.g.: -d<debug>) - #if !defined(__MORPHOS__) && !defined(__AMIGA__) && !defined(WIN32) - optformat = "m:s:v:hDfn::l:eit:d::r:g::G:p:c:"; - #else - optformat = "m:s:v:hDn::l:eit:d::r:g::G:p:c:"; // no fork option - #endif - - MyGetOptInit(&mgo, argc-1, argv+1, optformat); - while ((i = MyGetOpt(&mgo)) != -1) { - switch(i) { - case 'm': ttd_strlcpy(musicdriver, mgo.opt, sizeof(musicdriver)); break; - case 's': ttd_strlcpy(sounddriver, mgo.opt, sizeof(sounddriver)); break; - case 'v': ttd_strlcpy(videodriver, mgo.opt, sizeof(videodriver)); break; - case 'D': { - sprintf(musicdriver,"null"); - sprintf(sounddriver,"null"); - sprintf(videodriver,"dedicated"); - dedicated = true; - } break; - case 'f': { - _dedicated_forks = true; - }; break; - case 'n': { - network = true; - if (mgo.opt) - // Optional, you can give an IP - network_conn = mgo.opt; - else - network_conn = NULL; - } break; - case 'r': ParseResolution(resolution, mgo.opt); break; - case 'l': { - language = mgo.opt; - } break; - case 't': { - startdate = atoi(mgo.opt); - } break; - case 'd': { -#if defined(WIN32) - CreateConsole(); -#endif - if (mgo.opt) - SetDebugString(mgo.opt); - } break; - case 'e': _switch_mode = SM_EDITOR; break; - case 'i': _use_dos_palette = true; break; - case 'g': - if (mgo.opt) { - strcpy(_file_to_saveload.name, mgo.opt); - _switch_mode = SM_LOAD; - } else - _switch_mode = SM_NEWGAME; - break; - case 'G': - _random_seeds[0][0] = atoi(mgo.opt); - break; - case 'p': { - int i = atoi(mgo.opt); - // Play as an other player in network games - if (IS_INT_INSIDE(i, 1, MAX_PLAYERS)) _network_playas = i; - break; - } - case 'c': - _config_file = strdup(mgo.opt); - break; - case -2: - case 'h': - showhelp(); - return 0; - } - } - - DeterminePaths(); - CheckExternalFiles(); - -#ifdef UNIX - // We must fork here, or we'll end up without some resources we need (like sockets) - if (_dedicated_forks) - DedicatedFork(); -#endif - - LoadFromConfig(); - CheckConfig(); - LoadFromHighScore(); - - // override config? - if (musicdriver[0]) ttd_strlcpy(_ini_musicdriver, musicdriver, sizeof(_ini_musicdriver)); - if (sounddriver[0]) ttd_strlcpy(_ini_sounddriver, sounddriver, sizeof(_ini_sounddriver)); - if (videodriver[0]) ttd_strlcpy(_ini_videodriver, videodriver, sizeof(_ini_videodriver)); - if (resolution[0]) { _cur_resolution[0] = resolution[0]; _cur_resolution[1] = resolution[1]; } - if (startdate != (uint)-1) _patches.starting_date = startdate; - - if (_dedicated_forks && !dedicated) - _dedicated_forks = false; - - // enumerate language files - InitializeLanguagePacks(); - - // initialize screenshot formats - InitializeScreenshotFormats(); - - // initialize airport state machines - InitializeAirports(); - - /* initialize all variables that are allocated dynamically */ - InitializeDynamicVariables(); - - // Sample catalogue - DEBUG(misc, 1) ("Loading sound effects..."); - _os_version = GetOSVersion(); - MxInitialize(11025); - SoundInitialize("sample.cat"); - - // This must be done early, since functions use the InvalidateWindow* calls - InitWindowSystem(); - - GfxLoadSprites(); - LoadStringWidthTable(); - - DEBUG(misc, 1) ("Loading drivers..."); - LoadDriver(SOUND_DRIVER, _ini_sounddriver); - LoadDriver(MUSIC_DRIVER, _ini_musicdriver); - LoadDriver(VIDEO_DRIVER, _ini_videodriver); // load video last, to prevent an empty window while sound and music loads - _savegame_sort_order = 1; // default sorting of savegames is by date, newest first - -#ifdef ENABLE_NETWORK - // initialize network-core - NetworkStartUp(); -#endif /* ENABLE_NETWORK */ - - _opt_ptr = &_opt_newgame; - - /* XXX - ugly hack, if diff_level is 9, it means we got no setting from the config file */ - if (_opt_newgame.diff_level == 9) - SetDifficultyLevel(0, &_opt_newgame); - - // initialize the ingame console - IConsoleInit(); - InitializeGUI(); - IConsoleCmdExec("exec scripts/autoexec.scr 0"); - - InitPlayerRandoms(); - - GenerateWorld(1, 6, 6); // Make the viewport initialization happy - -#ifdef ENABLE_NETWORK - if ((network) && (_network_available)) { - if (network_conn != NULL) { - const char *port = NULL; - const char *player = NULL; - uint16 rport; - - rport = NETWORK_DEFAULT_PORT; - - ParseConnectionString(&player, &port, network_conn); - - if (player != NULL) _network_playas = atoi(player); - if (port != NULL) rport = atoi(port); - - LoadIntroGame(); - _switch_mode = SM_NONE; - NetworkClientConnectGame(network_conn, rport); - } - } -#endif /* ENABLE_NETWORK */ - - while (_video_driver->main_loop() == ML_SWITCHDRIVER) {} - - JoinOTTDThread(); - IConsoleFree(); - -#ifdef ENABLE_NETWORK - if (_network_available) { - // Shut down the network and close any open connections - NetworkDisconnect(); - NetworkUDPClose(); - NetworkShutDown(); - } -#endif /* ENABLE_NETWORK */ - - _video_driver->stop(); - _music_driver->stop(); - _sound_driver->stop(); - - SaveToConfig(); - SaveToHighScore(); - - // uninitialize airport state machines - UnInitializeAirports(); - - /* uninitialize variables that are allocated dynamic */ - UnInitializeDynamicVariables(); - - /* Close all and any open filehandles */ - FioCloseAll(); - UnInitializeGame(); - - return 0; -} - -static void ShowScreenshotResult(bool b) -{ - if (b) { - SetDParam(0, STR_SPEC_SCREENSHOT_NAME); - ShowErrorMessage(INVALID_STRING_ID, STR_031B_SCREENSHOT_SUCCESSFULLY, 0, 0); - } else { - ShowErrorMessage(INVALID_STRING_ID, STR_031C_SCREENSHOT_FAILED, 0, 0); - } - -} - -static void MakeNewGame(void) -{ - _game_mode = GM_NORMAL; - - // Copy in game options - _opt_ptr = &_opt; - memcpy(_opt_ptr, &_opt_newgame, sizeof(GameOptions)); - - GfxLoadSprites(); - - // Reinitialize windows - ResetWindowSystem(); - LoadStringWidthTable(); - - SetupColorsAndInitialWindow(); - - // Randomize world - GenerateWorld(0, _patches.map_x, _patches.map_y); - - // In a dedicated server, the server does not play - if (_network_dedicated) { - _local_player = OWNER_SPECTATOR; - } else { - // Create a single player - DoStartupNewPlayer(false); - - _local_player = 0; - } - - MarkWholeScreenDirty(); -} - -static void MakeNewEditorWorld(void) -{ - _game_mode = GM_EDITOR; - - // Copy in game options - _opt_ptr = &_opt; - memcpy(_opt_ptr, &_opt_newgame, sizeof(GameOptions)); - - GfxLoadSprites(); - - // Re-init the windowing system - ResetWindowSystem(); - - // Create toolbars - SetupColorsAndInitialWindow(); - - // Startup the game system - GenerateWorld(1, _patches.map_x, _patches.map_y); - - _local_player = OWNER_NONE; - MarkWholeScreenDirty(); -} - -void StartupPlayers(void); -void StartupDisasters(void); - -/** - * Start Scenario starts a new game based on a scenario. - * Eg 'New Game' --> select a preset scenario - * This starts a scenario based on your current difficulty settings - */ -static void StartScenario(void) -{ - _game_mode = GM_NORMAL; - - // invalid type - if (_file_to_saveload.mode == SL_INVALID) { - printf("Savegame is obsolete or invalid format: %s\n", _file_to_saveload.name); - ShowErrorMessage(_error_message, STR_4009_GAME_LOAD_FAILED, 0, 0); - _game_mode = GM_MENU; - return; - } - - GfxLoadSprites(); - - // Reinitialize windows - ResetWindowSystem(); - LoadStringWidthTable(); - - SetupColorsAndInitialWindow(); - - // Load game - if (SaveOrLoad(_file_to_saveload.name, _file_to_saveload.mode) != SL_OK) { - LoadIntroGame(); - ShowErrorMessage(_error_message, STR_4009_GAME_LOAD_FAILED, 0, 0); - } - - _opt_ptr = &_opt; - memcpy(&_opt_ptr->diff, &_opt_newgame.diff, sizeof(GameDifficulty)); - _opt.diff_level = _opt_newgame.diff_level; - - // Inititalize data - StartupPlayers(); - StartupEngines(); - StartupDisasters(); - - _local_player = 0; - - MarkWholeScreenDirty(); -} - -bool SafeSaveOrLoad(const char *filename, int mode, int newgm) -{ - byte ogm = _game_mode; - int r; - - _game_mode = newgm; - r = SaveOrLoad(filename, mode); - if (r == SL_REINIT) { - if (ogm == GM_MENU) - LoadIntroGame(); - else if (ogm == GM_EDITOR) - MakeNewEditorWorld(); - else - MakeNewGame(); - return false; - } else if (r != SL_OK) { - _game_mode = ogm; - return false; - } else - return true; -} - -void SwitchMode(int new_mode) -{ - _in_state_game_loop = true; - -#ifdef ENABLE_NETWORK - // If we are saving something, the network stays in his current state - if (new_mode != SM_SAVE) { - // If the network is active, make it not-active - if (_networking) { - if (_network_server && (new_mode == SM_LOAD || new_mode == SM_NEWGAME)) { - NetworkReboot(); - NetworkUDPClose(); - } else { - NetworkDisconnect(); - NetworkUDPClose(); - } - } - - // If we are a server, we restart the server - if (_is_network_server) { - // But not if we are going to the menu - if (new_mode != SM_MENU) { - NetworkServerStart(); - } else { - // This client no longer wants to be a network-server - _is_network_server = false; - } - } - } -#endif /* ENABLE_NETWORK */ - - switch (new_mode) { - case SM_EDITOR: /* Switch to scenario editor */ - MakeNewEditorWorld(); - break; - - case SM_NEWGAME: /* New Game --> 'Random game' */ -#ifdef ENABLE_NETWORK - if (_network_server) - snprintf(_network_game_info.map_name, 40, "Random"); -#endif /* ENABLE_NETWORK */ - MakeNewGame(); - break; - - case SM_START_SCENARIO: /* New Game --> Choose one of the preset scenarios */ - StartScenario(); - break; - - case SM_LOAD: { /* Load game, Play Scenario */ - _opt_ptr = &_opt; - - _error_message = INVALID_STRING_ID; - if (!SafeSaveOrLoad(_file_to_saveload.name, _file_to_saveload.mode, GM_NORMAL)) { - LoadIntroGame(); - ShowErrorMessage(_error_message, STR_4009_GAME_LOAD_FAILED, 0, 0); - } else { - _local_player = 0; - DoCommandP(0, 0, 0, NULL, CMD_PAUSE); // decrease pause counter (was increased from opening load dialog) -#ifdef ENABLE_NETWORK - if (_network_server) - snprintf(_network_game_info.map_name, 40, "Loaded game"); -#endif /* ENABLE_NETWORK */ - } - break; - } - - case SM_LOAD_SCENARIO: { /* Load scenario from scenario editor */ - int i; - - if (SafeSaveOrLoad(_file_to_saveload.name, _file_to_saveload.mode, GM_EDITOR)) { - _opt_ptr = &_opt; - - _local_player = OWNER_NONE; - _generating_world = true; - // delete all players. - for (i = 0; i != MAX_PLAYERS; i++) { - ChangeOwnershipOfPlayerItems(i, 0xff); - _players[i].is_active = false; - } - _generating_world = false; - // delete all stations owned by a player - DeleteAllPlayerStations(); - -#ifdef ENABLE_NETWORK - if (_network_server) - snprintf(_network_game_info.map_name, 40, "Loaded scenario"); -#endif /* ENABLE_NETWORK */ - } else - ShowErrorMessage(INVALID_STRING_ID, STR_4009_GAME_LOAD_FAILED, 0, 0); - - break; - } - - - case SM_MENU: /* Switch to game intro menu */ - LoadIntroGame(); - break; - - case SM_SAVE: /* Save game */ - if (SaveOrLoad(_file_to_saveload.name, SL_SAVE) != SL_OK) - ShowErrorMessage(INVALID_STRING_ID, STR_4007_GAME_SAVE_FAILED, 0, 0); - else - DeleteWindowById(WC_SAVELOAD, 0); - break; - - case SM_GENRANDLAND: /* Generate random land within scenario editor */ - GenerateWorld(2, _patches.map_x, _patches.map_y); - // XXX: set date - _local_player = OWNER_NONE; - MarkWholeScreenDirty(); - break; - } - - if (_switch_mode_errorstr != INVALID_STRING_ID) - ShowErrorMessage(INVALID_STRING_ID,_switch_mode_errorstr,0,0); - - _in_state_game_loop = false; -} - - -// State controlling game loop. -// The state must not be changed from anywhere -// but here. -// That check is enforced in DoCommand. -void StateGameLoop(void) -{ - // dont execute the state loop during pause - if (_pause) return; - - _in_state_game_loop = true; - // _frame_counter is increased somewhere else when in network-mode - // Sidenote: _frame_counter is ONLY used for _savedump in non-MP-games - // Should that not be deleted? If so, the next 2 lines can also be deleted - if (!_networking) - _frame_counter++; - - if (_savedump_path[0] && (uint)_frame_counter >= _savedump_first && (uint)(_frame_counter -_savedump_first) % _savedump_freq == 0 ) { - char buf[100]; - sprintf(buf, "%s%.5d.sav", _savedump_path, _frame_counter); - SaveOrLoad(buf, SL_SAVE); - if ((uint)_frame_counter >= _savedump_last) exit(1); - } - - if (_game_mode == GM_EDITOR) { - RunTileLoop(); - CallVehicleTicks(); - CallLandscapeTick(); - CallWindowTickEvent(); - NewsLoop(); - } else { - // All these actions has to be done from OWNER_NONE - // for multiplayer compatibility - uint p = _current_player; - _current_player = OWNER_NONE; - - AnimateAnimatedTiles(); - IncreaseDate(); - RunTileLoop(); - CallVehicleTicks(); - CallLandscapeTick(); - - // To bad the AI does not work in multiplayer, because states are not saved - // perfectly - if (!disable_computer && !_networking) - RunOtherPlayersLoop(); - - CallWindowTickEvent(); - NewsLoop(); - _current_player = p; - } - - _in_state_game_loop = false; -} - -static void DoAutosave(void) -{ - char buf[200]; - - if (_patches.keep_all_autosave && _local_player != OWNER_SPECTATOR) { - const Player *p = DEREF_PLAYER(_local_player); - char *s; - sprintf(buf, "%s%s", _path.autosave_dir, PATHSEP); - - SetDParam(0, p->name_1); - SetDParam(1, p->name_2); - SetDParam(2, _date); - s = (char*)GetString(buf + strlen(_path.autosave_dir) + strlen(PATHSEP), STR_4004); - strcpy(s, ".sav"); - } else { /* Save a maximum of 15 autosaves */ - int n = _autosave_ctr; - _autosave_ctr = (_autosave_ctr + 1) & 15; - sprintf(buf, "%s%sautosave%d.sav", _path.autosave_dir, PATHSEP, n); - } - - DEBUG(misc, 2) ("Autosaving to %s", buf); - if (SaveOrLoad(buf, SL_SAVE) != SL_OK) - ShowErrorMessage(INVALID_STRING_ID, STR_AUTOSAVE_FAILED, 0, 0); -} - -static void ScrollMainViewport(int x, int y) -{ - if (_game_mode != GM_MENU) { - Window *w = FindWindowById(WC_MAIN_WINDOW, 0); - assert(w); - - WP(w,vp_d).scrollpos_x += x << w->viewport->zoom; - WP(w,vp_d).scrollpos_y += y << w->viewport->zoom; - } -} - -static const int8 scrollamt[16][2] = { - { 0, 0}, - {-2, 0}, // 1:left - { 0,-2}, // 2:up - {-2,-1}, // 3:left + up - { 2, 0}, // 4:right - { 0, 0}, // 5:left + right - { 2,-1}, // 6:right + up - { 0,-2}, // 7:left + right + up = up - { 0 ,2}, // 8:down - {-2 ,1}, // 9:down+left - { 0, 0}, // 10:impossible - {-2, 0}, // 11:left + up + down = left - { 2, 1}, // 12:down+right - { 0, 2}, // 13:left + right + down = down - { 0,-2}, // 14:left + right + up = up - { 0, 0}, // 15:impossible -}; - -static void HandleKeyScrolling(void) -{ - if (_dirkeys && !_no_scroll) { - int factor = _shift_pressed ? 50 : 10; - ScrollMainViewport(scrollamt[_dirkeys][0] * factor, scrollamt[_dirkeys][1] * factor); - } -} - -void GameLoop(void) -{ - int m; - - // autosave game? - if (_do_autosave) { - _do_autosave = false; - DoAutosave(); - RedrawAutosave(); - } - - // handle scrolling of the main window - if (_dirkeys) HandleKeyScrolling(); - - // make a screenshot? - if ((m=_make_screenshot) != 0) { - _make_screenshot = 0; - switch(m) { - case 1: // make small screenshot - UndrawMouseCursor(); - ShowScreenshotResult(MakeScreenshot()); - break; - case 2: // make large screenshot - ShowScreenshotResult(MakeWorldScreenshot(-(int)MapMaxX() * 32, 0, MapMaxX() * 64, MapSizeY() * 32, 0)); - break; - } - } - - // switch game mode? - if ((m=_switch_mode) != SM_NONE) { - _switch_mode = SM_NONE; - SwitchMode(m); - } - - IncreaseSpriteLRU(); - InteractiveRandom(); - - if (_scroller_click_timeout > 3) - _scroller_click_timeout -= 3; - else - _scroller_click_timeout = 0; - - _caret_timer += 3; - _timer_counter+=8; - CursorTick(); - -#ifdef ENABLE_NETWORK - // Check for UDP stuff - NetworkUDPGameLoop(); - - if (_networking) { - // Multiplayer - NetworkGameLoop(); - } else { - if (_network_reconnect > 0 && --_network_reconnect == 0) { - // This means that we want to reconnect to the last host - // We do this here, because it means that the network is really closed - NetworkClientConnectGame(_network_last_host, _network_last_port); - } - // Singleplayer - StateGameLoop(); - } -#else - StateGameLoop(); -#endif /* ENABLE_NETWORK */ - - if (!_pause && _display_opt&DO_FULL_ANIMATION) - DoPaletteAnimations(); - - if (!_pause || _cheats.build_in_pause.value) - MoveAllTextEffects(); - - InputLoop(); - - MusicLoop(); -} - -void BeforeSaveGame(void) -{ - Window *w = FindWindowById(WC_MAIN_WINDOW, 0); - - if (w != NULL) { - _saved_scrollpos_x = WP(w,vp_d).scrollpos_x; - _saved_scrollpos_y = WP(w,vp_d).scrollpos_y; - _saved_scrollpos_zoom = w->viewport->zoom; - } -} - -static void ConvertTownOwner(void) -{ - uint tile; - - for (tile = 0; tile != MapSize(); tile++) { - if (IsTileType(tile, MP_STREET)) { - if ((_map5[tile] & 0xF0) == 0x10 && _map3_lo[tile] & 0x80) - _map3_lo[tile] = OWNER_TOWN; - - if (_map_owner[tile] & 0x80) - _map_owner[tile] = OWNER_TOWN; - } else if (IsTileType(tile, MP_TUNNELBRIDGE)) { - if (_map_owner[tile] & 0x80) - _map_owner[tile] = OWNER_TOWN; - } - } -} - -// before savegame version 4, the name of the company determined if it existed -static void CheckIsPlayerActive(void) -{ - Player *p; - FOR_ALL_PLAYERS(p) { - if (p->name_1 != 0) { - p->is_active = true; - } - } -} - -// since savegame version 4.1, exclusive transport rights are stored at towns -static void UpdateExclusiveRights(void) -{ - Town *t; - FOR_ALL_TOWNS(t) if (t->xy != 0) { - t->exclusivity=(byte)-1; - } - - /* FIXME old exclusive rights status is not being imported (stored in s->blocked_months_obsolete) - could be implemented this way: - 1.) Go through all stations - Build an array town_blocked[ town_id ][ player_id ] - that stores if at least one station in that town is blocked for a player - 2.) Go through that array, if you find a town that is not blocked for - one player, but for all others, then give him exclusivity. - */ -} - -const byte convert_currency[] = { - 0, 1, 12, 8, 3, - 10, 14, 19, 4, 5, - 9, 11, 13, 6, 17, - 16, 22, 21, 7, 15, - 18, 2, 20, }; - -// since savegame version 4.2 the currencies are arranged differently -static void UpdateCurrencies(void) -{ - _opt.currency = convert_currency[_opt.currency]; -} - -/* Up to revision 1413 the invisible tiles at the southern border have not been - * MP_VOID, even though they should have. This is fixed by this function - */ -static void UpdateVoidTiles(void) -{ - uint i; - - for (i = 0; i < MapMaxY(); ++i) - SetTileType(i * MapSizeX() + MapMaxX(), MP_VOID); - for (i = 0; i < MapSizeX(); ++i) - SetTileType(MapSizeX() * MapMaxY() + i, MP_VOID); -} - -// since savegame version 6.0 each sign has an "owner", signs without owner (from old games are set to 255) -static void UpdateSignOwner(void) -{ - SignStruct *ss; - FOR_ALL_SIGNS(ss) { - ss->owner = OWNER_NONE; // no owner - } -} - -extern void UpdateOldAircraft( void ); -extern void UpdateOilRig( void ); - -bool AfterLoadGame(uint version) -{ - Window *w; - ViewPort *vp; - - // in version 2.1 of the savegame, town owner was unified. - if (version <= 0x200) { - ConvertTownOwner(); - } - - // from version 4.1 of the savegame, exclusive rights are stored at towns - if (version <= 0x400) { - UpdateExclusiveRights(); - } - - // from version 4.2 of the savegame, currencies are in a different order - if (version <= 0x401) { - UpdateCurrencies(); - } - - // from version 6.0 of the savegame, signs have an "owner" - if (version <= 0x600) { - UpdateSignOwner(); - } - - /* In old version there seems to be a problem that water is owned by - OWNER_NONE, not OWNER_WATER.. I can't replicate it for the current - (0x402) version, so I just check when versions are older, and then - walk through the whole map.. */ - if (version <= 0x402) { - TileIndex tile = TILE_XY(0,0); - uint w = MapSizeX(); - uint h = MapSizeY(); - - BEGIN_TILE_LOOP(tile_cur, w, h, tile) - if (IsTileType(tile_cur, MP_WATER) && _map_owner[tile_cur] >= MAX_PLAYERS) - _map_owner[tile_cur] = OWNER_WATER; - END_TILE_LOOP(tile_cur, w, h, tile) - } - - // convert road side to my format. - if (_opt.road_side) _opt.road_side = 1; - - // Load the sprites - GfxLoadSprites(); - - // Update current year - SetDate(_date); - - // reinit the landscape variables (landscape might have changed) - InitializeLandscapeVariables(true); - - // Update all vehicles - AfterLoadVehicles(); - - // Update all waypoints - if (version < 0x0C00) - FixOldWaypoints(); - - UpdateAllWaypointSigns(); - - // in version 2.2 of the savegame, we have new airports - if (version <= 0x201) { - UpdateOldAircraft(); - } - - UpdateAllStationVirtCoord(); - - // Setup town coords - AfterLoadTown(); - UpdateAllSignVirtCoords(); - - // make sure there is a town in the game - if (_game_mode == GM_NORMAL && !ClosestTownFromTile(0, (uint)-1)) - { - _error_message = STR_NO_TOWN_IN_SCENARIO; - return false; - } - - // Initialize windows - ResetWindowSystem(); - SetupColorsAndInitialWindow(); - - w = FindWindowById(WC_MAIN_WINDOW, 0); - - WP(w,vp_d).scrollpos_x = _saved_scrollpos_x; - WP(w,vp_d).scrollpos_y = _saved_scrollpos_y; - - vp = w->viewport; - vp->zoom = _saved_scrollpos_zoom; - vp->virtual_width = vp->width << vp->zoom; - vp->virtual_height = vp->height << vp->zoom; - - - // in version 4.0 of the savegame, is_active was introduced to determine - // if a player does exist, rather then checking name_1 - if (version <= 0x400) { - CheckIsPlayerActive(); - } - - // the void tiles on the southern border used to belong to a wrong class. - if (version <= 0x402) - UpdateVoidTiles(); - - // If Load Scenario / New (Scenario) Game is used, - // a player does not exist yet. So create one here. - // 1 exeption: network-games. Those can have 0 players - // But this exeption is not true for network_servers! - if (!_players[0].is_active && (!_networking || (_networking && _network_server))) - DoStartupNewPlayer(false); - - DoZoomInOutWindow(ZOOM_NONE, w); // update button status - MarkWholeScreenDirty(); - - //In 5.1, Oilrigs have been moved (again) - if (version <= 0x500) { - UpdateOilRig(); - } - - if (version <= 0x600) { - BEGIN_TILE_LOOP(tile, MapSizeX(), MapSizeY(), 0) { - if (IsTileType(tile, MP_HOUSE)) { - _map3_hi[tile] = _map2[tile]; - //XXX magic - SetTileType(tile, MP_VOID); - _map2[tile] = ClosestTownFromTile(tile,(uint)-1)->index; - SetTileType(tile, MP_HOUSE); - } else if (IsTileType(tile, MP_STREET)) { - //XXX magic - SetTileType(tile, MP_VOID); - _map3_hi[tile] |= (_map2[tile] << 4); - if ( _map_owner[tile] == OWNER_TOWN) - _map2[tile] = ClosestTownFromTile(tile,(uint)-1)->index; - else - _map2[tile] = 0; - SetTileType(tile, MP_STREET); - } - } END_TILE_LOOP(tile, MapSizeX(), MapSizeY(), 0); - } - - if (version < 0x900) { - Town *t; - FOR_ALL_TOWNS(t) { - UpdateTownMaxPass(t); - } - } - - return true; -}
deleted file mode 100644 --- a/ttd.dsp +++ /dev/null @@ -1,905 +0,0 @@ -# Microsoft Developer Studio Project File - Name="ttd" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=ttd - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "ttd.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "ttd.mak" CFG="ttd - Win32 Checked" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "ttd - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "ttd - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "ttd - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /c -# ADD CPP /nologo /Gd /Zp4 /W3 /Zi /Ox /Oa /Ow /Og /Oi /Os /Gf /Gy /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "WIN32_EXCEPTION_TRACKER" /D "WIN32_ENABLE_DIRECTMUSIC_SUPPORT" /D "WITH_PNG" /D "WITH_ZLIB" /D "ENABLE_NETWORK" /FAcs /FR /Yu"stdafx.h" /J /FD /c -# SUBTRACT CPP /WX /Ot -# ADD BASE RSC /l 0x809 /d "NDEBUG" -# ADD RSC /l 0x809 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winmm.lib ws2_32.lib libpng.lib zlibstat.lib /nologo /subsystem:windows /map /machine:I386 /opt:nowin98 -# SUBTRACT LINK32 /pdb:none - -!ELSEIF "$(CFG)" == "ttd - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c -# ADD CPP /nologo /MTd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "WITH_PNG" /D "WITH_ZLIB" /D "ENABLE_NETWORK" /YX"stdafx.h" /FD /GZ /c -# SUBTRACT CPP /WX /Fr -# ADD BASE RSC /l 0x809 /d "_DEBUG" -# ADD RSC /l 0x809 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winmm.lib ws2_32.lib libpng.lib zlibstat.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept -# SUBTRACT LINK32 /pdb:none - -!ENDIF - -# Begin Target - -# Name "ttd - Win32 Release" -# Name "ttd - Win32 Debug" - -# Begin Group "Source Files" -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" - -# Begin Source File -SOURCE=.\ai.c -# End Source File - -# Begin Source File -SOURCE=.\ai_build.c -# End Source File - -# Begin Source File -SOURCE=.\ai_new.c -# End Source File - -# Begin Source File -SOURCE=.\ai_pathfinder.c -# End Source File - -# Begin Source File -SOURCE=.\ai_shared.c -# End Source File - -# Begin Source File -SOURCE=.\airport.c -# End Source File - -# Begin Source File -SOURCE=.\aystar.c -# End Source File - -# Begin Source File -SOURCE=.\command.c -# End Source File - -# Begin Source File -SOURCE=.\console.c -# End Source File - -# Begin Source File -SOURCE=.\console_cmds.c -# End Source File - -# Begin Source File -SOURCE=.\debug.c -# End Source File - -# Begin Source File -SOURCE=.\depot.c -# End Source File - -# Begin Source File -SOURCE=.\documentation.txt -# End Source File - -# Begin Source File -SOURCE=.\economy.c -# End Source File - -# Begin Source File -SOURCE=.\engine.c -# End Source File - -# Begin Source File -SOURCE=.\fileio.c -# End Source File - -# Begin Source File -SOURCE=.\gfx.c -# End Source File - -# Begin Source File -SOURCE=.\landscape.c -# End Source File - -# Begin Source File -SOURCE=.\map.c -# End Source File - -# Begin Source File -SOURCE=.\md5.c -# End Source File - -# Begin Source File -SOURCE=.\minilzo.c - -!IF "$(CFG)" == "ttd - Win32 Release" - -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "ttd - Win32 Debug" - -# SUBTRACT CPP /YX - -!ENDIF - -# End Source File - -# Begin Source File -SOURCE=.\misc.c -# End Source File - -# Begin Source File -SOURCE=.\mixer.c -# End Source File - -# Begin Source File -SOURCE=.\namegen.c -# End Source File - -# Begin Source File -SOURCE=.\network.c -# End Source File - -# Begin Source File -SOURCE=.\newgrf.c -# End Source File - -# Begin Source File -SOURCE=.\npf.c -# End Source File - -# Begin Source File -SOURCE=.\oldloader.c -# End Source File - -# Begin Source File -SOURCE=.\pathfind.c -# End Source File - -# Begin Source File -SOURCE=.\pool.c -# End Source File - -# Begin Source File -SOURCE=.\players.c -# End Source File - -# Begin Source File -SOURCE=.\queue.c -# End Source File - -# Begin Source File -SOURCE=.\saveload.c -# End Source File - -# Begin Source File -SOURCE=.\screenshot.c -# End Source File - -# Begin Source File -SOURCE=.\sdl.c -# End Source File - -# Begin Source File -SOURCE=.\settings.c -# End Source File - -# Begin Source File -SOURCE=.\signs.c -# End Source File - -# Begin Source File -SOURCE=.\sound.c -# End Source File - -# Begin Source File -SOURCE=.\sprite.c -# End Source File - -# Begin Source File -SOURCE=.\spritecache.c -# End Source File - -# Begin Source File - -SOURCE=.\StdAfx.c - -!IF "$(CFG)" == "ttd - Win32 Release" - -# ADD CPP /Yc"stdafx.h" - -!ELSEIF "$(CFG)" == "ttd - Win32 Debug" - -!ENDIF - -# End Source File - -# Begin Source File -SOURCE=.\string.c -# End Source File - -# Begin Source File -SOURCE=.\strings.c -# End Source File - -# Begin Source File -SOURCE=.\texteff.c -# End Source File - -# Begin Source File -SOURCE=.\tile.c -# End Source File - -# Begin Source File -SOURCE=.\ttd.c -# End Source File - -# Begin Source File -SOURCE=.\ttd.rc -# End Source File - -# Begin Source File - -SOURCE=.\unix.c - -!IF "$(CFG)" == "ttd - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "ttd - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File - -# Begin Source File -SOURCE=.\vehicle.c -# End Source File - -# Begin Source File -SOURCE=.\vehicle_gui.c -# End Source File - -# Begin Source File -SOURCE=.\viewport.c -# End Source File - -# Begin Source File -SOURCE=.\w32dm.c -# End Source File - -# Begin Source File -SOURCE=.\waypoint.c -# End Source File - -# Begin Source File - -SOURCE=.\w32dm2.cpp - -!IF "$(CFG)" == "ttd - Win32 Release" - -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "ttd - Win32 Debug" - -!ENDIF - -# End Source File - -# Begin Source File -SOURCE=.\widget.c -# End Source File - -# Begin Source File -SOURCE=.\win32.c -# End Source File - -# Begin Source File -SOURCE=.\window.c -# End Source File - -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" - -# Begin Source File -SOURCE=.\ai.h -# End Source File - -# Begin Source File -SOURCE=.\aystar.h -# End Source File - -# Begin Source File -SOURCE=.\command.h -# End Source File - -# Begin Source File -SOURCE=.\console.h -# End Source File - -# Begin Source File -SOURCE=.\debug.h -# End Source File - -# Begin Source File -SOURCE=.\depot.h -# End Source File - -# Begin Source File -SOURCE=.\economy.h -# End Source File - -# Begin Source File -SOURCE=.\engine.h -# End Source File - -# Begin Source File -SOURCE=.\fileio.h -# End Source File - -# Begin Source File -SOURCE=.\functions.h -# End Source File - -# Begin Source File -SOURCE=.\gfx.h -# End Source File - -# Begin Source File -SOURCE=.\gui.h -# End Source File - -# Begin Source File -SOURCE=.\hal.h -# End Source File - -# Begin Source File -SOURCE=.\industry.h -# End Source File - -# Begin Source File -SOURCE=.\macros.h -# End Source File - -# Begin Source File -SOURCE=.\map.h -# End Source File - -# Begin Source File -SOURCE=.\md5.h -# End Source File - -# Begin Source File -SOURCE=.\network.h -# End Source File - -# Begin Source File -SOURCE=.\news.h -# End Source File - -# Begin Source File -SOURCE=.\npf.h -# End Source File - -# Begin Source File -SOURCE=.\pathfind.h -# End Source File - -# Begin Source File -SOURCE=.\pool.h -# End Source File - -# Begin Source File -SOURCE=.\player.h -# End Source File - -# Begin Source File -SOURCE=.\queue.h -# End Source File - -# Begin Source File -SOURCE=.\saveload.h -# End Source File - -# Begin Source File -SOURCE=.\signs.h -# End Source File - -# Begin Source File -SOURCE=.\sound.h -# End Source File - -# Begin Source File -SOURCE=.\station.h -# End Source File - -# Begin Source File -SOURCE=.\string.h -# End Source File - -# Begin Source File -SOURCE=.\strings.h -# End Source File - -# Begin Source File -SOURCE=.\StdAfx.h -# End Source File - -# Begin Source File -SOURCE=.\tile.h -# End Source File - -# Begin Source File -SOURCE=.\town.h -# End Source File - -# Begin Source File -SOURCE=.\ttd.h -# End Source File - -# Begin Source File -SOURCE=.\variables.h -# End Source File - -# Begin Source File -SOURCE=.\vehicle.h -# End Source File - -# Begin Source File -SOURCE=.\vehicle_gui.h -# End Source File - -# Begin Source File -SOURCE=.\viewport.h -# End Source File - -# Begin Source File -SOURCE=.\waypoint.h -# End Source File - -# Begin Source File -SOURCE=.\window.h -# End Source File - -# End Group -# Begin Group "Gui Source codes" - -# PROP Default_Filter "" - -# Begin Source File -SOURCE=.\aircraft_gui.c -# End Source File - -# Begin Source File -SOURCE=.\airport_gui.c -# End Source File - -# Begin Source File -SOURCE=.\bridge_gui.c -# End Source File - -# Begin Source File -SOURCE=.\dock_gui.c -# End Source File - -# Begin Source File -SOURCE=.\engine_gui.c -# End Source File - -# Begin Source File -SOURCE=.\graph_gui.c -# End Source File - -# Begin Source File -SOURCE=.\industry_gui.c -# End Source File - -# Begin Source File -SOURCE=.\intro_gui.c -# End Source File - -# Begin Source File -SOURCE=.\main_gui.c -# End Source File - -# Begin Source File -SOURCE=.\misc_gui.c -# End Source File - -# Begin Source File -SOURCE=.\music_gui.c -# End Source File - -# Begin Source File -SOURCE=.\network_gui.c -# End Source File - -# Begin Source File -SOURCE=.\news_gui.c -# End Source File - -# Begin Source File -SOURCE=.\order_gui.c -# End Source File - -# Begin Source File -SOURCE=.\player_gui.c -# End Source File - -# Begin Source File -SOURCE=.\rail_gui.c -# End Source File - -# Begin Source File -SOURCE=.\road_gui.c -# End Source File - -# Begin Source File -SOURCE=.\roadveh_gui.c -# End Source File - -# Begin Source File -SOURCE=.\settings_gui.c -# End Source File - -# Begin Source File -SOURCE=.\ship_gui.c -# End Source File - -# Begin Source File -SOURCE=.\smallmap_gui.c -# End Source File - -# Begin Source File -SOURCE=.\station_gui.c -# End Source File - -# Begin Source File -SOURCE=.\subsidy_gui.c -# End Source File - -# Begin Source File -SOURCE=.\terraform_gui.c -# End Source File - -# Begin Source File -SOURCE=.\town_gui.c -# End Source File - -# Begin Source File -SOURCE=.\train_gui.c -# End Source File - -# End Group -# Begin Group "Landscape" - -# PROP Default_Filter "" - -# Begin Source File -SOURCE=.\aircraft_cmd.c -# End Source File - -# Begin Source File -SOURCE=.\clear_cmd.c -# End Source File - -# Begin Source File -SOURCE=.\disaster_cmd.c -# End Source File - -# Begin Source File -SOURCE=.\dummy_land.c -# End Source File - -# Begin Source File -SOURCE=.\industry_cmd.c -# End Source File - -# Begin Source File -SOURCE=.\misc_cmd.c -# End Source File - -# Begin Source File -SOURCE=.\order_cmd.c -# End Source File - -# Begin Source File -SOURCE=.\rail_cmd.c -# End Source File - -# Begin Source File -SOURCE=.\road_cmd.c -# End Source File - -# Begin Source File -SOURCE=.\roadveh_cmd.c -# End Source File - -# Begin Source File -SOURCE=.\ship_cmd.c -# End Source File - -# Begin Source File -SOURCE=.\station_cmd.c -# End Source File - -# Begin Source File -SOURCE=.\town_cmd.c -# End Source File - -# Begin Source File -SOURCE=.\train_cmd.c -# End Source File - -# Begin Source File -SOURCE=.\tree_cmd.c -# End Source File - -# Begin Source File -SOURCE=.\tunnelbridge_cmd.c -# End Source File - -# Begin Source File -SOURCE=.\unmovable_cmd.c -# End Source File - -# Begin Source File -SOURCE=.\water_cmd.c -# End Source File - -# End Group -# Begin Group "Tables" - -# PROP Default_Filter "" - -# Begin Source File -SOURCE=.\table\ai_rail.h -# End Source File - -# Begin Source File -SOURCE=.\table\allstrings.h -# End Source File - -# Begin Source File -SOURCE=.\table\animcursors.h -# End Source File - -# Begin Source File -SOURCE=.\table\autorail.h -# End Source File - -# Begin Source File -SOURCE=.\table\build_industry.h -# End Source File - -# Begin Source File -SOURCE=.\table\clear_land.h -# End Source File - -# Begin Source File -SOURCE=.\table\engines.h -# End Source File - -# Begin Source File -SOURCE=.\table\files.h -# End Source File - -# Begin Source File -SOURCE=.\table\genland.h -# End Source File - -# Begin Source File -SOURCE=.\table\industry_land.h -# End Source File - -# Begin Source File -SOURCE=.\table\landscape_const.h -# End Source File - -# Begin Source File -SOURCE=.\table\landscape_sprite.h -# End Source File - -# Begin Source File -SOURCE=.\table\namegen.h -# End Source File - -# Begin Source File -SOURCE=.\table\palettes.h -# End Source File - -# Begin Source File -SOURCE=.\table\road_land.h -# End Source File - -# Begin Source File -SOURCE=.\table\roadveh.h -# End Source File - -# Begin Source File -SOURCE=.\table\sprites.h -# End Source File - -# Begin Source File -SOURCE=.\table\station_land.h -# End Source File - -# Begin Source File -SOURCE=.\table\strings.h -# End Source File - -# Begin Source File -SOURCE=.\table\town_land.h -# End Source File - -# Begin Source File -SOURCE=.\table\track_land.h -# End Source File - -# Begin Source File -SOURCE=.\table\train_cmd.h -# End Source File - -# Begin Source File -SOURCE=.\table\tree_land.h -# End Source File - -# Begin Source File -SOURCE=.\table\tunnel_land.h -# End Source File - -# Begin Source File -SOURCE=.\table\unmovable_land.h -# End Source File - -# Begin Source File -SOURCE=.\table\water_land.h -# End Source File - -# End Group -# Begin Group "Network Source Files" - -# PROP Default_Filter "" - -# Begin Source File -SOURCE=.\callback_table.c -# End Source File - -# Begin Source File -SOURCE=.\dedicated.c -# End Source File - -# Begin Source File -SOURCE=.\network_client.c -# End Source File - -# Begin Source File -SOURCE=.\network_data.c -# End Source File - -# Begin Source File -SOURCE=.\network_gamelist.c -# End Source File - -# Begin Source File -SOURCE=.\network_server.c -# End Source File - -# Begin Source File -SOURCE=.\network_udp.c -# End Source File - -# End Group -# Begin Group "Network Header Files" - -# PROP Default_Filter "" - -# Begin Source File -SOURCE=.\network_client.h -# End Source File - -# Begin Source File -SOURCE=.\network_core.h -# End Source File - -# Begin Source File -SOURCE=.\network_data.h -# End Source File - -# Begin Source File -SOURCE=.\network_gamelist.h -# End Source File - -# Begin Source File -SOURCE=.\network_server.h -# End Source File - -# Begin Source File -SOURCE=.\network_udp.h -# End Source File - -# End Group - -# Begin Source File -SOURCE=.\changelog.txt -# End Source File - -# Begin Source File -SOURCE=.\openttd.ico -# End Source File - -# Begin Source File -SOURCE=.\mainicon.ico -# End Source File - -# Begin Source File -SOURCE=.\ReadMe.txt -# End Source File - -# End Target -# End Project
deleted file mode 100644 --- a/ttd.dsw +++ /dev/null @@ -1,59 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "langs"=.\langs.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name strgen - End Project Dependency -}}} - -############################################################################### - -Project: "strgen"=.\strgen\strgen.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Project: "ttd"=.\ttd.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name langs - End Project Dependency -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### -
deleted file mode 100644 --- a/ttd.h +++ /dev/null @@ -1,547 +0,0 @@ -#ifndef TTD_H -#define TTD_H - -#ifndef VARDEF -#define VARDEF extern -#endif - -// use this on non static functions -#define PUBLIC - -typedef struct Rect { - int left,top,right,bottom; -} Rect; - -typedef struct SmallPoint { - int16 x,y; -} SmallPoint; - -typedef struct Point { - int x,y; -} Point; - -typedef struct Pair { - int a; - int b; -} Pair; - -/** - * Is used as a general sortable struct (using qsort and friends). Is used for - * sorting vehicles and stations at the moment - */ -typedef struct SortStruct { - uint32 index; - byte owner; -} SortStruct; - -typedef struct YearMonthDay { - int year, month, day; -} YearMonthDay; - -/* --- 1 Day is 74 ticks --- -* The game's internal structure is dictated by ticks. The date counter (date_fract) is an integer of -* uint16 type, so it can have a max value of 65536. Every tick this variable (date_fract) is -* increased by 885. When it overflows, the new day loop is called. -* * this that means 1 day is : 65536 / 885 = 74 ticks -* * 1 tick is approximately 27ms. -* * 1 day is thus about 2 seconds (74*27 = 1998) on a machine that can run OpenTTD normally -*/ -#define DAY_TICKS 74 -#define MAX_YEAR_BEGIN_REAL 1920 -#define MAX_YEAR_END_REAL 2090 -#define MAX_YEAR_END 170 - -#include "macros.h" - -// Forward declarations of structs. -typedef struct Vehicle Vehicle; -typedef struct Depot Depot; -typedef struct Waypoint Waypoint; -typedef struct Window Window; -typedef struct Station Station; -typedef struct ViewPort ViewPort; -typedef struct Town Town; -typedef struct NewsItem NewsItem; -typedef struct Industry Industry; -typedef struct DrawPixelInfo DrawPixelInfo; -typedef uint16 VehicleID; -typedef byte PlayerID; -typedef byte OrderID; -typedef byte CargoID; -typedef uint16 StringID; -typedef uint16 SpriteID; -typedef uint32 PalSpriteID; - -typedef uint32 WindowNumber; -typedef byte WindowClass; - - -enum GameModes { - GM_MENU, - GM_NORMAL, - GM_EDITOR -}; - -enum SwitchModes { - SM_NONE = 0, - SM_NEWGAME = 1, - SM_EDITOR = 2, - SM_LOAD = 3, - SM_MENU = 4, - SM_SAVE = 5, - SM_GENRANDLAND = 6, - SM_LOAD_SCENARIO = 9, - SM_START_SCENARIO = 10, -}; - -typedef enum TransportTypes { - /* These constants are for now linked to the representation of bridges - * and tunnels, so they can be used by GetTileTrackStatus_TunnelBridge - * to compare against the map5 array. In an ideal world, these - * constants would be used everywhere when accessing tunnels and - * bridges. For now, you should just not change the values for road - * and rail. - */ - TRANSPORT_RAIL = 0, - TRANSPORT_ROAD = 1, - TRANSPORT_WATER, // = 2 - TRANSPORT_MAX // = 3 -} TransportType; - -typedef struct TileInfo { - uint x; - uint y; - uint tileh; - uint type; - uint map5; - uint tile; - uint z; -} TileInfo; - -enum { - NG_EDGE = 1, -}; - -/* Display Options */ -enum { - DO_SHOW_TOWN_NAMES = 1, - DO_SHOW_STATION_NAMES = 2, - DO_SHOW_SIGNS = 4, - DO_FULL_ANIMATION = 8, - DO_TRANS_BUILDINGS = 0x10, - DO_FULL_DETAIL = 0x20, - DO_WAYPOINTS = 0x40, -}; - -/* Landscape types */ -enum { - LT_NORMAL = 0, - LT_HILLY = 1, - LT_DESERT = 2, - LT_CANDY = 3, - - NUM_LANDSCAPE = 4, -}; - -enum { - NUM_PRICES = 49, -}; - -typedef struct Prices { - int32 station_value; - int32 build_rail; - int32 build_road; - int32 build_signals; - int32 build_bridge; - int32 build_train_depot; - int32 build_road_depot; - int32 build_ship_depot; - int32 build_tunnel; - int32 train_station_track; - int32 train_station_length; - int32 build_airport; - int32 build_bus_station; - int32 build_truck_station; - int32 build_dock; - int32 build_railvehicle; - int32 build_railwagon; - int32 aircraft_base; - int32 roadveh_base; - int32 ship_base; - int32 build_trees; - int32 terraform; - int32 clear_1; - int32 purchase_land; - int32 clear_2; - int32 clear_3; - int32 remove_trees; - int32 remove_rail; - int32 remove_signals; - int32 clear_bridge; - int32 remove_train_depot; - int32 remove_road_depot; - int32 remove_ship_depot; - int32 clear_tunnel; - int32 clear_water; - int32 remove_rail_station; - int32 remove_airport; - int32 remove_bus_station; - int32 remove_truck_station; - int32 remove_dock; - int32 remove_house; - int32 remove_road; - int32 running_rail[3]; - int32 aircraft_running; - int32 roadveh_running; - int32 ship_running; - int32 build_industry; -} Prices; - -#define GAME_DIFFICULTY_NUM 18 - -typedef struct GameDifficulty { - int max_no_competitors; - int competitor_start_time; - int number_towns; - int number_industries; - int max_loan; - int initial_interest; - int vehicle_costs; - int competitor_speed; - int competitor_intelligence; - int vehicle_breakdowns; - int subsidy_multiplier; - int construction_cost; - int terrain_type; - int quantity_sea_lakes; - int economy; - int line_reverse_mode; - int disasters; - int town_council_tolerance; // minimum required town ratings to be allowed to demolish stuff -} GameDifficulty; - -enum { - // Temperate - CT_PASSENGERS = 0, - CT_COAL = 1, - CT_MAIL = 2, - CT_OIL = 3, - CT_LIVESTOCK = 4, - CT_GOODS = 5, - CT_GRAIN = 6, - CT_WOOD = 7, - CT_IRON_ORE = 8, - CT_STEEL = 9, - CT_VALUABLES = 10, - CT_FOOD = 11, - - // Arctic - CT_WHEAT = 6, - CT_HILLY_UNUSED = 8, - CT_PAPER = 9, - CT_GOLD = 10, - - // Tropic - CT_RUBBER = 1, - CT_FRUIT = 4, - CT_MAIZE = 6, - CT_COPPER_ORE = 8, - CT_WATER = 9, - CT_DIAMONDS = 10, - - // Toyland - CT_SUGAR = 1, - CT_TOYS = 3, - CT_BATTERIES = 4, - CT_CANDY = 5, - CT_TOFFEE = 6, - CT_COLA = 7, - CT_COTTON_CANDY = 8, - CT_BUBBLES = 9, - CT_PLASTIC = 10, - CT_FIZZY_DRINKS = 11, - - NUM_CARGO = 12, - - CT_INVALID = 0xFF -}; - -typedef uint AcceptedCargo[NUM_CARGO]; - -typedef struct TileDesc { - StringID str; - byte owner; - uint16 build_date; - uint32 dparam[2]; -} TileDesc; - -typedef struct { - int32 left; - int32 top; - byte width_1, width_2; -} ViewportSign; - -typedef int32 CommandProc(int x, int y, uint32 flags, uint32 p1, uint32 p2); - -typedef void DrawTileProc(TileInfo *ti); -typedef uint GetSlopeZProc(TileInfo *ti); -typedef int32 ClearTileProc(uint tile, byte flags); -typedef void GetAcceptedCargoProc(uint tile, AcceptedCargo res); -typedef void GetTileDescProc(uint tile, TileDesc *td); -/* GetTileTrackStatusProcs return a value that contains the possible tracks - * that can be taken on a given tile by a given transport. The return value is - * composed as follows: 0xaabbccdd. ccdd and aabb are bitmasks of trackdirs, - * where bit n corresponds to trackdir n. ccdd are the trackdirs that are - * present in the tile (1==present, 0==not present), aabb is the signal - * status, if applicable (0==green/no signal, 1==red, note that this is - * reversed from map3/2[tile] for railway signals). - * - * The result (let's call it ts) is often used as follows: - * tracks = (byte)(ts | ts >>8) - * This effectively converts the present part of the result (ccdd) to a - * track bitmask, which disregards directions. Normally, this is the same as just - * doing (byte)ts I think, although I am not really sure - * - * A trackdir is combination of a track and a dir, where the lower three bits - * are a track, the fourth bit is the direction. these give 12 (or 14) - * possible options: 0-5 and 8-13, so we need 14 bits for a trackdir bitmask - * above. - */ -typedef uint32 GetTileTrackStatusProc(uint tile, TransportType mode); -typedef void GetProducedCargoProc(uint tile, byte *b); -typedef void ClickTileProc(uint tile); -typedef void AnimateTileProc(uint tile); -typedef void TileLoopProc(uint tile); -typedef void ChangeTileOwnerProc(uint tile, byte old_player, byte new_player); -/* Return value has bit 0x2 set, when the vehicle enters a station. Then, - * result << 8 contains the id of the station entered. If the return value has - * bit 0x8 set, the vehicle could not and did not enter the tile. Are there - * other bits that can be set? */ -typedef uint32 VehicleEnterTileProc(Vehicle *v, uint tile, int x, int y); -typedef void VehicleLeaveTileProc(Vehicle *v, uint tile, int x, int y); -typedef uint GetSlopeTilehProc(TileInfo *ti); - -typedef struct { - DrawTileProc *draw_tile_proc; - GetSlopeZProc *get_slope_z_proc; - ClearTileProc *clear_tile_proc; - GetAcceptedCargoProc *get_accepted_cargo_proc; - GetTileDescProc *get_tile_desc_proc; - GetTileTrackStatusProc *get_tile_track_status_proc; - ClickTileProc *click_tile_proc; - AnimateTileProc *animate_tile_proc; - TileLoopProc *tile_loop_proc; - ChangeTileOwnerProc *change_tile_owner_proc; - GetProducedCargoProc *get_produced_cargo_proc; - VehicleEnterTileProc *vehicle_enter_tile_proc; - VehicleLeaveTileProc *vehicle_leave_tile_proc; - GetSlopeTilehProc *get_slope_tileh_proc; -} TileTypeProcs; - - - -#define MP_SETTYPE(x) ((x+1) << 8) - -enum { - MP_MAP2 = 1<<0, - MP_MAP3LO = 1<<1, - MP_MAP3HI = 1<<2, - MP_MAP5 = 1<<3, - MP_MAPOWNER_CURRENT = 1<<4, - MP_MAPOWNER = 1<<5, - - MP_TYPE_MASK = 0xF << 8, - - MP_MAP2_CLEAR = 1 << 12, - MP_MAP3LO_CLEAR = 1 << 13, - MP_MAP3HI_CLEAR = 1 << 14, - - MP_NODIRTY = 1<<15, -}; - -enum { - WC_MAIN_WINDOW = 0x0, - WC_MAIN_TOOLBAR = 0x1, - WC_STATUS_BAR = 0x2, - WC_BUILD_TOOLBAR = 0x3, - WC_NEWS_WINDOW = 0x4, - WC_TOWN_DIRECTORY = 0x5, - WC_STATION_LIST = 0x6, - WC_TOWN_VIEW = 0x7, - WC_SMALLMAP = 0x8, - WC_TRAINS_LIST = 0x9, - WC_ROADVEH_LIST = 0xA, - WC_SHIPS_LIST = 0xB, - WC_AIRCRAFT_LIST = 0xC, - WC_VEHICLE_VIEW = 0xD, - WC_VEHICLE_DETAILS = 0xE, - WC_VEHICLE_REFIT = 0xF, - WC_VEHICLE_ORDERS = 0x10, - WC_STATION_VIEW = 0x11, - WC_VEHICLE_DEPOT = 0x12, - WC_BUILD_VEHICLE = 0x13, - WC_BUILD_BRIDGE = 0x14, - WC_ERRMSG = 0x15, - WC_ASK_ABANDON_GAME = 0x16, - WC_QUIT_GAME = 0x17, - WC_BUILD_STATION = 0x18, - WC_BUS_STATION = 0x19, - WC_TRUCK_STATION = 0x1A, - WC_BUILD_DEPOT = 0x1B, - WC_DEBUGGER = 0x1C, - WC_COMPANY = 0x1D, - WC_FINANCES = 0x1E, - WC_PLAYER_COLOR = 0x1F, - WC_QUERY_STRING = 0x20, - WC_SAVELOAD = 0x21, - WC_SELECT_GAME = 0x22, - WC_TOOLBAR_MENU = 0x24, - WC_INCOME_GRAPH = 0x25, - WC_OPERATING_PROFIT = 0x26, - WC_TOOLTIPS = 0x27, - WC_INDUSTRY_VIEW = 0x28, - WC_PLAYER_FACE = 0x29, - WC_LAND_INFO = 0x2A, - WC_TOWN_AUTHORITY = 0x2B, - WC_SUBSIDIES_LIST = 0x2C, - WC_GRAPH_LEGEND = 0x2D, - WC_DELIVERED_CARGO = 0x2E, - WC_PERFORMANCE_HISTORY = 0x2F, - WC_COMPANY_VALUE = 0x30, - WC_COMPANY_LEAGUE = 0x31, - WC_BUY_COMPANY = 0x32, - WC_PAYMENT_RATES = 0x33, - WC_SELECT_TUTORIAL = 0x34, - WC_ENGINE_PREVIEW = 0x35, - WC_MUSIC_WINDOW = 0x36, - WC_MUSIC_TRACK_SELECTION = 0x37, - WC_SCEN_LAND_GEN = 0x38, // also used for landscaping toolbar - WC_ASK_RESET_LANDSCAPE = 0x39, - WC_SCEN_TOWN_GEN = 0x3A, - WC_SCEN_INDUSTRY = 0x3B, - WC_SCEN_BUILD_ROAD = 0x3C, - WC_BUILD_TREES = 0x3D, - WC_SEND_NETWORK_MSG = 0x3E, - WC_DROPDOWN_MENU = 0x3F, - WC_BUILD_INDUSTRY = 0x40, - WC_GAME_OPTIONS = 0x41, - WC_NETWORK_WINDOW = 0x42, - WC_INDUSTRY_DIRECTORY = 0x43, - WC_MESSAGE_HISTORY = 0x44, - WC_CHEATS = 0x45, - WC_PERFORMANCE_DETAIL = 0x46, - WC_CONSOLE = 0x47, - WC_EXTRA_VIEW_PORT = 0x48, - WC_CLIENT_LIST = 0x49, - WC_NETWORK_STATUS_WINDOW = 0x4A, - WC_CUSTOM_CURRENCY = 0x4B, - WC_REPLACE_VEHICLE = 0x4C, - WC_HIGHSCORE = 0x4D, - WC_ENDSCREEN = 0x4E, - WC_SIGN_LIST = 0x4F, -}; - - -enum { - EXPENSES_CONSTRUCTION = 0, - EXPENSES_NEW_VEHICLES = 1, - EXPENSES_TRAIN_RUN = 2, - EXPENSES_ROADVEH_RUN = 3, - EXPENSES_AIRCRAFT_RUN = 4, - EXPENSES_SHIP_RUN = 5, - EXPENSES_PROPERTY = 6, - EXPENSES_TRAIN_INC = 7, - EXPENSES_ROADVEH_INC = 8, - EXPENSES_AIRCRAFT_INC = 9, - EXPENSES_SHIP_INC = 10, - EXPENSES_LOAN_INT = 11, - EXPENSES_OTHER = 12, -}; - -// Tile type misc constants, don't know where to put these -enum { - TRACKTYPE_SPRITE_PITCH = 0x52, -}; - - -// special string constants -enum SpecialStrings { - - // special strings for town names. the town name is generated dynamically on request. - SPECSTR_TOWNNAME_START = 0x20C0, - SPECSTR_TOWNNAME_ENGLISH = SPECSTR_TOWNNAME_START, - SPECSTR_TOWNNAME_FRENCH, - SPECSTR_TOWNNAME_GERMAN, - SPECSTR_TOWNNAME_AMERICAN, - SPECSTR_TOWNNAME_LATIN, - SPECSTR_TOWNNAME_SILLY, - SPECSTR_TOWNNAME_SWEDISH, - SPECSTR_TOWNNAME_DUTCH, - SPECSTR_TOWNNAME_FINNISH, - SPECSTR_TOWNNAME_POLISH, - SPECSTR_TOWNNAME_SLOVAKISH, - SPECSTR_TOWNNAME_NORWEGIAN, - SPECSTR_TOWNNAME_HUNGARIAN, - SPECSTR_TOWNNAME_AUSTRIAN, - SPECSTR_TOWNNAME_ROMANIAN, - SPECSTR_TOWNNAME_CZECH, - SPECSTR_TOWNNAME_SWISS, - SPECSTR_TOWNNAME_LAST = SPECSTR_TOWNNAME_SWISS, - - // special strings for player names on the form "TownName transport". - SPECSTR_PLAYERNAME_START = 0x70EA, - SPECSTR_PLAYERNAME_ENGLISH = SPECSTR_PLAYERNAME_START, - SPECSTR_PLAYERNAME_FRENCH, - SPECSTR_PLAYERNAME_GERMAN, - SPECSTR_PLAYERNAME_AMERICAN, - SPECSTR_PLAYERNAME_LATIN, - SPECSTR_PLAYERNAME_SILLY, - SPECSTR_PLAYERNAME_LAST = SPECSTR_PLAYERNAME_SILLY, - - SPECSTR_ANDCO_NAME = 0x70E6, - SPECSTR_PRESIDENT_NAME = 0x70E7, - SPECSTR_SONGNAME = 0x70E8, - - // reserve 32 strings for the *.lng files - SPECSTR_LANGUAGE_START = 0x7100, - SPECSTR_LANGUAGE_END = 0x711f, - - // reserve 32 strings for various screen resolutions - SPECSTR_RESOLUTION_START = 0x7120, - SPECSTR_RESOLUTION_END = 0x713f, - - // reserve 32 strings for screenshot formats - SPECSTR_SCREENSHOT_START = 0x7140, - SPECSTR_SCREENSHOT_END = 0x715F, - - STR_SPEC_SCREENSHOT_NAME = 0xF800, - STR_SPEC_USERSTRING = 0xF801, -}; - -typedef void PlaceProc(uint tile); - -VARDEF byte _savegame_sort_order; - -#define INVALID_UINT_TILE (uint)0xFFFFFFFF -#define INVALID_STRING_ID 0xFFFF - -enum { - MAX_SCREEN_WIDTH = 2048, - MAX_SCREEN_HEIGHT = 1200, -}; - -/* In certain windows you navigate with the arrow keys. Do not scroll the - * gameview when here. Bitencoded variable that only allows scrolling if all - * elements are zero */ -enum { - SCROLL_CON = 0, - SCROLL_EDIT = 1, - SCROLL_SAVE = 2, - SCROLL_CHAT = 4, -}; -VARDEF byte _no_scroll; - -#include "functions.h" -#include "variables.h" - -#endif /* TTD_H */
deleted file mode 100644 --- a/ttd.rc +++ /dev/null @@ -1,158 +0,0 @@ -//Microsoft Developer Studio generated resource script. -// -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "resource.h" -#define APSTUDIO_HIDDEN_SYMBOLS -#include "windows.h" -#undef APSTUDIO_HIDDEN_SYMBOLS -#include "afxres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// Neutral (Default) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEUD) -#ifdef _WIN32 -LANGUAGE LANG_NEUTRAL, SUBLANG_DEFAULT -#pragma code_page(1252) -#endif //_WIN32 - -///////////////////////////////////////////////////////////////////////////// -// -// Icon -// - -// Icon with lowest ID value placed first to ensure application icon -// remains consistent on all systems. -100 ICON DISCARDABLE "openttd.ico" -101 ICON DISCARDABLE "mainicon.ico" - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -100 DIALOG DISCARDABLE 0, 0, 305, 70 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Fatal Application Failure" -FONT 8, "MS Sans Serif" -BEGIN - PUSHBUTTON "&Close",12,7,49,50,14 - PUSHBUTTON "&Submit report",14,81,49,68,14,WS_DISABLED - PUSHBUTTON "&Emergency save",13,155,49,68,14 - PUSHBUTTON "",15,243,49,55,14,WS_DISABLED - EDITTEXT 11,7,70,291,118,ES_MULTILINE | ES_READONLY | WS_VSCROLL | - WS_HSCROLL | NOT WS_TABSTOP - LTEXT "",10,36,7,262,34 - ICON 100,IDC_STATIC,9,9,20,20 -END - - -#ifndef _MAC -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 0,0,0,0 - PRODUCTVERSION 0,0,0,0 - FILEFLAGSMASK 0x3fL -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x4L - FILETYPE 0x1L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "000004b0" - BEGIN - VALUE "Comments", "This program is licensed under the GNU General Public License.\0" - VALUE "CompanyName", "OpenTTD Development Team\0" - VALUE "FileDescription", "OpenTTD\0" - VALUE "FileVersion", "0.0.0.0\0" - VALUE "InternalName", "openttd\0" - VALUE "LegalCopyright", "Copyright © OpenTTD Developers 2002-2005. All Rights Reserved.\0" - VALUE "LegalTrademarks", "\0" - VALUE "OriginalFilename", "openttd.exe\0" - VALUE "PrivateBuild", "\0" - VALUE "ProductName", "OpenTTD\0" - VALUE "ProductVersion", "0.0.0.0\0" - VALUE "SpecialBuild", "-\0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x0, 1200 - END -END - -#endif // !_MAC - -#endif // Neutral (Default) resources -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// Swedish resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_SVE) -#ifdef _WIN32 -LANGUAGE LANG_SWEDISH, SUBLANG_DEFAULT -#pragma code_page(1252) -#endif //_WIN32 - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE DISCARDABLE -BEGIN - "resrc1.h\0" -END - -2 TEXTINCLUDE DISCARDABLE -BEGIN - "#include ""resource.h""\r\n" - "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" - "#include ""windows.h""\r\n" - "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" - "#include ""winres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE DISCARDABLE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - -#endif // Swedish resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED -
deleted file mode 100644 --- a/ttd.sln +++ /dev/null @@ -1,43 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 8.00 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "strgen", "strgen\strgen.vcproj", "{A133A442-BD0A-4ADE-B117-AD7545E4BDD1}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ttd", "ttd.vcproj", "{668328A0-B40E-4CDB-BD72-D0064424414A}" - ProjectSection(ProjectDependencies) = postProject - {0F066B23-18DF-4284-8265-F4A5E7E3B966} = {0F066B23-18DF-4284-8265-F4A5E7E3B966} - {A133A442-BD0A-4ADE-B117-AD7545E4BDD1} = {A133A442-BD0A-4ADE-B117-AD7545E4BDD1} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "langs", "langs.vcproj", "{0F066B23-18DF-4284-8265-F4A5E7E3B966}" - ProjectSection(ProjectDependencies) = postProject - {A133A442-BD0A-4ADE-B117-AD7545E4BDD1} = {A133A442-BD0A-4ADE-B117-AD7545E4BDD1} - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfiguration) = preSolution - Debug = Debug - Release = Release - EndGlobalSection - GlobalSection(ProjectConfiguration) = postSolution - {A133A442-BD0A-4ADE-B117-AD7545E4BDD1}.Debug.ActiveCfg = Debug|Win32 - {A133A442-BD0A-4ADE-B117-AD7545E4BDD1}.Debug.Build.0 = Debug|Win32 - {A133A442-BD0A-4ADE-B117-AD7545E4BDD1}.Release.ActiveCfg = Debug|Win32 - {A133A442-BD0A-4ADE-B117-AD7545E4BDD1}.Release.Build.0 = Debug|Win32 - {668328A0-B40E-4CDB-BD72-D0064424414A}.Debug.ActiveCfg = Debug|Win32 - {668328A0-B40E-4CDB-BD72-D0064424414A}.Debug.Build.0 = Debug|Win32 - {668328A0-B40E-4CDB-BD72-D0064424414A}.Release.ActiveCfg = Release|Win32 - {668328A0-B40E-4CDB-BD72-D0064424414A}.Release.Build.0 = Release|Win32 - {0F066B23-18DF-4284-8265-F4A5E7E3B966}.Debug.ActiveCfg = Debug|Win32 - {0F066B23-18DF-4284-8265-F4A5E7E3B966}.Debug.Build.0 = Debug|Win32 - {0F066B23-18DF-4284-8265-F4A5E7E3B966}.Release.ActiveCfg = Debug|Win32 - {0F066B23-18DF-4284-8265-F4A5E7E3B966}.Release.Build.0 = Debug|Win32 - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - EndGlobalSection - GlobalSection(ExtensibilityAddIns) = postSolution - EndGlobalSection - GlobalSection(DPCodeReviewSolutionGUID) = preSolution - DPCodeReviewSolutionGUID = {00000000-0000-0000-0000-000000000000} - EndGlobalSection -EndGlobal
deleted file mode 100644 --- a/ttd.vcproj +++ /dev/null @@ -1,752 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="7.10" - Name="ttd" - SccProjectName="" - SccLocalPath=""> - <Platforms> - <Platform - Name="Win32"/> - </Platforms> - <Configurations> - <Configuration - Name="Release|Win32" - OutputDirectory=".\Release" - IntermediateDirectory=".\Release" - ConfigurationType="1" - UseOfMFC="0" - ATLMinimizesCRunTimeLibraryUsage="FALSE" - CharacterSet="2" - WholeProgramOptimization="TRUE"> - <Tool - Name="VCCLCompilerTool" - Optimization="3" - GlobalOptimizations="TRUE" - InlineFunctionExpansion="1" - EnableIntrinsicFunctions="TRUE" - FavorSizeOrSpeed="2" - OmitFramePointers="TRUE" - OptimizeForProcessor="1" - PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WIN32_EXCEPTION_TRACKER;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_ZLIB;WITH_PNG;ENABLE_NETWORK" - StringPooling="TRUE" - ExceptionHandling="FALSE" - RuntimeLibrary="4" - StructMemberAlignment="3" - BufferSecurityCheck="FALSE" - EnableFunctionLevelLinking="TRUE" - DefaultCharIsUnsigned="TRUE" - UsePrecompiledHeader="1" - PrecompiledHeaderThrough="stdafx.h" - PrecompiledHeaderFile=".\Release/ttd.pch" - AssemblerOutput="2" - AssemblerListingLocation=".\Release/" - ObjectFile=".\Release/" - ProgramDataBaseFileName=".\Release/" - BrowseInformation="1" - WarningLevel="3" - WarnAsError="TRUE" - SuppressStartupBanner="TRUE" - DebugInformationFormat="3" - CompileAs="1"/> - <Tool - Name="VCCustomBuildTool"/> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="winmm.lib ws2_32.lib libpng.lib zlibstat.lib" - OutputFile=".\Release/openttd.exe" - LinkIncremental="1" - SuppressStartupBanner="TRUE" - ProgramDatabaseFile=".\Release/ttd.pdb" - GenerateMapFile="TRUE" - MapFileName=".\Release/ttd.map" - SubSystem="2" - OptimizeReferences="2" - OptimizeForWindows98="1" - TargetMachine="1"/> - <Tool - Name="VCMIDLTool" - TypeLibraryName=".\Release/ttd.tlb" - HeaderFileName=""/> - <Tool - Name="VCPostBuildEventTool"/> - <Tool - Name="VCPreBuildEventTool"/> - <Tool - Name="VCPreLinkEventTool"/> - <Tool - Name="VCResourceCompilerTool" - PreprocessorDefinitions="NDEBUG" - Culture="1053"/> - <Tool - Name="VCWebServiceProxyGeneratorTool"/> - <Tool - Name="VCXMLDataGeneratorTool"/> - <Tool - Name="VCWebDeploymentTool"/> - <Tool - Name="VCManagedWrapperGeneratorTool"/> - <Tool - Name="VCAuxiliaryManagedWrapperGeneratorTool"/> - </Configuration> - <Configuration - Name="Debug|Win32" - OutputDirectory=".\Debug" - IntermediateDirectory=".\Debug" - ConfigurationType="1" - UseOfMFC="0" - ATLMinimizesCRunTimeLibraryUsage="FALSE" - CharacterSet="2"> - <Tool - Name="VCCLCompilerTool" - Optimization="0" - PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;WITH_ZLIB;WITH_PNG;ENABLE_NETWORK" - BasicRuntimeChecks="3" - RuntimeLibrary="5" - UsePrecompiledHeader="2" - PrecompiledHeaderThrough="stdafx.h" - PrecompiledHeaderFile=".\Debug/ttd.pch" - AssemblerListingLocation=".\Debug/" - ObjectFile=".\Debug/" - ProgramDataBaseFileName=".\Debug/" - WarningLevel="3" - WarnAsError="TRUE" - SuppressStartupBanner="TRUE" - Detect64BitPortabilityProblems="FALSE" - DebugInformationFormat="4" - CallingConvention="0" - CompileAs="1"/> - <Tool - Name="VCCustomBuildTool"/> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="winmm.lib ws2_32.lib libpng.lib zlibstat.lib" - OutputFile=".\Debug/openttd.exe" - LinkIncremental="0" - SuppressStartupBanner="TRUE" - GenerateDebugInformation="TRUE" - ProgramDatabaseFile=".\Debug/ttd.pdb" - SubSystem="2" - TargetMachine="1"/> - <Tool - Name="VCMIDLTool" - TypeLibraryName=".\Debug/ttd.tlb" - HeaderFileName=""/> - <Tool - Name="VCPostBuildEventTool"/> - <Tool - Name="VCPreBuildEventTool"/> - <Tool - Name="VCPreLinkEventTool"/> - <Tool - Name="VCResourceCompilerTool" - PreprocessorDefinitions="_DEBUG" - Culture="1053"/> - <Tool - Name="VCWebServiceProxyGeneratorTool"/> - <Tool - Name="VCXMLDataGeneratorTool"/> - <Tool - Name="VCWebDeploymentTool"/> - <Tool - Name="VCManagedWrapperGeneratorTool"/> - <Tool - Name="VCAuxiliaryManagedWrapperGeneratorTool"/> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="Source Files" - Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"> - <File - RelativePath="ai.c"> - </File> - <File - RelativePath=".\airport.c"> - </File> - <File - RelativePath=".\aystar.c"> - </File> - <File - RelativePath=".\callback_table.c"> - </File> - <File - RelativePath="command.c"> - </File> - <File - RelativePath=".\console.c"> - </File> - <File - RelativePath=".\console_cmds.c"> - </File> - <File - RelativePath=".\debug.c"> - </File> - <File - RelativePath=".\dedicated.c"> - </File> - <File - RelativePath=".\depot.c"> - </File> - <File - RelativePath="economy.c"> - </File> - <File - RelativePath="engine.c"> - </File> - <File - RelativePath="fileio.c"> - </File> - <File - RelativePath="gfx.c"> - </File> - <File - RelativePath="landscape.c"> - </File> - <File - RelativePath=".\map.c"> - </File> - <File - RelativePath=".\md5.c"> - </File> - <File - RelativePath="minilzo.c"> - <FileConfiguration - Name="Release|Win32"> - <Tool - Name="VCCLCompilerTool" - UsePrecompiledHeader="0"/> - </FileConfiguration> - </File> - <File - RelativePath="misc.c"> - </File> - <File - RelativePath=".\mixer.c"> - </File> - <File - RelativePath="namegen.c"> - </File> - <File - RelativePath="network.c"> - </File> - <File - RelativePath=".\network_client.c"> - </File> - <File - RelativePath=".\network_data.c"> - </File> - <File - RelativePath=".\network_gamelist.c"> - </File> - <File - RelativePath=".\network_server.c"> - </File> - <File - RelativePath=".\network_udp.c"> - </File> - <File - RelativePath=".\newgrf.c"> - </File> - <File - RelativePath=".\npf.c"> - </File> - <File - RelativePath="oldloader.c"> - </File> - <File - RelativePath="pathfind.c"> - </File> - <File - RelativePath="players.c"> - </File> - <File - RelativePath=".\pool.c"> - </File> - <File - RelativePath=".\queue.c"> - </File> - <File - RelativePath="saveload.c"> - </File> - <File - RelativePath=".\screenshot.c"> - </File> - <File - RelativePath="sdl.c"> - </File> - <File - RelativePath=".\settings.c"> - </File> - <File - RelativePath=".\signs.c"> - </File> - <File - RelativePath="sound.c"> - </File> - <File - RelativePath=".\sprite.c"> - </File> - <File - RelativePath="spritecache.c"> - </File> - <File - RelativePath="StdAfx.c"> - </File> - <File - RelativePath=".\string.c"> - </File> - <File - RelativePath="strings.c"> - </File> - <File - RelativePath="texteff.c"> - </File> - <File - RelativePath=".\tile.c"> - </File> - <File - RelativePath="ttd.c"> - </File> - <File - RelativePath="ttd.rc"> - </File> - <File - RelativePath="vehicle.c"> - </File> - <File - RelativePath="viewport.c"> - </File> - <File - RelativePath=".\w32dm.c"> - </File> - <File - RelativePath=".\w32dm2.cpp"> - <FileConfiguration - Name="Release|Win32"> - <Tool - Name="VCCLCompilerTool" - UsePrecompiledHeader="0" - CompileAs="2"/> - </FileConfiguration> - </File> - <File - RelativePath=".\waypoint.c"> - </File> - <File - RelativePath="widget.c"> - </File> - <File - RelativePath="win32.c"> - </File> - <File - RelativePath="window.c"> - </File> - </Filter> - <Filter - Name="Header Files" - Filter="h;hpp;hxx;hm;inl"> - <File - RelativePath=".\airport.h"> - </File> - <File - RelativePath=".\airport_movement.h"> - </File> - <File - RelativePath=".\aystar.h"> - </File> - <File - RelativePath="command.h"> - </File> - <File - RelativePath="console.h"> - </File> - <File - RelativePath="debug.h"> - </File> - <File - RelativePath="depot.h"> - </File> - <File - RelativePath="economy.h"> - </File> - <File - RelativePath="engine.h"> - </File> - <File - RelativePath="fileio.h"> - </File> - <File - RelativePath="functions.h"> - </File> - <File - RelativePath="gfx.h"> - </File> - <File - RelativePath="gui.h"> - </File> - <File - RelativePath="hal.h"> - </File> - <File - RelativePath="industry.h"> - </File> - <File - RelativePath="macros.h"> - </File> - <File - RelativePath=".\map.h"> - </File> - <File - RelativePath="md5.h"> - </File> - <File - RelativePath=".\mixer.h"> - </File> - <File - RelativePath=".\network.h"> - </File> - <File - RelativePath=".\network_client.h"> - </File> - <File - RelativePath=".\network_core.h"> - </File> - <File - RelativePath=".\network_data.h"> - </File> - <File - RelativePath=".\network_gamelist.h"> - </File> - <File - RelativePath=".\network_server.h"> - </File> - <File - RelativePath=".\network_udp.h"> - </File> - <File - RelativePath=".\newgrf.h"> - </File> - <File - RelativePath="news.h"> - </File> - <File - RelativePath=".\npf.h"> - </File> - <File - RelativePath="pathfind.h"> - </File> - <File - RelativePath="player.h"> - </File> - <File - RelativePath=".\pool.h"> - </File> - <File - RelativePath=".\queue.h"> - </File> - <File - RelativePath="saveload.h"> - </File> - <File - RelativePath=".\screenshot.h"> - </File> - <File - RelativePath=".\signs.h"> - </File> - <File - RelativePath="sound.h"> - </File> - <File - RelativePath=".\sprite.h"> - </File> - <File - RelativePath="station.h"> - </File> - <File - RelativePath="StdAfx.h"> - </File> - <File - RelativePath=".\tile.h"> - </File> - <File - RelativePath=".\town.h"> - </File> - <File - RelativePath="ttd.h"> - </File> - <File - RelativePath="variables.h"> - </File> - <File - RelativePath="vehicle.h"> - </File> - <File - RelativePath=".\vehicle_gui.h"> - </File> - <File - RelativePath="viewport.h"> - </File> - <File - RelativePath="waypoint.h"> - </File> - <File - RelativePath="window.h"> - </File> - </Filter> - <Filter - Name="Gui Source codes" - Filter=""> - <File - RelativePath="aircraft_gui.c"> - </File> - <File - RelativePath="airport_gui.c"> - </File> - <File - RelativePath="bridge_gui.c"> - </File> - <File - RelativePath="dock_gui.c"> - </File> - <File - RelativePath="engine_gui.c"> - </File> - <File - RelativePath="graph_gui.c"> - </File> - <File - RelativePath="industry_gui.c"> - </File> - <File - RelativePath="intro_gui.c"> - </File> - <File - RelativePath="main_gui.c"> - </File> - <File - RelativePath="misc_gui.c"> - </File> - <File - RelativePath="music_gui.c"> - </File> - <File - RelativePath=".\network_gui.c"> - </File> - <File - RelativePath="news_gui.c"> - </File> - <File - RelativePath="order_gui.c"> - </File> - <File - RelativePath="player_gui.c"> - </File> - <File - RelativePath="rail_gui.c"> - </File> - <File - RelativePath="road_gui.c"> - </File> - <File - RelativePath="roadveh_gui.c"> - </File> - <File - RelativePath="settings_gui.c"> - </File> - <File - RelativePath="ship_gui.c"> - </File> - <File - RelativePath="smallmap_gui.c"> - </File> - <File - RelativePath="station_gui.c"> - </File> - <File - RelativePath="subsidy_gui.c"> - </File> - <File - RelativePath=".\terraform_gui.c"> - </File> - <File - RelativePath="town_gui.c"> - </File> - <File - RelativePath="train_gui.c"> - </File> - <File - RelativePath=".\vehicle_gui.c"> - </File> - </Filter> - <Filter - Name="Landscape" - Filter=""> - <File - RelativePath="aircraft_cmd.c"> - </File> - <File - RelativePath="clear_cmd.c"> - </File> - <File - RelativePath="disaster_cmd.c"> - </File> - <File - RelativePath="dummy_land.c"> - </File> - <File - RelativePath="industry_cmd.c"> - </File> - <File - RelativePath="misc_cmd.c"> - </File> - <File - RelativePath="order_cmd.c"> - </File> - <File - RelativePath="rail_cmd.c"> - </File> - <File - RelativePath="road_cmd.c"> - </File> - <File - RelativePath="roadveh_cmd.c"> - </File> - <File - RelativePath="ship_cmd.c"> - </File> - <File - RelativePath="station_cmd.c"> - </File> - <File - RelativePath="town_cmd.c"> - </File> - <File - RelativePath="train_cmd.c"> - </File> - <File - RelativePath="tree_cmd.c"> - </File> - <File - RelativePath="tunnelbridge_cmd.c"> - </File> - <File - RelativePath="unmovable_cmd.c"> - </File> - <File - RelativePath="water_cmd.c"> - </File> - </Filter> - <Filter - Name="Tables" - Filter=""> - <File - RelativePath="table\ai_rail.h"> - </File> - <File - RelativePath="table\allstrings.h"> - </File> - <File - RelativePath=".\table\animcursors.h"> - </File> - <File - RelativePath=".\table\autorail.h"> - </File> - <File - RelativePath="table\build_industry.h"> - </File> - <File - RelativePath="table\clear_land.h"> - </File> - <File - RelativePath="table\engines.h"> - </File> - <File - RelativePath="table\genland.h"> - </File> - <File - RelativePath="table\industry_land.h"> - </File> - <File - RelativePath="table\landscape_const.h"> - </File> - <File - RelativePath="table\landscape_sprite.h"> - </File> - <File - RelativePath=".\table\namegen.h"> - </File> - <File - RelativePath="table\palettes.h"> - </File> - <File - RelativePath="table\road_land.h"> - </File> - <File - RelativePath="table\roadveh.h"> - </File> - <File - RelativePath=".\table\sprites.h"> - </File> - <File - RelativePath="table\station_land.h"> - </File> - <File - RelativePath="table\strings.h"> - </File> - <File - RelativePath=".\table\town_land.h"> - </File> - <File - RelativePath="table\track_land.h"> - </File> - <File - RelativePath="table\train_cmd.h"> - </File> - <File - RelativePath="table\tree_land.h"> - </File> - <File - RelativePath="table\tunnel_land.h"> - </File> - <File - RelativePath="table\unmovable_land.h"> - </File> - <File - RelativePath="table\water_land.h"> - </File> - </Filter> - <Filter - Name="AI Files" - Filter=""> - <File - RelativePath=".\ai.h"> - </File> - <File - RelativePath=".\ai_build.c"> - </File> - <File - RelativePath=".\ai_new.c"> - </File> - <File - RelativePath=".\ai_pathfinder.c"> - </File> - <File - RelativePath=".\ai_shared.c"> - </File> - </Filter> - <File - RelativePath="icon1.ico"> - </File> - <File - RelativePath="mainicon.ico"> - </File> - <File - RelativePath="ReadMe.txt"> - </File> - </Files> - <Globals> - </Globals> -</VisualStudioProject>
--- a/tunnelbridge_cmd.c +++ b/tunnelbridge_cmd.c @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "ttd.h" +#include "openttd.h" #include "table/sprites.h" #include "table/strings.h" #include "map.h"
--- a/unmovable_cmd.c +++ b/unmovable_cmd.c @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "ttd.h" +#include "openttd.h" #include "table/strings.h" #include "map.h" #include "tile.h"
--- a/vehicle.c +++ b/vehicle.c @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "ttd.h" +#include "openttd.h" #include "spritecache.h" #include "table/sprites.h" #include "table/strings.h"
--- a/vehicle_gui.c +++ b/vehicle_gui.c @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "ttd.h" +#include "openttd.h" #include "debug.h" #include "strings.h" #include "table/sprites.h"
--- a/viewport.c +++ b/viewport.c @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "ttd.h" +#include "openttd.h" #include "debug.h" #include "spritecache.h" #include "strings.h"
--- a/w32dm.c +++ b/w32dm.c @@ -28,7 +28,7 @@ #ifdef WIN32_ENABLE_DIRECTMUSIC_SUPPORT -#include "ttd.h" +#include "openttd.h" #include "string.h" #include "sound.h" #include "hal.h"
--- a/w32dm2.cpp +++ b/w32dm2.cpp @@ -37,7 +37,7 @@ extern "C" { #endif -#include "ttd.h" +#include "openttd.h" #include "debug.h" #include "sound.h" #include "hal.h"
--- a/water_cmd.c +++ b/water_cmd.c @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "ttd.h" +#include "openttd.h" #include "table/sprites.h" #include "table/strings.h" #include "map.h"
--- a/waypoint.c +++ b/waypoint.c @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "ttd.h" +#include "openttd.h" #include "command.h" #include "gfx.h"
--- a/widget.c +++ b/widget.c @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "ttd.h" +#include "openttd.h" #include "table/sprites.h" #include "table/strings.h" #include "window.h"