Changeset - r222:4409829eb08f
[Not reviewed]
master
1 39 0
darkvater - 20 years ago 2004-09-12 21:49:38
darkvater@openttd.org
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
-CodeLayout: Remove trailing spaces and Windows linebreaks
40 files changed with 717 insertions and 721 deletions:
0 comments (0 inline, 0 general)
Jamfile.next
Show inline comments
 
@@ -9,13 +9,13 @@ CFILES = 	ai.c aircraft_cmd.c aircraft_g
 
	road_gui.c roadveh_cmd.c roadveh_gui.c saveload.c sdl.c
 
	settings.c settings_gui.c ship_cmd.c ship_gui.c smallmap_gui.c
 
	sound.c spritecache.c station_cmd.c station_gui.c
 
	strings.c subsidy_gui.c texteff.c town_cmd.c town_gui.c
 
	train_cmd.c train_gui.c tree_cmd.c ttd.c
 
	tunnelbridge_cmd.c unmovable_cmd.c vehicle.c
 
	viewport.c water_cmd.c widget.c window.c screenshot.c 
 
	viewport.c water_cmd.c widget.c window.c screenshot.c
 
	airport.c grfspecial.c terraform_gui.c ;
 

	
 

	
 
LANGFILES = english.txt swedish.txt french.txt german.txt italian.txt slovak.txt hungarian.txt norwegian.txt danish.txt czech.txt galician.txt polish.txt;
 

	
 
####################
 
@@ -25,16 +25,16 @@ if $(UNIX) {
 
	SDL_CONFIG_CFLAGS = `XX_SDL_CONFIG_PLACEHOLDER_XX --cflags` ;
 
	SDL_CONFIG_LIBS = `XX_SDL_CONFIG_PLACEHOLDER_XX --libs` ;
 

	
 
	LINKFLAGS += $(SDL_CONFIG_LIBS) ;
 
	CC = gcc ;
 
	CCFLAGS += -Wall -Wno-multichar -DUNIX -DWITH_SDL ;
 
	
 

	
 
	OPTIMFLAGS = -O2 -fomit-frame-pointer ;
 
	DEBUGFLAGS = -g ;
 
	
 

	
 
# also include extmidi
 
	CFILES += extmidi.c unix.c ;
 

	
 
# compile in PNG support?
 
	if $(WITH_PNG) {
 
		CCFLAGS += -DWITH_PNG -I$(WITH_PNG) ;
 
@@ -61,26 +61,26 @@ if $(UNIX) {
 

	
 
####################
 
# MSVC on Win32
 
####################
 

	
 
actions ActWin32Res {
 
	$(VISUALC)\\..\\common\\msdev98\\bin\\rc /r /i $(STDHDRS) /fo $(<) $(>) 
 
	$(VISUALC)\\..\\common\\msdev98\\bin\\rc /r /i $(STDHDRS) /fo $(<) $(>)
 
}
 

	
 
rule Win32Res { ActWin32Res $(<) : $(>) ; DEPENDS $(<) : $(>) ; }
 

	
 
if $(TOOLSET) = VISUALC {
 
	OPTIMFLAGS = /Oa /Os /Ow /Oy /Oi /Og /Ox /Gr /Gf /Gy /Zp4 /J	/WX /W3 -DNDEBUG ;
 

	
 
	CCFLAGS += -DWIN32 -DWIN32_EXCEPTION_TRACKER ;
 
	CFILES += win32.c ;	
 
	CFILES += win32.c ;
 
	LINKFLAGS += /opt:nowin98 /LIBPATH:$(VISUALC)\\lib ;
 
	
 

	
 
	LINKLIBS = ws2_32.lib winmm.lib user32.lib gdi32.lib ;
 
		
 

	
 
# compile resources too
 
	EOBJ = ttd.res ;
 
	Win32Res ttd.res : ttd.rc ;
 

	
 
# png screenshots?
 
	if $(WITH_PNG) {
 
@@ -90,13 +90,13 @@ if $(TOOLSET) = VISUALC {
 

	
 
# zlib savegames?
 
	if $(WITH_ZLIB) {
 
		CCFLAGS += -DWITH_ZLIB ;
 
		LINKLIBS += zlibstat.lib ;
 
	}
 
	
 

	
 
# build release by default
 
	RELEASE = 1 ;
 
}
 

	
 

	
 
####################
 
@@ -104,13 +104,13 @@ if $(TOOLSET) = VISUALC {
 
####################
 
rule MyObjects {
 
	local _i _t _s ;
 

	
 
	_t = $(OUTDIR)/$(>:S=$(SUFOBJ)) ;
 
	OPTIM on $(_t) = $(3) ;
 
	
 

	
 
	MkDir $(OUTDIR) ;
 
	Depends $(_t) : $(OUTDIR) ;
 

	
 
	for _i in $(>) {
 
		_s = $(OUTDIR)/$(_i:S=$(SUFOBJ)) ;
 
		Object $(_s) : $(_i) ;
 
@@ -139,13 +139,13 @@ rule LangFile {
 
	if $(>) = lang/english.txt {
 
		CompileLang $(<) table/strings.h : ;
 
		DEPENDS table/string.h : $(>) ;
 
	} else {
 
		CompileLang $(<) : $(>) ;
 
	}
 
	
 

	
 
	Clean clean : $(<) ;
 
	DEPENDS $(<) : $(>) ;
 
	DEPENDS all : $(<) ;
 
	DEPENDS $(<) : strgen/strgen ;
 
}
 

	
Makefile
Show inline comments
 
@@ -56,18 +56,18 @@
 
# PROFILE: build in profile mode, disables -s and -fomit-frame-pointer
 
# DISPLAY_WARNINGS: when off, some errors are not displayed while compiling
 
# TRANSLATOR: build in translator mode (untranslated strings are prepended by
 
#             a <TODO> mark)
 
# RELEASE: this will be the released version number. It replaces all places
 
#          where it normally would print the revision number
 
# MIDI: if set, it will use it as custom path to midi player. 
 
# MIDI: if set, it will use it as custom path to midi player.
 
#  If unset, it will use the hardcoded path in the c code
 
# NOVERBOSE: supress all warnings and errors during compilation. 
 
# NOVERBOSE: supress all warnings and errors during compilation.
 
#  It looks nicer, but you will not know what went wrong. Use it on released (stable) sources only
 
#
 
# DATA_DIR_PREFIX: This sets the dir OpenTTD looks for the needed files. 
 
# DATA_DIR_PREFIX: This sets the dir OpenTTD looks for the needed files.
 
#   MUST END WITH / if defined
 
#
 
# STATIC: link statically
 
# CYGWIN: build in Cygwin environment
 
# MINGW: build with MingW compiler, link with MingW libraries
 
#
 
@@ -131,20 +131,20 @@ ENABLE_NETWORK:=1   # sets network on by
 
-include $(LIB_DETECTION)
 
endif
 

	
 
# Verbose filter
 

	
 
ifdef NOVERBOSE
 
VERBOSE_FILTER =  >/dev/null 2>&1 
 
VERBOSE_FILTER =  >/dev/null 2>&1
 
else
 
VERBOSE_FILTER = 
 
VERBOSE_FILTER =
 
endif
 

	
 
ifdef DISPLAY_WARNINGS
 
WARNING_DISPLAY:=-fstrict-aliasing
 
VERBOSE_FILTER =  
 
VERBOSE_FILTER =
 
else
 
WARNING_DISPLAY:=-fno-strict-aliasing
 
endif
 

	
 
ifdef SUPRESS_LANG_ERRORS
 
ifndef VERBOSE_FILTER
 
@@ -514,20 +514,20 @@ OSX:=OSX
 
endif
 

	
 

	
 
all: endian.h $(UPDATECONFIG) $(TTD) $(OSX) $(endwarnings)
 

	
 
endian.h: $(ENDIAN_CHECK)
 
	@# Check if system is LITTLE_ENDIAN or BIG_ENDIAN 
 
	@# Check if system is LITTLE_ENDIAN or BIG_ENDIAN
 
	@echo 'Running endian_check'; \
 
		./$(ENDIAN_CHECK) > $@
 

	
 
$(ENDIAN_CHECK): endian_check.c
 
	@echo 'Compiling and Linking $@'; \
 
		$(CC) $(BASECFLAGS) $(CDEFS) endian_check.c -o $@
 
	
 

	
 

	
 
$(TTD): table/strings.h $(ttd_OBJS) $(LANGS) $(MAKE_CONFIG)
 
	@echo 'Compiling and Linking $@'; \
 
		$(C_LINK) $@ $(TTDLDFLAGS) $(ttd_OBJS) $(LIBS) $(VERBOSE_FILTER)
 

	
 
$(OSX):
 
@@ -552,13 +552,13 @@ endian.h: $(ENDIAN_CHECK)
 
	@echo 'Compiling and Linking $@'; \
 
		$(CC) $(BASECFLAGS) $(CDEFS) -o $@ $^ $(VERBOSE_FILTER)
 

	
 
lang/english.lng: lang/english.txt $(STRGEN)
 
	@echo 'Generating $@'; \
 
	$(STRGEN)
 
	
 

	
 
table/strings.h: lang/english.lng
 

	
 
lang/%.lng: lang/%.txt $(STRGEN)
 
	@echo 'Generating $@'; \
 
	$(STRGEN) $(STRGEN_FLAGS) $< $(VERBOSE_FILTER) $(LANG_ERRORS)
 

	
 
@@ -618,13 +618,13 @@ love:
 

	
 
.PHONY: clean all $(OSX) install $(64_bit_warnings) $(endwarnings) love
 

	
 

	
 
### Automatic configuration
 
-include $(CONFIG_WRITER)
 
	
 

	
 

	
 
# Export all variables set to subprocesses (a bit dirty)
 
.EXPORT_ALL_VARIABLES:
 
upgradeconf: $(MAKE_CONFIG)
 
	rm $(MAKE_CONFIG)
 
	$(MAKE) $(MAKE_CONFIG)
airport.c
Show inline comments
 
@@ -85,13 +85,13 @@ static void AirportFTAClass_Constructor(
 
	Airport->nofterminals = nofterminals;
 
	Airport->nofterminalgroups = nofterminalgroups;
 
	Airport->nofhelipads = nofhelipads;
 
	Airport->nofhelipadgroups = nofhelipadgroups;
 
	Airport->acc_planes = acc_planes;
 
	Airport->entry_point = entry_point;
 
	Airport->airport_depots = (uint16*)depots;
 
	Airport->airport_depots = (const uint16*)depots;
 

	
 

	
 
	// build the state machine
 
	AirportBuildAutomata(Airport, FA);
 
		DEBUG(misc, 1) ("#Elements %2d; #Terminals %2d in %d group(s); #Helipads %2d in %d group(s)", Airport->nofelements,
 
				  Airport->nofterminals, Airport->nofterminalgroups, Airport->nofhelipads, Airport->nofhelipadgroups);
airport.h
Show inline comments
 
@@ -22,21 +22,21 @@ enum {
 
	ALL = 1,
 
	HELICOPTERS_ONLY = 2
 
};
 

	
 
// Finite sTate mAchine --> FTA
 
typedef struct AirportFTAClass {
 
	byte nofelements;						// number of positions the airport consists of
 
	byte nofterminals;					// number of terminals this airport has
 
	byte nofterminalgroups;			// terminals belong to so many groups (MAX is the nofterminals)
 
	byte nofhelipads;						// number of helipads this airport has
 
	byte nofhelipadgroups;			// helipads belong to so many groups (MAX is the nofhelipads)
 
	byte entry_point;						// when an airplane arrives at this airport, enter it at position entry_point
 
	byte acc_planes;						// accept airplanes or helicopters or both
 
	uint16 *airport_depots;			// gives the position of the depots on the airports
 
	struct AirportFTA *layout;	// state machine for airport
 
	byte nofelements;							// number of positions the airport consists of
 
	byte nofterminals;						// number of terminals this airport has
 
	byte nofterminalgroups;				// terminals belong to so many groups (MAX is the nofterminals)
 
	byte nofhelipads;							// number of helipads this airport has
 
	byte nofhelipadgroups;				// helipads belong to so many groups (MAX is the nofhelipads)
 
	byte entry_point;							// when an airplane arrives at this airport, enter it at position entry_point
 
	byte acc_planes;							// accept airplanes or helicopters or both
 
	const uint16 *airport_depots;	// gives the position of the depots on the airports
 
	struct AirportFTA *layout;		// state machine for airport
 
} AirportFTAClass;
 

	
 
// internal structure used in openttd - Finite sTate mAchine --> FTA
 
typedef struct AirportFTA {
 
	byte position;										// the position that an airplane is at
 
	byte next_position;								// next position from this position
changelog.txt
Show inline comments
 
@@ -2,13 +2,13 @@ 0.3.3 (2004-07-13)
 
------------------------------------------------------------------------
 

	
 
- Feature: (MorphOS/AmigaOS) network support
 
- Feature: improved german town name generator
 
- Change: scenarios now have the file extension .scn
 
- Fix: removing and upgrading tracks under a bridge when a train is on the bridge
 
- Change: default network port from 12345 (known trojan) to 3979 
 
- Change: default network port from 12345 (known trojan) to 3979
 
- Fix: pause button was not synched in network games
 
- Fix: crash caused by invalid screen resolutions
 
- Fix: AI can not build tubular bridges in 1950, etc. Same restrictions apply to it, as to human players.
 
- Feature: transparent station signs
 
- Feature: show total cargo per wagon type in train details window
 
- Fix: volume, liters, was x100, should be x1000
 
@@ -26,13 +26,13 @@ 0.3.3 (2004-07-13)
 
- Fix Game crashes when you hit the build rail button
 
- Fix: some scenarios had a max_railtype of 0
 
- Fix: Bribe Autorithy. A failed attempt to bribe is now also stored in savegame
 
- Fix: 80% CPU load paused in fast-forward
 
- Feature: Enabled 'remove' button for stations
 
- Feature: Cheat GUI (activate with crtl-alt-c) The game remembers if you have used a cheat
 
- Fix: Some airport runways were treated 
 
- Fix: Some airport runways were treated
 
- Fix: minor minimap glitch
 
- Fix: station sorting scroll fails with not ennough stations
 
- Fix: desert ground for depots in the desert
 
- Feature: station sort implemented using qsort()
 
- Feature: station list shows #of stations owned by player
 
- Fix: trains could run on wrong track type under bridges
 
@@ -55,13 +55,13 @@ 0.3.3 (2004-07-13)
 
- Fix: fast forward button in scenario editor
 
- Change: screenshots are saved to PERSONAL_DIR (unix)
 
- Fix: screenshot hotkey does not function in scenario editor
 
- Fix: allow deleting a bridge if a vehicle is below
 
- Fix: crash loading a scenario
 
- Fix: build tracks on water
 
- Fix: fast forward button pressed with tab 
 
- Fix: fast forward button pressed with tab
 
- Fix: vehicles don't get old
 
- Feature: realistic train reversing
 
- Feature: added support for 64 bit CPUs
 
- Fix: finance bug with some original scenarios
 
- Feature: added water quantity level "very low", which is the default for easy mode now
 
- Fix: 'Stopped' is shown when train is stopping and 'Reverse' is clicked
console.c
Show inline comments
 
@@ -204,15 +204,15 @@ void IConsoleInit()
 
	for (i=0;i<80;i++) {
 
		_iconsole_buffer[i]=NULL;
 
		_iconsole_cbuffer[i]=0;
 
		}
 
	IConsoleStdLibRegister();
 
	#if defined(WITH_REV)
 
	IConsolePrintF(13,"OpenTTD Game Console Revision 3 - %s",_openttd_revision);
 
	IConsolePrintF(13,"OpenTTD Game Console Revision 4 - %s",_openttd_revision);
 
	#else
 
	IConsolePrint(13,"OpenTTD Game Console Revision 3");
 
	IConsolePrint(13,"OpenTTD Game Console Revision 4");
 
	#endif
 
	IConsolePrint(12,"---------------------------------");
 
	IConsolePrint(12,"use \"help\" for more info");
 
	IConsolePrint(12,"");
 
	IConsoleClearCommand();
 
	IConsoleCmdBufferAdd("");
 
@@ -266,22 +266,22 @@ void IConsoleClose()
 

	
 
void IConsoleOpen()
 
{
 
	if (_iconsole_mode==ICONSOLE_CLOSED) IConsoleSwitch();
 
}
 

	
 
void IConsoleCmdBufferAdd(byte * cmd)
 
void IConsoleCmdBufferAdd(const byte * cmd)
 
{
 
	int i;
 
	if (_iconsole_cmdbufferpos != 19) return;
 
	if (_iconsole_cmdbuffer[18]!=NULL) free(_iconsole_cmdbuffer[18]);
 
	for (i=18; i>0; i--) _iconsole_cmdbuffer[i]=_iconsole_cmdbuffer[i-1];
 
	i=strlen((char *)cmd);
 
	i=strlen(cmd);
 
	_iconsole_cmdbuffer[0]=malloc(i+1);
 
	memset(((void *)_iconsole_cmdbuffer[0]),0,i+1);
 
	memcpy(((void *)_iconsole_cmdbuffer[0]),(void *)cmd,i);
 
	memcpy(((void *)_iconsole_cmdbuffer[0]),cmd,i);
 
	_iconsole_cmdbuffer[0][i]=0;
 
	_iconsole_cmdbufferpos = 19;
 
}
 

	
 
void IConsoleCmdBufferNavigate(signed char direction)
 
{
 
@@ -300,24 +300,24 @@ void IConsoleCmdBufferNavigate(signed ch
 
	_iconsole_cmdbufferpos = i;
 
	IConsoleClearCommand();
 
	memcpy((void *)_iconsole_cmdline,(void *)_iconsole_cmdbuffer[i],strlen(_iconsole_cmdbuffer[i]));
 
	_iconsole_cmdpos =strlen(_iconsole_cmdbuffer[i]);
 
}
 

	
 
void IConsolePrint(byte color_code, byte* string)
 
void IConsolePrint(byte color_code, const byte* string)
 
{
 
	byte * _ex;
 
	byte * _new;
 
	byte _exc;
 
	byte _newc;
 
	int i,j;
 

	
 
	if (!_iconsole_inited) return;
 

	
 
	_newc=color_code;
 
	i=strlen((char *)string);
 
	i=strlen(string);
 
	_new=malloc(i+1);
 
	memset(_new,0,i+1);
 
	memcpy(_new,string,i);
 

	
 
	for (j=0;j<i;j++) {
 
		if (_new[j]<0x1F) _new[j]=0x20;
 
@@ -351,28 +351,28 @@ void CDECL IConsolePrintF(byte color_cod
 

	
 
void IConsoleDebug(byte* string)
 
{
 
	if (_stdlib_developer>1) IConsolePrintF(_iconsole_color_debug, "DEBUG: %s", string);
 
}
 

	
 
void IConsoleError(byte* string)
 
void IConsoleError(const byte* string)
 
{
 
	if (_stdlib_developer>0) IConsolePrintF(_iconsole_color_error, "ERROR: %s", string);
 
}
 

	
 
void IConsoleCmdRegister(byte * name, void * addr)
 
void IConsoleCmdRegister(const byte * name, void * addr)
 
{
 
	byte * _new;
 
	_iconsole_cmd * item;
 
	_iconsole_cmd * item_new;
 
	int i;
 

	
 
		i=strlen((char *)name);
 
		_new=malloc(i+1);
 
		memset(_new,0,i+1);
 
		memcpy(_new,name,i);
 
	i=strlen(name);
 
	_new=malloc(i+1);
 
	memset(_new,0,i+1);
 
	memcpy(_new,name,i);
 

	
 
	item_new = malloc(sizeof(_iconsole_cmd));
 

	
 
	item_new->_next = NULL;
 
	item_new->addr  = addr;
 
	item_new->name  = _new;
 
@@ -387,36 +387,36 @@ void IConsoleCmdRegister(byte * name, vo
 
		} else {
 
		while (item->_next != NULL) { item = item->_next; };
 
		item->_next = item_new;
 
		}
 
}
 

	
 
void* IConsoleCmdGet(byte * name)
 
void* IConsoleCmdGet(const byte * name)
 
{
 
	_iconsole_cmd * item;
 

	
 
	item = _iconsole_cmds;
 
	while (item != NULL) {
 
		if (strcmp(item->name,name)==0) return item;
 
		item = item->_next;
 
		}
 
	return NULL;
 
}
 

	
 
void IConsoleVarRegister(byte * name, void * addr, byte type)
 
void IConsoleVarRegister(const byte * name, void * addr, byte type)
 
{
 
	byte * _new;
 
	_iconsole_var * item;
 
	_iconsole_var * item_new;
 
	int i;
 

	
 
		i=strlen((char *)name)+1;
 
		_new=malloc(i+1);
 
		memset(_new,0,i+1);
 
		_new[0]='*';
 
		memcpy(_new+1,name,i);
 
	i=strlen(name)+1;
 
	_new=malloc(i+1);
 
	memset(_new,0,i+1);
 
	_new[0]='*';
 
	memcpy(_new+1,name,i);
 

	
 
	item_new = malloc(sizeof(_iconsole_var));
 

	
 
	item_new->_next = NULL;
 
	item_new->addr  = addr;
 
	item_new->name  = _new;
 
@@ -433,37 +433,37 @@ void IConsoleVarRegister(byte * name, vo
 
		} else {
 
		while (item->_next != NULL) { item = item->_next; };
 
		item->_next = item_new;
 
		}
 
}
 

	
 
void IConsoleVarMemRegister(byte * name, byte type)
 
void IConsoleVarMemRegister(byte * name, byte type) /* XXX TRON */
 
{
 
	_iconsole_var * item;
 
	item = IConsoleVarAlloc(type);
 
	IConsoleVarInsert(item,name);
 
}
 

	
 

	
 
void IConsoleVarInsert(_iconsole_var * var, byte * name)
 
void IConsoleVarInsert(_iconsole_var * var, const byte * name)
 
{
 
	byte * _new;
 
	_iconsole_var * item;
 
	_iconsole_var * item_new;
 
	int i;
 

	
 
	item_new = var;
 

	
 
	// dont allow to build variable rings
 
	if (item_new->_next != NULL) return;
 

	
 
		i=strlen((char *)name)+1;
 
		_new=malloc(i+1);
 
		memset(_new,0,i+1);
 
		_new[0]='*';
 
		memcpy(_new+1,name,i);
 
	i=strlen(name)+1;
 
	_new=malloc(i+1);
 
	memset(_new,0,i+1);
 
	_new[0]='*';
 
	memcpy(_new+1,name,i);
 

	
 
	item_new->name  = _new;
 

	
 
	item = _iconsole_vars;
 
	if (item == NULL) {
 
		_iconsole_vars = item_new;
 
@@ -471,13 +471,13 @@ void IConsoleVarInsert(_iconsole_var * v
 
		while (item->_next != NULL) { item = item->_next; };
 
		item->_next = item_new;
 
	}
 
}
 

	
 

	
 
_iconsole_var * IConsoleVarGet(byte * name)
 
_iconsole_var * IConsoleVarGet(const byte * name)
 
{
 
	_iconsole_var * item;
 

	
 
	item = _iconsole_vars;
 
	while (item != NULL) {
 
		if (strcmp(item->name,name)==0) return item;
 
@@ -548,74 +548,61 @@ void IConsoleVarInsert(_iconsole_var * v
 
	return item;
 
}
 

	
 

	
 
void IConsoleVarFree(_iconsole_var * var)
 
{
 
	if (var ->_malloc) {
 
		free(var ->addr);
 
		}
 
	if (var->_malloc)
 
		free(var->addr);
 
	free(var);
 
}
 

	
 
void IConsoleVarSetString(_iconsole_var * var, byte * string)
 
void IConsoleVarSetString(_iconsole_var * var, const byte * string)
 
{
 
	int l;
 

	
 
	if (string == NULL) return;
 

	
 
	if (var->_malloc) {
 
		free(var->addr);
 
		}
 

	
 
	l=strlen((char *) string);
 
	l=strlen(string);
 
	var->addr=malloc(l+1);
 
	var->_malloc=true;
 
	memset(var->addr,0,l);
 
	memcpy((void *) var->addr,(void *) string, l);
 
	memcpy(var->addr, string, l);
 
	((byte *)var->addr)[l]=0;
 
	}
 
}
 

	
 
	void IConsoleVarSetValue(_iconsole_var * var, int value) {
 
void IConsoleVarSetValue(_iconsole_var * var, int value) {
 
	switch (var->type) {
 
			case ICONSOLE_VAR_BOOLEAN:
 
					{
 
					(*(bool *)var->addr)=(value!=0);
 
					}
 
					*(bool *)var->addr = (value != 0);
 
					break;
 
			case ICONSOLE_VAR_BYTE:
 
					{
 
					(*(byte *)var->addr)=value;
 
					}
 
					*(byte *)var->addr = value;
 
					break;
 
			case ICONSOLE_VAR_UINT16:
 
					{
 
					(*(unsigned short *)var->addr)=value;
 
					}
 
					*(unsigned short *)var->addr = value;
 
					break;
 
			case ICONSOLE_VAR_UINT32:
 
					{
 
					(*(unsigned int *)var->addr)=value;
 
					}
 
					*(unsigned int *)var->addr = value;
 
					break;
 
			case ICONSOLE_VAR_INT16:
 
					{
 
					(*(signed short *)var->addr)=value;
 
					}
 
					*(signed short *)var->addr = value;
 
					break;
 
			case ICONSOLE_VAR_INT32:
 
					{
 
					(*(signed int *)var->addr)=value;
 
					}
 
					*(signed int *)var->addr = value;
 
					break;
 
			default:
 
					break;
 
			}
 
	}
 
}
 

	
 
void IConsoleVarDump(_iconsole_var * var, byte * dump_desc)
 
void IConsoleVarDump(_iconsole_var * var, const byte * dump_desc)
 
{
 
	byte var_b; // TYPE BYTE
 
	unsigned short var_ui16; // TYPE UINT16
 
	unsigned int var_ui32; // TYPE UINT32
 
	signed short var_i16; // TYPE INT16
 
	signed int var_i32; // TYPE INT32
 
@@ -683,13 +670,13 @@ void IConsoleVarDump(_iconsole_var * var
 
}
 

	
 
// * ************************* * //
 
// * hooking code              * //
 
// * ************************* * //
 

	
 
void IConsoleVarHook(byte * name, byte type, void * proc)
 
void IConsoleVarHook(const byte * name, byte type, void * proc)
 
{
 
	_iconsole_var * hook_var;
 
	hook_var = IConsoleVarGet(name);
 
	if (hook_var == NULL) return;
 
	switch (type) {
 
	case ICONSOLE_HOOK_BEFORE_CHANGE:
 
@@ -703,29 +690,30 @@ void IConsoleVarHook(byte * name, byte t
 
		break;
 
	}
 
}
 

	
 
bool IConsoleVarHookHandle(_iconsole_var * hook_var, byte type)
 
{
 
	bool (*proc)(_iconsole_var * hook_var);
 
	bool (*proc)(_iconsole_var * hook_var) = NULL;
 
	switch (type) {
 
	case ICONSOLE_HOOK_BEFORE_CHANGE:
 
		proc = hook_var->hook_before_change;
 
		break;
 
	case ICONSOLE_HOOK_AFTER_CHANGE:
 
		proc = hook_var->hook_after_change;
 
		break;
 
	case ICONSOLE_HOOK_ACCESS:
 
		proc = hook_var->hook_access;
 
		break;
 
	default: return true;
 
	}
 
	if (proc == NULL) return true;
 

	
 
	return proc(hook_var);
 
}
 

	
 
void IConsoleCmdHook(byte * name, byte type, void * proc)
 
void IConsoleCmdHook(const byte * name, byte type, void * proc)
 
{
 
	_iconsole_cmd * hook_cmd;
 
	hook_cmd = IConsoleCmdGet(name);
 
	if (hook_cmd == NULL) return;
 
	switch (type) {
 
	case ICONSOLE_HOOK_AFTER_EXEC:
 
@@ -750,12 +738,15 @@ bool IConsoleCmdHookHandle(_iconsole_cmd
 
	case ICONSOLE_HOOK_BEFORE_EXEC:
 
		proc = hook_cmd->hook_before_exec;
 
		break;
 
	case ICONSOLE_HOOK_ACCESS:
 
		proc = hook_cmd->hook_access;
 
		break;
 
	default:
 
		proc = NULL;
 
		break;
 
	}
 
	if (proc == NULL) return true;
 
	return proc(hook_cmd);
 
}
 

	
 
void IConsoleCmdExec(byte * cmdstr)
 
@@ -882,13 +873,13 @@ void IConsoleCmdExec(byte * cmdstr)
 
		} else {
 
		var = IConsoleVarGet(tokens[0]);
 
		if (var != NULL) {
 
			execution_mode=2; // this is a variable
 
			if (c>2) if (strcmp(tokens[1],"<<")==0) {
 
				// this is command to variable mode [normal]
 
				
 

	
 
				function = NULL;
 
				cmd = IConsoleCmdGet(tokens[2]);
 
				if (cmd != NULL) function = cmd->addr;
 

	
 
				if (function != NULL) {
 
					execution_mode=3;
 
@@ -1112,34 +1103,35 @@ void IConsoleCmdExec(byte * cmdstr)
 
		}
 
		break;
 
	case 3:
 
	case 4:
 
		{
 
		// execute command with result or assign a variable
 
			if (execution_mode==3) if (IConsoleCmdHookHandle(cmd,ICONSOLE_HOOK_ACCESS)) {
 
			int i;
 
			int diff;
 
			void * temp;
 
			byte temp2;
 
			if (execution_mode==3) {
 
				if (IConsoleCmdHookHandle(cmd,ICONSOLE_HOOK_ACCESS)) {
 
					int i;
 
					int diff;
 
					void * temp;
 
					byte temp2;
 

	
 
			// tokenshifting
 
			for (diff=0; diff<2; diff++) {
 
				temp=tokens[0];
 
				temp2=tokentypes[0];
 
				for (i=1; i<20; i++) {
 
					tokens[i-1]=tokens[i];
 
					tokentypes[i-1]=tokentypes[i];
 
					// tokenshifting
 
					for (diff=0; diff<2; diff++) {
 
						temp=tokens[0];
 
						temp2=tokentypes[0];
 
						for (i=1; i<20; i++) {
 
							tokens[i-1]=tokens[i];
 
							tokentypes[i-1]=tokentypes[i];
 
						}
 
						tokens[19]=temp;
 
						tokentypes[19]=temp2;
 
					}
 
				tokens[19]=temp;
 
				tokentypes[19]=temp2;
 
				}
 
			IConsoleCmdHookHandle(cmd,ICONSOLE_HOOK_BEFORE_EXEC);
 
			result = function(c,tokens,tokentypes);
 
			IConsoleCmdHookHandle(cmd,ICONSOLE_HOOK_AFTER_EXEC);
 
			} else {
 
				execution_mode=255;
 
					IConsoleCmdHookHandle(cmd,ICONSOLE_HOOK_BEFORE_EXEC);
 
					result = function(c,tokens,tokentypes);
 
					IConsoleCmdHookHandle(cmd,ICONSOLE_HOOK_AFTER_EXEC);
 
				} else
 
					execution_mode=255;
 
			}
 

	
 
		if (IConsoleVarHookHandle(var,ICONSOLE_HOOK_ACCESS)) if (result!=NULL) {
 
			if (result ->type != var -> type) {
 
				IConsoleError("variable type missmatch");
 
				} else {
console.h
Show inline comments
 
@@ -44,13 +44,13 @@ typedef struct {
 
	void * _next;
 
	} _iconsole_cmd;
 

	
 
typedef struct {
 
	// --------------- //
 
	void * addr;
 
	byte * name;
 
	const byte * name;
 
	byte type;
 
	// -------------- //
 
	void * hook_access;
 
	void * hook_before_change;
 
	void * hook_after_change;
 
	// -------------- //
 
@@ -82,47 +82,47 @@ void IConsoleFree();
 
void IConsoleResize();
 
void IConsoleSwitch();
 
void IConsoleClose();
 
void IConsoleOpen();
 

	
 
// ** console cmd buffer ** //
 
void IConsoleCmdBufferAdd(byte * cmd);
 
void IConsoleCmdBufferAdd(const byte *cmd);
 
void IConsoleCmdBufferNavigate(signed char direction);
 

	
 
// ** console output ** //
 
void IConsolePrint(byte color_code, byte* string);
 
void IConsolePrint(byte color_code, const byte* string);
 
void CDECL IConsolePrintF(byte color_code, const char *s, ...);
 
void IConsoleDebug(byte* string);
 
void IConsoleError(byte* string);
 
void IConsoleError(const byte* string);
 

	
 
// *** Commands *** //
 

	
 
void IConsoleCmdRegister(byte * name, void * addr);
 
void IConsoleCmdRegister(const byte * name, void * addr);
 
void* IConsoleCmdGetAddr(byte * name);
 

	
 
// *** Variables *** //
 

	
 
void IConsoleVarRegister(byte * name, void * addr, byte type);
 
void IConsoleVarRegister(const byte * name, void * addr, byte type);
 
void IConsoleVarMemRegister(byte * name, byte type);
 
void IConsoleVarInsert(_iconsole_var * var, byte * name);
 
_iconsole_var * IConsoleVarGet(byte * name);
 
void IConsoleVarInsert(_iconsole_var * var, const byte * name);
 
_iconsole_var * IConsoleVarGet(const byte * name);
 
_iconsole_var * IConsoleVarAlloc(byte type);
 
void IConsoleVarFree(_iconsole_var * var);
 
void IConsoleVarSetString(_iconsole_var * var, byte * string);
 
void IConsoleVarSetString(_iconsole_var * var, const byte * string);
 
void IConsoleVarSetValue(_iconsole_var * var, int value);
 
void IConsoleVarDump(_iconsole_var * var, byte * dump_desc);
 
void IConsoleVarDump(_iconsole_var * var, const byte * dump_desc);
 

	
 
// *** Parser *** //
 

	
 
void IConsoleCmdExec(byte * cmdstr);
 

	
 
// ** console std lib ** //
 
void IConsoleStdLibRegister();
 

	
 
// ** hook code ** //
 
void IConsoleVarHook(byte * name, byte type, void * proc);
 
void IConsoleCmdHook(byte * name, byte type, void * proc);
 
void IConsoleVarHook(const byte * name, byte type, void * proc);
 
void IConsoleCmdHook(const byte * name, byte type, void * proc);
 
bool IConsoleVarHookHandle(_iconsole_var * hook_var, byte type);
 
bool IConsoleCmdHookHandle(_iconsole_cmd * hook_cmd, byte type);
 

	
 

	
 
#endif /* CONSOLE_H */
console_cmds.c
Show inline comments
 
/* -------------------- dont cross this line --------------------- */
 
#include "stdafx.h"
 
#include "ttd.h"
 
#include "console.h"
 
#include "engine.h"
 
#include "functions.h"
 
#include "variables.h"
 
 
#if defined(WIN32)
 
# define ENABLE_NETWORK
 
#endif
 
 
// ** console command / variable defines ** //
 
#define DEF_CONSOLE_CMD(yyyy) static _iconsole_var * yyyy(byte argc, byte* argv[], byte argt[])
 
#define DEF_CONSOLE_CMD_HOOK(yyyy) static bool yyyy(_iconsole_cmd * hookcmd)
 
#define DEF_CONSOLE_VAR_HOOK(yyyy) static bool yyyy(_iconsole_var * hookvar)
 
 
static int32 GetArgumentInteger(byte *arg)
 
{
 
	int32 result;
 
	sscanf((char *)arg, "%u", &result);
 
 
	if (result == 0 && arg[0] == '0' && arg[1] == 'x')
 
		sscanf((char *)arg, "%x", &result);
 
 
	return result;
 
}
 
 
/* **************************** */
 
/* variable and command hooks   */
 
/* **************************** */
 
 
DEF_CONSOLE_CMD_HOOK(ConCmdHookNoNetwork)
 
{
 
	if (_networking) {
 
		IConsoleError("this command is forbidden in multiplayer");
 
		return false;
 
		}
 
	return true;
 
}
 
 
DEF_CONSOLE_VAR_HOOK(ConVarHookNoNetwork)
 
{
 
	if (_networking) {
 
		IConsoleError("this variable is forbidden in multiplayer");
 
		return false;
 
		}
 
	return true;
 
}
 
 
DEF_CONSOLE_VAR_HOOK(ConVarHookNoNetClient)
 
{
 
	if (!_networking_server) {
 
		IConsoleError("this variable only makes sense for a network server");
 
		return false;
 
		}
 
	return true;
 
}
 
 
/* **************************** */
 
/* reset commands               */
 
/* **************************** */
 
 
DEF_CONSOLE_CMD(ConResetEngines)
 
{
 
	StartupEngines();
 
	return 0;
 
}
 
 
DEF_CONSOLE_CMD(ConResetTile)
 
{
 
	if (argc == 2) {
 
		TileIndex tile = (TileIndex)GetArgumentInteger(argv[1]);
 
		DoClearSquare(tile);
 
	}
 
 
	return 0;
 
}
 
 
DEF_CONSOLE_CMD(ConScrollToTile)
 
{
 
	if (argc == 2) {
 
		TileIndex tile = (TileIndex)GetArgumentInteger(argv[1]);
 
		ScrollMainWindowToTile(tile);
 
	}
 
 
	return 0;
 
}
 
 
// ********************************* //
 
// * Network Core Console Commands * //
 
// ********************************* //
 
#ifdef ENABLE_NETWORK
 
 
DEF_CONSOLE_CMD(ConNetworkConnect)
 
{
 
	byte * b;
 
	byte * ip = NULL;
 
	byte * port = NULL;
 
	byte * player = NULL;
 
	byte c;
 
	uint16 rport;
 
 
	if (argc<2) return NULL;
 
 
	b = argv[1];
 
	rport = _network_server_port;
 
	c = 0;
 
	ip = b;
 
	
 
	while (b[c] != 0) {
 
		if (((char)b[c]) == '#') {
 
			player = &b[c+1];
 
			b[c] = 0;
 
			}
 
		if (((char)b[c]) == ':') {
 
			port = &b[c+1];
 
			b[c] = 0;
 
			}
 
		c++;
 
		}
 
 
	IConsolePrintF(_iconsole_color_default,"Connecting to %s...",ip);
 
	if (player!=NULL) {
 
		_network_playas = atoi(player);
 
		IConsolePrintF(_iconsole_color_default,"    player-no: %s",player);
 
	}
 
	if (port!=NULL) {
 
		rport = atoi(port);
 
		IConsolePrintF(_iconsole_color_default,"    port: %s",port);
 
	}
 
 
	NetworkCoreConnectGame(b, rport);
 
 
	return NULL;
 
}
 
 
#endif
 
 
/* **************************** */
 
/*   default console commands   */
 
/* **************************** */
 
 
DEF_CONSOLE_CMD(ConEcho)
 
{
 
	if (argc<2) return NULL;
 
	IConsolePrint(_iconsole_color_default, argv[1]);
 
	return NULL;
 
}
 
 
DEF_CONSOLE_CMD(ConEchoC)
 
{
 
	if (argc<3) return NULL;
 
	IConsolePrint(atoi(argv[1]), argv[2]);
 
	return NULL;
 
}
 
 
DEF_CONSOLE_CMD(ConPrintF)
 
{
 
	if (argc<3) return NULL;
 
	IConsolePrintF(_iconsole_color_default, argv[1] ,argv[2],argv[3],argv[4],argv[5],argv[6],argv[7],argv[8],argv[9],argv[10],argv[11],argv[12],argv[13],argv[14],argv[15],argv[16],argv[17],argv[18],argv[19]);
 
	return NULL;
 
}
 
 
DEF_CONSOLE_CMD(ConPrintFC)
 
{
 
	if (argc<3) return NULL;
 
	IConsolePrintF(atoi(argv[1]), argv[2] ,argv[3],argv[4],argv[5],argv[6],argv[7],argv[8],argv[9],argv[10],argv[11],argv[12],argv[13],argv[14],argv[15],argv[16],argv[17],argv[18],argv[19]);
 
	return NULL;
 
}
 
 
DEF_CONSOLE_CMD(ConScreenShot)
 
{
 
	if (argc<2) {
 
		_make_screenshot=1;
 
	} else {
 
		if (strcmp(argv[1],"big")==0) {
 
			_make_screenshot=2;
 
			}
 
		if (strcmp(argv[1],"no_con")==0) {
 
			IConsoleClose();
 
			_make_screenshot=1;
 
			}
 
		}
 
	return NULL;
 
}
 
 
DEF_CONSOLE_CMD(ConVarInfo)
 
{
 
	if (argc<2) return NULL;
 
	if (argt[1]!=ICONSOLE_VAR_REFERENCE) {
 
		IConsoleError("variable must be an variable reference");
 
		} else {
 
		_iconsole_var * item;
 
		item = (_iconsole_var *) argv[1];
 
		IConsolePrintF(_iconsole_color_default,"variable_name: %s",item->name);
 
		IConsolePrintF(_iconsole_color_default,"variable_type: %i",item->type);
 
		IConsolePrintF(_iconsole_color_default,"variable_addr: %i",item->addr);
 
		if (item->_malloc) IConsolePrintF(_iconsole_color_default,"variable_malloc: internal allocated"); else IConsolePrintF(_iconsole_color_default, "variable_malloc: external allocated");
 
		}
 
	return NULL;
 
}
 
 
DEF_CONSOLE_CMD(ConDebugLevel) 
 
{
 
	if (argc<2) return NULL;
 
	SetDebugString(argv[1]);
 
	return NULL;
 
}
 
 
DEF_CONSOLE_CMD(ConExit) 
 
{
 
	_exit_game = true;
 
	return NULL;
 
}
 
 
DEF_CONSOLE_CMD(ConHelp) 
 
{
 
	IConsolePrint(13	," -- console help -- ");
 
	IConsolePrint(1		," variables: [command to list them: list_vars]");
 
	IConsolePrint(1		," *temp_string = \"my little \"");
 
	IConsolePrint(1		,"");
 
	IConsolePrint(1		," commands: [command to list them: list_cmds]");
 
	IConsolePrint(1		," [command] [\"string argument with spaces\"] [argument 2] ...");
 
	IConsolePrint(1		," printf \"%s world\" *temp_string");
 
	IConsolePrint(1		,"");
 
	IConsolePrint(1		," command/variable returning a value into an variable:");
 
	IConsolePrint(1		," *temp_uint16 << random");
 
	IConsolePrint(1		," *temp_uint16 << *temp_uint16_2");
 
	IConsolePrint(1		,"");
 
	return NULL;
 
}
 
 
DEF_CONSOLE_CMD(ConRandom)
 
{
 
	_iconsole_var * result;
 
	result = IConsoleVarAlloc(ICONSOLE_VAR_UINT16);
 
	IConsoleVarSetValue(result,rand());
 
	return result;
 
}
 
 
DEF_CONSOLE_CMD(ConListCommands) 
 
{
 
	_iconsole_cmd * item;
 
	int l = 0;
 
 
	if (argv[1]!=NULL) l = strlen((char *) argv[1]);
 
 
	item = _iconsole_cmds;
 
	while (item != NULL) {
 
		if (argv[1]!=NULL) {
 
 
			if (memcmp((void *) item->name, (void *) argv[1],l)==0)
 
					IConsolePrintF(_iconsole_color_default,"%s",item->name);
 
 
			} else {
 
 
			IConsolePrintF(_iconsole_color_default,"%s",item->name);
 
 
			}
 
		item = item->_next;
 
		}
 
 
	return NULL;
 
}
 
 
DEF_CONSOLE_CMD(ConListVariables) 
 
{
 
	_iconsole_var * item;
 
	int l = 0;
 
 
	if (argv[1]!=NULL) l = strlen((char *) argv[1]);
 
 
	item = _iconsole_vars;
 
	while (item != NULL) {
 
		if (argv[1]!=NULL) {
 
 
			if (memcmp((void *) item->name, (void *) argv[1],l)==0)
 
					IConsolePrintF(_iconsole_color_default,"%s",item->name);
 
 
			} else {
 
 
			IConsolePrintF(_iconsole_color_default,"%s",item->name);
 
 
			}
 
		item = item->_next;
 
		}
 
 
	return NULL;
 
}
 
 
DEF_CONSOLE_CMD(ConListDumpVariables)
 
{
 
	_iconsole_var * item;
 
	int l = 0;
 
 
	if (argv[1]!=NULL) l = strlen((char *) argv[1]);
 
 
	item = _iconsole_vars;
 
	while (item != NULL) {
 
		if (argv[1]!=NULL) {
 
 
			if (memcmp((void *) item->name, (void *) argv[1],l)==0)
 
					IConsoleVarDump(item,NULL);
 
 
			} else {
 
 
			IConsoleVarDump(item,NULL);
 
 
			}
 
		item = item->_next;
 
		}
 
 
	return NULL;
 
}
 
 
#ifdef _DEBUG
 
/* ****************************************** */
 
/*  debug commands and variables */
 
/* ****************************************** */
 
 
void IConsoleDebugLibRegister() 
 
{
 
	IConsoleVarMemRegister("temp_bool",ICONSOLE_VAR_BOOLEAN);
 
	IConsoleVarMemRegister("temp_int16",ICONSOLE_VAR_INT16);
 
	IConsoleVarMemRegister("temp_int32",ICONSOLE_VAR_INT32);
 
	IConsoleVarMemRegister("temp_pointer",ICONSOLE_VAR_POINTER);
 
	IConsoleVarMemRegister("temp_uint16",ICONSOLE_VAR_UINT16);
 
	IConsoleVarMemRegister("temp_uint16_2",ICONSOLE_VAR_UINT16);
 
	IConsoleVarMemRegister("temp_uint32",ICONSOLE_VAR_UINT32);
 
	IConsoleVarMemRegister("temp_string",ICONSOLE_VAR_STRING);
 
	IConsoleVarMemRegister("temp_string2",ICONSOLE_VAR_STRING);
 
	IConsoleCmdRegister("resettile",ConResetTile);
 
}
 
#endif
 
 
/* ****************************************** */
 
/*  console command and variable registration */
 
/* ****************************************** */
 
 
void IConsoleStdLibRegister()
 
{
 
	// stdlib
 
	extern byte _stdlib_developer;
 
	extern bool _stdlib_con_developer;
 
 
#ifdef _DEBUG
 
	IConsoleDebugLibRegister();
 
#endif
 
 
	// functions [please add them alphabeticaly]
 
#ifdef ENABLE_NETWORK
 
	IConsoleCmdRegister("connect",ConNetworkConnect);
 
	IConsoleCmdHook("connect",ICONSOLE_HOOK_ACCESS,ConCmdHookNoNetwork);
 
#endif
 
	IConsoleCmdRegister("debug_level",ConDebugLevel);
 
	IConsoleCmdRegister("dump_vars",ConListDumpVariables);
 
	IConsoleCmdRegister("echo",ConEcho);
 
	IConsoleCmdRegister("echoc",ConEchoC);
 
	IConsoleCmdRegister("exit",ConExit);
 
	IConsoleCmdRegister("help",ConHelp);
 
	IConsoleCmdRegister("printf",ConPrintF);
 
	IConsoleCmdRegister("printfc",ConPrintFC);
 
	IConsoleCmdRegister("quit",ConExit);
 
	IConsoleCmdRegister("random",ConRandom);
 
	IConsoleCmdRegister("list_cmds",ConListCommands);
 
	IConsoleCmdRegister("list_vars",ConListVariables);
 
	IConsoleCmdRegister("resetengines",ConResetEngines);
 
	IConsoleCmdHook("resetengines",ICONSOLE_HOOK_ACCESS,ConCmdHookNoNetwork);
 
	IConsoleCmdRegister("screenshot",ConScreenShot);
 
	IConsoleCmdRegister("scrollto",ConScrollToTile);
 
	IConsoleCmdRegister("varinfo",ConVarInfo);
 
 
	// variables [please add them alphabeticaly]
 
	IConsoleVarRegister("con_developer",(void *) &_stdlib_con_developer,ICONSOLE_VAR_BOOLEAN);
 
	IConsoleVarRegister("developer",(void *) &_stdlib_developer,ICONSOLE_VAR_BYTE);
 
#ifdef ENABLE_NETWORK
 
	IConsoleVarRegister("net_client_timeout",&_network_client_timeout,ICONSOLE_VAR_UINT16);
 
	IConsoleVarHook("*net_client_timeout",ICONSOLE_HOOK_ACCESS,ConVarHookNoNetClient);
 
	IConsoleVarRegister("net_ready_ahead",&_network_ready_ahead,ICONSOLE_VAR_UINT16);
 
	IConsoleVarRegister("net_sync_freq",&_network_sync_freq,ICONSOLE_VAR_UINT16);
 
	IConsoleVarHook("*net_sync_freq",ICONSOLE_HOOK_ACCESS,ConVarHookNoNetClient);
 
#endif
 
 
 
}
 
/* -------------------- dont cross this line --------------------- */
 
/* -------------------- dont cross this line --------------------- */
 
#include "stdafx.h"
 
#include "ttd.h"
 
#include "console.h"
 
#include "engine.h"
 
#include "functions.h"
 
#include "variables.h"
 

	
 
#if defined(WIN32)
 
# define ENABLE_NETWORK
 
#endif
 

	
 
// ** console command / variable defines ** //
 
#define DEF_CONSOLE_CMD(yyyy) static _iconsole_var * yyyy(byte argc, byte* argv[], byte argt[])
 
#define DEF_CONSOLE_CMD_HOOK(yyyy) static bool yyyy(_iconsole_cmd * hookcmd)
 
#define DEF_CONSOLE_VAR_HOOK(yyyy) static bool yyyy(_iconsole_var * hookvar)
 

	
 
static int32 GetArgumentInteger(byte *arg)
 
{
 
	int32 result;
 
	sscanf((char *)arg, "%u", &result);
 

	
 
	if (result == 0 && arg[0] == '0' && arg[1] == 'x')
 
		sscanf((char *)arg, "%x", &result);
 

	
 
	return result;
 
}
 

	
 
/* **************************** */
 
/* variable and command hooks   */
 
/* **************************** */
 

	
 
DEF_CONSOLE_CMD_HOOK(ConCmdHookNoNetwork)
 
{
 
	if (_networking) {
 
		IConsoleError("this command is forbidden in multiplayer");
 
		return false;
 
		}
 
	return true;
 
}
 

	
 
#if 0 /* Not used atm */
 
DEF_CONSOLE_VAR_HOOK(ConVarHookNoNetwork)
 
{
 
	if (_networking) {
 
		IConsoleError("this variable is forbidden in multiplayer");
 
		return false;
 
		}
 
	return true;
 
}
 
#endif
 

	
 
DEF_CONSOLE_VAR_HOOK(ConVarHookNoNetClient)
 
{
 
	if (!_networking_server) {
 
		IConsoleError("this variable only makes sense for a network server");
 
		return false;
 
		}
 
	return true;
 
}
 

	
 
/* **************************** */
 
/* reset commands               */
 
/* **************************** */
 

	
 
DEF_CONSOLE_CMD(ConResetEngines)
 
{
 
	StartupEngines();
 
	return 0;
 
}
 

	
 
DEF_CONSOLE_CMD(ConResetTile)
 
{
 
	if (argc == 2) {
 
		TileIndex tile = (TileIndex)GetArgumentInteger(argv[1]);
 
		DoClearSquare(tile);
 
	}
 

	
 
	return 0;
 
}
 

	
 
DEF_CONSOLE_CMD(ConScrollToTile)
 
{
 
	if (argc == 2) {
 
		TileIndex tile = (TileIndex)GetArgumentInteger(argv[1]);
 
		ScrollMainWindowToTile(tile);
 
	}
 

	
 
	return 0;
 
}
 

	
 
// ********************************* //
 
// * Network Core Console Commands * //
 
// ********************************* //
 
#ifdef ENABLE_NETWORK
 

	
 
DEF_CONSOLE_CMD(ConNetworkConnect)
 
{
 
	byte * b;
 
	byte * ip = NULL;
 
	byte * port = NULL;
 
	byte * player = NULL;
 
	byte c;
 
	uint16 rport;
 

	
 
	if (argc<2) return NULL;
 

	
 
	b = argv[1];
 
	rport = _network_server_port;
 
	c = 0;
 
	ip = b;
 

	
 
	while (b[c] != 0) {
 
		if (((char)b[c]) == '#') {
 
			player = &b[c+1];
 
			b[c] = 0;
 
			}
 
		if (((char)b[c]) == ':') {
 
			port = &b[c+1];
 
			b[c] = 0;
 
			}
 
		c++;
 
		}
 

	
 
	IConsolePrintF(_iconsole_color_default,"Connecting to %s...",ip);
 
	if (player!=NULL) {
 
		_network_playas = atoi(player);
 
		IConsolePrintF(_iconsole_color_default,"    player-no: %s",player);
 
	}
 
	if (port!=NULL) {
 
		rport = atoi(port);
 
		IConsolePrintF(_iconsole_color_default,"    port: %s",port);
 
	}
 

	
 
	NetworkCoreConnectGame(b, rport);
 

	
 
	return NULL;
 
}
 

	
 
#endif
 

	
 
/* **************************** */
 
/*   default console commands   */
 
/* **************************** */
 

	
 
DEF_CONSOLE_CMD(ConEcho)
 
{
 
	if (argc<2) return NULL;
 
	IConsolePrint(_iconsole_color_default, argv[1]);
 
	return NULL;
 
}
 

	
 
DEF_CONSOLE_CMD(ConEchoC)
 
{
 
	if (argc<3) return NULL;
 
	IConsolePrint(atoi(argv[1]), argv[2]);
 
	return NULL;
 
}
 

	
 
DEF_CONSOLE_CMD(ConPrintF)
 
{
 
	if (argc<3) return NULL;
 
	IConsolePrintF(_iconsole_color_default, argv[1] ,argv[2],argv[3],argv[4],argv[5],argv[6],argv[7],argv[8],argv[9],argv[10],argv[11],argv[12],argv[13],argv[14],argv[15],argv[16],argv[17],argv[18],argv[19]);
 
	return NULL;
 
}
 

	
 
DEF_CONSOLE_CMD(ConPrintFC)
 
{
 
	if (argc<3) return NULL;
 
	IConsolePrintF(atoi(argv[1]), argv[2] ,argv[3],argv[4],argv[5],argv[6],argv[7],argv[8],argv[9],argv[10],argv[11],argv[12],argv[13],argv[14],argv[15],argv[16],argv[17],argv[18],argv[19]);
 
	return NULL;
 
}
 

	
 
DEF_CONSOLE_CMD(ConScreenShot)
 
{
 
	if (argc<2) {
 
		_make_screenshot=1;
 
	} else {
 
		if (strcmp(argv[1],"big")==0) {
 
			_make_screenshot=2;
 
			}
 
		if (strcmp(argv[1],"no_con")==0) {
 
			IConsoleClose();
 
			_make_screenshot=1;
 
			}
 
		}
 
	return NULL;
 
}
 

	
 
DEF_CONSOLE_CMD(ConVarInfo)
 
{
 
	if (argc<2) return NULL;
 
	if (argt[1]!=ICONSOLE_VAR_REFERENCE) {
 
		IConsoleError("variable must be an variable reference");
 
		} else {
 
		_iconsole_var * item;
 
		item = (_iconsole_var *) argv[1];
 
		IConsolePrintF(_iconsole_color_default,"variable_name: %s",item->name);
 
		IConsolePrintF(_iconsole_color_default,"variable_type: %i",item->type);
 
		IConsolePrintF(_iconsole_color_default,"variable_addr: %i",item->addr);
 
		if (item->_malloc) IConsolePrintF(_iconsole_color_default,"variable_malloc: internal allocated"); else IConsolePrintF(_iconsole_color_default, "variable_malloc: external allocated");
 
		}
 
	return NULL;
 
}
 

	
 
DEF_CONSOLE_CMD(ConDebugLevel)
 
{
 
	if (argc<2) return NULL;
 
	SetDebugString(argv[1]);
 
	return NULL;
 
}
 

	
 
DEF_CONSOLE_CMD(ConExit)
 
{
 
	_exit_game = true;
 
	return NULL;
 
}
 

	
 
DEF_CONSOLE_CMD(ConHelp)
 
{
 
	IConsolePrint(13	," -- console help -- ");
 
	IConsolePrint(1		," variables: [command to list them: list_vars]");
 
	IConsolePrint(1		," *temp_string = \"my little \"");
 
	IConsolePrint(1		,"");
 
	IConsolePrint(1		," commands: [command to list them: list_cmds]");
 
	IConsolePrint(1		," [command] [\"string argument with spaces\"] [argument 2] ...");
 
	IConsolePrint(1		," printf \"%s world\" *temp_string");
 
	IConsolePrint(1		,"");
 
	IConsolePrint(1		," command/variable returning a value into an variable:");
 
	IConsolePrint(1		," *temp_uint16 << random");
 
	IConsolePrint(1		," *temp_uint16 << *temp_uint16_2");
 
	IConsolePrint(1		,"");
 
	return NULL;
 
}
 

	
 
DEF_CONSOLE_CMD(ConRandom)
 
{
 
	_iconsole_var * result;
 
	result = IConsoleVarAlloc(ICONSOLE_VAR_UINT16);
 
	IConsoleVarSetValue(result,rand());
 
	return result;
 
}
 

	
 
DEF_CONSOLE_CMD(ConListCommands)
 
{
 
	_iconsole_cmd * item;
 
	int l = 0;
 

	
 
	if (argv[1]!=NULL) l = strlen((char *) argv[1]);
 

	
 
	item = _iconsole_cmds;
 
	while (item != NULL) {
 
		if (argv[1]!=NULL) {
 

	
 
			if (memcmp((void *) item->name, (void *) argv[1],l)==0)
 
					IConsolePrintF(_iconsole_color_default,"%s",item->name);
 

	
 
			} else {
 

	
 
			IConsolePrintF(_iconsole_color_default,"%s",item->name);
 

	
 
			}
 
		item = item->_next;
 
		}
 

	
 
	return NULL;
 
}
 

	
 
DEF_CONSOLE_CMD(ConListVariables)
 
{
 
	_iconsole_var * item;
 
	int l = 0;
 

	
 
	if (argv[1]!=NULL) l = strlen((char *) argv[1]);
 

	
 
	item = _iconsole_vars;
 
	while (item != NULL) {
 
		if (argv[1]!=NULL) {
 

	
 
			if (memcmp(item->name, argv[1],l)==0)
 
					IConsolePrintF(_iconsole_color_default,"%s",item->name);
 

	
 
			} else {
 

	
 
			IConsolePrintF(_iconsole_color_default,"%s",item->name);
 

	
 
			}
 
		item = item->_next;
 
		}
 

	
 
	return NULL;
 
}
 

	
 
DEF_CONSOLE_CMD(ConListDumpVariables)
 
{
 
	_iconsole_var * item;
 
	int l = 0;
 

	
 
	if (argv[1]!=NULL) l = strlen((char *) argv[1]);
 

	
 
	item = _iconsole_vars;
 
	while (item != NULL) {
 
		if (argv[1]!=NULL) {
 

	
 
			if (memcmp(item->name, argv[1],l)==0)
 
					IConsoleVarDump(item,NULL);
 

	
 
			} else {
 

	
 
			IConsoleVarDump(item,NULL);
 

	
 
			}
 
		item = item->_next;
 
		}
 

	
 
	return NULL;
 
}
 

	
 
#ifdef _DEBUG
 
/* ****************************************** */
 
/*  debug commands and variables */
 
/* ****************************************** */
 

	
 
void IConsoleDebugLibRegister()
 
{
 
	IConsoleVarMemRegister("temp_bool",ICONSOLE_VAR_BOOLEAN);
 
	IConsoleVarMemRegister("temp_int16",ICONSOLE_VAR_INT16);
 
	IConsoleVarMemRegister("temp_int32",ICONSOLE_VAR_INT32);
 
	IConsoleVarMemRegister("temp_pointer",ICONSOLE_VAR_POINTER);
 
	IConsoleVarMemRegister("temp_uint16",ICONSOLE_VAR_UINT16);
 
	IConsoleVarMemRegister("temp_uint16_2",ICONSOLE_VAR_UINT16);
 
	IConsoleVarMemRegister("temp_uint32",ICONSOLE_VAR_UINT32);
 
	IConsoleVarMemRegister("temp_string",ICONSOLE_VAR_STRING);
 
	IConsoleVarMemRegister("temp_string2",ICONSOLE_VAR_STRING);
 
	IConsoleCmdRegister("resettile",ConResetTile);
 
}
 
#endif
 

	
 
/* ****************************************** */
 
/*  console command and variable registration */
 
/* ****************************************** */
 

	
 
void IConsoleStdLibRegister()
 
{
 
	// stdlib
 
	extern byte _stdlib_developer;
 
	extern bool _stdlib_con_developer;
 

	
 
#ifdef _DEBUG
 
	IConsoleDebugLibRegister();
 
#else
 
	(void)ConResetTile; // Silence warning, this is only used in _DEBUG
 
#endif
 

	
 
	// functions [please add them alphabeticaly]
 
#ifdef ENABLE_NETWORK
 
	IConsoleCmdRegister("connect",ConNetworkConnect);
 
	IConsoleCmdHook("connect",ICONSOLE_HOOK_ACCESS,ConCmdHookNoNetwork);
 
#endif
 
	IConsoleCmdRegister("debug_level",ConDebugLevel);
 
	IConsoleCmdRegister("dump_vars",ConListDumpVariables);
 
	IConsoleCmdRegister("echo",ConEcho);
 
	IConsoleCmdRegister("echoc",ConEchoC);
 
	IConsoleCmdRegister("exit",ConExit);
 
	IConsoleCmdRegister("help",ConHelp);
 
	IConsoleCmdRegister("printf",ConPrintF);
 
	IConsoleCmdRegister("printfc",ConPrintFC);
 
	IConsoleCmdRegister("quit",ConExit);
 
	IConsoleCmdRegister("random",ConRandom);
 
	IConsoleCmdRegister("list_cmds",ConListCommands);
 
	IConsoleCmdRegister("list_vars",ConListVariables);
 
	IConsoleCmdRegister("resetengines",ConResetEngines);
 
	IConsoleCmdHook("resetengines",ICONSOLE_HOOK_ACCESS,ConCmdHookNoNetwork);
 
	IConsoleCmdRegister("screenshot",ConScreenShot);
 
	IConsoleCmdRegister("scrollto",ConScrollToTile);
 
	IConsoleCmdRegister("varinfo",ConVarInfo);
 

	
 
	// variables [please add them alphabeticaly]
 
	IConsoleVarRegister("con_developer",(void *) &_stdlib_con_developer,ICONSOLE_VAR_BOOLEAN);
 
	IConsoleVarRegister("developer",(void *) &_stdlib_developer,ICONSOLE_VAR_BYTE);
 
#ifdef ENABLE_NETWORK
 
	IConsoleVarRegister("net_client_timeout",&_network_client_timeout,ICONSOLE_VAR_UINT16);
 
	IConsoleVarHook("*net_client_timeout",ICONSOLE_HOOK_ACCESS,ConVarHookNoNetClient);
 
	IConsoleVarRegister("net_ready_ahead",&_network_ready_ahead,ICONSOLE_VAR_UINT16);
 
	IConsoleVarRegister("net_sync_freq",&_network_sync_freq,ICONSOLE_VAR_UINT16);
 
	IConsoleVarHook("*net_sync_freq",ICONSOLE_HOOK_ACCESS,ConVarHookNoNetClient);
 
#endif
 

	
 

	
 
}
 
/* -------------------- dont cross this line --------------------- */
console_cmds.h
Show inline comments
 
deleted file
graph_gui.c
Show inline comments
 
@@ -1013,14 +1013,14 @@ static const StringID _performance_title
 
static StringID GetPerformanceTitleFromValue(uint v)
 
{
 
	return _performance_titles[minu(v, 1000) >> 6];
 
}
 

	
 
static int CDECL _perf_hist_comp(const void *elem1, const void *elem2 ) {
 
	Player *p1 = *(Player**)elem1;
 
	Player *p2 = *(Player**)elem2;
 
	const Player *p1 = *(const Player* const *)elem1;
 
	const Player *p2 = *(const Player* const *)elem2;
 
	int32 v = p2->old_economy[1].performance_history - p1->old_economy[1].performance_history;
 
	return (v!=0) | (v >> (sizeof(int32)*8-1));
 
}
 

	
 
static void CompanyLeagueWndProc(Window *w, WindowEvent *e)
 
{
hal.h
Show inline comments
 
@@ -132,13 +132,13 @@ FiosItem *FiosGetScenarioList(int *num, 
 
void FiosFreeSavegameList();
 
// Browse to. Returns a filename w/path if we reached a file.
 
char *FiosBrowseTo(const FiosItem *item);
 
// Get descriptive texts.
 
// Returns a path as well as a
 
//  string describing the path.
 
StringID FiosGetDescText(char **path);
 
StringID FiosGetDescText(const char **path);
 
// Delete a name
 
void FiosDelete(const char *name);
 
// Make a filename from a name
 
void FiosMakeSavegameName(char *buf, const char *name);
 

	
 
void CreateConsole();
industry_gui.c
Show inline comments
 
@@ -389,14 +389,14 @@ static byte _last_industry_idx;
 
static byte _industry_sort_order;
 

	
 
static int CDECL GeneralIndustrySorter(const void *a, const void *b)
 
{
 
	char buf1[96];
 
	byte val;
 
	Industry *i = DEREF_INDUSTRY(*(byte*)a);
 
	Industry *j = DEREF_INDUSTRY(*(byte*)b);
 
	Industry *i = DEREF_INDUSTRY(*(const byte*)a);
 
	Industry *j = DEREF_INDUSTRY(*(const byte*)b);
 
	int r = 0;
 

	
 
	switch (_industry_sort_order >> 1) {
 
	/* case 0: Sort by Name (handled later) */
 
	case 1: /* Sort by Type */
 
		r = i->type - j->type;
 
@@ -434,13 +434,13 @@ static int CDECL GeneralIndustrySorter(c
 

	
 
	// default to string sorting if they are otherwise equal
 
	if (r == 0) {
 
		SET_DPARAM32(0, i->town->townnameparts);
 
		GetString(buf1, i->town->townnametype);
 

	
 
		if ( (val=*(byte*)b) != _last_industry_idx) {
 
		if ( (val=*(const byte*)b) != _last_industry_idx) {
 
			_last_industry_idx = val;
 
			SET_DPARAM32(0, j->town->townnameparts);
 
			GetString(_bufcache, j->town->townnametype);
 
		}
 
		r = strcmp(buf1, _bufcache);
 
	}
macros.h
Show inline comments
 
@@ -200,24 +200,24 @@ static INLINE void swap_uint16(uint16 *a
 
static INLINE void swap_int16(int16 *a, int16 *b) { int16 t = *a; *a = *b; *b = t; }
 
static INLINE void swap_tile(TileIndex *a, TileIndex *b) { TileIndex t = *a; *a = *b; *b = t; }
 

	
 

	
 

	
 
#if defined(TTD_LITTLE_ENDIAN)
 
#	define READ_LE_UINT16(b) (*(uint16*)(b))
 
#	define READ_LE_UINT16(b) (*(const uint16*)(b))
 
#	define ADD_WORD(x) (x)&0xFF, ((x) >> 8)&0xFF
 
#	define ADD_DWORD(x) (x)&0xFF, ((x) >> 8)&0xFF, ((x) >> 16)&0xFF, ((x) >> 24)&0xFF
 
#elif defined(TTD_BIG_ENDIAN)
 
	static INLINE uint16 READ_LE_UINT16(const void *b) {
 
		return ((byte*)b)[0] + (((byte*)b)[1] << 8);
 
		return ((const byte*)b)[0] + (((const byte*)b)[1] << 8);
 
	}
 
#	define ADD_WORD(x) ((x) >> 8)&0xFF, (x)&0xFF
 
#	define ADD_DWORD(x) ((x) >> 24)&0xFF, ((x) >> 16)&0xFF, ((x) >> 8)&0xFF,  (x)&0xFF
 
#endif
 

	
 
static INLINE void WRITE_LE_UINT16(const void *b, uint16 x) {
 
static INLINE void WRITE_LE_UINT16(void *b, uint16 x) {
 
	((byte*)b)[0] = (byte)x;
 
	((byte*)b)[1] = (byte)(x >> 8);
 
}
 

	
 
#define MAX_DETOUR 6
 

	
main_gui.c
Show inline comments
 
@@ -2223,16 +2223,16 @@ void SetupColorsAndInitialWindow()
 
		w = AllocateWindow(0, 0, width, height, MainWindowWndProc, 0, NULL);
 
		AssignWindowViewport(w, 0, 0, width, height, 0x8080, 0);
 

	
 
		w = AllocateWindowDesc(&_toolb_normal_desc);
 
		w->disabled_state = 1 << 17; // disable zoon-in button (by default game is zoomed in)
 

	
 
		if (_networking) { // if networking, disable fast-forward button
 
			w->disabled_state |= (1 << 1);
 
			if (!_networking_server) // if not server, disable pause button
 
				w->disabled_state |= (1 << 0);
 
		if (_networking) { // if networking, disable fast-forward button
 
			w->disabled_state |= (1 << 1);
 
			if (!_networking_server) // if not server, disable pause button
 
				w->disabled_state |= (1 << 0);
 
		}
 

	
 
		w->flags4 &= ~WF_WHITE_BORDER_MASK;
 

	
 
		PositionMainToolbar(w); // already WC_MAIN_TOOLBAR passed (&_toolb_normal_desc)
 

	
misc_gui.c
Show inline comments
 
@@ -960,13 +960,13 @@ static void BuildFileList()
 
	else
 
		_fios_list = FiosGetSavegameList(&_fios_num, _saveload_mode);
 
}
 

	
 
static void DrawFiosTexts()
 
{
 
	char *path;
 
	const char *path;
 
	StringID str;
 

	
 
	str = FiosGetDescText(&path);
 
	if (str != 0)
 
		DrawString(2, 37, str, 0);
 
	DoDrawString(path, 2, 27, 16);
network.c
Show inline comments
 
@@ -525,13 +525,13 @@ static void HandleCommandPacket(ClientSt
 
		// put it into the command queue
 
		qp = AllocQueuedCommand(&_command_queue);
 
	} else {
 
		qp = (QueuedCommand*)calloc(sizeof(QueuedCommand), 1);
 
	}
 
	qp->cp = *np;
 
	
 

	
 
	qp->frame = _frame_counter_max - GetNextSyncFrame();
 

	
 
	qp->callback = NULL;
 

	
 
	// extra params
 
	memcpy(&qp->cp.dp, np->dp, np->packet_length - COMMAND_PACKET_BASE_SIZE);
network_gui.c
Show inline comments
 
@@ -141,13 +141,13 @@ static void NetworkGameWindowWndProc(Win
 
			NetworkGameListFromLAN();
 
			break;
 
		case 1: /* Internet */
 
			NetworkGameListFromInternet();
 
			break;
 
		}
 
		
 

	
 
		_network_game_count_last = _network_game_count;
 
		SetWindowDirty(w);
 

	
 
		break;
 

	
 
	case WE_MOUSELOOP:
 
@@ -176,13 +176,13 @@ static void NetworkGameWindowWndProc(Win
 
			byte c;
 
			uint16 rport;
 

	
 
			rport = _network_server_port;
 
			c = 0;
 
			ip = b;
 
			
 

	
 
			while (b[c] != 0) {
 
				if (((char)b[c]) == '#') {
 
					player = &b[c+1];
 
					b[c] = 0;
 
					}
 
				if (((char)b[c]) == ':') {
rail_cmd.c
Show inline comments
 
@@ -1517,13 +1517,13 @@ static void DrawTile_Track(TileInfo *ti)
 
			return;
 

	
 
		if (ti->tileh != 0) { DrawFoundation(ti, ti->tileh); }
 

	
 
		s = _track_depot_layout_table[m5 & 0x3F];
 

	
 
		image = *(uint16*)s;
 
		image = *(const uint16*)s;
 
		if (image & 0x8000) image = (image & 0x7FFF) + tracktype_offs;
 

	
 
		// adjust ground tile for desert
 
		// (don't adjust for arctic, because snow in depots looks weird)
 
		if ((_map2[ti->tile] & RAIL_MAP2LO_GROUND_MASK)==RAIL_GROUND_ICE_DESERT && _opt.landscape == LT_DESERT)
 
		{
 
@@ -1563,17 +1563,17 @@ void DrawTrainDepotSprite(int x, int y, 
 

	
 
	t = _track_depot_layout_table[image];
 

	
 
	x+=33;
 
	y+=17;
 

	
 
	img = *(uint16*)t;
 
	img = *(const uint16*)t;
 
	if (img & 0x8000) img = (img & 0x7FFF) + railtype;
 
	DrawSprite(img, x, y);
 

	
 
	for(dtss = (DrawTrackSeqStruct *)(t + sizeof(uint16)); dtss->image != 0; dtss++) {
 
	for(dtss = (const DrawTrackSeqStruct *)(t + sizeof(uint16)); dtss->image != 0; dtss++) {
 
		Point pt = RemapCoords(dtss->subcoord_x, dtss->subcoord_y, 0);
 
		image = dtss->image;
 
		if (image & 0x8000) image |= ormod;
 
		DrawSprite(image + railtype, x + pt.x, y + pt.y);
 
	}
 
}
readme.txt
Show inline comments
 
@@ -123,13 +123,13 @@ 7.0) Compiling:
 
---- ----------
 
Windows:
 
  You need Microsoft Visual Studio 6 or .NET. Open the project file
 
  and it should build automatically. In case you don't build with SDL,
 
  you need to remove WITH_SDL from the project settings.
 
  (see also docs/Readme_Windows_MSVC6.0.txt)
 
  
 

	
 
  You can also build it using the Makefile with MSys/MingW or Cygwin/MingW.
 
  Please read the Makefile for more information.
 

	
 
Unix:
 
  OpenTTD can be built either with "make" or with "jam". To build with
 
  "make", just type "make", or "gmake" on non-gnu systems. To build with "jam",
 
@@ -144,14 +144,14 @@ BeOS:
 
  Use "jam".
 

	
 
FreeBSD
 
  Use "gmake".
 

	
 
MorphOS
 
  Use "make". Note that you need the MorphOS SDK and the 
 
  powersdl.library SDK. 
 
  Use "make". Note that you need the MorphOS SDK and the
 
  powersdl.library SDK.
 

	
 
8.0) Translating:
 
---- -------------------
 
See http://www.openttd.com/translating.php for up-to-date information.
 

	
 
8.1) Guidelines:
 
@@ -206,20 +206,20 @@ The OpenTTD team:
 
  Tamas Farago (Darkvater)       - Coder
 
  Owen Rudge (orudge)            - Contributor, forum host.
 
  Bjarni Corfitzen (Bjarni)      - MacOS port
 
  Cian Duffy (MYOB)              - BeOS port / manual writing
 
  Christian Rosentreter (tokaiz) - MorphOS/AmigaOS port
 
  Viktor Strigeus (wiggo)        - Web hosting services
 
  
 

	
 
Thanks to:
 
  Josef Drexler - For his great work on TTDPatch.
 
  Marcin Grzegorczyk - For his TTDPatch work and documentation of TTD internals and graphics (signals and track foundations).
 
  Mike Ragsdale - OpenTTD installer
 
  pasky - Many patches, newgrf support, etc.
 
  truesatan - Some patches
 
  TrueLight - Some patches
 
  Michael Polnick - Some patches
 
  Michael Blunck - Nice graphics
 
  George - Canal graphics
 
  Bug Reporters - Thanks for all bug reports.
 
  Chris Sawyer - For an amazing game.
 
  
 

	
road_cmd.c
Show inline comments
 
@@ -807,15 +807,15 @@ static void DrawTile_Road(TileInfo *ti)
 
		player = _map_owner[ti->tile];
 
		if (player < MAX_PLAYERS)
 
			ormod = PLAYER_SPRITE_COLOR(player);
 

	
 
		s = _road_display_datas[ti->map5 & 0xF];
 

	
 
		DrawGroundSprite(*(uint32*)s);
 
		DrawGroundSprite(*(const uint32*)s);
 
		s += sizeof(uint32);
 
		drss = (DrawRoadSeqStruct*)s;
 
		drss = (const DrawRoadSeqStruct*)s;
 

	
 
		while ((image=drss->image) != 0) {
 
			if (image & 0x8000)
 
				image |= ormod;
 
			if (!(_display_opt & DO_TRANS_BUILDINGS)) // show transparent depots
 
				image = (image & 0x3FFF) | 0x3224000;
 
@@ -837,16 +837,16 @@ void DrawRoadDepotSprite(int x, int y, i
 

	
 
	t = _road_display_datas[image];
 

	
 
	x+=33;
 
	y+=17;
 

	
 
	DrawSprite(*(uint32*)t, x, y);
 
	DrawSprite(*(const uint32*)t, x, y);
 
	t += sizeof(uint32);
 

	
 
	for(dtss = (DrawRoadSeqStruct *)t; dtss->image != 0; dtss++) {
 
	for(dtss = (const DrawRoadSeqStruct *)t; dtss->image != 0; dtss++) {
 
		Point pt = RemapCoords(dtss->subcoord_x, dtss->subcoord_y, 0);
 

	
 
		image = dtss->image;
 
		if (image & 0x8000)
 
			image |= ormod;
 

	
saveload.c
Show inline comments
 
@@ -419,13 +419,13 @@ void SlArray(void *array, uint length, u
 

	
 
// Calculate the size of an object.
 
static size_t SlCalcObjLength(void *object, const void *desc)
 
{
 
	size_t length = 0;
 
	uint cmd,conv;
 
	byte *d = (byte*)desc;
 
	const byte *d = (const byte*)desc;
 

	
 
	// Need to determine the length and write a length tag.
 
	while (true) {
 
		cmd = (d[0] >> 4);
 
		if (cmd < 8) {
 
			conv = d[2];
 
@@ -461,13 +461,13 @@ static size_t SlCalcObjLength(void *obje
 
	}
 
	return length;
 
}
 

	
 
void SlObject(void *object, const void *desc)
 
{
 
	byte *d = (byte*)desc;
 
	const byte *d = (const byte*)desc;
 
	void *ptr;
 
	uint cmd,conv;
 

	
 
	// Automatically calculate the length?
 
	if (_sl.need_length != NL_NONE) {
 
		SlSetLength(SlCalcObjLength(object, d));
sdl.c
Show inline comments
 
@@ -209,15 +209,15 @@ static void DrawSurfaceToScreen()
 
		}
 
	}
 
}
 

	
 
static int CDECL compare_res(const void *pa, const void *pb)
 
{
 
	int x = ((uint16*)pa)[0] - ((uint16*)pb)[0];
 
	int x = ((const uint16*)pa)[0] - ((const uint16*)pb)[0];
 
	if (x) return x;
 
	return ((uint16*)pa)[1] - ((uint16*)pb)[1];
 
	return ((const uint16*)pa)[1] - ((const uint16*)pb)[1];
 
}
 

	
 
static const uint16 default_resolutions[][2] = {
 
	{640,480},
 
	{800,600},
 
	{1024,768},
settings.c
Show inline comments
 
@@ -322,15 +322,15 @@ static void ini_free(IniFile *ini)
 
	pool_free(&ini->pool);
 
}
 

	
 
struct SettingDesc {
 
	const char *name;
 
	int flags;
 
	void *def;
 
	const void *def;
 
	void *ptr;
 
	void *b;
 
	const void *b;
 

	
 
};
 

	
 
static int lookup_oneofmany(const char *many, const char *one, int onelen)
 
{
 
	const char *s;
 
@@ -490,13 +490,13 @@ static void make_manyofmany(char *buf, c
 
		}
 
		if (*many == '|') many++;
 
	} while (++i, x>>=1);
 
	*buf = 0;
 
}
 

	
 
static void *string_to_val(const SettingDesc *desc, const char *str)
 
static const void *string_to_val(const SettingDesc *desc, const char *str)
 
{
 
	unsigned long val;
 
	char *end;
 

	
 
	switch(desc->flags & 0xF) {
 
	case SDT_INTX:
 
@@ -529,17 +529,17 @@ static void *string_to_val(const Setting
 
		return (void*)str;
 
	}
 

	
 
	return NULL;
 
}
 

	
 
static void load_setting_desc(IniFile *ini, const SettingDesc *desc, void *grpname, void *base)
 
static void load_setting_desc(IniFile *ini, const SettingDesc *desc, const void *grpname, void *base)
 
{
 
	IniGroup *group_def = ini_getgroup(ini, grpname, -1), *group;
 
	IniItem *item;
 
	void *p;
 
	const void *p;
 
	void *ptr;
 

	
 
	for (;desc->name;desc++) {
 
		// group override?
 
		const char *s = strchr(desc->name, '.');
 
		if (s) {
 
@@ -600,17 +600,18 @@ static void load_setting_desc(IniFile *i
 
		default:
 
			NOT_REACHED();
 
		}
 
	}
 
}
 

	
 
static void save_setting_desc(IniFile *ini, const SettingDesc *desc, void *grpname, void *base)
 
static void save_setting_desc(IniFile *ini, const SettingDesc *desc, const void *grpname, void *base)
 
{
 
	IniGroup *group_def = NULL, *group;
 
	IniItem *item;
 
	void *p, *ptr;
 
	const void *p;
 
	void *ptr;
 
	int i = 0;
 
	char buf[512]; // setting buffer
 
	const char *s;
 

	
 
	for (;desc->name;desc++) {
 
		if (desc->flags & SDT_NOSAVE)
 
@@ -880,13 +881,13 @@ static const SettingDesc patch_settings[
 

	
 
	{"drag_signals_density",SDT_UINT8,	(void*)4,			(void*)offsetof(Patches, drag_signals_density), NULL},
 

	
 
	{NULL,									0,					NULL,					NULL,																						NULL}
 
};
 

	
 
typedef void SettingDescProc(IniFile *ini, const SettingDesc *desc, void *grpname, void *base);
 
typedef void SettingDescProc(IniFile *ini, const SettingDesc *desc, const void *grpname, void *base);
 

	
 
static void HandleSettingDescs(IniFile *ini, SettingDescProc *proc)
 
{
 
	proc(ini, misc_settings,		"misc",			NULL);
 
	proc(ini, win32_settings,		"win32",		NULL);
 
	proc(ini, network_settings, "network",	NULL);
station_cmd.c
Show inline comments
 
@@ -1740,30 +1740,30 @@ static void DrawTile_Station(TileInfo *t
 
	// don't show foundation for docks (docks are between 76 (0x4C) and 81 (0x51))
 
	if (ti->tileh != 0 && (ti->map5 < 0x4C || ti->map5 > 0x51))
 
		DrawFoundation(ti, ti->tileh);
 

	
 
	t = _station_display_datas[ti->map5];
 

	
 
	image = *(uint32*)t;
 
	image = *(const uint32*)t;
 
	t += sizeof(uint32);
 
	if (image & 0x8000)
 
		image |= image_or_modificator;
 
	DrawGroundSprite(image + base_img);
 

	
 
	for(dtss = (DrawTileSeqStruct *)t; (byte)dtss->delta_x != 0x80; dtss++) {
 
	for(dtss = (const DrawTileSeqStruct *)t; (byte)dtss->delta_x != 0x80; dtss++) {
 
		if ((byte)dtss->delta_z != 0x80) {
 
			image =	dtss->image + base_img;
 
			if (_display_opt & DO_TRANS_BUILDINGS) {
 
				if (image&0x8000) image |= image_or_modificator;
 
			} else {
 
				image = (image & 0x3FFF) | 0x03224000;
 
			}
 

	
 
			AddSortableSpriteToDraw(image, ti->x + dtss->delta_x, ti->y + dtss->delta_y, dtss->width, dtss->height, dtss->unk, ti->z + dtss->delta_z);
 
		} else {
 
			image = *(uint32*)&dtss->height + base_img; /* endian ok */
 
			image = *(const uint32*)&dtss->height + base_img; /* endian ok */
 

	
 
			if (_display_opt & DO_TRANS_BUILDINGS) {
 
				if (image&0x8000) image |= image_or_modificator;
 
			} else {
 
				image = (image & 0x3FFF) | 0x03224000;
 
			}
 
@@ -1782,19 +1782,19 @@ void StationPickerDrawSprite(int x, int 
 
	railtype *= TRACKTYPE_SPRITE_PITCH;
 

	
 
	ormod = PLAYER_SPRITE_COLOR(_local_player);
 

	
 
	t = _station_display_datas[image];
 

	
 
	img = *(uint32*)t;
 
	img = *(const uint32*)t;
 
	t += sizeof(uint32);
 
	if (img & 0x8000)
 
		img |= ormod;
 
	DrawSprite(img, x, y);
 

	
 
	for(dtss = (DrawTileSeqStruct *)t; (byte)dtss->delta_x != 0x80; dtss++) {
 
	for(dtss = (const DrawTileSeqStruct *)t; (byte)dtss->delta_x != 0x80; dtss++) {
 
		Point pt = RemapCoords(dtss->delta_x, dtss->delta_y, dtss->delta_z);
 
		DrawSprite((dtss->image | ormod) + railtype, x + pt.x, y + pt.y);
 
	}
 
}
 

	
 
static uint GetSlopeZ_Station(TileInfo *ti)
station_gui.c
Show inline comments
 
@@ -51,15 +51,14 @@ static char _bufcache[64];
 
static uint16 _last_station_idx;
 

	
 
static int CDECL StationNameSorter(const void *a, const void *b)
 
{
 
	char buf1[64];
 
	Station *st;
 
	SortStruct *cmp1, *cmp2;
 
	cmp1 = (SortStruct*)a;
 
	cmp2 = (SortStruct*)b;
 
	const SortStruct *cmp1 = (const SortStruct*)a;
 
	const SortStruct *cmp2 = (const SortStruct*)b;
 

	
 
	st = DEREF_STATION(cmp1->index);
 
	SET_DPARAM16(0, st->town->townnametype);
 
	SET_DPARAM32(1, st->town->townnameparts);
 
	GetString(buf1, st->string_id);
 

	
strgen/strgen.c
Show inline comments
 
@@ -40,13 +40,13 @@ typedef struct CmdStruct {
 
} CmdStruct;
 

	
 
typedef struct LineName {
 
	struct LineName *hash_next;
 
	int value;
 
	char str[1];
 
} LineName; 
 
} LineName;
 

	
 
int _cur_line;
 
bool _warnings;
 

	
 
uint32 _hash;
 
char _lang_name[32], _lang_ownname[32];
 
@@ -215,13 +215,13 @@ static const CmdStruct _cmd_structs[] = 
 
	{"BIGFONT", EmitSingleByte, 9},
 

	
 
	// New line
 
	{"", EmitSingleByte, 10},
 

	
 
	// Colors
 
	{"BLUE", EmitSingleByte, 15},		
 
	{"BLUE", EmitSingleByte, 15},
 
	{"SILVER", EmitSingleByte, 16},
 
	{"GOLD", EmitSingleByte, 17},
 
	{"RED", EmitSingleByte, 18},
 
	{"PURPLE", EmitSingleByte, 19},
 
	{"LTBROWN", EmitSingleByte, 20},
 
	{"ORANGE", EmitSingleByte, 21},
 
@@ -232,28 +232,28 @@ static const CmdStruct _cmd_structs[] = 
 
	{"BROWN", EmitSingleByte, 26},
 
	{"WHITE", EmitSingleByte, 27},
 
	{"LTBLUE", EmitSingleByte, 28},
 
	{"GRAY", EmitSingleByte, 29},
 
	{"DKBLUE", EmitSingleByte, 30},
 
	{"BLACK", EmitSingleByte, 31},
 
	
 

	
 
	// 0x7B=123 is the LAST special character we may use.
 

	
 
	// Numbers
 
	{"COMMA32", EmitSingleByte, 0x7B},
 
	{"COMMA16", EmitSingleByte, 0x7C},
 
	{"COMMA8", EmitSingleByte, 0x7D},
 
	{"NUMU16", EmitSingleByte, 0x7E},
 

	
 
	{"CURRENCY", EmitSingleByte, 0x7F},
 
	
 

	
 
	{"CURRCOMPACT", EmitEscapedByte, 0}, // compact currency
 
	{"INT32", EmitEscapedByte, 1}, // compact currency
 
	{"REV", EmitEscapedByte, 2}, // openttd revision string
 
	{"SHORTCARGO", EmitEscapedByte, 3}, // short cargo description, only ### tons, or ### litres
 
	
 

	
 
	{"STRINL", EmitStringInl, 0x81},
 

	
 
	{"DATE_LONG", EmitSingleByte, 0x82},
 
	{"DATE_SHORT", EmitSingleByte, 0x83},
 

	
 
	{"VELOCITY", EmitSingleByte, 0x84},
 
@@ -385,13 +385,13 @@ bool check_commands_match(char *a, char 
 
	return true;
 
}
 

	
 
void handle_string(char *str, bool master) {
 
	char *s,*t,*r;
 
	int ent;
 
		
 

	
 
	if (*str == '#') {
 
		if (str[1] == '#' && str[2] != '#')
 
			handle_pragma(str + 2);
 
		return;
 
	}
 

	
 
@@ -468,23 +468,23 @@ uint32 my_hash_str(uint32 hash, const ch
 
{
 
	for(;*s;s++) {
 
		hash = ((hash << 3) | (hash >> 29)) ^ *s;
 
		if (hash & 1) hash = (hash>>1) ^ 0xDEADBEEF; else hash >>= 1;
 
	}
 
	return hash;
 
	
 

	
 
}
 

	
 
void parse_file(const char *file, bool english) {
 
	char buf[2048];
 
	int i;
 
	FILE *in;
 

	
 
	in = fopen(file, "r");
 
	if (in == NULL) { error("Cannot open file '%s'", file); }
 
	
 

	
 
	_cur_line = 1;
 
	while (fgets(buf, sizeof(buf),in) != NULL) {
 
		i = strlen(buf);
 
		while (i>0 && (buf[i-1]=='\r' || buf[i-1]=='\n' || buf[i-1] == ' ')) i--;
 
		buf[i] = 0;
 

	
 
@@ -509,13 +509,13 @@ void parse_file(const char *file, bool e
 
				while ((cs = parse_command_string(&s, buf, NULL)) != 0) {
 
					if ( (uint)cs >= 256) {
 
						hash ^= (cs - _cmd_structs) * 0x1234567;
 
						if (hash & 1) hash = (hash>>1) ^ 0xF00BAA4; else hash >>= 1;
 
					}
 
				}
 
			}	
 
			}
 
		}
 
		_hash = hash;
 
	}
 
}
 

	
 
int count_inuse(int grp) {
 
@@ -576,13 +576,13 @@ void gen_output(FILE *f) {
 
	fwrite(in_use_file, 32*sizeof(uint16), 1, f);
 

	
 
	for(i=0; i!=32; i++) {
 
		for(j=0; j!=in_use[i]; j++) {
 
			char *s = allstr[(i<<11)+j];
 
			if (s == NULL) error("Internal error, s==NULL");
 
			
 

	
 
			write_length(f, *(uint16*)s);
 
			fwrite(s + sizeof(uint16), *(uint16*)s , 1, f);
 
			tot_str--;
 
		}
 
	}
 

	
 
@@ -639,21 +639,21 @@ void write_strings_h(const char *filenam
 
	for(i = 0; i!=65536; i++) {
 
		if (allstr[i]) {
 
			if (lastgrp != (i >> 11)) {
 
				lastgrp = (i >> 11);
 
				fprintf(out, "};\n\nenum {");
 
			}
 
			
 

	
 
			fprintf(out, next == i ? "%s,\n" : "\n%s = 0x%X,\n", allstr[i] + 1, i);
 
			next = i + 1;
 
		}
 
	}
 

	
 
	fprintf(out, "};\n");
 

	
 
	fprintf(out, 
 
	fprintf(out,
 
		"\nenum {\n"
 
		"\tLANGUAGE_PACK_IDENT = 0x474E414C, // Big Endian value for 'LANG' (LE is 0x 4C 41 4E 47)\n"
 
		"\tLANGUAGE_PACK_VERSION = 0x%X,\n"
 
		"};\n", (unsigned int)_hash);
 

	
 

	
 
@@ -687,13 +687,13 @@ void write_langfile(const char *filename
 
	for(i=0; i!=32; i++) {
 
		int n = count_inuse(i);
 
		in_use[i] = n;
 
		hdr.offsets[i] = TO_LE16(n);
 
	}
 

	
 
	// see line 655: fprintf(..."\tLANGUAGE_PACK_IDENT = 0x474E414C,...) 
 
	// see line 655: fprintf(..."\tLANGUAGE_PACK_IDENT = 0x474E414C,...)
 
	hdr.ident = TO_LE32(0x474E414C); // Big Endian value for 'LANG'
 
	hdr.version = TO_LE32(_hash);
 
	strcpy(hdr.name, _lang_name);
 
	strcpy(hdr.own_name, _lang_ownname);
 

	
 
	fwrite(&hdr, sizeof(hdr), 1, f);
 
@@ -709,13 +709,13 @@ void write_langfile(const char *filename
 
				str = s + 2 + strlen(s + 1);
 

	
 
				if (show_todo && s[0]) {
 
					if (show_todo == 2) {
 
						fprintf(stderr, "Warning:%s: String '%s' is untranslated\n", filename, s + 1);
 
					} else {
 
						char *s = "<TODO> ";
 
						const char *s = "<TODO> ";
 
						while(*s) put_byte(*s++);
 
					}
 
				}
 

	
 
				for(;;) {
 
					cs = parse_command_string(&str, param, s[0] ? "english.lng" : filename);
 
@@ -766,16 +766,16 @@ int main(int argc, char* argv[])
 
	if (argc == 1) {
 
		// parse master file
 
		parse_file("lang/english.txt", true);
 
		if (_warnings) return 1;
 

	
 
		// write english.lng and strings.h
 
		
 

	
 
		write_langfile("lang/english.lng", 0);
 
		write_strings_h("table/strings.h");
 
		
 

	
 
	} else if (argc == 2) {
 
		parse_file("lang/english.txt", true);
 
		parse_file(argv[1], false);
 
		if (_warnings) return 1;
 
		strcpy(buf, argv[1]);
 
		r = strrchr(buf, '.');
table/landscape_const.h
Show inline comments
 
@@ -63,13 +63,13 @@ static const LandscapePredefVar _landsca
 
			STR_0014_GOODS,
 
			STR_0022_WHEAT,
 
			STR_0016_WOOD,
 
			STR_000E,
 
			STR_001F_PAPER,
 
			STR_0020_GOLD,
 
			STR_001E_FOOD,			
 
			STR_001E_FOOD,
 
		},
 
		/* hilly weights */
 
		{
 
			1, 16, 4, 16, 3, 8, 16, 16, 0, 16, 8, 16
 
		},
 

	
table/landscape_sprite.h
Show inline comments
 
@@ -129,13 +129,13 @@ 0x10E4, 0x1133,
 
 0x511,  0x511,
 
 0x322,  0x322,
 
 0xffff,
 
};
 

	
 

	
 
/* Slope graphics indexes temperate climate 
 
/* Slope graphics indexes temperate climate
 
Skip first 3 sprites and only load the proper set */
 
static const SpriteID _slopes_spriteindexes_0[] = {
 
 0xfffe,  3,
 
 SPR_SLOPES_BASE, SPR_SLOPES_BASE+73,
 
 0xffff,
 
};
 
@@ -145,13 +145,13 @@ Skip first 79 sprites and only load the 
 
static const SpriteID _slopes_spriteindexes_1[] = {
 
 0xfffe,  79,
 
 SPR_SLOPES_BASE, SPR_SLOPES_BASE+73,
 
 0xffff,
 
};
 

	
 
/* Slope graphics indexes tropical climate 
 
/* Slope graphics indexes tropical climate
 
Skip first 155 sprites and only load the proper set */
 
static const SpriteID _slopes_spriteindexes_2[] = {
 
 0xfffe,  155,
 
 SPR_SLOPES_BASE, SPR_SLOPES_BASE+73,
 
 0xffff,
 
};
table/palettes.h
Show inline comments
 
byte _palettes[4][256 * 3] = {
 
/* palette 1 */
 
{
 
0,   0,   0,   212,   0, 212,   212,   0, 212,   212,   0, 212, 
 
212,   0, 212,   212,   0, 212,   212,   0, 212,   212,   0, 212, 
 
212,   0, 212,   212,   0, 212,   168, 168, 168,   184, 184, 184, 
 
200, 200, 200,   216, 216, 216,   232, 232, 232,   252, 252, 252, 
 
 52,  60,  72,    68,  76,  92,    88,  96, 112,   108, 116, 132, 
 
132, 140, 152,   156, 160, 172,   176, 184, 196,   204, 208, 220, 
 
 48,  44,   4,    64,  60,  12,    80,  76,  20,    96,  92,  28, 
 
120, 120,  64,   148, 148, 100,   176, 176, 132,   204, 204, 168, 
 
100, 100, 100,   116, 116, 116,   104,  80,  44,   124, 104,  72, 
 
152, 132,  92,   184, 160, 120,   212, 188, 148,   244, 220, 176, 
 
132, 132, 132,    88,   4,  16,   112,  16,  32,   136,  32,  52, 
 
160,  56,  76,   188,  84, 108,   204, 104, 124,   220, 132, 144, 
 
236, 156, 164,   252, 188, 192,   252, 212,   0,   252, 232,  60, 
 
252, 248, 128,    76,  40,   0,    96,  60,   8,   116,  88,  28, 
 
136, 116,  56,   156, 136,  80,   176, 156, 108,   196, 180, 136, 
 
 68,  24,   0,    96,  44,   4,   128,  68,   8,   156,  96,  16, 
 
184, 120,  24,   212, 156,  32,   232, 184,  16,   252, 212,   0, 
 
252, 248, 128,   252, 252, 192,    32,   4,   0,    64,  20,   8, 
 
 84,  28,  16,   108,  44,  28,   128,  56,  40,   148,  72,  56, 
 
168,  92,  76,   184, 108,  88,   196, 128, 108,   212, 148, 128, 
 
  8,  52,   0,    16,  64,   0,    32,  80,   4,    48,  96,   4, 
 
 64, 112,  12,    84, 132,  20,   104, 148,  28,   128, 168,  44, 
 
 64,  64,  64,    44,  68,  32,    60,  88,  48,    80, 104,  60, 
 
104, 124,  76,   128, 148,  92,   152, 176, 108,   180, 204, 124, 
 
 16,  52,  24,    32,  72,  44,    56,  96,  72,    76, 116,  88, 
 
 96, 136, 108,   120, 164, 136,   152, 192, 168,   184, 220, 200, 
 
 32,  24,   0,    56,  28,   0,    80,  80,  80,    88,  52,  12, 
 
104,  64,  24,   124,  84,  44,   140, 108,  64,   160, 128,  88, 
 
 76,  40,  16,    96,  52,  24,   116,  68,  40,   136,  84,  56, 
 
164,  96,  64,   184, 112,  80,   204, 128,  96,   212, 148, 112, 
 
224, 168, 128,   236, 188, 148,    80,  28,   4,   100,  40,  20, 
 
120,  56,  40,   140,  76,  64,   160, 100,  96,   184, 136, 136, 
 
 36,  40,  68,    48,  52,  84,    64,  64, 100,    80,  80, 116, 
 
100, 100, 136,   132, 132, 164,   172, 172, 192,   212, 212, 224, 
 
 48,  48,  48,    64,  44, 144,    88,  64, 172,   104,  76, 196, 
 
120,  88, 224,   140, 104, 252,   160, 136, 252,   188, 168, 252, 
 
  0,  24, 108,     0,  36, 132,     0,  52, 160,     0,  72, 184, 
 
  0,  96, 212,    24, 120, 220,    56, 144, 232,    88, 168, 240, 
 
128, 196, 252,   188, 224, 252,    16,  64,  96,    24,  80, 108, 
 
 40,  96, 120,    52, 112, 132,    80, 140, 160,   116, 172, 192, 
 
156, 204, 220,   204, 240, 252,   172,  52,  52,   212,  52,  52, 
 
252,  52,  52,   252, 100,  88,   252, 144, 124,   252, 184, 160, 
 
252, 216, 200,   252, 244, 236,    72,  20, 112,    92,  44, 140, 
 
112,  68, 168,   140, 100, 196,   168, 136, 224,   204, 180, 252, 
 
204, 180, 252,   232, 208, 252,    60,   0,   0,    92,   0,   0, 
 
128,   0,   0,   160,   0,   0,   196,   0,   0,   224,   0,   0, 
 
252,   0,   0,   252,  80,   0,   252, 108,   0,   252, 136,   0, 
 
252, 164,   0,   252, 192,   0,   252, 220,   0,   252, 252,   0, 
 
204, 136,   8,   228, 144,   4,   252, 156,   0,   252, 176,  48, 
 
252, 196, 100,   252, 216, 152,     8,  24,  88,    12,  36, 104, 
 
 20,  52, 124,    28,  68, 140,    40,  92, 164,    56, 120, 188, 
 
 72, 152, 216,   100, 172, 224,    92, 156,  52,   108, 176,  64, 
 
124, 200,  76,   144, 224,  92,   224, 244, 252,   204, 240, 252, 
 
180, 220, 236,   132, 188, 216,    88, 152, 172,    16,  16,  16, 
 
 32,  32,  32,     8,  92, 104,    16, 100, 112,    24, 108, 120, 
 
 32, 116, 128,    44, 124, 140,    92, 164, 184,   116, 180, 196, 
 
148, 200, 216,   180, 220, 232,   216, 244, 252,     0,   0,   0, 
 
  0,   0,   0,     0,   0,   0,     0,   0,   0,     0,   0,   0, 
 
252,  60,   0,   252,  80,   0,   252, 104,   0,   252, 128,   0, 
 
252, 148,   0,   252, 172,   0,   252, 196,   0,   252,   0,   0, 
 
252,   0,   0,     0,   0,   0,     0,   0,   0,     0,   0,   0, 
 
252, 228,   0,   148, 148, 148,   212,   0, 212,   212,   0, 212, 
 
212,   0, 212,   212,   0, 212,   212,   0, 212,   212,   0, 212, 
 
212,   0, 212,   212,   0, 212,   212,   0, 212,   252, 252, 252, 
 
0,   0,   0,   212,   0, 212,   212,   0, 212,   212,   0, 212,
 
212,   0, 212,   212,   0, 212,   212,   0, 212,   212,   0, 212,
 
212,   0, 212,   212,   0, 212,   168, 168, 168,   184, 184, 184,
 
200, 200, 200,   216, 216, 216,   232, 232, 232,   252, 252, 252,
 
 52,  60,  72,    68,  76,  92,    88,  96, 112,   108, 116, 132,
 
132, 140, 152,   156, 160, 172,   176, 184, 196,   204, 208, 220,
 
 48,  44,   4,    64,  60,  12,    80,  76,  20,    96,  92,  28,
 
120, 120,  64,   148, 148, 100,   176, 176, 132,   204, 204, 168,
 
100, 100, 100,   116, 116, 116,   104,  80,  44,   124, 104,  72,
 
152, 132,  92,   184, 160, 120,   212, 188, 148,   244, 220, 176,
 
132, 132, 132,    88,   4,  16,   112,  16,  32,   136,  32,  52,
 
160,  56,  76,   188,  84, 108,   204, 104, 124,   220, 132, 144,
 
236, 156, 164,   252, 188, 192,   252, 212,   0,   252, 232,  60,
 
252, 248, 128,    76,  40,   0,    96,  60,   8,   116,  88,  28,
 
136, 116,  56,   156, 136,  80,   176, 156, 108,   196, 180, 136,
 
 68,  24,   0,    96,  44,   4,   128,  68,   8,   156,  96,  16,
 
184, 120,  24,   212, 156,  32,   232, 184,  16,   252, 212,   0,
 
252, 248, 128,   252, 252, 192,    32,   4,   0,    64,  20,   8,
 
 84,  28,  16,   108,  44,  28,   128,  56,  40,   148,  72,  56,
 
168,  92,  76,   184, 108,  88,   196, 128, 108,   212, 148, 128,
 
  8,  52,   0,    16,  64,   0,    32,  80,   4,    48,  96,   4,
 
 64, 112,  12,    84, 132,  20,   104, 148,  28,   128, 168,  44,
 
 64,  64,  64,    44,  68,  32,    60,  88,  48,    80, 104,  60,
 
104, 124,  76,   128, 148,  92,   152, 176, 108,   180, 204, 124,
 
 16,  52,  24,    32,  72,  44,    56,  96,  72,    76, 116,  88,
 
 96, 136, 108,   120, 164, 136,   152, 192, 168,   184, 220, 200,
 
 32,  24,   0,    56,  28,   0,    80,  80,  80,    88,  52,  12,
 
104,  64,  24,   124,  84,  44,   140, 108,  64,   160, 128,  88,
 
 76,  40,  16,    96,  52,  24,   116,  68,  40,   136,  84,  56,
 
164,  96,  64,   184, 112,  80,   204, 128,  96,   212, 148, 112,
 
224, 168, 128,   236, 188, 148,    80,  28,   4,   100,  40,  20,
 
120,  56,  40,   140,  76,  64,   160, 100,  96,   184, 136, 136,
 
 36,  40,  68,    48,  52,  84,    64,  64, 100,    80,  80, 116,
 
100, 100, 136,   132, 132, 164,   172, 172, 192,   212, 212, 224,
 
 48,  48,  48,    64,  44, 144,    88,  64, 172,   104,  76, 196,
 
120,  88, 224,   140, 104, 252,   160, 136, 252,   188, 168, 252,
 
  0,  24, 108,     0,  36, 132,     0,  52, 160,     0,  72, 184,
 
  0,  96, 212,    24, 120, 220,    56, 144, 232,    88, 168, 240,
 
128, 196, 252,   188, 224, 252,    16,  64,  96,    24,  80, 108,
 
 40,  96, 120,    52, 112, 132,    80, 140, 160,   116, 172, 192,
 
156, 204, 220,   204, 240, 252,   172,  52,  52,   212,  52,  52,
 
252,  52,  52,   252, 100,  88,   252, 144, 124,   252, 184, 160,
 
252, 216, 200,   252, 244, 236,    72,  20, 112,    92,  44, 140,
 
112,  68, 168,   140, 100, 196,   168, 136, 224,   204, 180, 252,
 
204, 180, 252,   232, 208, 252,    60,   0,   0,    92,   0,   0,
 
128,   0,   0,   160,   0,   0,   196,   0,   0,   224,   0,   0,
 
252,   0,   0,   252,  80,   0,   252, 108,   0,   252, 136,   0,
 
252, 164,   0,   252, 192,   0,   252, 220,   0,   252, 252,   0,
 
204, 136,   8,   228, 144,   4,   252, 156,   0,   252, 176,  48,
 
252, 196, 100,   252, 216, 152,     8,  24,  88,    12,  36, 104,
 
 20,  52, 124,    28,  68, 140,    40,  92, 164,    56, 120, 188,
 
 72, 152, 216,   100, 172, 224,    92, 156,  52,   108, 176,  64,
 
124, 200,  76,   144, 224,  92,   224, 244, 252,   204, 240, 252,
 
180, 220, 236,   132, 188, 216,    88, 152, 172,    16,  16,  16,
 
 32,  32,  32,     8,  92, 104,    16, 100, 112,    24, 108, 120,
 
 32, 116, 128,    44, 124, 140,    92, 164, 184,   116, 180, 196,
 
148, 200, 216,   180, 220, 232,   216, 244, 252,     0,   0,   0,
 
  0,   0,   0,     0,   0,   0,     0,   0,   0,     0,   0,   0,
 
252,  60,   0,   252,  80,   0,   252, 104,   0,   252, 128,   0,
 
252, 148,   0,   252, 172,   0,   252, 196,   0,   252,   0,   0,
 
252,   0,   0,     0,   0,   0,     0,   0,   0,     0,   0,   0,
 
252, 228,   0,   148, 148, 148,   212,   0, 212,   212,   0, 212,
 
212,   0, 212,   212,   0, 212,   212,   0, 212,   212,   0, 212,
 
212,   0, 212,   212,   0, 212,   212,   0, 212,   252, 252, 252,
 
}};
 

	
 
#define GET_PALETTE(x) _palettes[x]
 

	
 
typedef struct {
 
	byte a[15];
table/road_land.h
Show inline comments
 
@@ -40,13 +40,13 @@ static const SpriteID _road_tile_sprites
 
	0, 0x546, 0x545, 0x53B, 0x544, 0x534, 0x53E, 0x539,
 
  0x543, 0x53C, 0x535, 0x538, 0x53D, 0x537, 0x53A, 0x536
 
};
 

	
 

	
 

	
 
#define MAKELINE(a,b,c) ADD_WORD(a), b, c, 
 
#define MAKELINE(a,b,c) ADD_WORD(a), b, c,
 
static const byte _road_display_datas2_0[] = {
 
	0,0
 
};
 

	
 
static const byte _road_display_datas2_1[] = {
 
	0,0
table/station_land.h
Show inline comments
 
@@ -533,13 +533,13 @@ static const byte _station_display_datas
 

	
 
static const byte _station_display_datas_82[] = {
 
	TILE_SEQ_BEGIN(0xFEC)
 
	TILE_SEQ_END()
 
};
 

	
 
// end of runway 
 
// end of runway
 
const byte _station_display_datas_083[] = {
 
	TILE_SEQ_BEGIN(0xA59)
 
	TILE_SEQ_END()
 
};
 

	
 
// runway tiles
 
@@ -567,23 +567,23 @@ const byte _station_display_datas_086[] 
 
const byte _station_display_datas_087[] = {
 
	TILE_SEQ_BEGIN(0xA4A)
 
	TILE_SEQ_LINE( 0,  0, 0,  1, 16,  6, 0x8A67)
 
	TILE_SEQ_END()
 
};
 

	
 
// end of runway 
 
// end of runway
 
const byte _station_display_datas_088[] = {
 
	TILE_SEQ_BEGIN(0xA59)
 
	TILE_SEQ_LINE(  0,  0,  0, 16,  1,  6, 0x8A68) // fences
 
	TILE_SEQ_END()
 
};
 

	
 
// runway tiles
 
const byte _station_display_datas_089[] = {
 
	TILE_SEQ_BEGIN(0xA56)
 
	TILE_SEQ_LINE(  0,  0,  0, 16,  1,  6, 0x8A68) // fences	
 
	TILE_SEQ_LINE(  0,  0,  0, 16,  1,  6, 0x8A68) // fences
 
	TILE_SEQ_END()
 
};
 

	
 
// turning radar with concrete underground fences on south -- needs 12 tiles
 
//BEGIN
 
const byte _station_display_datas_090[] = {
 
@@ -854,32 +854,32 @@ static const byte * const _station_displ
 
	_station_display_datas_084,
 
	_station_display_datas_085,
 
	_station_display_datas_086,
 
	_station_display_datas_087,
 
	_station_display_datas_088,
 
	_station_display_datas_089,
 
	_station_display_datas_090,		
 
	_station_display_datas_091,	
 
	_station_display_datas_092,	
 
	_station_display_datas_093,	
 
	_station_display_datas_094,	
 
	_station_display_datas_095,	
 
	_station_display_datas_096,	
 
	_station_display_datas_097,	
 
	_station_display_datas_098,	
 
	_station_display_datas_099,	
 
	_station_display_datas_090,
 
	_station_display_datas_091,
 
	_station_display_datas_092,
 
	_station_display_datas_093,
 
	_station_display_datas_094,
 
	_station_display_datas_095,
 
	_station_display_datas_096,
 
	_station_display_datas_097,
 
	_station_display_datas_098,
 
	_station_display_datas_099,
 
	_station_display_datas_0100,
 
	_station_display_datas_0101,		
 
	_station_display_datas_0102,		
 
	_station_display_datas_0103,	
 
	_station_display_datas_0104,	
 
	_station_display_datas_0105,	
 
	_station_display_datas_0106,	
 
	_station_display_datas_0107,	
 
	_station_display_datas_0108,	
 
	_station_display_datas_0109,	
 
	_station_display_datas_0110,	
 
	_station_display_datas_0111,	
 
	_station_display_datas_0101,
 
	_station_display_datas_0102,
 
	_station_display_datas_0103,
 
	_station_display_datas_0104,
 
	_station_display_datas_0105,
 
	_station_display_datas_0106,
 
	_station_display_datas_0107,
 
	_station_display_datas_0108,
 
	_station_display_datas_0109,
 
	_station_display_datas_0110,
 
	_station_display_datas_0111,
 
	_station_display_datas_0112,
 
	_station_display_datas_0113,
 
  _station_display_datas_0114,
 
};
table/train_cmd.h
Show inline comments
 
static const SpriteID _engine_sprite_base[] = {
 
0x0B59, 0x0B61, 0x0B69, 0x0BE1, 0x0B71, 0x0B75, 0x0B7D, 0x0B7D, 
 
0x0B85, 0x0B85, 0x0B8D, 0x0B8D, 0x0BC9, 0x0BD1, 0x0BD9, 0x0BE9, 
 
0x0BED, 0x0BED, 0x0BF5, 0x0BF9, 0x0B79, 0x0B9D, 0x0B9D, 0x0B95, 
 
0x0B95, 0x0BA5, 0x0BA9, 0x0BA9, 0x0BC1, 0x0BC5, 0x0BB1, 0x0BB9, 
 
0x0BB9, 0x0AAD, 0x0AB1, 0x0AB5, 0x0AB9, 0x0ABD, 0x0AC1, 0x0AC9, 
 
0x0ACD, 0x0AD5, 0x0AD1, 0x0AD9, 0x0AC5, 0x0AD1, 0x0AD5, 0x0AF9, 
 
0x0AFD, 0x0B05, 0x0AB9, 0x0AC1, 0x0AC9, 0x0AD1, 0x0AD9, 0x0AE1, 
 
0x0AE5, 0x0AE9, 0x0AF1, 0x0AF9, 0x0B0D, 0x0B11, 0x0B15, 0x0B19, 
 
0x0B1D, 0x0B21, 0x0B29, 0x0B2D, 0x0B35, 0x0B31, 0x0B39, 0x0B25, 
 
0x0B31, 0x0B35, 
 
0x0B59, 0x0B61, 0x0B69, 0x0BE1, 0x0B71, 0x0B75, 0x0B7D, 0x0B7D,
 
0x0B85, 0x0B85, 0x0B8D, 0x0B8D, 0x0BC9, 0x0BD1, 0x0BD9, 0x0BE9,
 
0x0BED, 0x0BED, 0x0BF5, 0x0BF9, 0x0B79, 0x0B9D, 0x0B9D, 0x0B95,
 
0x0B95, 0x0BA5, 0x0BA9, 0x0BA9, 0x0BC1, 0x0BC5, 0x0BB1, 0x0BB9,
 
0x0BB9, 0x0AAD, 0x0AB1, 0x0AB5, 0x0AB9, 0x0ABD, 0x0AC1, 0x0AC9,
 
0x0ACD, 0x0AD5, 0x0AD1, 0x0AD9, 0x0AC5, 0x0AD1, 0x0AD5, 0x0AF9,
 
0x0AFD, 0x0B05, 0x0AB9, 0x0AC1, 0x0AC9, 0x0AD1, 0x0AD9, 0x0AE1,
 
0x0AE5, 0x0AE9, 0x0AF1, 0x0AF9, 0x0B0D, 0x0B11, 0x0B15, 0x0B19,
 
0x0B1D, 0x0B21, 0x0B29, 0x0B2D, 0x0B35, 0x0B31, 0x0B39, 0x0B25,
 
0x0B31, 0x0B35,
 
};
 

	
 
/* For how many directions do we have sprites? (8 or 4; if 4, the other 4
 
 * directions are symmetric. */
 
static const byte _engine_sprite_and[] = {
 
7, 7, 7, 7, 3, 3, 7, 7, 
 
7, 7, 7, 7, 7, 7, 7, 3, 
 
7, 7, 3, 7, 3, 7, 7, 7, 
 
7, 3, 7, 7, 3, 3, 7, 7, 
 
7, 3, 3, 3, 3, 3, 3, 3, 
 
3, 3, 3, 3, 3, 3, 3, 3, 
 
3, 3, 3, 3, 3, 3, 3, 3, 
 
3, 3, 3, 3, 3, 3, 3, 3, 
 
3, 3, 3, 3, 3, 3, 3, 3, 
 
3, 3, 
 
7, 7, 7, 7, 3, 3, 7, 7,
 
7, 7, 7, 7, 7, 7, 7, 3,
 
7, 7, 3, 7, 3, 7, 7, 7,
 
7, 3, 7, 7, 3, 3, 7, 7,
 
7, 3, 3, 3, 3, 3, 3, 3,
 
3, 3, 3, 3, 3, 3, 3, 3,
 
3, 3, 3, 3, 3, 3, 3, 3,
 
3, 3, 3, 3, 3, 3, 3, 3,
 
3, 3, 3, 3, 3, 3, 3, 3,
 
3, 3,
 
};
 

	
 
/* Non-zero for multihead trains. */
 
static const byte _engine_sprite_add[] = {
 
0, 0, 0, 0, 0, 0, 0, 4, 
 
0, 4, 0, 4, 0, 0, 0, 0, 
 
0, 4, 0, 0, 0, 0, 4, 0, 
 
4, 0, 0, 4, 0, 0, 0, 0, 
 
4, 0, 0, 0, 0, 0, 0, 0, 
 
0, 0, 0, 0, 0, 0, 0, 0, 
 
0, 0, 0, 0, 0, 0, 0, 0, 
 
0, 0, 0, 0, 0, 0, 0, 0, 
 
0, 0, 0, 0, 0, 0, 0, 0, 
 
0, 0, 
 
0, 0, 0, 0, 0, 0, 0, 4,
 
0, 4, 0, 4, 0, 0, 0, 0,
 
0, 4, 0, 0, 0, 0, 4, 0,
 
4, 0, 0, 4, 0, 0, 0, 0,
 
4, 0, 0, 0, 0, 0, 0, 0,
 
0, 0, 0, 0, 0, 0, 0, 0,
 
0, 0, 0, 0, 0, 0, 0, 0,
 
0, 0, 0, 0, 0, 0, 0, 0,
 
0, 0, 0, 0, 0, 0, 0, 0,
 
0, 0,
 
};
 

	
 

	
 
static const byte _wagon_full_adder[] = {
 
	0, 0, 0, 0, 0, 0, 0, 0,
 
	0, 0, 0, 0, 0, 0, 0, 0,
table/water_land.h
Show inline comments
 
static const byte _shipdepot_display_seq_1[] = {
 
	ADD_WORD(0xFDD),
 

	
 
	0,15,0,16,1,0x14,
 
	ADD_WORD(0x8FE8),
 
	
 
	0x80 
 

	
 
	0x80
 
};
 

	
 
static const byte _shipdepot_display_seq_2[] = {
 
	ADD_WORD(0xFDD),
 

	
 
	0,0,0,16,1,0x14, ADD_WORD(0xFEA),
 
@@ -118,13 +118,13 @@ static const byte _shiplift_display_seq_
 
};
 

	
 
static const byte _shiplift_display_seq_3t[] = {
 
	ADD_WORD(0xFDD),
 
	0, 0, 0, 1, 0x10, 0x14, ADD_WORD(SPR_CANALS_BASE + 9 + 16 + 3),
 
	0xF, 0, 0, 1, 0x10, 0x14, ADD_WORD(SPR_CANALS_BASE + 9 + 20 + 3),
 
	0x80, 8	
 
	0x80, 8
 
};
 

	
 
static const byte * const _shiplift_display_seq[] = {
 
	_shiplift_display_seq_0,
 
	_shiplift_display_seq_1,
 
	_shiplift_display_seq_2,
town_gui.c
Show inline comments
 
@@ -351,21 +351,21 @@ static uint _num_town_sort;
 
static char _bufcache[64];
 
static byte _last_town_idx;
 

	
 
static int CDECL TownNameSorter(const void *a, const void *b)
 
{
 
	char buf1[64];
 
	Town *t;
 
	const Town *t;
 
	byte val;
 
	int r;
 

	
 
	t = DEREF_TOWN(*(byte*)a);
 
	t = DEREF_TOWN(*(const byte*)a);
 
	SET_DPARAM32(0, t->townnameparts);
 
	GetString(buf1, t->townnametype);
 

	
 
	if ( (val=*(byte*)b) != _last_town_idx) {
 
	if ( (val=*(const byte*)b) != _last_town_idx) {
 
		_last_town_idx = val;
 
		t = DEREF_TOWN(val);
 
		SET_DPARAM32(0, t->townnameparts);
 
		GetString(_bufcache, t->townnametype);
 
	}
 

	
 
@@ -373,14 +373,14 @@ static int CDECL TownNameSorter(const vo
 
	if (_town_sort_order & 1) r = -r;
 
	return r;
 
}
 

	
 
static int CDECL TownPopSorter(const void *a, const void *b)
 
{
 
	Town *ta = DEREF_TOWN(*(byte*)a);
 
	Town *tb = DEREF_TOWN(*(byte*)b);
 
	const Town *ta = DEREF_TOWN(*(const byte*)a);
 
	const Town *tb = DEREF_TOWN(*(const byte*)b);
 
	int r = ta->population - tb->population;
 
	if (_town_sort_order & 1) r = -r;
 
	return r;
 
}
 

	
 
static void MakeSortedTownList()
ttd.c
Show inline comments
 
@@ -276,16 +276,16 @@ void LoadDriver(int driver, const char *
 
		}
 
		dd = GetDriverByName(dc->descs, buffer);
 
		if (dd == NULL)
 
			error("No such %s driver: %s\n", dc->name, buffer);
 
	}
 
	var = dc->var;
 
	if (*var != NULL) ((HalCommonDriver*)*var)->stop();
 
	if (*var != NULL) ((const HalCommonDriver*)*var)->stop();
 
	*var = NULL;
 
	drv = dd->drv;
 
	if ((err=((HalCommonDriver*)drv)->start(parms)) != NULL)
 
	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;
 
}
 

	
 
void PrintDriverList()
 
{
unix.c
Show inline comments
 
@@ -276,13 +276,13 @@ char *FiosBrowseTo(const FiosItem *item)
 
	return NULL;
 
}
 

	
 
// Get descriptive texts.
 
// Returns a path as well as a
 
//  string describing the path.
 
StringID FiosGetDescText(char **path)
 
StringID FiosGetDescText(const char **path)
 
{
 
	*path = _fios_path[0] ? _fios_path : "/";
 

	
 
#if defined(__linux__)
 
	{
 
	struct statvfs s;
 
@@ -357,13 +357,13 @@ bool FileExists(const char *filename)
 
{
 
	return access(filename, 0) == 0;
 
}
 

	
 
static int LanguageCompareFunc(const void *a, const void *b)
 
{
 
	return strcmp(*(char**)a, *(char**)b);
 
	return strcmp(*(const char* const *)a, *(const char* const *)b);
 
}
 

	
 
int GetLanguageList(char **languages, int max)
 
{
 
	DIR *dir;
 
	struct dirent *dirent;
unmovable_cmd.c
Show inline comments
 
@@ -81,17 +81,17 @@ static void DrawTile_Unmovable(TileInfo 
 

	
 
		if (ti->tileh) DrawFoundation(ti, ti->tileh);
 

	
 
		ormod = PLAYER_SPRITE_COLOR(_map_owner[ti->tile]);
 

	
 
		t = _unmovable_display_datas[ti->map5 & 0x7F];
 
		DrawGroundSprite(*(uint16*)t | ormod);
 
		DrawGroundSprite(*(const uint16*)t | ormod);
 

	
 
		t += sizeof(uint16);
 

	
 
		for(dtss = (DrawTileSeqStruct *)t; (byte)dtss->delta_x != 0x80; dtss++) {
 
		for(dtss = (const DrawTileSeqStruct *)t; (byte)dtss->delta_x != 0x80; dtss++) {
 
			image =	dtss->image;
 
			if (_display_opt & DO_TRANS_BUILDINGS) {
 
				image |= ormod;
 
			} else {
 
				image = (image & 0x3FFF) | 0x03224000;
 
			}
water_cmd.c
Show inline comments
 
@@ -380,16 +380,16 @@ typedef struct LocksDrawTileStruct {
 

	
 
static void DrawWaterStuff(TileInfo *ti, const byte *t, uint32 palette, uint base)
 
{
 
	const WaterDrawTileStruct *wdts;
 
	uint32 image;
 

	
 
	DrawGroundSprite(*(uint16*)t);
 
	DrawGroundSprite(*(const uint16*)t);
 
	t += sizeof(uint16);
 

	
 
	for(wdts = (WaterDrawTileStruct *)t; (byte)wdts->delta_x != 0x80; wdts++) {
 
	for(wdts = (const WaterDrawTileStruct *)t; (byte)wdts->delta_x != 0x80; wdts++) {
 
		image =	wdts->image + base;
 
		if (_display_opt & DO_TRANS_BUILDINGS) {
 
			image |= palette;
 
		} else {
 
			image = (image & 0x3FFF) | 0x03224000;
 
		}
 
@@ -426,16 +426,16 @@ static void DrawTile_Water(TileInfo *ti)
 
void DrawShipDepotSprite(int x, int y, int image)
 
{
 
	const byte *t;
 
	const WaterDrawTileStruct *wdts;
 

	
 
	t = _shipdepot_display_seq[image];
 
	DrawSprite(*(uint16*)t, x, y);
 
	DrawSprite(*(const uint16*)t, x, y);
 
	t += sizeof(uint16);
 

	
 
	for(wdts = (WaterDrawTileStruct *)t; (byte)wdts->delta_x != 0x80; wdts++) {
 
	for(wdts = (const WaterDrawTileStruct *)t; (byte)wdts->delta_x != 0x80; wdts++) {
 
		Point pt = RemapCoords(wdts->delta_x, wdts->delta_y, wdts->delta_z);
 
		DrawSprite(wdts->image + PLAYER_SPRITE_COLOR(_local_player), x + pt.x, y + pt.y);
 
	}
 
}
 

	
 

	
win32.c
Show inline comments
 
@@ -1738,13 +1738,13 @@ char *FiosBrowseTo(const FiosItem *item)
 
	return NULL;
 
}
 

	
 
// Get descriptive texts.
 
// Returns a path as well as a
 
//  string describing the path.
 
StringID FiosGetDescText(char **path)
 
StringID FiosGetDescText(const char **path)
 
{
 
	char root[4];
 
	DWORD spc, bps, nfc, tnc;
 
	*path = _fios_path;
 

	
 
	root[0] = _fios_path[0];
 
@@ -1809,13 +1809,13 @@ bool FileExists(const char *filename)
 
	CloseHandle(hand);
 
	return true;
 
}
 

	
 
static int CDECL LanguageCompareFunc(const void *a, const void *b)
 
{
 
	return strcmp(*(char**)a, *(char**)b);
 
	return strcmp(*(const char* const *)a, *(const char* const *)b);
 
}
 

	
 
int GetLanguageList(char **languages, int max)
 
{
 
	HANDLE hand;
 
	int num = 0;
window.c
Show inline comments
 
@@ -22,13 +22,13 @@ void DispatchLeftClickEvent(Window *w, i
 

	
 
	if (w->desc_flags & WDF_DEF_WIDGET) {
 
		e.click.widget = GetWidgetFromPos(w, x, y);
 
		if (e.click.widget < 0) return; /* exit if clicked outside of widgets */
 

	
 
		wi = &w->widget[e.click.widget];
 
				
 

	
 
		/* don't allow any interaction if the button has been disabled */
 
		if (HASBIT(w->disabled_state, e.click.widget))
 
			return;
 

	
 
		if (wi->type & 0xE0) {
 
			/* special widget handling for buttons*/
0 comments (0 inline, 0 general)