Update to 1.11.0-beta1
87
media/baseset/CMakeLists.txt
Normal file
@@ -0,0 +1,87 @@
|
||||
add_subdirectory(openttd)
|
||||
add_subdirectory(orig_extra)
|
||||
|
||||
set(BASESET_SOURCE_FILES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/orig_dos.obg
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/orig_dos_de.obg
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/orig_win.obg
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/no_music.obm
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/orig_dos.obm
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/orig_tto.obm
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/orig_win.obm
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/no_sound.obs
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/orig_dos.obs
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/orig_win.obs
|
||||
)
|
||||
set(BASESET_OTHER_SOURCE_FILES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/openttd.grf
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/opntitle.dat
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/orig_extra.grf
|
||||
)
|
||||
|
||||
# Done by the subdirectories, if nforenum / grfcodec is installed
|
||||
if(GRFCODEC_FOUND)
|
||||
set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/openttd.grf PROPERTIES GENERATED TRUE)
|
||||
set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/orig_extra.grf PROPERTIES GENERATED TRUE)
|
||||
|
||||
list(APPEND BASESET_BINARY_FILES openttd.grf)
|
||||
list(APPEND BASESET_BINARY_FILES orig_extra.grf)
|
||||
endif()
|
||||
|
||||
set(BASESET_EXTRAGRF_FILE ${CMAKE_CURRENT_SOURCE_DIR}/orig_extra.grf)
|
||||
|
||||
# Walk over all the baseset files, and generate a command to configure them
|
||||
foreach(BASESET_SOURCE_FILE IN LISTS BASESET_SOURCE_FILES)
|
||||
get_filename_component(BASESET_SOURCE_FILE_NAME "${BASESET_SOURCE_FILE}" NAME)
|
||||
set(BASESET_BINARY_FILE "${CMAKE_BINARY_DIR}/baseset/${BASESET_SOURCE_FILE_NAME}")
|
||||
|
||||
get_target_property(LANG_SOURCE_FILES language_files LANG_SOURCE_FILES)
|
||||
|
||||
add_custom_command_timestamp(OUTPUT ${BASESET_BINARY_FILE}
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
-DBASESET_SOURCE_FILE=${BASESET_SOURCE_FILE}
|
||||
-DBASESET_BINARY_FILE=${BASESET_BINARY_FILE}
|
||||
-DBASESET_EXTRAGRF_FILE=${BASESET_EXTRAGRF_FILE}
|
||||
-P ${CMAKE_SOURCE_DIR}/cmake/scripts/Baseset.cmake
|
||||
--
|
||||
${LANG_SOURCE_FILES}
|
||||
MAIN_DEPENDENCY ${BASESET_SOURCE_FILE}
|
||||
DEPENDS ${LANG_SOURCE_FILES}
|
||||
${BASESET_EXTRAGRF_FILE}
|
||||
${CMAKE_SOURCE_DIR}/cmake/scripts/Baseset.cmake
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
COMMENT "Generating ${BASESET_SOURCE_FILE_NAME} baseset metadata file"
|
||||
)
|
||||
|
||||
list(APPEND BASESET_BINARY_FILES ${BASESET_BINARY_FILE})
|
||||
endforeach()
|
||||
|
||||
# Walk over all the other baseset files, and generate a command to copy them
|
||||
foreach(BASESET_OTHER_SOURCE_FILE IN LISTS BASESET_OTHER_SOURCE_FILES)
|
||||
get_filename_component(BASESET_OTHER_SOURCE_FILE_NAME "${BASESET_OTHER_SOURCE_FILE}" NAME)
|
||||
set(BASESET_OTHER_BINARY_FILE "${CMAKE_BINARY_DIR}/baseset/${BASESET_OTHER_SOURCE_FILE_NAME}")
|
||||
|
||||
add_custom_command(OUTPUT ${BASESET_OTHER_BINARY_FILE}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy
|
||||
${BASESET_OTHER_SOURCE_FILE}
|
||||
${BASESET_OTHER_BINARY_FILE}
|
||||
MAIN_DEPENDENCY ${BASESET_OTHER_SOURCE_FILE}
|
||||
COMMENT "Copying ${BASESET_OTHER_SOURCE_FILE_NAME} baseset file"
|
||||
)
|
||||
|
||||
list(APPEND BASESET_BINARY_FILES ${BASESET_OTHER_BINARY_FILE})
|
||||
endforeach()
|
||||
|
||||
# Create a new target which generates all baseset metadata files
|
||||
add_custom_target_timestamp(baseset_files
|
||||
DEPENDS
|
||||
${BASESET_BINARY_FILES}
|
||||
)
|
||||
|
||||
add_library(basesets
|
||||
INTERFACE
|
||||
)
|
||||
add_dependencies(basesets
|
||||
baseset_files
|
||||
)
|
||||
add_library(openttd::basesets ALIAS basesets)
|
||||
@@ -5,7 +5,7 @@ name = NoMusic
|
||||
shortname = NULL
|
||||
version = 0
|
||||
fallback = true
|
||||
!! description STR_BASEMUSIC_NONE_DESCRIPTION
|
||||
@description_STR_BASEMUSIC_NONE_DESCRIPTION@
|
||||
|
||||
[files]
|
||||
theme =
|
||||
|
||||
@@ -5,7 +5,7 @@ name = NoSound
|
||||
shortname = NULL
|
||||
version = 2
|
||||
fallback = true
|
||||
!! description STR_BASESOUNDS_NONE_DESCRIPTION
|
||||
@description_STR_BASESOUNDS_NONE_DESCRIPTION@
|
||||
|
||||
[files]
|
||||
samples =
|
||||
|
||||
BIN
media/baseset/openttd.grf
Normal file
9
media/baseset/openttd/CMakeLists.txt
Normal file
@@ -0,0 +1,9 @@
|
||||
# In case both NFORenum and GRFCodec are found, generate the GRF.
|
||||
# Otherwise, just use them from the cache (read: git).
|
||||
# This is mainly because not many people have both of these tools installed,
|
||||
# so it is cheaper to cache them in git, and only regenerate when you are
|
||||
# working on it / have the tools installed.
|
||||
if(GRFCODEC_FOUND)
|
||||
include(CreateGrfCommand)
|
||||
create_grf_command()
|
||||
endif()
|
||||
|
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 29 KiB |
|
Before Width: | Height: | Size: 9.3 KiB After Width: | Height: | Size: 9.3 KiB |
|
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.5 KiB |
|
Before Width: | Height: | Size: 5.4 KiB After Width: | Height: | Size: 5.4 KiB |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 6.1 KiB After Width: | Height: | Size: 6.1 KiB |
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 5.9 KiB After Width: | Height: | Size: 5.9 KiB |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 54 KiB After Width: | Height: | Size: 54 KiB |
|
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 4.7 KiB |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
@@ -4,7 +4,7 @@
|
||||
// See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
-1 * 0 0C "OpenTTD GUI graphics"
|
||||
-1 * 3 05 15 \b 184 // OPENTTD_SPRITE_COUNT
|
||||
-1 * 3 05 15 \b 186 // OPENTTD_SPRITE_COUNT
|
||||
-1 sprites/openttdgui.png 8bpp 66 8 64 31 -31 7 normal
|
||||
-1 sprites/openttdgui.png 8bpp 146 8 64 31 -31 7 normal
|
||||
-1 sprites/openttdgui.png 8bpp 226 8 64 31 -31 7 normal
|
||||
@@ -189,3 +189,5 @@
|
||||
-1 sprites/openttdgui_convert_road.png 8bpp 24 0 32 32 0 0 normal
|
||||
-1 sprites/openttdgui_convert_tram.png 8bpp 0 0 20 20 0 0 normal
|
||||
-1 sprites/openttdgui_convert_tram.png 8bpp 24 0 32 32 0 0 normal
|
||||
-1 sprites/openttdgui.png 8bpp 513 440 10 10 0 0 normal
|
||||
-1 sprites/openttdgui.png 8bpp 526 440 10 10 0 0 normal
|
||||
|
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 43 KiB |
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 23 KiB |
|
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 25 KiB |
|
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.6 KiB |
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
BIN
media/baseset/opntitle.dat
Normal file
@@ -6,7 +6,7 @@ name = original_dos
|
||||
shortname = TTDD
|
||||
version = 1
|
||||
palette = DOS
|
||||
!! description STR_BASEGRAPHICS_DOS_DESCRIPTION
|
||||
@description_STR_BASEGRAPHICS_DOS_DESCRIPTION@
|
||||
|
||||
[files]
|
||||
base = TRG1.GRF
|
||||
@@ -22,7 +22,7 @@ TRGI.GRF = da6a6c9dcc451eec88d79211437b76a8
|
||||
TRGC.GRF = ed446637e034104c5559b32c18afe78d
|
||||
TRGH.GRF = ee6616fb0e6ef6b24892c58c93d86fc9
|
||||
TRGT.GRF = e30e8a398ae86c03dc534a8ac7dfb3b6
|
||||
ORIG_EXTRA.GRF =
|
||||
ORIG_EXTRA.GRF = ${ORIG_EXTRA_GRF_MD5}
|
||||
|
||||
[origin]
|
||||
default = You can find it on your Transport Tycoon Deluxe CD-ROM.
|
||||
|
||||
@@ -5,43 +5,43 @@
|
||||
name = original_dos
|
||||
shortname = TTDD
|
||||
version = 1
|
||||
!! description STR_BASEMUSIC_DOS_DESCRIPTION
|
||||
@description_STR_BASEMUSIC_DOS_DESCRIPTION@
|
||||
|
||||
[files]
|
||||
theme = gm.cat
|
||||
old_0 = gm.cat
|
||||
old_1 = gm.cat
|
||||
old_2 = gm.cat
|
||||
old_3 = gm.cat
|
||||
old_4 = gm.cat
|
||||
old_5 = gm.cat
|
||||
old_6 = gm.cat
|
||||
old_7 = gm.cat
|
||||
theme = GM.CAT
|
||||
old_0 = GM.CAT
|
||||
old_1 = GM.CAT
|
||||
old_2 = GM.CAT
|
||||
old_3 = GM.CAT
|
||||
old_4 = GM.CAT
|
||||
old_5 = GM.CAT
|
||||
old_6 = GM.CAT
|
||||
old_7 = GM.CAT
|
||||
old_8 =
|
||||
old_9 =
|
||||
new_0 = gm.cat
|
||||
new_1 = gm.cat
|
||||
new_2 = gm.cat
|
||||
new_3 = gm.cat
|
||||
new_4 = gm.cat
|
||||
new_5 = gm.cat
|
||||
new_6 = gm.cat
|
||||
new_0 = GM.CAT
|
||||
new_1 = GM.CAT
|
||||
new_2 = GM.CAT
|
||||
new_3 = GM.CAT
|
||||
new_4 = GM.CAT
|
||||
new_5 = GM.CAT
|
||||
new_6 = GM.CAT
|
||||
new_7 =
|
||||
new_8 =
|
||||
new_9 =
|
||||
ezy_0 = gm.cat
|
||||
ezy_1 = gm.cat
|
||||
ezy_2 = gm.cat
|
||||
ezy_3 = gm.cat
|
||||
ezy_4 = gm.cat
|
||||
ezy_5 = gm.cat
|
||||
ezy_0 = GM.CAT
|
||||
ezy_1 = GM.CAT
|
||||
ezy_2 = GM.CAT
|
||||
ezy_3 = GM.CAT
|
||||
ezy_4 = GM.CAT
|
||||
ezy_5 = GM.CAT
|
||||
ezy_6 =
|
||||
ezy_7 =
|
||||
ezy_8 =
|
||||
ezy_9 =
|
||||
|
||||
[md5s]
|
||||
gm.cat = 7a29d2d0c4f7d2e03091ffa9b2bdfffb
|
||||
GM.CAT = 7a29d2d0c4f7d2e03091ffa9b2bdfffb
|
||||
|
||||
[catindex]
|
||||
theme = 0
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
name = original_dos
|
||||
shortname = TTDO
|
||||
version = 0
|
||||
!! description STR_BASESOUNDS_DOS_DESCRIPTION
|
||||
@description_STR_BASESOUNDS_DOS_DESCRIPTION@
|
||||
|
||||
[files]
|
||||
samples = SAMPLE.CAT
|
||||
|
||||
@@ -6,7 +6,7 @@ name = original_dos_de
|
||||
shortname = TTDD
|
||||
version = 0
|
||||
palette = DOS
|
||||
!! description STR_BASEGRAPHICS_DOS_DE_DESCRIPTION
|
||||
@description_STR_BASEGRAPHICS_DOS_DE_DESCRIPTION@
|
||||
|
||||
[files]
|
||||
base = TRG1.GRF
|
||||
@@ -22,7 +22,7 @@ TRGI.GRF = da6a6c9dcc451eec88d79211437b76a8
|
||||
TRGC.GRF = ed446637e034104c5559b32c18afe78d
|
||||
TRGH.GRF = ee6616fb0e6ef6b24892c58c93d86fc9
|
||||
TRGT.GRF = fcde1d7e8a74197d72a62695884b909e
|
||||
ORIG_EXTRA.GRF =
|
||||
ORIG_EXTRA.GRF = ${ORIG_EXTRA_GRF_MD5}
|
||||
|
||||
[origin]
|
||||
default = You can find it on your Transport Tycoon Deluxe CD-ROM.
|
||||
|
||||
BIN
media/baseset/orig_extra.grf
Normal file
14
media/baseset/orig_extra/CMakeLists.txt
Normal file
@@ -0,0 +1,14 @@
|
||||
# In case both NFORenum and GRFCodec are found, generate the GRF.
|
||||
# Otherwise, just use them from the cache (read: git).
|
||||
# This is mainly because not many people have both of these tools installed,
|
||||
# so it is cheaper to cache them in git, and only regenerate when you are
|
||||
# working on it / have the tools installed.
|
||||
if(GRFCODEC_FOUND)
|
||||
include(CreateGrfCommand)
|
||||
create_grf_command(
|
||||
# We share some files with 'openttd' grf
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../openttd/airports.png
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../openttd/canals.png
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../openttd/chars.png
|
||||
)
|
||||
endif()
|
||||
|
Before Width: | Height: | Size: 76 KiB After Width: | Height: | Size: 76 KiB |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
@@ -5,28 +5,28 @@
|
||||
name = original_tto
|
||||
shortname = TTOD
|
||||
version = 1
|
||||
!! description STR_BASEMUSIC_TTO_DESCRIPTION
|
||||
@description_STR_BASEMUSIC_TTO_DESCRIPTION@
|
||||
|
||||
[files]
|
||||
theme = gm-tto.cat
|
||||
old_0 = gm-tto.cat
|
||||
old_1 = gm-tto.cat
|
||||
old_2 = gm-tto.cat
|
||||
old_3 = gm-tto.cat
|
||||
old_4 = gm-tto.cat
|
||||
old_5 = gm-tto.cat
|
||||
old_6 = gm-tto.cat
|
||||
old_7 = gm-tto.cat
|
||||
theme = GM-TTO.CAT
|
||||
old_0 = GM-TTO.CAT
|
||||
old_1 = GM-TTO.CAT
|
||||
old_2 = GM-TTO.CAT
|
||||
old_3 = GM-TTO.CAT
|
||||
old_4 = GM-TTO.CAT
|
||||
old_5 = GM-TTO.CAT
|
||||
old_6 = GM-TTO.CAT
|
||||
old_7 = GM-TTO.CAT
|
||||
old_8 =
|
||||
old_9 =
|
||||
new_0 = gm-tto.cat
|
||||
new_1 = gm-tto.cat
|
||||
new_2 = gm-tto.cat
|
||||
new_3 = gm-tto.cat
|
||||
new_4 = gm-tto.cat
|
||||
new_5 = gm-tto.cat
|
||||
new_6 = gm-tto.cat
|
||||
new_7 = gm-tto.cat
|
||||
new_0 = GM-TTO.CAT
|
||||
new_1 = GM-TTO.CAT
|
||||
new_2 = GM-TTO.CAT
|
||||
new_3 = GM-TTO.CAT
|
||||
new_4 = GM-TTO.CAT
|
||||
new_5 = GM-TTO.CAT
|
||||
new_6 = GM-TTO.CAT
|
||||
new_7 = GM-TTO.CAT
|
||||
new_8 =
|
||||
new_9 =
|
||||
ezy_0 =
|
||||
@@ -60,7 +60,7 @@ new_6 = 14
|
||||
new_7 = 3
|
||||
|
||||
[md5s]
|
||||
gm-tto.cat = 26e85ff84b0063aa5da05dd4698fc76e
|
||||
GM-TTO.CAT = 26e85ff84b0063aa5da05dd4698fc76e
|
||||
|
||||
[names]
|
||||
; Names get read from the CAT file
|
||||
|
||||
@@ -6,7 +6,7 @@ name = original_windows
|
||||
shortname = TTDW
|
||||
version = 0
|
||||
palette = Windows
|
||||
!! description STR_BASEGRAPHICS_WIN_DESCRIPTION
|
||||
@description_STR_BASEGRAPHICS_WIN_DESCRIPTION@
|
||||
|
||||
[files]
|
||||
base = TRG1R.GRF
|
||||
@@ -22,7 +22,7 @@ TRGIR.GRF = 0c2484ff6be49fc63a83be6ab5c38f32
|
||||
TRGCR.GRF = 3668f410c761a050b5e7095a2b14879b
|
||||
TRGHR.GRF = 06bf2b7a31766f048baac2ebe43457b1
|
||||
TRGTR.GRF = de53650517fe661ceaa3138c6edb0eb8
|
||||
ORIG_EXTRA.GRF =
|
||||
ORIG_EXTRA.GRF = ${ORIG_EXTRA_GRF_MD5}
|
||||
|
||||
[origin]
|
||||
default = You can find it on your Transport Tycoon Deluxe CD-ROM.
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
name = original_windows
|
||||
shortname = TTDW
|
||||
version = 1
|
||||
!! description STR_BASEMUSIC_WIN_DESCRIPTION
|
||||
@description_STR_BASEMUSIC_WIN_DESCRIPTION@
|
||||
|
||||
[files]
|
||||
theme = GM_TT00.GM
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
name = original_windows
|
||||
shortname = TTDO
|
||||
version = 0
|
||||
!! description STR_BASESOUNDS_WIN_DESCRIPTION
|
||||
@description_STR_BASESOUNDS_WIN_DESCRIPTION@
|
||||
|
||||
[files]
|
||||
samples = SAMPLE.CAT
|
||||
|
||||
@@ -1,67 +0,0 @@
|
||||
# This file is part of OpenTTD.
|
||||
# OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
|
||||
# OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#
|
||||
# Awk script to extract translations for baseset descriptions
|
||||
# from lang files for insertion into .obg/obs/obm files.
|
||||
# If there is no translation, there is no output.
|
||||
#
|
||||
# The input file is scanned for the pattern
|
||||
# !! <ini-key> <STR_id>
|
||||
#
|
||||
# The lang files (passed as variable 'langfiles') are scanned for <STR_id> and
|
||||
# the translations are added to the output file:
|
||||
# <ini-key>.<iso-code> = <translation>
|
||||
#
|
||||
|
||||
# Simple insertion sort since not all AWKs have a sort implementation
|
||||
function isort(A) {
|
||||
n = 0
|
||||
for (val in A) {
|
||||
n++;
|
||||
}
|
||||
|
||||
for (i = 2; i <= n; i++) {
|
||||
j = i;
|
||||
hold = A[j]
|
||||
while (A[j - 1] > hold) {
|
||||
j--;
|
||||
A[j + 1] = A[j]
|
||||
}
|
||||
A[j] = hold
|
||||
}
|
||||
|
||||
return n
|
||||
}
|
||||
|
||||
/^!!/ {
|
||||
ini_key = $2;
|
||||
str_id = $3;
|
||||
|
||||
file = langfiles
|
||||
while ((getline < file) > 0) {
|
||||
if (match($0, "##isocode") > 0) {
|
||||
lang = $2;
|
||||
} else if (match($0, "^" str_id " *:") > 0) {
|
||||
sub("^[^:]*:", "", $0)
|
||||
i++;
|
||||
if (lang == "en_GB") {
|
||||
texts[i] = ini_key " = "$0;
|
||||
} else {
|
||||
texts[i] = ini_key "." lang " = "$0;
|
||||
}
|
||||
}
|
||||
}
|
||||
close(file);
|
||||
|
||||
count = isort(texts);
|
||||
for (i = 1; i <= count; i++) {
|
||||
print texts[i]
|
||||
}
|
||||
|
||||
next
|
||||
}
|
||||
|
||||
{ print }
|
||||
@@ -1,145 +0,0 @@
|
||||
Option Explicit
|
||||
|
||||
' This file is part of OpenTTD.
|
||||
' OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
|
||||
' OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
' See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Dim FSO
|
||||
Set FSO = CreateObject("Scripting.FileSystemObject")
|
||||
|
||||
Dim inputfile, outputfile, langpath, extra_grf
|
||||
inputfile = WScript.Arguments(0)
|
||||
outputfile = WScript.Arguments(1)
|
||||
langpath = WScript.Arguments(2)
|
||||
|
||||
If WScript.Arguments.Length > 3 Then
|
||||
extra_grf = WScript.Arguments(3)
|
||||
End If
|
||||
|
||||
Function GetExtraGrfHash
|
||||
Dim WSO, exe, line
|
||||
|
||||
Set WSO = WScript.CreateObject("WScript.Shell")
|
||||
Set exe = WSO.Exec("certutil -hashfile " & extra_grf & " MD5")
|
||||
|
||||
Do Until exe.StdOut.AtEndOfStream
|
||||
line = exe.StdOut.ReadLine
|
||||
If Len(line) = 32 Then GetExtraGrfHash = line
|
||||
Loop
|
||||
|
||||
Set WSO = Nothing
|
||||
End Function
|
||||
|
||||
' Simple insertion sort, copied from translations.awk
|
||||
Sub ISort(a)
|
||||
Dim i, j, n, hold
|
||||
n = UBound(a)
|
||||
|
||||
For i = 1 To n
|
||||
j = i
|
||||
hold = a(j)
|
||||
Do While a(j - 1) > hold
|
||||
j = j - 1
|
||||
a(j + 1) = a(j)
|
||||
|
||||
If j = 0 Then Exit Do
|
||||
Loop
|
||||
a(j) = hold
|
||||
Next
|
||||
End Sub
|
||||
|
||||
Sub Lookup(ini_key, str_id, outfile)
|
||||
Dim folder, file, line, p, lang, i
|
||||
|
||||
' Ensure only complete string matches
|
||||
str_id = str_id & " "
|
||||
|
||||
Set folder = FSO.GetFolder(langpath)
|
||||
|
||||
Dim output()
|
||||
ReDim output(folder.Files.Count)
|
||||
|
||||
For Each file In folder.Files
|
||||
If UCase(FSO.GetExtensionName(file.Name)) = "TXT" Then
|
||||
Dim f
|
||||
Set f = CreateObject("ADODB.Stream")
|
||||
f.Charset = "utf-8"
|
||||
f.LineSeparator = 10 ' Assume lines end with \n even for \r\n files
|
||||
f.Open
|
||||
f.LoadFromFile(file.Path)
|
||||
|
||||
Do Until f.EOS
|
||||
line = Replace(f.ReadText(-2), Chr(13), "") ' Read a line and remove any \r
|
||||
|
||||
If InStr(1, line, "##isocode ") = 1 Then
|
||||
p = Split(line)
|
||||
lang = p(1)
|
||||
ElseIf InStr(1, line, str_id) = 1 Then
|
||||
p = Split(line, ":", 2)
|
||||
If lang = "en_GB" Then
|
||||
output(i) = ini_key & " = " & p(1)
|
||||
Else
|
||||
output(i) = ini_key & "." & lang & " = " & p(1)
|
||||
End If
|
||||
i = i + 1
|
||||
End If
|
||||
Loop
|
||||
|
||||
f.Close
|
||||
End If
|
||||
Next
|
||||
|
||||
ReDim Preserve output(i - 1)
|
||||
ISort output
|
||||
|
||||
For Each line In output
|
||||
outfile.WriteText line, 1
|
||||
Next
|
||||
|
||||
End Sub
|
||||
|
||||
Dim line, p
|
||||
|
||||
Dim infile
|
||||
Set infile = FSO.OpenTextFile(inputfile)
|
||||
|
||||
Dim outfile
|
||||
Set outfile = CreateObject("ADODB.Stream")
|
||||
outfile.Charset = "utf-8"
|
||||
outfile.Open
|
||||
|
||||
Do Until infile.atEndOfStream
|
||||
|
||||
line = infile.ReadLine()
|
||||
|
||||
If InStr(1, line, "ORIG_EXTRA.GRF ") = 1 Then
|
||||
p = Split(line, "=")
|
||||
If Trim(p(1)) = "" Then
|
||||
outfile.WriteText "ORIG_EXTRA.GRF = " & GetExtraGrfHash(), 1
|
||||
Else
|
||||
outfile.WriteText line, 1
|
||||
End If
|
||||
ElseIf InStr(1, line, "!! ") = 1 Then
|
||||
p = Split(line)
|
||||
Lookup p(1), p(2), outfile
|
||||
Else
|
||||
outfile.WriteText line, 1
|
||||
End If
|
||||
|
||||
Loop
|
||||
|
||||
' UTF-8 Text ADO Stream includes BOM, so we need to remove it
|
||||
Dim outfile_noBOM
|
||||
Set outfile_noBOM = CreateObject("ADODB.Stream")
|
||||
outfile_noBOM.Type = 1
|
||||
outfile_noBOM.Open
|
||||
|
||||
' Copy Text stream to Binary stream, skiping the BOM
|
||||
outfile.Position = 3
|
||||
outfile.CopyTo outfile_noBOM
|
||||
outfile.Close
|
||||
|
||||
' Write the Binary stream
|
||||
outfile_noBOM.SaveToFile outputfile, 2
|
||||
outfile_noBOM.Close
|
||||
@@ -1,30 +0,0 @@
|
||||
# This file is part of OpenTTD.
|
||||
# OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
|
||||
# OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
BEGIN {
|
||||
# Very basic variant function; barely any error checking.
|
||||
# Just use the first argument as the file to start from when assembling everything
|
||||
path = ARGV[1];
|
||||
gsub("[^/\\\\]*$", "", path);
|
||||
assemble(ARGV[1]);
|
||||
}
|
||||
|
||||
# Recursive function for assembling by means of resolving the #includes.
|
||||
function assemble(filename) {
|
||||
while ((getline < filename) > 0) {
|
||||
if (NF == 2 && $1 == "#include" ) {
|
||||
# Remove the quotes.
|
||||
gsub("[\"'<>]", "", $2);
|
||||
assemble(path $2);
|
||||
} else {
|
||||
print $0;
|
||||
}
|
||||
}
|
||||
|
||||
if (close(filename) < 0) {
|
||||
print "Could not open " filename > "/dev/stderr";
|
||||
exit -1;
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 39 KiB |