Merge branch 'develop' into myk_no_alias
commit
ea34a0b0fd
@ -1,14 +0,0 @@
|
|||||||
title-version
|
|
||||||
=============
|
|
||||||
|
|
||||||
.. dfhack-tool::
|
|
||||||
:summary: Displays the DFHack version on DF's title screen.
|
|
||||||
:tags: unavailable interface
|
|
||||||
:no-command:
|
|
||||||
|
|
||||||
Usage
|
|
||||||
-----
|
|
||||||
|
|
||||||
::
|
|
||||||
|
|
||||||
enable title-version
|
|
@ -1,109 +0,0 @@
|
|||||||
#include <cmath>
|
|
||||||
#include <cstdio>
|
|
||||||
#include <cstring>
|
|
||||||
#include <stack>
|
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#include "Core.h"
|
|
||||||
#include "Console.h"
|
|
||||||
#include "Export.h"
|
|
||||||
#include "PluginManager.h"
|
|
||||||
#include "modules/Gui.h"
|
|
||||||
#include "modules/Screen.h"
|
|
||||||
#include "VTableInterpose.h"
|
|
||||||
#include "DFHackVersion.h"
|
|
||||||
|
|
||||||
#include "df/graphic.h"
|
|
||||||
#include "df/viewscreen_optionst.h"
|
|
||||||
#include "df/viewscreen_titlest.h"
|
|
||||||
#include "uicommon.h"
|
|
||||||
|
|
||||||
using std::vector;
|
|
||||||
using std::string;
|
|
||||||
using namespace DFHack;
|
|
||||||
|
|
||||||
DFHACK_PLUGIN("title-version");
|
|
||||||
DFHACK_PLUGIN_IS_ENABLED(is_enabled);
|
|
||||||
REQUIRE_GLOBAL(gps);
|
|
||||||
|
|
||||||
void draw_version(int start_x, int start_y) {
|
|
||||||
int x = start_x,
|
|
||||||
y = start_y;
|
|
||||||
|
|
||||||
OutputString(COLOR_WHITE, x, y, string("DFHack ") + DFHACK_VERSION);
|
|
||||||
if (!DFHACK_IS_RELEASE)
|
|
||||||
{
|
|
||||||
OutputString(COLOR_WHITE, x, y, " (dev)");
|
|
||||||
x = start_x; y++;
|
|
||||||
OutputString(COLOR_WHITE, x, y, "Git: ");
|
|
||||||
OutputString(COLOR_WHITE, x, y, DFHACK_GIT_DESCRIPTION);
|
|
||||||
}
|
|
||||||
if (strlen(DFHACK_BUILD_ID))
|
|
||||||
{
|
|
||||||
x = start_x; y++;
|
|
||||||
OutputString(COLOR_WHITE, x, y, "Build ID: ");
|
|
||||||
OutputString(COLOR_WHITE, x, y, DFHACK_BUILD_ID);
|
|
||||||
}
|
|
||||||
if (DFHACK_IS_PRERELEASE)
|
|
||||||
{
|
|
||||||
x = start_x; y++;
|
|
||||||
OutputString(COLOR_LIGHTRED, x, y, "Pre-release build");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
struct title_version_hook : df::viewscreen_titlest {
|
|
||||||
typedef df::viewscreen_titlest interpose_base;
|
|
||||||
|
|
||||||
DEFINE_VMETHOD_INTERPOSE(void, render, ())
|
|
||||||
{
|
|
||||||
INTERPOSE_NEXT(render)();
|
|
||||||
if (!loading)
|
|
||||||
draw_version(0, 0);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
IMPLEMENT_VMETHOD_INTERPOSE(title_version_hook, render);
|
|
||||||
|
|
||||||
struct options_version_hook : df::viewscreen_optionst {
|
|
||||||
typedef df::viewscreen_optionst interpose_base;
|
|
||||||
|
|
||||||
DEFINE_VMETHOD_INTERPOSE(void, render, ())
|
|
||||||
{
|
|
||||||
INTERPOSE_NEXT(render)();
|
|
||||||
if (!msg_quit && !in_retire_adv && !msg_peasant &&
|
|
||||||
!in_retire_dwf_abandon_adv && !in_abandon_dwf && !ending_game)
|
|
||||||
draw_version(2, gps->dimy - 6);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
IMPLEMENT_VMETHOD_INTERPOSE(options_version_hook, render);
|
|
||||||
|
|
||||||
DFhackCExport command_result plugin_enable (color_ostream &out, bool enable)
|
|
||||||
{
|
|
||||||
if (!gps)
|
|
||||||
return CR_FAILURE;
|
|
||||||
|
|
||||||
if (enable != is_enabled)
|
|
||||||
{
|
|
||||||
if (!INTERPOSE_HOOK(title_version_hook, render).apply(enable) ||
|
|
||||||
!INTERPOSE_HOOK(options_version_hook, render).apply(enable))
|
|
||||||
return CR_FAILURE;
|
|
||||||
|
|
||||||
is_enabled = enable;
|
|
||||||
}
|
|
||||||
|
|
||||||
return CR_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
DFhackCExport command_result plugin_init (color_ostream &out, vector<PluginCommand> &commands)
|
|
||||||
{
|
|
||||||
return CR_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
DFhackCExport command_result plugin_shutdown (color_ostream &out)
|
|
||||||
{
|
|
||||||
INTERPOSE_HOOK(title_version_hook, render).remove();
|
|
||||||
INTERPOSE_HOOK(options_version_hook, render).remove();
|
|
||||||
return CR_OK;
|
|
||||||
}
|
|
@ -1 +1 @@
|
|||||||
Subproject commit 5da969fce69a5b9330f183cc0629798bf9907b69
|
Subproject commit 68f6d354b0d815ad0985dbe9b5faa140c980af14
|
@ -1,14 +0,0 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
|
|
||||||
import os
|
|
||||||
import subprocess
|
|
||||||
import sys
|
|
||||||
|
|
||||||
script_name = os.path.basename(__file__)
|
|
||||||
new_script_path = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'ci', script_name)
|
|
||||||
|
|
||||||
sys.stderr.write('\nNote: travis/{script_name} is deprecated. Use ci/{script_name} instead.\n\n'.format(script_name=script_name))
|
|
||||||
sys.stderr.flush()
|
|
||||||
|
|
||||||
p = subprocess.run([sys.executable, new_script_path] + sys.argv[1:])
|
|
||||||
sys.exit(p.returncode)
|
|
@ -1,14 +0,0 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
|
|
||||||
import os
|
|
||||||
import subprocess
|
|
||||||
import sys
|
|
||||||
|
|
||||||
script_name = os.path.basename(__file__)
|
|
||||||
new_script_path = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'ci', script_name)
|
|
||||||
|
|
||||||
sys.stderr.write('\nNote: travis/{script_name} is deprecated. Use ci/{script_name} instead.\n\n'.format(script_name=script_name))
|
|
||||||
sys.stderr.flush()
|
|
||||||
|
|
||||||
p = subprocess.run([sys.executable, new_script_path] + sys.argv[1:])
|
|
||||||
sys.exit(p.returncode)
|
|
@ -1,14 +0,0 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
|
|
||||||
import os
|
|
||||||
import subprocess
|
|
||||||
import sys
|
|
||||||
|
|
||||||
script_name = os.path.basename(__file__)
|
|
||||||
new_script_path = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'ci', script_name)
|
|
||||||
|
|
||||||
sys.stderr.write('\nNote: travis/{script_name} is deprecated. Use ci/{script_name} instead.\n\n'.format(script_name=script_name))
|
|
||||||
sys.stderr.flush()
|
|
||||||
|
|
||||||
p = subprocess.run([sys.executable, new_script_path] + sys.argv[1:])
|
|
||||||
sys.exit(p.returncode)
|
|
@ -1,9 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
script_name="$(basename "$0")"
|
|
||||||
new_script_path="$(dirname "$0")/../ci/${script_name}"
|
|
||||||
|
|
||||||
printf >&2 "\nNote: travis/%s is deprecated. Use ci/%s instead.\n\n" "${script_name}" "${script_name}"
|
|
||||||
|
|
||||||
"${new_script_path}" "$@"
|
|
||||||
exit $?
|
|
@ -1,9 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
script_name="$(basename "$0")"
|
|
||||||
new_script_path="$(dirname "$0")/../ci/${script_name}"
|
|
||||||
|
|
||||||
printf >&2 "\nNote: travis/%s is deprecated. Use ci/%s instead.\n\n" "${script_name}" "${script_name}"
|
|
||||||
|
|
||||||
"${new_script_path}" "$@"
|
|
||||||
exit $?
|
|
@ -1,14 +0,0 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
|
|
||||||
import os
|
|
||||||
import subprocess
|
|
||||||
import sys
|
|
||||||
|
|
||||||
script_name = os.path.basename(__file__)
|
|
||||||
new_script_path = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'ci', script_name)
|
|
||||||
|
|
||||||
sys.stderr.write('\nNote: travis/{script_name} is deprecated. Use ci/{script_name} instead.\n\n'.format(script_name=script_name))
|
|
||||||
sys.stderr.flush()
|
|
||||||
|
|
||||||
p = subprocess.run([sys.executable, new_script_path] + sys.argv[1:])
|
|
||||||
sys.exit(p.returncode)
|
|
@ -1,14 +0,0 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
|
|
||||||
import os
|
|
||||||
import subprocess
|
|
||||||
import sys
|
|
||||||
|
|
||||||
script_name = os.path.basename(__file__)
|
|
||||||
new_script_path = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'ci', script_name)
|
|
||||||
|
|
||||||
sys.stderr.write('\nNote: travis/{script_name} is deprecated. Use ci/{script_name} instead.\n\n'.format(script_name=script_name))
|
|
||||||
sys.stderr.flush()
|
|
||||||
|
|
||||||
p = subprocess.run([sys.executable, new_script_path] + sys.argv[1:])
|
|
||||||
sys.exit(p.returncode)
|
|
@ -1,14 +0,0 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
|
|
||||||
import os
|
|
||||||
import subprocess
|
|
||||||
import sys
|
|
||||||
|
|
||||||
script_name = os.path.basename(__file__)
|
|
||||||
new_script_path = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'ci', script_name)
|
|
||||||
|
|
||||||
sys.stderr.write('\nNote: travis/{script_name} is deprecated. Use ci/{script_name} instead.\n\n'.format(script_name=script_name))
|
|
||||||
sys.stderr.flush()
|
|
||||||
|
|
||||||
p = subprocess.run([sys.executable, new_script_path] + sys.argv[1:])
|
|
||||||
sys.exit(p.returncode)
|
|
@ -1,14 +0,0 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
|
|
||||||
import os
|
|
||||||
import subprocess
|
|
||||||
import sys
|
|
||||||
|
|
||||||
script_name = os.path.basename(__file__)
|
|
||||||
new_script_path = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'ci', script_name)
|
|
||||||
|
|
||||||
sys.stderr.write('\nNote: travis/{script_name} is deprecated. Use ci/{script_name} instead.\n\n'.format(script_name=script_name))
|
|
||||||
sys.stderr.flush()
|
|
||||||
|
|
||||||
p = subprocess.run([sys.executable, new_script_path] + sys.argv[1:])
|
|
||||||
sys.exit(p.returncode)
|
|
Loading…
Reference in New Issue