diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..e6ac07d
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,63 @@
+# Busy Bee Makefile
+#
+# This program 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; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program 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 this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+PROJECT_NAME = BusyBee
+
+SOURCES = *.nut
+VERSION_NUT = version.nut
+LANGFILES = lang/*.txt
+DOCS = license.txt readme.txt
+BANANAS_INI = bananas.ini
+
+MUSA = musa.py
+
+VERSION_INFO := "$(shell ./findversion.sh)"
+REPO_VERSION := $(shell echo ${VERSION_INFO} | cut -f2)
+REPO_DATE := $(shell echo ${VERSION_INFO} | cut -f7)
+
+DISPLAY_NAME := $(PROJECT_NAME) $(shell echo ${VERSION_INFO} | cut -f5)
+BUNDLE_NAME := $(PROJECT_NAME)
+BUNDLE_FILENAME = $(shell echo "$(DISPLAY_NAME)" | sed 's/ /-/g')
+
+BUNDLE_DIR = bundle
+
+.PHONY: all bananas bundle clean
+
+all: bundle
+
+clean:
+ echo "[CLEAN]"
+ $(_V) rm -rf $(BUNDLE_DIR)
+
+bundle: $(BUNDLE_DIR)/$(BUNDLE_FILENAME).tar
+
+$(BUNDLE_DIR)/$(BUNDLE_FILENAME).tar: $(SOURCES) $(LANGFILES) $(DOCS)
+ echo "[Bundle] $@"
+ python3 check_lang_compatibility.py lang/english.txt info.nut
+ rm -rf "$(BUNDLE_DIR)"
+ mkdir -p "$(BUNDLE_DIR)/$(BUNDLE_FILENAME)/lang"
+ cp $(SOURCES) $(DOCS) "$(BUNDLE_DIR)/$(BUNDLE_FILENAME)"
+ cp $(LANGFILES) "$(BUNDLE_DIR)/$(BUNDLE_FILENAME)/lang"
+ sed -i 's/^PROGRAM_VERSION.*/PROGRAM_VERSION <- $(REPO_VERSION);/' "$(BUNDLE_DIR)/$(BUNDLE_FILENAME)/info.nut"
+ sed -i 's/^PROGRAM_DATE.*/PROGRAM_DATE <- "$(REPO_DATE)";/' "$(BUNDLE_DIR)/$(BUNDLE_FILENAME)/info.nut"
+ sed -i 's/^PROGRAM_NAME.*/PROGRAM_NAME <- "$(DISPLAY_NAME)";/' "$(BUNDLE_DIR)/$(BUNDLE_FILENAME)/info.nut"
+ cd $(BUNDLE_DIR); tar -cf "$(BUNDLE_FILENAME).tar" "$(BUNDLE_FILENAME)"
+
+bananas: bundle
+ echo "[BaNaNaS]"
+ sed 's/^version *=.*/version = $(DISPLAY_VERSION)/' $(BANANAS_INI) > "$(BUNDLE_DIR)/$(BANANAS_INI)"
+ $(MUSA) -r -x license.txt -c $(BUNDLE_DIR)/$(BANANAS_INI) "$(BUNDLE_DIR)/$(BUNDLE_FILENAME)"
+
diff --git a/bananas.ini b/bananas.ini
new file mode 100644
index 0000000..ec7613f
--- /dev/null
+++ b/bananas.ini
@@ -0,0 +1,19 @@
+[musa]
+type = Game Script
+name = BusyBee
+
+# The version is inserted by the Makefile
+version =
+
+description_file = bananas_description.txt
+url = http://dev.openttdcoop.org/projects/busybee-gs
+license = GPL v2
+tags = cargo, challenge, goal, cooperative
+openttd_minimum_supported_version = 1.4.2
+openttd_maximum_supported_version =
+
+# SuperLib_for_NoGo-36.tar
+dependencies =
+
+authors = alberth, andythenorth
+
diff --git a/bananas_description.txt b/bananas_description.txt
new file mode 100644
index 0000000..9806012
--- /dev/null
+++ b/bananas_description.txt
@@ -0,0 +1 @@
+BusyBee continuously gives you new goals for transportation. It's meant for long-term fun; as such there is no ultimate goal to achieve.
diff --git a/check_lang_compatibility.py b/check_lang_compatibility.py
new file mode 100755
index 0000000..c25d393
--- /dev/null
+++ b/check_lang_compatibility.py
@@ -0,0 +1,133 @@
+#!/usr/bin/env python3
+#
+# This file is part of BusyBee, which is a GameScript for OpenTTD
+# Copyright (C) 2014-2015 alberth / andythenorth
+#
+# BusyBee 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 of the License
+#
+# BusyBee 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 BusyBee; If not, see or
+# write to the Free Software Foundation, Inc., 51 Franklin Street,
+# Fifth Floor, Boston, MA 02110-1301 USA.
+"""
+Verify whether the current language file is compatible with a language file at
+a revision as given in a file, indicated by the prefix "// cset:".
+"""
+
+import os, subprocess, re, sys
+
+
+def process_langline(line):
+ """
+ Process a line in a language file.
+
+ @param line: Line in a language file.
+ @type line: C{str}
+
+ @return: The name of the string if reading a string line, else C{None}
+ @rtype: C{None} or C{str}
+ """
+ line = line.rstrip()
+ if len(line) == 0 or line[0] == '#':
+ return None
+
+ i = line.find(':')
+ if i < 0:
+ return None
+
+ return line[:i].rstrip()
+
+
+def get_langfile_rev(name, rev):
+ """
+ Get the string names of a language file.
+
+ @param name: Name of the language file.
+ @type name: C{str}
+
+ @param rev: Revision to retrieve.
+ @type rev: C{str}
+
+ @return: Lines wit string names.
+ @rtype: C{list} of C{str}
+ """
+ cmd = ['hg', 'cat', '-r', rev, name]
+ txt = subprocess.check_output(cmd, universal_newlines=True, env={'HGPLAIN':''})
+
+ lines = []
+ for line in txt.split('\n'):
+ line = process_langline(line)
+ if line is not None:
+ lines.append(line)
+
+ return lines
+
+def get_langfile(fname):
+ """
+ Get strings from the given language file.
+
+ @param fname: Name of the file to open.
+ @type fname: C{str}
+
+ @return: Lines wit string names.
+ @rtype: C{list} of C{str}
+ """
+ handle = open(fname, 'rt', encoding='utf-8')
+
+ lines = []
+ for line in handle:
+ line = process_langline(line)
+ if line is not None:
+ lines.append(line)
+
+ handle.close()
+ return lines
+
+cset_pattern = re.compile('//[ \\t]*cset:[ \\t]*([0-9A-F[a-f]*)')
+
+def get_cset(fname):
+ """
+ Get changeset revision from the given file.
+
+ @param fname: Name of the file to open.
+ @type fname: C{str}
+
+ @return: Changeset number, if available (C{// *cset: *([0-9A-F[a-f]*)})
+ @rtype: C{list} of C{str}
+ """
+ handle = open(fname, 'rt', encoding='utf-8')
+ for line in handle:
+ m = cset_pattern.search(line)
+ if m and len(m.group(1)) > 4:
+ handle.close()
+ return m.group(1)
+
+ handle.close()
+ return None
+
+if len(sys.argv) != 3:
+ print("Incorrect number of arguments: expected \"check_lang_compatibility.py \"")
+ sys.exit(1)
+
+language_name = sys.argv[1]
+cset_file = sys.argv[2]
+
+cset = get_cset(cset_file)
+if cset is None:
+ print("No change set number found.")
+ sys.exit(1)
+
+print("** Comparing file {}, current version and at revision {} **".format(language_name, cset))
+min_comp_strings = get_langfile_rev(language_name, cset)
+now_strings = get_langfile(language_name)
+result = min_comp_strings != now_strings #0 code is ok.
+if result:
+ print("\nCompatibility of language files failed.\n")
+sys.exit(result)
diff --git a/findversion.sh b/findversion.sh
new file mode 100755
index 0000000..2d62520
--- /dev/null
+++ b/findversion.sh
@@ -0,0 +1,131 @@
+# make-nml NewGRF build framework
+# (c) 2014 planetmaker and others
+# Contact: planetmaker@openttd.org
+#
+# This program 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; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program 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 this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+
+# This file is derived from OpenTTD's version check
+
+
+# Arguments given? Show help text.
+if [ "$#" != "0" ]; then
+ cat <\t\t\t\t\t\t
+HASH
+ a string unique to the version of the code the current checkout is
+ based on. The exact format of this string depends on the version
+ control system in use, but it tries to identify the revision used as
+ close as possible (using the svn revision number or hg/git hash).
+ This also includes an indication of whether the checkout was
+ modified and which branch was checked out. This value is not
+ guaranteed to be sortable, but is mainly meant for identifying the
+ revision and user display.
+
+ If no revision identifier could be found, this is left empty.
+VERSION
+ the version number to be reported to OpenTTD (aka NewGRF version).
+ This usually is the number of days passed since 1.1.2000 up to the
+ date of the last commit in the repository.
+
+ This number should be sortable. Within a given branch or trunk, a
+ higher number means a newer version. However, when using git or hg,
+ this number will not increase on new commits.
+
+ If no revision number could be found, this is left empty.
+MODIFIED
+ Whether (the src directory of) this checkout is modified or not. A
+ value of 0 means not modified, a value of 2 means it was modified.
+ Modification is determined in relation to the commit identified by
+ REV, so not in relation to the svn revision identified by REV_NR.
+
+ A value of 1 means that the modified status is unknown, because this
+ is not an svn/git/hg checkout for example.
+TAG
+ the tag of the commit (if any) - used to indicate and name releases
+DISPLAY_VERSION
+ The version string shown to the user of the NewGRF
+BRANCH
+ The branch the version is based on
+DATE
+ The date of the last commit in ISO format
+
+
+By setting the AWK environment variable, a caller can determine which
+version of "awk" is used. If nothing is set, this script defaults to
+"awk".
+EOF
+exit 1;
+fi
+
+# Allow awk to be provided by the caller.
+if [ -z "$AWK" ]; then
+ AWK=awk
+fi
+
+# Find out some dirs
+cd `dirname "$0"`
+ROOT_DIR=`pwd`
+
+# Determine if we are using a modified version
+# Assume the dir is not modified
+MODIFIED=""
+REPO_DATE="2000,1,1"
+if [ -d "$ROOT_DIR/.hg" ]; then
+ # We are a hg checkout
+ if [ -n "`HGPLAIN= hg status -S | grep -v '^?'`" ]; then
+ MODIFIED="M"
+ fi
+ HASH=`LC_ALL=C HGPLAIN= hg id -i | cut -c1-12`
+ REV="h`echo $HASH | cut -c1-8`"
+ BRANCH="`hg branch | sed 's@^default$@@'`"
+ TAG="`HGPLAIN= hg id -t | grep -v 'tip$'`"
+ ISO_DATE="`HGPLAIN= hg log -r$HASH --template=\"{date|shortdate}\"`"
+ REPO_DATE="`echo ${ISO_DATE} | sed s/-/,/g | sed s/,0/,/g`"
+ VERSION=`python -c "from datetime import date; print (date($REPO_DATE)-date(2000,1,1)).days"`
+ DISPLAY_VERSION="v${VERSION}"
+ if [ -n "$TAG" ]; then
+ BRANCH=""
+ DISPLAY_VERSION="${TAG}"
+ fi
+elif [ -f "$ROOT_DIR/.rev" ]; then
+ # We are an exported source bundle
+ cat $ROOT_DIR/.rev
+ exit
+else
+ # We don't know
+ HASH=""
+ VERSION="0"
+ MODIFIED=""
+ BRANCH=""
+ TAG=""
+ DISPLAY_VERSION="noRev"
+ ISO_DATE=""
+fi
+
+DISPLAY_VERSION="${DISPLAY_VERSION}${MODIFIED}"
+
+if [ -n "$BRANCH" ]; then
+ DISPLAY_VERSION="$BRANCH-${DISPLAY_VERSION}"
+fi
+
+if [ -z "${TAG}" -a -n "${HASH}" ]; then
+ DISPLAY_VERSION="${DISPLAY_VERSION}-h${HASH}"
+fi
+
+echo "$HASH $VERSION $MODIFIED $TAG $DISPLAY_VERSION $BRANCH $ISO_DATE"
diff --git a/info.nut b/info.nut
index 6692125..43961f6 100644
--- a/info.nut
+++ b/info.nut
@@ -17,17 +17,24 @@
* Fifth Floor, Boston, MA 02110-1301 USA.
*/
+SAVEGAME_VERSION <- 1; // Set manually if/when save games break.
+MINCOMPATIBLE_SAVEGAME_VERSION <- 1; // cset: 06b75370997d
+
+PROGRAM_VERSION <- Syntax error, set by 'make bundle'.
+PROGRAM_DATE <- Syntax error, set by 'make bundle'.
+PROGRAM_NAME <- Syntax error, set by 'make bundle'.
+
class BusyBeeInfo extends GSInfo {
function GetAuthor() { return "alberth & andythenorth"; }
- function GetName() { return "BusyBee"; }
+ function GetName() { return PROGRAM_NAME; }
function GetDescription() { return "Make connection, transport cargo"; }
- function GetVersion() { return 1; }
- function GetDate() { return "2015-01-10"; }
+ function GetVersion() { return PROGRAM_VERSION + SAVEGAME_VERSION * 100000; }
+ function GetDate() { return PROGRAM_DATE; }
function CreateInstance() { return "BusyBeeClass"; }
function GetShortName() { return "BBEE"; }
- function GetAPIVersion() { return "1.5"; }
- function GetUrl() { return ""; }
- function MinVersionToLoad() { return 1; }
+ function GetAPIVersion() { return "1.4.2"; }
+ function GetUrl() { return "http://dev.openttdcoop.org/projects/busybee-gs"; }
+ function MinVersionToLoad() { return MINCOMPATIBLE_SAVEGAME_VERSION; }
function GetSettings();
}