2011-06-16 15:53:39 -06:00
|
|
|
/*
|
|
|
|
https://github.com/peterix/dfhack
|
|
|
|
Copyright (c) 2009-2011 Petr Mrázek (peterix@gmail.com)
|
|
|
|
|
|
|
|
This software is provided 'as-is', without any express or implied
|
|
|
|
warranty. In no event will the authors be held liable for any
|
|
|
|
damages arising from the use of this software.
|
|
|
|
|
|
|
|
Permission is granted to anyone to use this software for any
|
|
|
|
purpose, including commercial applications, and to alter it and
|
|
|
|
redistribute it freely, subject to the following restrictions:
|
|
|
|
|
|
|
|
1. The origin of this software must not be misrepresented; you must
|
|
|
|
not claim that you wrote the original software. If you use this
|
|
|
|
software in a product, an acknowledgment in the product documentation
|
|
|
|
would be appreciated but is not required.
|
|
|
|
|
|
|
|
2. Altered source versions must be plainly marked as such, and
|
|
|
|
must not be misrepresented as being the original software.
|
|
|
|
|
|
|
|
3. This notice may not be removed or altered from any source
|
|
|
|
distribution.
|
|
|
|
*/
|
|
|
|
|
2011-06-14 08:13:28 -06:00
|
|
|
#include "Internal.h"
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
#include <map>
|
|
|
|
#include <set>
|
|
|
|
#include <cstdio>
|
|
|
|
#include <cstring>
|
2011-06-24 21:35:29 -06:00
|
|
|
#include <iterator>
|
|
|
|
#include <sstream>
|
2011-06-14 08:13:28 -06:00
|
|
|
using namespace std;
|
|
|
|
|
2011-06-22 10:04:22 -06:00
|
|
|
#include "dfhack/Error.h"
|
|
|
|
#include "dfhack/Process.h"
|
2011-06-14 08:13:28 -06:00
|
|
|
#include "dfhack/Core.h"
|
2011-06-22 00:14:21 -06:00
|
|
|
#include "dfhack/Console.h"
|
2011-07-09 03:33:58 -06:00
|
|
|
#include "dfhack/Module.h"
|
2011-06-14 08:13:28 -06:00
|
|
|
#include "dfhack/VersionInfoFactory.h"
|
2011-06-24 21:35:29 -06:00
|
|
|
#include "dfhack/PluginManager.h"
|
2011-06-17 07:02:43 -06:00
|
|
|
#include "ModuleFactory.h"
|
2011-06-14 08:13:28 -06:00
|
|
|
#include "dfhack/modules/Gui.h"
|
2011-07-09 03:33:58 -06:00
|
|
|
|
|
|
|
#include "dfhack/SDL_fakes/events.h"
|
|
|
|
|
2011-06-16 18:09:03 -06:00
|
|
|
#include <stdio.h>
|
2011-06-26 20:49:56 -06:00
|
|
|
#include <iomanip>
|
2011-07-12 04:13:14 -06:00
|
|
|
#include <stdlib.h>
|
2011-06-14 08:13:28 -06:00
|
|
|
using namespace DFHack;
|
|
|
|
|
2011-07-11 14:23:13 -06:00
|
|
|
struct Core::Cond
|
|
|
|
{
|
|
|
|
Cond()
|
|
|
|
{
|
|
|
|
predicate = false;
|
|
|
|
wakeup = SDL_CreateCond();
|
|
|
|
}
|
|
|
|
~Cond()
|
|
|
|
{
|
|
|
|
SDL_DestroyCond(wakeup);
|
|
|
|
}
|
|
|
|
bool Lock(SDL::Mutex * m)
|
|
|
|
{
|
|
|
|
while(!predicate)
|
|
|
|
{
|
|
|
|
SDL_CondWait(wakeup,m);
|
|
|
|
}
|
|
|
|
predicate = false;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
bool Unlock()
|
|
|
|
{
|
|
|
|
predicate = true;
|
|
|
|
SDL_CondSignal(wakeup);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
SDL::Cond * wakeup;
|
|
|
|
bool predicate;
|
|
|
|
};
|
|
|
|
|
2011-06-24 21:35:29 -06:00
|
|
|
void cheap_tokenise(string const& input, vector<string> &output)
|
2011-06-16 18:09:03 -06:00
|
|
|
{
|
2011-06-24 21:35:29 -06:00
|
|
|
istringstream str(input);
|
|
|
|
istream_iterator<string> cur(str), end;
|
|
|
|
output.assign(cur, end);
|
2011-06-19 20:29:38 -06:00
|
|
|
}
|
2011-06-16 15:53:39 -06:00
|
|
|
|
2011-06-24 21:35:29 -06:00
|
|
|
struct IODATA
|
|
|
|
{
|
|
|
|
Core * core;
|
|
|
|
PluginManager * plug_mgr;
|
|
|
|
};
|
2011-06-16 15:53:39 -06:00
|
|
|
|
2011-07-09 03:33:58 -06:00
|
|
|
// A thread function... for handling hotkeys. This is needed because
|
|
|
|
// all the plugin commands are expected to be run from foreign threads.
|
|
|
|
// Running them from one of the main DF threads will result in deadlock!
|
|
|
|
int fHKthread(void * iodata)
|
|
|
|
{
|
|
|
|
Core * core = ((IODATA*) iodata)->core;
|
|
|
|
PluginManager * plug_mgr = ((IODATA*) iodata)->plug_mgr;
|
|
|
|
if(plug_mgr == 0 || core == 0)
|
|
|
|
{
|
|
|
|
cerr << "Hotkey thread has croaked." << endl;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
while(1)
|
|
|
|
{
|
|
|
|
std::string stuff = core->getHotkeyCmd(); // waits on mutex!
|
|
|
|
if(!stuff.empty())
|
|
|
|
{
|
|
|
|
vector <string> crap;
|
|
|
|
plug_mgr->InvokeCommand(stuff, crap);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// A thread function... for the interactive console.
|
2011-06-24 21:35:29 -06:00
|
|
|
int fIOthread(void * iodata)
|
2011-06-19 20:29:38 -06:00
|
|
|
{
|
2011-07-13 20:05:27 -06:00
|
|
|
IODATA * iod = ((IODATA*) iodata);
|
|
|
|
Core * core = iod->core;
|
2011-06-24 21:35:29 -06:00
|
|
|
PluginManager * plug_mgr = ((IODATA*) iodata)->plug_mgr;
|
2011-07-13 20:05:27 -06:00
|
|
|
Console & con = core->con;
|
2011-07-09 03:33:58 -06:00
|
|
|
if(plug_mgr == 0 || core == 0)
|
2011-06-25 00:05:17 -06:00
|
|
|
{
|
2011-07-14 03:15:23 -06:00
|
|
|
con.printerr("Something horrible happened in Core's constructor...\n");
|
2011-06-25 00:05:17 -06:00
|
|
|
return 0;
|
|
|
|
}
|
2011-07-13 20:05:27 -06:00
|
|
|
con.print("DFHack is ready. Have a nice day! Type in '?' or 'help' for help.\n");
|
2011-06-22 00:14:21 -06:00
|
|
|
//dfterm << << endl;
|
|
|
|
int clueless_counter = 0;
|
2011-06-16 15:53:39 -06:00
|
|
|
while (true)
|
|
|
|
{
|
|
|
|
string command = "";
|
2011-07-13 20:05:27 -06:00
|
|
|
con.lineedit("[DFHack]# ",command);
|
|
|
|
con.history_add(command);
|
|
|
|
//con <<"[DFHack]# ";
|
2011-07-13 03:45:30 -06:00
|
|
|
//char * line = linenoise("[DFHack]# ", core->con.dfout_C);
|
2011-07-12 04:13:14 -06:00
|
|
|
// dfout <<"[DFHack]# ";
|
2011-07-13 03:45:30 -06:00
|
|
|
/*
|
|
|
|
if (line)
|
2011-07-12 04:13:14 -06:00
|
|
|
{
|
|
|
|
command=line;
|
|
|
|
linenoiseHistoryAdd(line);
|
|
|
|
free(line);
|
2011-07-13 03:45:30 -06:00
|
|
|
}*/
|
2011-07-12 04:13:14 -06:00
|
|
|
//getline(cin, command);
|
2011-06-16 15:53:39 -06:00
|
|
|
if(command=="help" || command == "?")
|
|
|
|
{
|
2011-07-13 20:05:27 -06:00
|
|
|
con.print("Available commands\n");
|
|
|
|
con.print("------------------\n");
|
2011-06-26 20:49:56 -06:00
|
|
|
for(int i = 0; i < plug_mgr->size();i++)
|
|
|
|
{
|
|
|
|
const Plugin * plug = (plug_mgr->operator[](i));
|
2011-07-12 04:13:14 -06:00
|
|
|
if(!plug->size())
|
|
|
|
continue;
|
2011-07-13 20:05:27 -06:00
|
|
|
con.print("Plugin %s :\n", plug->getName().c_str());
|
2011-06-26 20:49:56 -06:00
|
|
|
for (int j = 0; j < plug->size();j++)
|
|
|
|
{
|
|
|
|
const PluginCommand & pcmd = (plug->operator[](j));
|
2011-07-14 00:02:29 -06:00
|
|
|
con.print("%12s| %s\n",pcmd.name.c_str(), pcmd.description.c_str());
|
|
|
|
//con << setw(12) << pcmd.name << "| " << pcmd.description << endl;
|
2011-06-26 20:49:56 -06:00
|
|
|
}
|
2011-07-14 00:02:29 -06:00
|
|
|
con.print("\n");
|
2011-06-26 20:49:56 -06:00
|
|
|
}
|
2011-06-16 15:53:39 -06:00
|
|
|
}
|
2011-06-22 00:14:21 -06:00
|
|
|
else if( command == "" )
|
|
|
|
{
|
|
|
|
clueless_counter++;
|
|
|
|
}
|
2011-06-16 15:53:39 -06:00
|
|
|
else
|
|
|
|
{
|
2011-06-24 21:35:29 -06:00
|
|
|
vector <string> parts;
|
|
|
|
cheap_tokenise(command,parts);
|
|
|
|
if(parts.size() == 0)
|
2011-06-19 20:29:38 -06:00
|
|
|
{
|
2011-06-24 21:35:29 -06:00
|
|
|
clueless_counter++;
|
2011-06-19 20:29:38 -06:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-06-24 21:35:29 -06:00
|
|
|
string first = parts[0];
|
|
|
|
parts.erase(parts.begin());
|
|
|
|
command_result res = plug_mgr->InvokeCommand(first, parts);
|
|
|
|
if(res == CR_NOT_IMPLEMENTED)
|
|
|
|
{
|
2011-07-14 03:15:23 -06:00
|
|
|
con.printerr("Invalid command.\n");
|
2011-06-24 21:35:29 -06:00
|
|
|
clueless_counter ++;
|
|
|
|
}
|
|
|
|
else if(res == CR_FAILURE)
|
|
|
|
{
|
2011-07-14 03:15:23 -06:00
|
|
|
con.printerr("ERROR!\n");
|
2011-06-24 21:35:29 -06:00
|
|
|
}
|
2011-06-19 20:29:38 -06:00
|
|
|
}
|
2011-06-16 15:53:39 -06:00
|
|
|
}
|
2011-06-22 00:14:21 -06:00
|
|
|
if(clueless_counter == 3)
|
|
|
|
{
|
2011-07-14 00:02:29 -06:00
|
|
|
con.print("Do 'help' or '?' for the list of available commands.\n");
|
2011-06-22 00:14:21 -06:00
|
|
|
clueless_counter = 0;
|
|
|
|
}
|
2011-06-16 15:53:39 -06:00
|
|
|
}
|
|
|
|
}
|
2011-06-14 08:13:28 -06:00
|
|
|
|
|
|
|
Core::Core()
|
|
|
|
{
|
2011-06-22 00:14:21 -06:00
|
|
|
// init the console. This must be always the first step!
|
2011-06-24 21:35:29 -06:00
|
|
|
plug_mgr = 0;
|
2011-07-09 03:33:58 -06:00
|
|
|
vif = 0;
|
|
|
|
p = 0;
|
|
|
|
errorstate = false;
|
|
|
|
vinfo = 0;
|
|
|
|
started = false;
|
|
|
|
memset(&(s_mods), 0, sizeof(s_mods));
|
|
|
|
|
|
|
|
// create mutex for syncing with interactive tasks
|
|
|
|
AccessMutex = 0;
|
2011-07-11 14:23:13 -06:00
|
|
|
core_cond = 0;
|
2011-07-09 03:33:58 -06:00
|
|
|
// set up hotkey capture
|
|
|
|
memset(hotkey_states,0,sizeof(hotkey_states));
|
|
|
|
hotkey_set = false;
|
|
|
|
HotkeyMutex = 0;
|
|
|
|
HotkeyCond = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
bool Core::Init()
|
|
|
|
{
|
|
|
|
// init the console. This must be always the first step!
|
2011-07-13 03:45:30 -06:00
|
|
|
con.init();
|
2011-06-17 07:02:43 -06:00
|
|
|
// find out what we are...
|
2011-06-14 08:13:28 -06:00
|
|
|
vif = new DFHack::VersionInfoFactory("Memory.xml");
|
|
|
|
p = new DFHack::Process(vif);
|
|
|
|
if (!p->isIdentified())
|
|
|
|
{
|
2011-07-14 03:15:23 -06:00
|
|
|
con.printerr("Couldn't identify this version of DF.\n");
|
2011-06-14 08:13:28 -06:00
|
|
|
errorstate = true;
|
2011-06-17 07:02:43 -06:00
|
|
|
delete p;
|
|
|
|
p = NULL;
|
2011-07-09 03:33:58 -06:00
|
|
|
return false;
|
2011-06-14 08:13:28 -06:00
|
|
|
}
|
2011-06-17 07:02:43 -06:00
|
|
|
vinfo = p->getDescriptor();
|
|
|
|
|
|
|
|
// create mutex for syncing with interactive tasks
|
2011-06-16 15:53:39 -06:00
|
|
|
AccessMutex = SDL_CreateMutex();
|
|
|
|
if(!AccessMutex)
|
|
|
|
{
|
2011-07-14 03:15:23 -06:00
|
|
|
con.printerr("Mutex creation failed\n");
|
2011-06-16 15:53:39 -06:00
|
|
|
errorstate = true;
|
2011-07-09 03:33:58 -06:00
|
|
|
return false;
|
2011-06-16 15:53:39 -06:00
|
|
|
}
|
2011-07-11 14:23:13 -06:00
|
|
|
core_cond = new Core::Cond();
|
2011-07-09 03:33:58 -06:00
|
|
|
// create plugin manager
|
2011-06-24 21:35:29 -06:00
|
|
|
plug_mgr = new PluginManager(this);
|
2011-07-09 03:33:58 -06:00
|
|
|
if(!plug_mgr)
|
|
|
|
{
|
2011-07-14 03:15:23 -06:00
|
|
|
con.printerr("Failed to create the Plugin Manager.\n");
|
2011-07-09 03:33:58 -06:00
|
|
|
errorstate = true;
|
|
|
|
return false;
|
|
|
|
}
|
2011-06-19 20:29:38 -06:00
|
|
|
// look for all plugins,
|
2011-06-16 15:53:39 -06:00
|
|
|
// create IO thread
|
2011-06-25 00:05:17 -06:00
|
|
|
IODATA *temp = new IODATA;
|
|
|
|
temp->core = this;
|
|
|
|
temp->plug_mgr = plug_mgr;
|
2011-07-09 03:33:58 -06:00
|
|
|
SDL::Thread * IO = SDL_CreateThread(fIOthread, (void *) temp);
|
|
|
|
// set up hotkey capture
|
|
|
|
HotkeyMutex = SDL_CreateMutex();
|
|
|
|
HotkeyCond = SDL_CreateCond();
|
|
|
|
SDL::Thread * HK = SDL_CreateThread(fHKthread, (void *) temp);
|
|
|
|
started = true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
/// sets the current hotkey command
|
|
|
|
bool Core::setHotkeyCmd( std::string cmd )
|
|
|
|
{
|
|
|
|
// access command
|
|
|
|
SDL_mutexP(HotkeyMutex);
|
|
|
|
{
|
|
|
|
hotkey_set = true;
|
|
|
|
hotkey_cmd = cmd;
|
|
|
|
SDL_CondSignal(HotkeyCond);
|
|
|
|
}
|
|
|
|
SDL_mutexV(HotkeyMutex);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
/// removes the hotkey command and gives it to the caller thread
|
|
|
|
std::string Core::getHotkeyCmd( void )
|
|
|
|
{
|
|
|
|
string returner;
|
|
|
|
SDL_mutexP(HotkeyMutex);
|
|
|
|
while ( ! hotkey_set )
|
|
|
|
{
|
|
|
|
SDL_CondWait(HotkeyCond, HotkeyMutex);
|
|
|
|
}
|
|
|
|
hotkey_set = false;
|
|
|
|
returner = hotkey_cmd;
|
|
|
|
hotkey_cmd.clear();
|
|
|
|
SDL_mutexV(HotkeyMutex);
|
|
|
|
return returner;
|
|
|
|
}
|
|
|
|
|
2011-06-14 08:13:28 -06:00
|
|
|
|
2011-06-16 15:53:39 -06:00
|
|
|
void Core::Suspend()
|
2011-06-14 08:13:28 -06:00
|
|
|
{
|
2011-07-11 14:23:13 -06:00
|
|
|
Core::Cond * nc = new Core::Cond();
|
|
|
|
// put the condition on a stack
|
|
|
|
SDL_mutexP(StackMutex);
|
|
|
|
suspended_tools.push(nc);
|
|
|
|
SDL_mutexV(StackMutex);
|
|
|
|
// wait until Core::Update() wakes up the tool
|
2011-06-16 15:53:39 -06:00
|
|
|
SDL_mutexP(AccessMutex);
|
2011-07-11 14:23:13 -06:00
|
|
|
nc->Lock(AccessMutex);
|
|
|
|
SDL_mutexV(AccessMutex);
|
2011-06-16 15:53:39 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
void Core::Resume()
|
|
|
|
{
|
2011-07-11 14:23:13 -06:00
|
|
|
SDL_mutexP(AccessMutex);
|
|
|
|
core_cond->Unlock();
|
2011-06-16 15:53:39 -06:00
|
|
|
SDL_mutexV(AccessMutex);
|
2011-06-14 08:13:28 -06:00
|
|
|
}
|
|
|
|
|
2011-07-09 03:33:58 -06:00
|
|
|
// should always be from simulation thread!
|
2011-06-14 08:13:28 -06:00
|
|
|
int Core::Update()
|
|
|
|
{
|
2011-07-09 03:33:58 -06:00
|
|
|
if(!started) Init();
|
2011-06-14 08:13:28 -06:00
|
|
|
if(errorstate)
|
|
|
|
return -1;
|
2011-07-11 14:23:13 -06:00
|
|
|
|
2011-06-26 18:13:01 -06:00
|
|
|
// notify all the plugins that a game tick is finished
|
|
|
|
plug_mgr->OnUpdate();
|
2011-07-11 14:23:13 -06:00
|
|
|
// wake waiting tools
|
|
|
|
// do not allow more tools to join in while we process stuff here
|
|
|
|
SDL_mutexP(StackMutex);
|
|
|
|
while (!suspended_tools.empty())
|
|
|
|
{
|
|
|
|
Core::Cond * nc = suspended_tools.top();
|
|
|
|
suspended_tools.pop();
|
|
|
|
SDL_mutexP(AccessMutex);
|
|
|
|
// wake tool
|
|
|
|
nc->Unlock();
|
|
|
|
// wait for tool to wake us
|
|
|
|
core_cond->Lock(AccessMutex);
|
|
|
|
SDL_mutexV(AccessMutex);
|
|
|
|
// destroy condition
|
|
|
|
delete nc;
|
|
|
|
}
|
|
|
|
SDL_mutexV(StackMutex);
|
2011-06-14 08:13:28 -06:00
|
|
|
return 0;
|
|
|
|
};
|
|
|
|
|
2011-07-12 04:13:14 -06:00
|
|
|
// FIXME: needs to terminate the IO threads and properly dismantle all the machinery involved.
|
2011-06-14 08:13:28 -06:00
|
|
|
int Core::Shutdown ( void )
|
|
|
|
{
|
2011-06-17 07:02:43 -06:00
|
|
|
errorstate = 1;
|
2011-06-24 21:35:29 -06:00
|
|
|
if(plug_mgr)
|
|
|
|
{
|
|
|
|
delete plug_mgr;
|
|
|
|
plug_mgr = 0;
|
|
|
|
}
|
2011-06-17 07:02:43 -06:00
|
|
|
// invalidate all modules
|
|
|
|
for(unsigned int i = 0 ; i < allModules.size(); i++)
|
|
|
|
{
|
|
|
|
delete allModules[i];
|
|
|
|
}
|
|
|
|
allModules.clear();
|
|
|
|
memset(&(s_mods), 0, sizeof(s_mods));
|
2011-07-13 03:45:30 -06:00
|
|
|
con.shutdown();
|
2011-06-17 07:02:43 -06:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2011-07-09 03:33:58 -06:00
|
|
|
int Core::SDL_Event(SDL::Event* ev, int orig_return)
|
2011-07-07 19:55:37 -06:00
|
|
|
{
|
2011-07-09 03:33:58 -06:00
|
|
|
// do NOT process events before we are ready.
|
|
|
|
if(!started) return orig_return;
|
|
|
|
if(!ev)
|
|
|
|
return orig_return;
|
|
|
|
if(ev && ev->type == SDL::ET_KEYDOWN || ev->type == SDL::ET_KEYUP)
|
2011-07-07 19:55:37 -06:00
|
|
|
{
|
2011-07-09 03:33:58 -06:00
|
|
|
SDL::KeyboardEvent * ke = (SDL::KeyboardEvent *)ev;
|
|
|
|
bool shift = ke->ksym.mod & SDL::KMOD_SHIFT;
|
|
|
|
// consuming F1 .. F8
|
|
|
|
int idx = ke->ksym.sym - SDL::K_F1;
|
|
|
|
if(idx < 0 || idx > 7)
|
|
|
|
return orig_return;
|
|
|
|
idx += 8*shift;
|
|
|
|
// now we have the real index...
|
|
|
|
if(ke->state == SDL::BTN_PRESSED && !hotkey_states[idx])
|
|
|
|
{
|
|
|
|
hotkey_states[idx] = 1;
|
|
|
|
Gui * g = getGui();
|
|
|
|
if(g->hotkeys && g->interface && g->menu_state)
|
|
|
|
{
|
|
|
|
t_viewscreen * ws = g->GetCurrentScreen();
|
|
|
|
if(ws->getClassName() == "viewscreen_dwarfmodest" && *g->menu_state == 0x23)
|
|
|
|
return orig_return;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
t_hotkey & hotkey = (*g->hotkeys)[idx];
|
|
|
|
setHotkeyCmd(hotkey.name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if(ke->state == SDL::BTN_RELEASED)
|
|
|
|
{
|
|
|
|
hotkey_states[idx] = 0;
|
|
|
|
}
|
2011-07-07 19:55:37 -06:00
|
|
|
}
|
2011-07-09 03:33:58 -06:00
|
|
|
return orig_return;
|
|
|
|
// do stuff with the events...
|
2011-07-07 19:55:37 -06:00
|
|
|
}
|
|
|
|
|
2011-06-17 07:02:43 -06:00
|
|
|
/*******************************************************************************
|
|
|
|
M O D U L E S
|
|
|
|
*******************************************************************************/
|
|
|
|
|
|
|
|
#define MODULE_GETTER(TYPE) \
|
|
|
|
TYPE * Core::get##TYPE() \
|
|
|
|
{ \
|
2011-06-19 17:12:07 -06:00
|
|
|
if(errorstate) return NULL;\
|
2011-06-17 07:02:43 -06:00
|
|
|
if(!s_mods.p##TYPE)\
|
|
|
|
{\
|
|
|
|
Module * mod = create##TYPE();\
|
|
|
|
s_mods.p##TYPE = (TYPE *) mod;\
|
|
|
|
allModules.push_back(mod);\
|
|
|
|
}\
|
|
|
|
return s_mods.p##TYPE;\
|
2011-06-14 08:13:28 -06:00
|
|
|
}
|
2011-06-17 07:02:43 -06:00
|
|
|
|
|
|
|
MODULE_GETTER(Creatures);
|
|
|
|
MODULE_GETTER(Engravings);
|
|
|
|
MODULE_GETTER(Maps);
|
|
|
|
MODULE_GETTER(Gui);
|
|
|
|
MODULE_GETTER(World);
|
|
|
|
MODULE_GETTER(Materials);
|
|
|
|
MODULE_GETTER(Items);
|
|
|
|
MODULE_GETTER(Translation);
|
|
|
|
MODULE_GETTER(Vegetation);
|
|
|
|
MODULE_GETTER(Buildings);
|
2011-07-13 00:17:51 -06:00
|
|
|
MODULE_GETTER(Constructions);
|
|
|
|
MODULE_GETTER(Vermin);
|