summaryrefslogtreecommitdiff
path: root/projects
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-10-21 14:59:05 +0000
committerrubidium <rubidium@openttd.org>2007-10-21 14:59:05 +0000
commitf4775d06bb53f927ad05c7e6344a4e839c884c44 (patch)
tree2808064f7264f726364aadc0c5869eb17d794970 /projects
parent93303cffc453d8cd99b4a1e00645c072e7f7fae3 (diff)
downloadopenttd-f4775d06bb53f927ad05c7e6344a4e839c884c44.tar.xz
(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.
Diffstat (limited to 'projects')
-rw-r--r--projects/determineversion.vbs20
1 files changed, 17 insertions, 3 deletions
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()