Changeset - r8409:2e7aa818987b
[Not reviewed]
master
7 6 0
rubidium - 16 years ago 2008-01-24 18:47:05
rubidium@openttd.org
(svn r11979) -Codechange: drop MSVC 2003 support because MSVC 2003 is broken in such a manner that it triggers an internal compiler error without any clue what of the code is wrong. Even trying to bisect the problem does not give a single line of code that causes the trouble.
13 files changed with 53 insertions and 5136 deletions:
0 comments (0 inline, 0 general)
docs/Readme_Windows_MSVC.txt
Show inline comments
 
@@ -6,11 +6,11 @@ PLEASE READ THE ENTIRE DOCUMENT BEFORE D
 

	
 
SUPPORTED MSVC COMPILERS
 
------------------------
 
OpenTTD includes projects for MSVC 2003.NET and MSVC 2005.NET. Both will
 
OpenTTD includes projects for MSVC 2005.NET and MSVC 2008.NET. Both will
 
compile out of the box, providing you have the required libraries/headers;
 
which ones, see below. There is no support for VS6, you are therefore
 
strongly encouraged to either upgrade to MSVC 2005 Express (free) or use GCC.
 
MSVC 2002 probably works as well, but it has not been tested.
 
which ones, see below. There is no support for VS6 or MSVC 2002, or
 
MSVC 2003.NET. You are therefore strongly encouraged to either upgrade to
 
MSVC 2005 Express (free) or use GCC.
 

	
 

	
 
1) REQUIRED FILES
 
@@ -74,20 +74,6 @@ NOTE: make sure that the directory for t
 
list, above all others, otherwise compilation will most likely fail!!
 

	
 

	
 
2.3) DEBUGGING - WORKING DIRECTORY (MSVC 2003 ONLY!)
 
----------------------------------------------------
 
The very first time you check out and compile OpenTTD with Visual Studio 2003, running
 
the binary will complain about missing files. You need to go into and change a setting
 

	
 
OpenTTD > Project > Properties > Configuration (All Configurations) > ...
 
 Configuration Properties > Debugging >
 

	
 
	* Working Directory: ..\bin
 

	
 
VS 2005 works out of the box because Microsoft allowed a user to supply a humanly-
 
readable defaults file (openttd_vs80.vcproj.user), whereas 2003 is braindead.
 

	
 

	
 
3) TTD GRAPHICS FILES
 
---------------------
 
Copy the following files from Transport Tycoon Deluxe to the bin/data folder
 
@@ -102,12 +88,12 @@ Copy the following files from Transport 
 

	
 
4) COMPILING
 
------------
 
Open trunk/openttd[_vs80].sln
 
Open trunk/openttd_vs[89]0.sln
 
Set the build mode to 'Release' in
 
Build > Configuration manager > Active solution configuration > select "Release"
 
Compile...
 

	
 
If everything works well the binary should be in trunk/objs/[Win32]/Release/openttd.exe
 
If everything works well the binary should be in trunk/objs/Win[32|64]/Release/openttd.exe
 

	
 

	
 
5) EDITING, CHANGING SOURCE CODE
 
@@ -126,4 +112,4 @@ to ask about reasons; or just wait. The 
 
within a few days as the problem is noticed and fixed.
 

	
 
An up-to-date version of this README can be found on the wiki:
 
http://wiki.openttd.org/index.php/MicrosoftVisualCExpress
 
\ No newline at end of file
 
http://wiki.openttd.org/index.php/MicrosoftVisualCExpress
projects/generate
Show inline comments
 
@@ -25,13 +25,6 @@ fi
 
# langs_vs80.vcproj   is for MSVC 2005
 
# strgen_vs80.vcproj  is for MSVC 2005
 

	
 
# openttd.sln         is for MSVC 2003
 
# openttd.vcproj      is for MSVC 2003
 
# langs.vcproj        is for MSVC 2003
 
# strgen.vcproj       is for MSVC 2003
 

	
 
# openttd.tgt         is for WatCom
 

	
 

	
 

	
 
# First, collect the list of Windows files
 
@@ -110,7 +103,7 @@ load_main_data() {
 

	
 
				print "		<Filter";
 
				print "			Name=\\""$0"\\"";
 
				print "			Filter=\\"\\">";
 
				print "			>";
 
			}
 

	
 
			next;
 
@@ -121,7 +114,8 @@ load_main_data() {
 
				gsub("	", "", $0);
 
				gsub("/", "\\\\", $0);
 
				print "			<File";
 
				print "				RelativePath=\\".\\\\'$file_prefix'"$0"\\">";
 
				print "				RelativePath=\\".\\\\'$file_prefix'"$0"\\"";
 
				print "				>";
 
				print "			</File>";
 
			}
 
		}
 
@@ -138,15 +132,18 @@ load_lang_data() {
 
		i=`basename $i | sed s/.txt$//g`
 
		RES="$RES
 
		<File
 
			RelativePath=\"..\\src\\lang\\"$i".txt\">
 
			RelativePath=\"..\\src\\lang\\"$i".txt\"
 
			>
 
			<FileConfiguration
 
				Name=\"Debug|Win32\">
 
				Name=\"Debug|Win32\"
 
				>
 
				<Tool
 
					Name=\"VCCustomBuildTool\"
 
					Description=\"Generating "$i" language file\"
 
					CommandLine=\"..\\objs\\strgen\\strgen.exe -s ..\\src\\lang -d ..\\bin\\lang &quot;\$(InputPath)&quot;&#x0D;&#x0A;\"
 
					AdditionalDependencies=\"\"
 
					Outputs=\"..\\bin\\lang\\"$i".lng\"/>
 
					Outputs=\"..\\bin\\lang\\"$i".lng\"
 
				/>
 
			</FileConfiguration>
 
		</File>"
 
	done
 
@@ -165,22 +162,7 @@ generate() {
 
		}
 
	' > "$ROOT_DIR/projects/$2"
 

	
 
	# The files-list
 
	echo "$1" | awk -v type="$3" '
 
		/&#x0D;&#x0A;/ {
 
			if (type == "msvc2003") gsub("&#x0D;&#x0A;", "\n", $0);
 
		}
 
		/Filter="">/ {
 
			if (type == "msvc2005") gsub("Filter=\"\">", ">", $0);
 
		}
 
		/"\/>/ {
 
			if (type == "msvc2005") gsub("/>", "\n" substr($0, 1, index($0, $1) - 2) "/>", $0);
 
		}
 
		/">/ {
 
			if (type == "msvc2005") gsub(">", "\n" substr($0, 1, index($0, $1) - 1) ">", $0);
 
		}
 
		{ print $0 }
 
	' >> "$ROOT_DIR/projects/$2"
 
	echo "$1" >> "$ROOT_DIR/projects/$2"
 

	
 
	# Everything below the !!FILES!! marker
 
	cat "$ROOT_DIR/projects/$2".in | tr '\r' '\n' | awk '
 
@@ -199,9 +181,7 @@ safety_check "$ROOT_DIR/source.list"
 
load_main_data "$ROOT_DIR/source.list" openttd
 
load_lang_data "$ROOT_DIR/src/lang/*.txt" lang
 

	
 
generate "$openttd" "openttd.vcproj"      "msvc2003"
 
generate "$openttd" "openttd_vs80.vcproj" "msvc2005"
 
generate "$openttd" "openttd_vs90.vcproj" "msvc2005"
 
generate "$lang" "langs.vcproj"           "msvc2003"
 
generate "$lang" "langs_vs80.vcproj"      "msvc2005"
 
generate "$lang" "langs_vs90.vcproj"      "msvc2005"
 
generate "$openttd" "openttd_vs80.vcproj"
 
generate "$openttd" "openttd_vs90.vcproj"
 
generate "$lang" "langs_vs80.vcproj"
 
generate "$lang" "langs_vs90.vcproj"
projects/langs.vcproj
Show inline comments
 
deleted file
projects/langs.vcproj.in
Show inline comments
 
deleted file
projects/openttd.sln
Show inline comments
 
deleted file
projects/openttd.tgt
Show inline comments
 
deleted file
projects/openttd.vcproj
Show inline comments
 
deleted file
projects/openttd.vcproj.in
Show inline comments
 
deleted file
projects/strgen.vcproj
Show inline comments
 
deleted file
src/debug.cpp
Show inline comments
 
@@ -59,50 +59,34 @@ struct DebugLevel {
 

	
 
#if !defined(NO_DEBUG_MESSAGES)
 

	
 
/** Functionized DEBUG macro for compilers that don't support
 
 * variadic macros (__VA_ARGS__) such as...yes MSVC2003 and lower */
 
#if defined(NO_VARARG_MACRO)
 
void CDECL DEBUG(int name, int level, ...)
 
{
 
	va_list va;
 
	const char *dbg;
 
	const DebugLevel *dl = &debug_level[name];
 

	
 
	if (level != 0 && *dl->level < level) return;
 
	dbg = dl->name;
 
	va_start(va, level);
 
#else
 
void CDECL debug(const char *dbg, ...)
 
{
 
	va_list va;
 
	va_start(va, dbg);
 
#endif /* NO_VARARG_MACRO */
 
	{
 
		const char *s;
 
		char buf[1024];
 
	const char *s;
 
	char buf[1024];
 

	
 
		s = va_arg(va, const char*);
 
		vsnprintf(buf, lengthof(buf), s, va);
 
		va_end(va);
 
	s = va_arg(va, const char*);
 
	vsnprintf(buf, lengthof(buf), s, va);
 
	va_end(va);
 
#if defined(ENABLE_NETWORK)
 
		if (_debug_socket != INVALID_SOCKET) {
 
			char buf2[lengthof(buf) + 32];
 
	if (_debug_socket != INVALID_SOCKET) {
 
		char buf2[lengthof(buf) + 32];
 

	
 
			snprintf(buf2, lengthof(buf2), "dbg: [%s] %s\n", dbg, buf);
 
			send(_debug_socket, buf2, strlen(buf2), 0);
 
		} else
 
		snprintf(buf2, lengthof(buf2), "dbg: [%s] %s\n", dbg, buf);
 
		send(_debug_socket, buf2, strlen(buf2), 0);
 
	} else
 
#endif /* ENABLE_NETWORK */
 
		{
 
	{
 
#if defined(WINCE)
 
			/* We need to do OTTD2FS twice, but as it uses a static buffer, we need to store one temporary */
 
			TCHAR tbuf[512];
 
			_sntprintf(tbuf, sizeof(tbuf), _T("%s"), OTTD2FS(dbg));
 
			NKDbgPrintfW(_T("dbg: [%s] %s\n"), tbuf, OTTD2FS(buf));
 
		/* We need to do OTTD2FS twice, but as it uses a static buffer, we need to store one temporary */
 
		TCHAR tbuf[512];
 
		_sntprintf(tbuf, sizeof(tbuf), _T("%s"), OTTD2FS(dbg));
 
		NKDbgPrintfW(_T("dbg: [%s] %s\n"), tbuf, OTTD2FS(buf));
 
#else
 
			fprintf(stderr, "dbg: [%s] %s\n", dbg, buf);
 
		fprintf(stderr, "dbg: [%s] %s\n", dbg, buf);
 
#endif
 
			IConsoleDebug(dbg, buf);
 
		}
 
		IConsoleDebug(dbg, buf);
 
	}
 
}
 
#endif /* NO_DEBUG_MESSAGES */
src/debug.h
Show inline comments
 
@@ -19,44 +19,14 @@
 
 * 6.. - extremely detailed spamming
 
 */
 

	
 
/* Of course MSVC 2003 and lower has no support for variadic macros
 
 * so we need to work around this... *sigh* */
 
#if defined(_MSC_VER) && (_MSC_VER < 1400)
 
	#define NO_VARARG_MACRO
 
#endif
 

	
 
#if defined(NO_VARARG_MACRO)
 
	enum DebugLevelType {
 
		ai,
 
		driver,
 
		grf,
 
		map,
 
		misc,
 
		ms,
 
		net,
 
		sprite,
 
		oldloader,
 
		ntp,
 
		npf,
 
		yapf,
 
		freetype,
 
		sl,
 
		station,
 
	};
 
#endif /* NO_VARARG_MACRO */
 

	
 
#ifdef NO_DEBUG_MESSAGES
 
	#if defined(NO_VARARG_MACRO)
 
		static inline void DEBUG(int name, int level, ...) {}
 
	#elif defined(__GNUC__) && (__GNUC__ < 3)
 
	#if defined(__GNUC__) && (__GNUC__ < 3)
 
		#define DEBUG(name, level, args...)
 
	#else
 
		#define DEBUG(name, level, ...)
 
	#endif
 
#else /* NO_DEBUG_MESSAGES */
 
	#if defined(NO_VARARG_MACRO)
 
		void CDECL DEBUG(int name, int level, ...);
 
	#elif defined(__GNUC__) && (__GNUC__ < 3)
 
	#if defined(__GNUC__) && (__GNUC__ < 3)
 
		#define DEBUG(name, level, args...) if ((level == 0) || ( _debug_ ## name ## _level >= level)) debug(#name, args)
 
	#else
 
		#define DEBUG(name, level, ...) if (level == 0 || _debug_ ## name ## _level >= level) debug(#name, __VA_ARGS__)
 
@@ -78,9 +48,7 @@
 
	extern int _debug_sl_level;
 
	extern int _debug_station_level;
 

	
 
	#if !defined(NO_VARARG_MACRO)
 
		void CDECL debug(const char *dbg, ...);
 
	#endif /* NO_VARARG_MACRO */
 
	void CDECL debug(const char *dbg, ...);
 
#endif /* NO_DEBUG_MESSAGES */
 

	
 
void SetDebugString(const char *s);
src/graph_gui.cpp
Show inline comments
 
@@ -43,7 +43,7 @@ enum {
 
};
 

	
 
/* Apparently these don't play well with enums. */
 
static const OverflowSafeInt64 INVALID_DATAPOINT = INT64_MAX; // Value used for a datapoint that shouldn't be drawn.
 
static const OverflowSafeInt64 INVALID_DATAPOINT(INT64_MAX); // Value used for a datapoint that shouldn't be drawn.
 
static const uint INVALID_DATAPOINT_POS = UINT_MAX;  // Used to determine if the previous point was drawn.
 

	
 
struct GraphDrawer {
src/stdafx.h
Show inline comments
 
@@ -156,19 +156,17 @@
 
	#pragma warning(disable: 4761)  // integral size mismatch in argument : conversion supplied
 
	#pragma warning(disable: 4200)  // nonstandard extension used : zero-sized array in struct/union
 

	
 
	#if (_MSC_VER >= 1400)                   // MSVC 2005 safety checks
 
		#pragma warning(disable: 4996)   // 'strdup' was declared deprecated
 
		#define _CRT_SECURE_NO_DEPRECATE // all deprecated 'unsafe string functions
 
		#pragma warning(disable: 6308)   // code analyzer: 'realloc' might return null pointer: assigning null pointer to 't_ptr', which is passed as an argument to 'realloc', will cause the original memory block to be leaked
 
		#pragma warning(disable: 6011)   // code analyzer: Dereferencing NULL pointer 'pfGetAddrInfo': Lines: 995, 996, 998, 999, 1001
 
		#pragma warning(disable: 6326)   // code analyzer: potential comparison of a constant with another constant
 
		#pragma warning(disable: 6031)   // code analyzer: Return value ignored: 'ReadFile'
 
		#pragma warning(disable: 6255)   // code analyzer: _alloca indicates failure by raising a stack overflow exception. Consider using _malloca instead
 
		#pragma warning(disable: 6246)   // code analyzer: Local declaration of 'statspec' hides declaration of the same name in outer scope. For additional information, see previous declaration at ...
 
	#else /* _MSC_VER >= 1400  ( <1400 for MSVC2003) */
 
		#pragma warning(disable: 4288)   // nonstandard extension used : 'y' : loop control variable declared in the for-loop is used outside the for-loop scope; it conflicts with the declaration in the outer scope
 
		#pragma warning(disable: 4292)   // compiler limit : terminating debug information emission for enum 'StringIdEnum' with member 'STR_801D_COAL_CAR'
 
	#endif /* _MSC_VER >= 1400 */
 
	#if (_MSC_VER < 1400)                   // MSVC 2005 safety checks
 
		#error "Only MSVC 2005 or higher are supported. MSVC 2003 and earlier are not!. Upgrade your compiler."
 
	#endif /* (_MSC_VER < 1400) */
 
	#pragma warning(disable: 4996)   // 'strdup' was declared deprecated
 
	#define _CRT_SECURE_NO_DEPRECATE // all deprecated 'unsafe string functions
 
	#pragma warning(disable: 6308)   // code analyzer: 'realloc' might return null pointer: assigning null pointer to 't_ptr', which is passed as an argument to 'realloc', will cause the original memory block to be leaked
 
	#pragma warning(disable: 6011)   // code analyzer: Dereferencing NULL pointer 'pfGetAddrInfo': Lines: 995, 996, 998, 999, 1001
 
	#pragma warning(disable: 6326)   // code analyzer: potential comparison of a constant with another constant
 
	#pragma warning(disable: 6031)   // code analyzer: Return value ignored: 'ReadFile'
 
	#pragma warning(disable: 6255)   // code analyzer: _alloca indicates failure by raising a stack overflow exception. Consider using _malloca instead
 
	#pragma warning(disable: 6246)   // code analyzer: Local declaration of 'statspec' hides declaration of the same name in outer scope. For additional information, see previous declaration at ...
 

	
 
	#include <malloc.h> // alloca()
 
	#define NORETURN __declspec(noreturn)
0 comments (0 inline, 0 general)