From f4775d06bb53f927ad05c7e6344a4e839c884c44 Mon Sep 17 00:00:00 2001 From: rubidium Date: Sun, 21 Oct 2007 14:59:05 +0000 Subject: (svn r11330) -Add: OTTD version checking for NewGRFs. This allows NewGRFs to do something different for different versions of OpenTTD, like disabling it for too low versions or loading different graphics. --- projects/determineversion.vbs | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'projects') diff --git a/projects/determineversion.vbs b/projects/determineversion.vbs index 6d04e49f2..c1c254fbd 100644 --- a/projects/determineversion.vbs +++ b/projects/determineversion.vbs @@ -14,8 +14,9 @@ Sub FindReplaceInFile(filename, to_find, replacement) file.Close End Sub -Sub UpdateFile(version, cur_date, filename) +Sub UpdateFile(revision, version, cur_date, filename) FSO.CopyFile filename & ".in", filename + FindReplaceInFile filename, "@@REVISION@@", revision FindReplaceInFile filename, "@@VERSION@@", version FindReplaceInFile filename, "@@DATE@@", cur_date End Sub @@ -23,8 +24,21 @@ End Sub Sub UpdateFiles(version) Dim cur_date cur_date = DatePart("D", Date) & "." & DatePart("M", Date) & "." & DatePart("YYYY", Date) - UpdateFile version, cur_date, "../src/rev.cpp" - UpdateFile version, cur_date, "../src/ottdres.rc" + Dim revision + If version = "norev000" Then + revision = 0 + Else + revision = Mid(version, 2) + If InStr(revision, "M") Then + revision = Mid(revision, 1, InStr(revision, "M") - 1) + End If + If InStr(revision, "-") Then + revision = Mid(revision, 1, InStr(revision, "-") - 1) + End If + End If + + UpdateFile revision, version, cur_date, "../src/rev.cpp" + UpdateFile revision, version, cur_date, "../src/ottdres.rc" End Sub Function DetermineSVNVersion() -- cgit v1.2.3-70-g09d2