Merge remote-tracking branch 'dfhack/develop' into remote_reader

develop
JapaMala 2019-03-18 22:00:07 -05:00
commit d906e7c462
7 changed files with 50 additions and 30 deletions

@ -28,7 +28,7 @@ matrix:
- g++-4.8 - g++-4.8
before_install: before_install:
- export DF_VERSION=$(sh travis/get-df-version.sh) - export DF_VERSION=$(sh travis/get-df-version.sh)
- export DF_FOLDER="$HOME/DF-travis/$DF_VERSION" - export DF_FOLDER="$HOME/DF-travis/$DF_VERSION/df_linux"
- pip install --user "sphinx==1.4" "requests[security]" - pip install --user "sphinx==1.4" "requests[security]"
- sh travis/build-lua.sh - sh travis/build-lua.sh
- sh travis/download-df.sh - sh travis/download-df.sh
@ -56,9 +56,7 @@ script:
- python travis/check-rpc.py "$DF_FOLDER/dfhack-rpc.txt" - python travis/check-rpc.py "$DF_FOLDER/dfhack-rpc.txt"
before_cache: before_cache:
- cat "$DF_FOLDER/stderr.log" - cat "$DF_FOLDER/stderr.log"
- rm -rf "$DF_FOLDER/hack" - rm -rf "$DF_FOLDER"
- rm -rf "$DF_FOLDER/dfhack-config"
- rm -f "$DF_FOLDER"/*.log
notifications: notifications:
email: false email: false
irc: irc:

@ -561,16 +561,19 @@ directly to the main dwarf mode screen.
Professions Professions
----------- -----------
The manipulator plugin supports saving Professions: a named set of Labors labors that can be The manipulator plugin supports saving professions: a named set of labors that can be
quickly applied to one or multiple Dwarves. quickly applied to one or multiple dwarves.
To save a Profession highlight a Dwarf and press :kbd:`P`. The Profession will be saved using To save a profession, highlight a dwarf and press :kbd:`P`. The profession will be saved using
the Custom Profession Name of the Dwarf, or the default for that Dwarf if no Custom Profession the custom profession name of the dwarf, or the default for that dwarf if no custom profession
Name has been set. name has been set.
To apply a Profession either highlight a single Dwarf, or select multiple with :kbd:`x`, and press To apply a profession, either highlight a single dwarf or select multiple with
:kbd:`p` to select the Profession to apply. All labors for the selected Dwarves will be reset to :kbd:`x`, and press :kbd:`p` to select the profession to apply. All labors for
the labors of the chosen Profession. the selected dwarves will be reset to the labors of the chosen profession.
Professions are saved as human-readable text files in the "professions" folder
within the DF folder, and can be edited or deleted there.
.. comment - the link target "search" is reserved for the Sphinx search page .. comment - the link target "search" is reserved for the Sphinx search page
.. _search-plugin: .. _search-plugin:

@ -480,7 +480,7 @@ namespace DFHack
{ {
char seq[64]; char seq[64];
int cols = get_columns(); int cols = get_columns();
int plen = prompt.size(); int plen = prompt.size() % cols;
int len = raw_buffer.size(); int len = raw_buffer.size();
int begin = 0; int begin = 0;
int cooked_cursor = raw_cursor; int cooked_cursor = raw_cursor;
@ -493,7 +493,15 @@ namespace DFHack
} }
if (plen+len > cols) if (plen+len > cols)
len -= plen+len - cols; len -= plen+len - cols;
std::string mbstr = toLocaleMB(raw_buffer.substr(begin,len)); std::string mbstr;
try {
mbstr = toLocaleMB(raw_buffer.substr(begin,len));
}
catch (std::out_of_range&) {
// fallback check in case begin is still out of range
// (this behaves badly but at least doesn't crash)
mbstr = toLocaleMB(raw_buffer);
}
/* Cursor to left edge */ /* Cursor to left edge */
snprintf(seq,64,"\x1b[1G"); snprintf(seq,64,"\x1b[1G");
if (::write(STDIN_FILENO,seq,strlen(seq)) == -1) return; if (::write(STDIN_FILENO,seq,strlen(seq)) == -1) return;

@ -67,9 +67,9 @@ for plugin_name in actual:
io = methods[m] io = methods[m]
if m in expected[plugin_name]: if m in expected[plugin_name]:
if expected[plugin_name][m] != io: if expected[plugin_name][m] != io:
wrong.add('// RPC ' + m + ' : ' + io[0] + ' -> ' + io[1]) wrong.append('// RPC ' + m + ' : ' + io[0] + ' -> ' + io[1])
else: else:
missing.add('// RPC ' + m + ' : ' + io[0] + ' -> ' + io[1]) missing.append('// RPC ' + m + ' : ' + io[0] + ' -> ' + io[1])
if len(missing) > 0: if len(missing) > 0:
print('Incomplete documentation for ' + ('core' if plugin_name == '' else 'plugin "' + plugin_name + '"') + ' proto files. Add the following lines:') print('Incomplete documentation for ' + ('core' if plugin_name == '' else 'plugin "' + plugin_name + '"') + ' proto files. Add the following lines:')
@ -98,7 +98,7 @@ for plugin_name in expected:
for m in methods: for m in methods:
io = methods[m] io = methods[m]
if m not in actual[plugin_name]: if m not in actual[plugin_name]:
missing.add('// RPC ' + m + ' : ' + io[0] + ' -> ' + io[1]) missing.append('// RPC ' + m + ' : ' + io[0] + ' -> ' + io[1])
if len(missing) > 0: if len(missing) > 0:
print('Incorrect documentation for ' + ('core' if plugin_name == '' else 'plugin "' + plugin_name + '"') + ' proto files. Remove the following lines:') print('Incorrect documentation for ' + ('core' if plugin_name == '' else 'plugin "' + plugin_name + '"') + ' proto files. Remove the following lines:')

@ -10,31 +10,37 @@ cd "$(dirname "$0")"
echo "DF_VERSION: $DF_VERSION" echo "DF_VERSION: $DF_VERSION"
echo "DF_FOLDER: $DF_FOLDER" echo "DF_FOLDER: $DF_FOLDER"
mkdir -p "$DF_FOLDER" mkdir -p "$DF_FOLDER"
cd "$DF_FOLDER" # back out of df_linux
cd "$DF_FOLDER/.."
if [ -f receipt ]; then if [ -f receipt ]; then
if [ "$selfmd5" != "$(cat receipt)" ]; then if [ "$selfmd5" != "$(cat receipt)" ]; then
echo "download-df.sh changed; removing DF" echo "download-df.sh changed; removing DF"
rm receipt
else else
echo "Already downloaded $DF_VERSION" echo "Already downloaded $DF_VERSION"
exit 0
fi fi
fi fi
rm -rif "$tardest" df_linux if [ ! -f receipt ]; then
rm -f "$tardest"
minor=$(echo "$DF_VERSION" | cut -d. -f2)
patch=$(echo "$DF_VERSION" | cut -d. -f3)
url="http://www.bay12games.com/dwarves/df_${minor}_${patch}_linux.tar.bz2"
echo Downloading
wget "$url" -O "$tardest"
fi
minor=$(echo "$DF_VERSION" | cut -d. -f2) rm -rf df_linux
patch=$(echo "$DF_VERSION" | cut -d. -f3) mkdir df_linux
url="http://www.bay12games.com/dwarves/df_${minor}_${patch}_linux.tar.bz2"
echo Downloading
wget "$url" -O "$tardest"
echo Extracting echo Extracting
tar xf "$tardest" --strip-components=1 tar xf "$tardest" --strip-components=1 -C df_linux
echo Changing settings echo Changing settings
echo '' >> "$DF_FOLDER/data/init/init.txt" echo '' >> "df_linux/data/init/init.txt"
echo '[PRINT_MODE:TEXT]' >> "$DF_FOLDER/data/init/init.txt" echo '[PRINT_MODE:TEXT]' >> "df_linux/data/init/init.txt"
echo '[SOUND:NO]' >> "$DF_FOLDER/data/init/init.txt" echo '[SOUND:NO]' >> "df_linux/data/init/init.txt"
echo Done echo Done
echo "$selfmd5" > receipt echo "$selfmd5" > receipt
ls

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/sh
cd "$(dirname "$0")" cd "$(dirname "$0")"
cd .. cd ..
grep DF_VERSION CMakeLists.txt | perl -ne 'print "$&\n" if /[\d\.]+/' grep -i 'set(DF_VERSION' CMakeLists.txt | perl -ne 'print "$&\n" if /[\d\.]+/'

@ -14,6 +14,9 @@ os.chdir(sys.argv[1])
if os.path.exists(test_stage): if os.path.exists(test_stage):
os.remove(test_stage) os.remove(test_stage)
print(os.getcwd())
print(os.listdir('.'))
tries = 0 tries = 0
while True: while True:
tries += 1 tries += 1
@ -33,3 +36,5 @@ while True:
process = subprocess.Popen([dfhack], stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE) process = subprocess.Popen([dfhack], stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE)
process.communicate() process.communicate()
if process.returncode != 0:
print('DF exited with ' + repr(process.returncode))