Merge remote-tracking branch 'upstream/master'

develop
Kelly Martin 2012-03-28 23:22:28 -05:00
commit 453141920f
9 changed files with 28 additions and 21 deletions

@ -47,6 +47,11 @@ if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
message(FATAL_ERROR "In-source builds are not allowed.")
endif()
# make sure all the necessary submodules have been set up
if (NOT EXISTS ${dfhack_SOURCE_DIR}/library/xml/codegen.pl OR NOT EXISTS ${dfhack_SOURCE_DIR}/depends/clsocket/CMakeLists.txt)
message(FATAL_ERROR "Required submodules could not be found! First run 'git submodule init' and 'git submodule update' from the root DFHack directory. (See the section 'Getting the Code' in Compile.html)")
endif()
# set up versioning.
set(DF_VERSION_MAJOR "0")
set(DF_VERSION_MINOR "34")

@ -179,7 +179,7 @@ namespace DFHack
void color(int index)
{
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(hConsole, index);
SetConsoleTextAttribute(hConsole, index == color_ostream::COLOR_RESET ? default_attributes : index);
}
void reset_color( void )

@ -70,7 +70,7 @@ using df::global::init;
// FIXME: A lot of code in one file, all doing different things... there's something fishy about it.
static void loadScriptFile(Core *core, PluginManager *plug_mgr, string fname);
static void loadScriptFile(Core *core, PluginManager *plug_mgr, string fname, bool silent);
static void runInteractiveCommand(Core *core, PluginManager *plug_mgr, int &clueless_counter, const string &command);
static bool parseKeySpec(std::string keyspec, int *psym, int *pmod);
@ -492,7 +492,7 @@ static void runInteractiveCommand(Core *core, PluginManager *plug_mgr, int &clue
{
if(parts.size() == 1)
{
loadScriptFile(core, plug_mgr, parts[0]);
loadScriptFile(core, plug_mgr, parts[0], false);
}
else
{
@ -512,9 +512,10 @@ static void runInteractiveCommand(Core *core, PluginManager *plug_mgr, int &clue
}
}
static void loadScriptFile(Core *core, PluginManager *plug_mgr, string fname)
static void loadScriptFile(Core *core, PluginManager *plug_mgr, string fname, bool silent)
{
core->getConsole() << "Loading script at " << fname << std::endl;
if(!silent)
core->getConsole() << "Loading script at " << fname << std::endl;
ifstream script(fname);
if (script.good())
{
@ -528,7 +529,8 @@ static void loadScriptFile(Core *core, PluginManager *plug_mgr, string fname)
}
else
{
core->getConsole().printerr("Error loading script\n");
if(!silent)
core->getConsole().printerr("Error loading script\n");
}
script.close();
@ -551,7 +553,7 @@ void fIOthread(void * iodata)
return;
}
loadScriptFile(core, plug_mgr, "dfhack.init");
loadScriptFile(core, plug_mgr, "dfhack.init", true);
con.print("DFHack is ready. Have a nice day!\n"
"Type in '?' or 'help' for general help, 'ls' to see all commands.\n");

@ -1,4 +1,4 @@
/*
/*
https://github.com/peterix/dfhack
Copyright (c) 2009-2011 Petr Mrázek (peterix@gmail.com)

@ -1,4 +1,4 @@
/*
/*
https://github.com/peterix/dfhack
Copyright (c) 2009-2011 Petr Mrázek (peterix@gmail.com)

@ -212,6 +212,7 @@ bool Plugin::load(color_ostream &con)
plugin_rpcconnect = (RPCService* (*)(color_ostream &)) LookupPlugin(plug, "plugin_rpcconnect");
this->name = *plug_name;
plugin_lib = plug;
commands.clear();
if(plugin_init(con,commands) == CR_OK)
{
state = PS_LOADED;
@ -242,6 +243,7 @@ bool Plugin::unload(color_ostream &con)
access->wait();
// cleanup...
parent->unregisterCommands(this);
commands.clear();
if(cr == CR_OK)
{
ClosePlugin(plugin_lib);

@ -25,6 +25,7 @@ distribution.
#include "Internal.h"
#include <dirent.h>
#include <errno.h>
#include <unistd.h>
#include <sys/mman.h>
#include <string>

@ -1 +1 @@
Subproject commit 1b1fe798e553cf0ed309606f32b8448bb96b30c8
Subproject commit 6d11abbbae7e5408e739563266f3300261a5c726

@ -397,17 +397,14 @@ struct dwarf_info
DFhackCExport command_result plugin_init ( color_ostream &out, std::vector <PluginCommand> &commands)
{
// initialize labor infos table from default table
labor_infos = new struct labor_info[ARRAY_COUNT(default_labor_infos)];
for (int i = 0; i < ARRAY_COUNT(default_labor_infos); i++) {
labor_infos[i] = default_labor_infos[i];
}
assert(ARRAY_COUNT(labor_infos) > ENUM_LAST_ITEM(unit_labor));
// Fill the command list with your commands.
commands.clear();
// initialize labor infos table from default table
if(ARRAY_COUNT(default_labor_infos) != ENUM_LAST_ITEM(unit_labor) + 1)
return CR_FAILURE;
labor_infos = new struct labor_info[ARRAY_COUNT(default_labor_infos)];
for (int i = 0; i < ARRAY_COUNT(default_labor_infos); i++) {
labor_infos[i] = default_labor_infos[i];
}
// Fill the command list with your commands.
commands.push_back(PluginCommand(
"autolabor", "Automatically manage dwarf labors.",
autolabor, false, /* true means that the command can't be used from non-interactive user interface */