diff options
| author | Alexander Gavrilov | 2012-08-18 11:48:07 +0400 |
|---|---|---|
| committer | Alexander Gavrilov | 2012-08-18 11:48:07 +0400 |
| commit | 01ba2a31fc2dd7597ab6e2db3f1496b123e10720 (patch) | |
| tree | 60de15f2bd50bca0bb9e68f82dc77c1d85014934 /plugins/devel | |
| parent | 236ffd578b66805fa45d65df79e099d00156bfff (diff) | |
| download | dfhack-01ba2a31fc2dd7597ab6e2db3f1496b123e10720.tar.gz dfhack-01ba2a31fc2dd7597ab6e2db3f1496b123e10720.tar.bz2 dfhack-01ba2a31fc2dd7597ab6e2db3f1496b123e10720.tar.xz | |
Tweak the interpose API, and fix a couple of bugs.
Diffstat (limited to 'plugins/devel')
| -rw-r--r-- | plugins/devel/vshook.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/plugins/devel/vshook.cpp b/plugins/devel/vshook.cpp index 28f98362..319ff0e9 100644 --- a/plugins/devel/vshook.cpp +++ b/plugins/devel/vshook.cpp @@ -33,9 +33,12 @@ struct title_hook : df::viewscreen_titlest { uint8_t *buf = gps->screen; int32_t *stp = gps->screentexpos; - for (const char *p = "DFHack " DFHACK_VERSION; *p; p++) { - *buf++ = *p; *buf++ = 7; *buf++ = 0; *buf++ = 1; - *stp++ = 0; + for (const char *p = "DFHack " DFHACK_VERSION; + *p && buf < gps->screen_limit; + p++, buf += gps->dimy*4, stp += gps->dimy) + { + buf[0] = *p; buf[1] = 7; buf[2] = 0; buf[3] = 1; + *stp = 0; } } } @@ -47,7 +50,7 @@ DFhackCExport command_result plugin_init ( color_ostream &out, std::vector <Plug { if (gps) { - if (!title_hook::interpose_render.apply()) + if (!INTERPOSE_HOOK(title_hook, render).apply()) out.printerr("Could not interpose viewscreen_titlest::render\n"); } @@ -56,6 +59,6 @@ DFhackCExport command_result plugin_init ( color_ostream &out, std::vector <Plug DFhackCExport command_result plugin_shutdown ( color_ostream &out ) { - title_hook::interpose_render.remove(); + INTERPOSE_HOOK(title_hook, render).remove(); return CR_OK; } |
