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
 
@@ -12,7 +12,7 @@ CFILES = 	ai.c aircraft_cmd.c aircraft_g
 
	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 ;
 

	
 

	
 
@@ -28,10 +28,10 @@ if $(UNIX) {
 
	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 ;
 

	
 
@@ -64,7 +64,7 @@ if $(UNIX) {
 
####################
 

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

	
 
rule Win32Res { ActWin32Res $(<) : $(>) ; DEPENDS $(<) : $(>) ; }
 
@@ -73,11 +73,11 @@ 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 ;
 
@@ -93,7 +93,7 @@ if $(TOOLSET) = VISUALC {
 
		CCFLAGS += -DWITH_ZLIB ;
 
		LINKLIBS += zlibstat.lib ;
 
	}
 
	
 

	
 
# build release by default
 
	RELEASE = 1 ;
 
}
 
@@ -107,7 +107,7 @@ rule MyObjects {
 

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

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

	
 
@@ -142,7 +142,7 @@ rule LangFile {
 
	} else {
 
		CompileLang $(<) : $(>) ;
 
	}
 
	
 

	
 
	Clean clean : $(<) ;
 
	DEPENDS $(<) : $(>) ;
 
	DEPENDS all : $(<) ;
Makefile
Show inline comments
 
@@ -59,12 +59,12 @@
 
#             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
 
@@ -134,14 +134,14 @@ 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
 
@@ -517,14 +517,14 @@ 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 $@'; \
 
@@ -555,7 +555,7 @@ endian.h: $(ENDIAN_CHECK)
 
lang/english.lng: lang/english.txt $(STRGEN)
 
	@echo 'Generating $@'; \
 
	$(STRGEN)
 
	
 

	
 
table/strings.h: lang/english.lng
 

	
 
lang/%.lng: lang/%.txt $(STRGEN)
 
@@ -621,7 +621,7 @@ love:
 

	
 
### Automatic configuration
 
-include $(CONFIG_WRITER)
 
	
 

	
 

	
 
# Export all variables set to subprocesses (a bit dirty)
 
.EXPORT_ALL_VARIABLES:
airport.c
Show inline comments
 
@@ -88,7 +88,7 @@ static void AirportFTAClass_Constructor(
 
	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
airport.h
Show inline comments
 
@@ -25,15 +25,15 @@ enum {
 

	
 
// 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
changelog.txt
Show inline comments
 
@@ -5,7 +5,7 @@ 0.3.3 (2004-07-13)
 
- 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.
 
@@ -29,7 +29,7 @@ 0.3.3 (2004-07-13)
 
- 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
 
@@ -58,7 +58,7 @@ 0.3.3 (2004-07-13)
 
- 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
console.c
Show inline comments
 
@@ -207,9 +207,9 @@ void IConsoleInit()
 
		}
 
	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");
 
@@ -269,16 +269,16 @@ 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;
 
}
 
@@ -303,7 +303,7 @@ void IConsoleCmdBufferNavigate(signed ch
 
	_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;
 
@@ -314,7 +314,7 @@ void IConsolePrint(byte color_code, byte
 
	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);
 
@@ -354,22 +354,22 @@ 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));
 

	
 
@@ -390,7 +390,7 @@ void IConsoleCmdRegister(byte * name, vo
 
		}
 
}
 

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

	
 
@@ -402,18 +402,18 @@ void* IConsoleCmdGet(byte * name)
 
	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));
 

	
 
@@ -436,7 +436,7 @@ void IConsoleVarRegister(byte * name, vo
 
		}
 
}
 

	
 
void IConsoleVarMemRegister(byte * name, byte type)
 
void IConsoleVarMemRegister(byte * name, byte type) /* XXX TRON */
 
{
 
	_iconsole_var * item;
 
	item = IConsoleVarAlloc(type);
 
@@ -444,7 +444,7 @@ void IConsoleVarMemRegister(byte * name,
 
}
 

	
 

	
 
void IConsoleVarInsert(_iconsole_var * var, byte * name)
 
void IConsoleVarInsert(_iconsole_var * var, const byte * name)
 
{
 
	byte * _new;
 
	_iconsole_var * item;
 
@@ -456,11 +456,11 @@ void IConsoleVarInsert(_iconsole_var * v
 
	// 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;
 

	
 
@@ -474,7 +474,7 @@ void IConsoleVarInsert(_iconsole_var * v
 
}
 

	
 

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

	
 
@@ -551,13 +551,12 @@ void IConsoleVarInsert(_iconsole_var * v
 

	
 
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;
 

	
 
@@ -567,52 +566,40 @@ void IConsoleVarSetString(_iconsole_var 
 
		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
 
@@ -686,7 +673,7 @@ 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);
 
@@ -706,7 +693,7 @@ void IConsoleVarHook(byte * name, byte t
 

	
 
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;
 
@@ -717,12 +704,13 @@ bool IConsoleVarHookHandle(_iconsole_var
 
	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);
 
@@ -753,6 +741,9 @@ bool IConsoleCmdHookHandle(_iconsole_cmd
 
	case ICONSOLE_HOOK_ACCESS:
 
		proc = hook_cmd->hook_access;
 
		break;
 
	default:
 
		proc = NULL;
 
		break;
 
	}
 
	if (proc == NULL) return true;
 
	return proc(hook_cmd);
 
@@ -885,7 +876,7 @@ void IConsoleCmdExec(byte * cmdstr)
 
			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;
 
@@ -1115,28 +1106,29 @@ void IConsoleCmdExec(byte * cmdstr)
 
	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) {
console.h
Show inline comments
 
@@ -47,7 +47,7 @@ typedef struct {
 
typedef struct {
 
	// --------------- //
 
	void * addr;
 
	byte * name;
 
	const byte * name;
 
	byte type;
 
	// -------------- //
 
	void * hook_access;
 
@@ -85,31 +85,31 @@ 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 *** //
 

	
 
@@ -119,8 +119,8 @@ void IConsoleCmdExec(byte * cmdstr);
 
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);
 

	
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
 
@@ -1016,8 +1016,8 @@ static StringID GetPerformanceTitleFromV
 
}
 

	
 
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));
 
}
hal.h
Show inline comments
 
@@ -135,7 +135,7 @@ 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
industry_gui.c
Show inline comments
 
@@ -392,8 +392,8 @@ static int CDECL GeneralIndustrySorter(c
 
{
 
	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) {
 
@@ -437,7 +437,7 @@ static int CDECL GeneralIndustrySorter(c
 
		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);
macros.h
Show inline comments
 
@@ -203,18 +203,18 @@ static INLINE void swap_tile(TileIndex *
 

	
 

	
 
#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);
 
}
main_gui.c
Show inline comments
 
@@ -2226,10 +2226,10 @@ void SetupColorsAndInitialWindow()
 
		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;
misc_gui.c
Show inline comments
 
@@ -963,7 +963,7 @@ static void BuildFileList()
 

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

	
 
	str = FiosGetDescText(&path);
network.c
Show inline comments
 
@@ -528,7 +528,7 @@ static void HandleCommandPacket(ClientSt
 
		qp = (QueuedCommand*)calloc(sizeof(QueuedCommand), 1);
 
	}
 
	qp->cp = *np;
 
	
 

	
 
	qp->frame = _frame_counter_max - GetNextSyncFrame();
 

	
 
	qp->callback = NULL;
network_gui.c
Show inline comments
 
@@ -144,7 +144,7 @@ static void NetworkGameWindowWndProc(Win
 
			NetworkGameListFromInternet();
 
			break;
 
		}
 
		
 

	
 
		_network_game_count_last = _network_game_count;
 
		SetWindowDirty(w);
 

	
 
@@ -179,7 +179,7 @@ static void NetworkGameWindowWndProc(Win
 
			rport = _network_server_port;
 
			c = 0;
 
			ip = b;
 
			
 

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

	
 
		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
 
@@ -1566,11 +1566,11 @@ void DrawTrainDepotSprite(int x, int y, 
 
	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;
readme.txt
Show inline comments
 
@@ -126,7 +126,7 @@ Windows:
 
  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.
 

	
 
@@ -147,8 +147,8 @@ 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:
 
---- -------------------
 
@@ -209,7 +209,7 @@ The OpenTTD team:
 
  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).
 
@@ -222,4 +222,4 @@ Thanks to:
 
  George - Canal graphics
 
  Bug Reporters - Thanks for all bug reports.
 
  Chris Sawyer - For an amazing game.
 
  
 

	
road_cmd.c
Show inline comments
 
@@ -810,9 +810,9 @@ static void DrawTile_Road(TileInfo *ti)
 

	
 
		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)
 
@@ -840,10 +840,10 @@ void DrawRoadDepotSprite(int x, int y, i
 
	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;
saveload.c
Show inline comments
 
@@ -422,7 +422,7 @@ static size_t SlCalcObjLength(void *obje
 
{
 
	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) {
 
@@ -464,7 +464,7 @@ static size_t SlCalcObjLength(void *obje
 

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

	
sdl.c
Show inline comments
 
@@ -212,9 +212,9 @@ 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] = {
settings.c
Show inline comments
 
@@ -325,9 +325,9 @@ static void ini_free(IniFile *ini)
 
struct SettingDesc {
 
	const char *name;
 
	int flags;
 
	void *def;
 
	const void *def;
 
	void *ptr;
 
	void *b;
 
	const void *b;
 

	
 
};
 

	
 
@@ -493,7 +493,7 @@ static void make_manyofmany(char *buf, c
 
	*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;
 
@@ -532,11 +532,11 @@ static void *string_to_val(const Setting
 
	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++) {
 
@@ -603,11 +603,12 @@ static void load_setting_desc(IniFile *i
 
	}
 
}
 

	
 
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;
 
@@ -883,7 +884,7 @@ static const SettingDesc patch_settings[
 
	{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)
 
{
station_cmd.c
Show inline comments
 
@@ -1743,13 +1743,13 @@ static void DrawTile_Station(TileInfo *t
 

	
 
	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) {
 
@@ -1760,7 +1760,7 @@ static void DrawTile_Station(TileInfo *t
 

	
 
			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;
 
@@ -1785,13 +1785,13 @@ void StationPickerDrawSprite(int x, int 
 

	
 
	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);
 
	}
station_gui.c
Show inline comments
 
@@ -54,9 +54,8 @@ static int CDECL StationNameSorter(const
 
{
 
	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);
strgen/strgen.c
Show inline comments
 
@@ -43,7 +43,7 @@ typedef struct LineName {
 
	struct LineName *hash_next;
 
	int value;
 
	char str[1];
 
} LineName; 
 
} LineName;
 

	
 
int _cur_line;
 
bool _warnings;
 
@@ -218,7 +218,7 @@ static const CmdStruct _cmd_structs[] = 
 
	{"", EmitSingleByte, 10},
 

	
 
	// Colors
 
	{"BLUE", EmitSingleByte, 15},		
 
	{"BLUE", EmitSingleByte, 15},
 
	{"SILVER", EmitSingleByte, 16},
 
	{"GOLD", EmitSingleByte, 17},
 
	{"RED", EmitSingleByte, 18},
 
@@ -235,7 +235,7 @@ static const CmdStruct _cmd_structs[] = 
 
	{"GRAY", EmitSingleByte, 29},
 
	{"DKBLUE", EmitSingleByte, 30},
 
	{"BLACK", EmitSingleByte, 31},
 
	
 

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

	
 
	// Numbers
 
@@ -245,12 +245,12 @@ static const CmdStruct _cmd_structs[] = 
 
	{"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},
 
@@ -388,7 +388,7 @@ bool check_commands_match(char *a, char 
 
void handle_string(char *str, bool master) {
 
	char *s,*t,*r;
 
	int ent;
 
		
 

	
 
	if (*str == '#') {
 
		if (str[1] == '#' && str[2] != '#')
 
			handle_pragma(str + 2);
 
@@ -471,7 +471,7 @@ uint32 my_hash_str(uint32 hash, const ch
 
		if (hash & 1) hash = (hash>>1) ^ 0xDEADBEEF; else hash >>= 1;
 
	}
 
	return hash;
 
	
 

	
 
}
 

	
 
void parse_file(const char *file, bool english) {
 
@@ -481,7 +481,7 @@ void parse_file(const char *file, bool e
 

	
 
	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);
 
@@ -512,7 +512,7 @@ void parse_file(const char *file, bool e
 
						if (hash & 1) hash = (hash>>1) ^ 0xF00BAA4; else hash >>= 1;
 
					}
 
				}
 
			}	
 
			}
 
		}
 
		_hash = hash;
 
	}
 
@@ -579,7 +579,7 @@ void gen_output(FILE *f) {
 
		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--;
 
@@ -642,7 +642,7 @@ void write_strings_h(const char *filenam
 
				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;
 
		}
 
@@ -650,7 +650,7 @@ void write_strings_h(const char *filenam
 

	
 
	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"
 
@@ -690,7 +690,7 @@ void write_langfile(const char *filename
 
		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);
 
@@ -712,7 +712,7 @@ void write_langfile(const char *filename
 
					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++);
 
					}
 
				}
 
@@ -769,10 +769,10 @@ int main(int argc, char* argv[])
 
		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);
table/landscape_const.h
Show inline comments
 
@@ -66,7 +66,7 @@ static const LandscapePredefVar _landsca
 
			STR_000E,
 
			STR_001F_PAPER,
 
			STR_0020_GOLD,
 
			STR_001E_FOOD,			
 
			STR_001E_FOOD,
 
		},
 
		/* hilly weights */
 
		{
table/landscape_sprite.h
Show inline comments
 
@@ -132,7 +132,7 @@ 0x10E4, 0x1133,
 
};
 

	
 

	
 
/* 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,
 
@@ -148,7 +148,7 @@ static const SpriteID _slopes_spriteinde
 
 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,
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]
table/road_land.h
Show inline comments
 
@@ -43,7 +43,7 @@ static const SpriteID _road_tile_sprites
 

	
 

	
 

	
 
#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
 
};
table/station_land.h
Show inline comments
 
@@ -536,7 +536,7 @@ static const byte _station_display_datas
 
	TILE_SEQ_END()
 
};
 

	
 
// end of runway 
 
// end of runway
 
const byte _station_display_datas_083[] = {
 
	TILE_SEQ_BEGIN(0xA59)
 
	TILE_SEQ_END()
 
@@ -570,7 +570,7 @@ const byte _station_display_datas_087[] 
 
	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
 
@@ -580,7 +580,7 @@ const byte _station_display_datas_088[] 
 
// 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()
 
};
 

	
 
@@ -857,28 +857,28 @@ static const byte * const _station_displ
 
	_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,
 
};
 

	
 

	
table/water_land.h
Show inline comments
 
@@ -3,8 +3,8 @@ static const byte _shipdepot_display_seq
 

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

	
 
	0x80
 
};
 

	
 
static const byte _shipdepot_display_seq_2[] = {
 
@@ -121,7 +121,7 @@ static const byte _shiplift_display_seq_
 
	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[] = {
town_gui.c
Show inline comments
 
@@ -354,15 +354,15 @@ 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);
 
@@ -376,8 +376,8 @@ static int CDECL TownNameSorter(const vo
 

	
 
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;
ttd.c
Show inline comments
 
@@ -279,10 +279,10 @@ void LoadDriver(int driver, const char *
 
			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;
 
}
unix.c
Show inline comments
 
@@ -279,7 +279,7 @@ 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)
 
{
 
	*path = _fios_path[0] ? _fios_path : "/";
 

	
 
@@ -360,7 +360,7 @@ bool FileExists(const char *filename)
 

	
 
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)
unmovable_cmd.c
Show inline comments
 
@@ -84,11 +84,11 @@ static void DrawTile_Unmovable(TileInfo 
 
		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;
water_cmd.c
Show inline comments
 
@@ -383,10 +383,10 @@ static void DrawWaterStuff(TileInfo *ti,
 
	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;
 
@@ -429,10 +429,10 @@ void DrawShipDepotSprite(int x, int y, i
 
	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
 
@@ -1741,7 +1741,7 @@ 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)
 
{
 
	char root[4];
 
	DWORD spc, bps, nfc, tnc;
 
@@ -1812,7 +1812,7 @@ bool FileExists(const char *filename)
 

	
 
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)
window.c
Show inline comments
 
@@ -25,7 +25,7 @@ void DispatchLeftClickEvent(Window *w, i
 
		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;
0 comments (0 inline, 0 general)