Common base for all modules

develop
Petr Mrázek 2010-06-25 07:11:26 +02:00
parent 3c458f4701
commit ec35663b62
25 changed files with 951 additions and 840 deletions

@ -3,7 +3,7 @@ INCLUDE(CPack)
PROJECT (dfhack)
cmake_minimum_required(VERSION 2.6)
SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/CMake/Modules)
SET ( DFHACK_VERSION "0.4.0.2" )
SET ( DFHACK_VERSION "0.4.0.3-dev" )
# disable warning, autosearch
if(COMMAND cmake_policy)
@ -30,6 +30,7 @@ include_directories (${CMAKE_SOURCE_DIR}/library/depends/tinyxml/)
include_directories (${CMAKE_SOURCE_DIR}/library/depends/argstream/)
add_subdirectory (library)
add_subdirectory (library/shm)
#add_subdirectory (dfhack/python)
add_subdirectory (tools/examples)
add_subdirectory (tools/playground)

@ -168,61 +168,3 @@ IF(UNIX)
install(TARGETS dfhack LIBRARY DESTINATION lib)
install(FILES ${CMAKE_SOURCE_DIR}/output/Memory.xml DESTINATION share/dfhack)
ENDIF(UNIX)
################################################################################
# DFCONNECT
###
SET(DFCONNECT_HDRS
shm/shms.h
shm/mod-core.h
shm/mod-maps.h
)
SET(PROJECT_SRCS
shm/mod-core.cpp
shm/mod-maps.cpp
#mod-creature40d.cpp
)
SET(PROJECT_HDRS_LINUX
)
SET(PROJECT_HDRS_WINDOWS
)
SET(PROJECT_SRCS_LINUX
shm/shms-linux.cpp
)
SET(PROJECT_SRCS_WINDOWS
shm/shms-windows.cpp
)
IF(UNIX)
LIST(APPEND PROJECT_HDRS ${PROJECT_HDRS_LINUX})
LIST(APPEND PROJECT_SRCS ${PROJECT_SRCS_LINUX})
ELSE(UNIX)
LIST(APPEND PROJECT_HDRS ${PROJECT_HDRS_WINDOWS})
LIST(APPEND PROJECT_SRCS ${PROJECT_SRCS_WINDOWS})
ENDIF(UNIX)
SET_SOURCE_FILES_PROPERTIES( ${PROJECT_HDRS} PROPERTIES HEADER_FILE_ONLY TRUE )
LIST(APPEND PROJECT_SRCS ${PROJECT_HDRS})
#IF(CMAKE_SIZEOF_VOID_P EQUAL 4)
IF(UNIX)
add_definitions(-DLINUX_BUILD)
SET(PROJECT_LIBS rt)
SET(CMAKE_CXX_FLAGS "-fvisibility=hidden")
ADD_LIBRARY(dfconnect SHARED ${PROJECT_SRCS})
TARGET_LINK_LIBRARIES(dfconnect ${PROJECT_LIBS})
ELSE(UNIX)
# SET(PROJECT_LIBS psapi)
ADD_LIBRARY(SDL SHARED ${PROJECT_SRCS})
TARGET_LINK_LIBRARIES(SDL ${PROJECT_LIBS})
ENDIF(UNIX)
#ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 4)

@ -24,33 +24,18 @@ using namespace DFHack;
DFContextShared::DFContextShared()
{
// init modules
creatures = 0;
maps = 0;
position = 0;
gui = 0;
world = 0;
materials = 0;
translation = 0;
vegetation = 0;
buildings = 0;
constructions = 0;
items = 0;
windowio = 0;
allModules.clear();
memset(&(s_mods), 0, sizeof(s_mods));
}
DFContextShared::~DFContextShared()
{
if(creatures) delete creatures;
if(maps) delete maps;
if(position) delete position;
if(gui) delete gui;
if(materials) delete materials;
if(translation) delete translation;
if(vegetation) delete vegetation;
if(buildings) delete buildings;
if(constructions) delete constructions;
if(world) delete world;
if(windowio) delete windowio;
// invalidate all modules
for(int i = 0 ; i < allModules.size(); i++)
{
delete allModules[i];
}
allModules.clear();
}
bool DFContextShared::InitReadNames()

@ -27,7 +27,6 @@ distribution.
#include "dfhack/DFProcess.h"
#include "dfhack/DFProcessEnumerator.h"
#include "dfhack/DFContext.h"
#include "dfhack/DFContext.h"
#include "dfhack/DFError.h"
#include <shms.h>
@ -93,6 +92,13 @@ bool Context::Detach()
}
d->shm_start = 0;
// invalidate all modules
for(int i = 0 ; i < d->allModules.size(); i++)
{
delete d->allModules[i];
}
d->allModules.clear();
memset(&(d->s_mods), 0, sizeof(d->s_mods));
/*
if(d->creatures)
{
delete d->creatures;
@ -147,7 +153,7 @@ bool Context::Detach()
{
delete d->translation;
d->translation = 0;
}
}*/
return true;
}
@ -201,13 +207,39 @@ Process * Context::getProcess()
/*******************************************************************************
M O D U L E S
*******************************************************************************/
#define MODULE_GETTER(TYPE) \
TYPE * Context::get##TYPE() \
{ \
if(!d->s_mods.p##TYPE)\
{\
d->s_mods.p##TYPE = new TYPE(d);\
d->allModules.push_back(d->s_mods.p##TYPE);\
}\
return d->s_mods.p##TYPE;\
}
MODULE_GETTER(Creatures);
MODULE_GETTER(Maps);
MODULE_GETTER(Gui);
MODULE_GETTER(WindowIO);
MODULE_GETTER(World);
MODULE_GETTER(Position);
MODULE_GETTER(Materials);
MODULE_GETTER(Items);
MODULE_GETTER(Translation);
MODULE_GETTER(Vegetation);
MODULE_GETTER(Buildings);
MODULE_GETTER(Constructions);
/*
Creatures * Context::getCreatures()
{
if(!d->creatures)
d->creatures = new Creatures(d);
return d->creatures;
}
*/
/*
Maps * Context::getMaps()
{
if(!d->maps)
@ -284,7 +316,7 @@ Constructions * Context::getConstructions()
d->constructions = new Constructions(d);
return d->constructions;
}
*/
/*
// returns number of buildings, expects v_buildingtypes that will later map t_building.type to its name

@ -240,7 +240,7 @@ DFHackObject* Context_getWindow(DFHackObject* context)
{
if(context != NULL)
{
return (DFHackObject*)((DFHack::Context*)context)->getWindow();
return (DFHackObject*)((DFHack::Context*)context)->getWindowIO();
}
return NULL;

@ -1,6 +1,16 @@
#ifndef DFHACK_API_H
#define DFHACK_API_H
// Defines
#ifdef __GNUC__
#define DEPRECATED(func) func __attribute__ ((deprecated))
#elif defined(_MSC_VER)
#define DEPRECATED(func) __declspec(deprecated) func
#else
#pragma message("WARNING: You need to implement DEPRECATED for this compiler")
#define DEPRECATED(func) func
#endif
// DFHack core classes and types
#include "dfhack/DFIntegers.h"
#include "dfhack/DFGlobal.h"

@ -113,7 +113,7 @@ namespace DFHack
Constructions * getConstructions();
/// get the Window management and I/O module
WindowIO * getWindow();
WindowIO * getWindowIO();
// DEAD CODE, WAITING TO BE UPDATED TO DF2010
/*

@ -0,0 +1,45 @@
/*
www.sourceforge.net/projects/dfhack
Copyright (c) 2009 Petr Mrázek (peterix), Kenneth Ferland (Impaler[WrG]), dorf
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.
*/
#ifndef MODULE_H_INCLUDED
#define MODULE_H_INCLUDED
#include "DFExport.h"
namespace DFHack
{
class Context;
class DFHACK_EXPORT Module
{
public:
~Module(){};
virtual bool Start(){return true;};// default start...
virtual bool Finish() = 0;// everything should have a Finish()
virtual bool doFinishOnResume(){return true;}; // should Context call Finish when Resume is called?
virtual bool doFinishOnMapChange(){return false;}; // Finish when map change is detected?
virtual bool doFinishOnDetach(){return false;}; // Finish in Context::Detach?
};
}
#endif //MODULE_H_INCLUDED

@ -4,6 +4,7 @@
* Buildings - also includes zones and stockpiles
*/
#include "dfhack/DFExport.h"
#include "dfhack/DFModule.h"
namespace DFHack
{
struct t_building
@ -26,7 +27,7 @@ namespace DFHack
};
class DFContextShared;
class DFHACK_EXPORT Buildings
class DFHACK_EXPORT Buildings : public Module
{
public:
Buildings(DFContextShared * d);

@ -4,6 +4,7 @@
* DF constructions
*/
#include "dfhack/DFExport.h"
#include "dfhack/DFModule.h"
namespace DFHack
{
// type of item the construction is made of
@ -40,7 +41,7 @@ namespace DFHack
};
#pragma pack (pop)
class DFContextShared;
class DFHACK_EXPORT Constructions
class DFHACK_EXPORT Constructions : public Module
{
public:
Constructions(DFContextShared * d);

@ -4,6 +4,7 @@
* Creatures
*/
#include "dfhack/DFExport.h"
#include "dfhack/DFModule.h"
namespace DFHack
{
/*
@ -357,7 +358,7 @@ namespace DFHack
class DFContextShared;
struct t_creature;
class DFHACK_EXPORT Creatures
class DFHACK_EXPORT Creatures : public Module
{
public:
Creatures(DFHack::DFContextShared * d);

@ -5,12 +5,13 @@
* Gui: Query the DF's GUI state
*/
#include "dfhack/DFExport.h"
#include "dfhack/DFModule.h"
namespace DFHack
{
class DFContextShared;
struct t_viewscreen;
class DFHACK_EXPORT Gui
class DFHACK_EXPORT Gui: public Module
{
public:

@ -4,32 +4,13 @@
* Creatures
*/
#include "dfhack/DFExport.h"
#include "dfhack/DFModule.h"
namespace DFHack
{
class Context;
class DFContextShared;
enum accessor_type {ACCESSOR_CONSTANT, ACCESSOR_INDIRECT, ACCESSOR_DOUBLE_INDIRECT};
/* this is used to store data about the way accessors work */
class DFHACK_EXPORT Accessor
{
private:
accessor_type type;
int32_t constant;
uint32_t offset1;
uint32_t offset2;
Process * p;
uint32_t dataWidth;
public:
Accessor(uint32_t function, Process * p);
Accessor(accessor_type type, int32_t constant, uint32_t offset1, uint32_t offset2, uint32_t dataWidth, Process * p);
int32_t getValue(uint32_t objectPtr);
bool isConstant();
};
struct t_item
{
t_material matdesc;
@ -43,50 +24,19 @@ struct t_improvement
int32_t quality;
};
class DFHACK_EXPORT ItemImprovementDesc
{
private:
Accessor * AType;
Process * p;
public:
ItemImprovementDesc(uint32_t VTable, Process * p);
bool getImprovement(uint32_t descptr, t_improvement & imp);
uint32_t vtable;
uint32_t maintype;
};
class DFHACK_EXPORT ItemDesc
{
private:
Accessor * AMainType;
Accessor * ASubType;
Accessor * ASubIndex;
Accessor * AIndex;
Accessor * AQuality;
Process * p;
bool hasDecoration;
public:
ItemDesc(uint32_t VTable, Process * p);
bool getItem(uint32_t itemptr, t_item & item);
std::string className;
uint32_t vtable;
uint32_t mainType;
std::vector<ItemImprovementDesc> improvement;
};
class DFHACK_EXPORT Items
class DFHACK_EXPORT Items : public Module
{
public:
Items(DFContextShared * _d);
~Items();
bool Start();
bool Finish();
std::string getItemDescription(uint32_t itemptr, Materials * Materials);
std::string getItemClass(int32_t index);
bool getItemData(uint32_t itemptr, t_item & item);
private:
class Private;
Private* d;
std::map<int32_t, ItemDesc *> descType;
std::map<uint32_t, ItemDesc *> descVTable;
};
}
#endif

@ -6,6 +6,7 @@
#define CL_MOD_MAPS
#include "dfhack/DFExport.h"
#include "dfhack/DFModule.h"
namespace DFHack
{
/***************************************************************************
@ -304,10 +305,10 @@ namespace DFHack
/***************************************************************************
C L I E N T M O D U L E
***************************************************************************/
#ifndef BUILD_SHM
class DFContextShared;
struct t_viewscreen;
class DFHACK_EXPORT Maps
class DFHACK_EXPORT Maps : public Module
{
public:
@ -422,5 +423,6 @@ namespace DFHack
struct Private;
Private *d;
};
#endif
}
#endif

@ -1,9 +1,10 @@
#ifndef CL_MOD_MATERIALS
#define CL_MOD_MATERIALS
/*
* Creatures
* Materials
*/
#include "dfhack/DFExport.h"
#include "dfhack/DFModule.h"
namespace DFHack
{
class DFContextShared;
@ -116,11 +117,12 @@ namespace DFHack
uint32_t flags;
};
class DFHACK_EXPORT Materials
class DFHACK_EXPORT Materials : public Module
{
public:
Materials(DFHack::DFContextShared * _d);
~Materials();
bool Finish();
std::vector<t_matgloss> inorganic;
std::vector<t_matgloss> organic;

@ -4,6 +4,7 @@
* View position and size and cursor position
*/
#include "dfhack/DFExport.h"
#include "dfhack/DFModule.h"
namespace DFHack
{
#define NUM_HOTKEYS 16
@ -17,12 +18,13 @@ namespace DFHack
};
class DFContextShared;
class DFHACK_EXPORT Position
class DFHACK_EXPORT Position : public Module
{
public:
Position(DFContextShared * d);
~Position();
bool Finish(){return true;};
/*
* Cursor and window coords
*/

@ -4,6 +4,7 @@
* DF translation tables and name translation
*/
#include "dfhack/DFExport.h"
#include "dfhack/DFModule.h"
namespace DFHack
{
class DFContextShared;
@ -14,7 +15,7 @@ namespace DFHack
DFDict foreign_languages;
} Dicts;
class DFHACK_EXPORT Translation
class DFHACK_EXPORT Translation : public Module
{
public:
Translation(DFContextShared * d);

@ -4,6 +4,7 @@
* DF vegetation - stuff that grows and gets cut down or trampled by dwarves
*/
#include "dfhack/DFExport.h"
#include "dfhack/DFModule.h"
namespace DFHack
{
/*
@ -28,7 +29,7 @@ namespace DFHack
};
class DFContextShared;
class DFHACK_EXPORT Vegetation
class DFHACK_EXPORT Vegetation : public Module
{
public:
Vegetation(DFContextShared * d);

@ -27,6 +27,7 @@ distribution.
#include "dfhack/DFPragma.h"
#include "dfhack/DFExport.h"
#include "dfhack/DFModule.h"
namespace DFHack
{
@ -88,12 +89,13 @@ enum t_special
NUM_SPECIALS
};
class DFContextShared;
class DFHACK_EXPORT WindowIO
class DFHACK_EXPORT WindowIO : public Module
{
class Private;
private:
Private * d;
public:
bool Finish(){return true;};
WindowIO(DFHack::DFContextShared * d);
~WindowIO();
void TypeStr (const char *input, int delay = 0, bool useShift = false);

@ -5,11 +5,12 @@
* World: all kind of stuff related to the current world state
*/
#include "dfhack/DFExport.h"
#include "dfhack/DFModule.h"
namespace DFHack
{
class DFContextShared;
class DFHACK_EXPORT World
class DFHACK_EXPORT World : public Module
{
public:

@ -33,29 +33,57 @@ distribution.
using namespace DFHack;
class Items::Private
enum accessor_type {ACCESSOR_CONSTANT, ACCESSOR_INDIRECT, ACCESSOR_DOUBLE_INDIRECT};
/* this is used to store data about the way accessors work */
class DFHACK_EXPORT Accessor
{
private:
accessor_type type;
int32_t constant;
uint32_t offset1;
uint32_t offset2;
Process * p;
uint32_t dataWidth;
public:
DFContextShared *d;
Process * owner;
/*
bool Inited;
bool Started;
*/
Accessor(uint32_t function, Process * p);
Accessor(accessor_type type, int32_t constant, uint32_t offset1, uint32_t offset2, uint32_t dataWidth, Process * p);
int32_t getValue(uint32_t objectPtr);
bool isConstant();
};
Items::Items(DFContextShared * d_)
class DFHACK_EXPORT ItemImprovementDesc
{
d = new Private;
d->d = d_;
d->owner = d_->p;
}
Items::~Items()
private:
Accessor * AType;
Process * p;
public:
ItemImprovementDesc(uint32_t VTable, Process * p);
bool getImprovement(uint32_t descptr, t_improvement & imp);
uint32_t vtable;
uint32_t maintype;
};
class DFHACK_EXPORT ItemDesc
{
delete d;
/* TODO : delete all item descs */
}
private:
Accessor * AMainType;
Accessor * ASubType;
Accessor * ASubIndex;
Accessor * AIndex;
Accessor * AQuality;
Process * p;
bool hasDecoration;
public:
ItemDesc(uint32_t VTable, Process * p);
bool getItem(uint32_t itemptr, t_item & item);
std::string className;
uint32_t vtable;
uint32_t mainType;
std::vector<ItemImprovementDesc> improvement;
};
// FIXME: this is crazy
Accessor::Accessor(uint32_t function, Process *p)
{
this->p = p;
@ -196,19 +224,50 @@ bool ItemDesc::getItem(uint32_t itemptr, DFHack::t_item &item)
return true;
}
class Items::Private
{
public:
DFContextShared *d;
Process * owner;
std::map<int32_t, ItemDesc *> descType;
std::map<uint32_t, ItemDesc *> descVTable;
};
Items::Items(DFContextShared * d_)
{
d = new Private;
d->d = d_;
d->owner = d_->p;
}
bool Items::Start(){return true;}
bool Items::Finish(){return true;}
Items::~Items()
{
Finish();
std::map<uint32_t, ItemDesc *>::iterator it;
it = d->descVTable.begin();
while (it != d->descVTable.end())
{
delete (*it).second;
}
d->descType.clear();
d->descVTable.clear();
delete d;
}
bool Items::getItemData(uint32_t itemptr, DFHack::t_item &item)
{
std::map<uint32_t, ItemDesc *>::iterator it;
Process * p = d->owner;
ItemDesc * desc;
it = this->descVTable.find(itemptr);
if(it==descVTable.end())
it = d->descVTable.find(itemptr);
if(it==d->descVTable.end())
{
uint32_t vtable = p->readDWord(itemptr);
desc = new ItemDesc(vtable, p);
this->descVTable[vtable] = desc;
this->descType[desc->mainType] = desc;
d->descVTable[vtable] = desc;
d->descType[desc->mainType] = desc;
}
else
desc = it->second;
@ -221,8 +280,8 @@ std::string Items::getItemClass(int32_t index)
std::map<int32_t, ItemDesc *>::iterator it;
std::string out;
it = this->descType.find(index);
if(it==this->descType.end())
it = d->descType.find(index);
if(it==d->descType.end())
{
/* these are dummy values for mood decoding */
switch(index)

@ -90,7 +90,6 @@ Maps::Maps(DFContextShared* _d)
off.region_y_offset = mem->getAddress ("region_y");
off.region_z_offset = mem->getAddress ("region_z");
off.world_regions = mem->getAddress ("ptr2_region_array");
off.region_size = mem->getHexValue ("region_size");
off.region_geo_index_offset = mem->getOffset ("region_geo_index_off");
@ -137,8 +136,10 @@ bool Maps::Start()
return false;
if(d->Started)
Finish();
Process *p = d->owner;
Server::Maps::maps_offsets &off = d->offsets;
// get the map pointer
uint32_t x_array_loc = p->readDWord (off.map_offset);
if (!x_array_loc)
@ -292,7 +293,7 @@ bool Maps::WriteTileTypes (uint32_t x, uint32_t y, uint32_t z, tiletypes40d *buf
}
/*
* Dirty flags
* Dirty bit
*/
bool Maps::ReadDirtyBit(uint32_t x, uint32_t y, uint32_t z, bool &dirtybit)
@ -326,7 +327,9 @@ bool Maps::WriteDirtyBit(uint32_t x, uint32_t y, uint32_t z, bool dirtybit)
return false;
}
/// read/write the block flags
/*
* Block flags
*/
bool Maps::ReadBlockFlags(uint32_t x, uint32_t y, uint32_t z, t_blockflags &blockflags)
{
MAPS_GUARD
@ -357,7 +360,6 @@ bool Maps::WriteBlockFlags(uint32_t x, uint32_t y, uint32_t z, t_blockflags bloc
/*
* Designations
*/
bool Maps::ReadDesignations (uint32_t x, uint32_t y, uint32_t z, designations40d *buffer)
{
MAPS_GUARD
@ -385,7 +387,6 @@ bool Maps::WriteDesignations (uint32_t x, uint32_t y, uint32_t z, designations40
/*
* Occupancies
*/
bool Maps::ReadOccupancy (uint32_t x, uint32_t y, uint32_t z, occupancies40d *buffer)
{
MAPS_GUARD
@ -735,26 +736,20 @@ bool Maps::ReadLocalFeatures( std::map <planecoord, std::vector<t_feature *> > &
for(uint32_t blockX = 0; blockX < d->x_block_count; blockX ++)
for(uint32_t blockY = 0; blockY < d->x_block_count; blockY ++)
{
//uint64_t block48_x = blockX / 3 + d->regionX;
//uint16_t region_x_plus8 = ( block48_x + 8 ) / 16;
// region X coord offset by 8 big blocks (48x48 tiles)
uint16_t region_x_plus8 = ( (blockX / 3 ) + d->regionX /*+ 8*/ ) / 16;
//((BYTE4(region_x_local) & 0xF) + (_DWORD)region_x_local) >> 4;
//int16_t region_x_local = (blockX / 3) + d->regionX;
//int16_t region_x_plus8 = ((region_x_local & 0xF) + region_x_local) >> 4;
// plain region Y coord
// region X coord (48x48 tiles)
uint16_t region_x_local = ( (blockX / 3) + d->regionX ) / 16;
// region Y coord (48x48 tiles)
uint64_t region_y_local = ( (blockY / 3) + d->regionY ) / 16;
// this is just a few pointers to arrays of 16B (4 DWORD) structs
uint32_t array_elem = p->readDWord(base + (region_x_plus8 / 16) * 4);
uint32_t array_elem = p->readDWord(base + (region_x_local / 16) * 4);
// 16B structs, second DWORD of the struct is a pointer
uint32_t wtf = p->readDWord(array_elem + ( sizeof_elem * ( (uint32_t)region_y_local/16)) + offset_elem);
if(wtf)
{
// wtf + sizeof(vector<ptr>) * crap;
uint32_t feat_vector = wtf + sizeof_vec * (16 * (region_x_plus8 % 16) + (region_y_local % 16));
uint32_t feat_vector = wtf + sizeof_vec * (16 * (region_x_local % 16) + (region_y_local % 16));
DfVector<uint32_t> p_features(p, feat_vector);
uint32_t size = p_features.size();
planecoord pc;

@ -53,6 +53,21 @@ Materials::~Materials()
{
delete d;
}
bool Materials::Finish()
{
inorganic.clear();
organic.clear();
tree.clear();
plant.clear();
race.clear();
raceEx.clear();
color.clear();
other.clear();
alldesc.clear();
return true;
}
/*
{
LABEL_53:

@ -31,20 +31,23 @@ distribution.
namespace DFHack
{
class Materials;
class Module;
class Creatures;
class Maps;
class Position;
class Gui;
class World;
class Position;
class Maps;
class Creatures;
class Materials;
class Items;
class Translation;
class Vegetation;
class Buildings;
class Constructions;
class WindowIO;
class ProcessEnumerator;
class Process;
class WindowIO;
class Vegetation;
class Constructions;
class memory_info;
struct t_name;
class DFContextShared
@ -69,19 +72,22 @@ namespace DFHack
string xml;
// Modules
Creatures * creatures;
Maps * maps;
Position * position;
Gui * gui;
World * world;
Materials * materials;
Items * items;
Translation * translation;
Vegetation * vegetation;
Buildings * buildings;
Constructions * constructions;
WindowIO * windowio;
struct
{
Creatures * pCreatures;
Maps * pMaps;
Position * pPosition;
Gui * pGui;
World * pWorld;
Materials * pMaterials;
Items * pItems;
Translation * pTranslation;
Vegetation * pVegetation;
Buildings * pBuildings;
Constructions * pConstructions;
WindowIO * pWindowIO;
} s_mods;
std::vector <Module *> allModules;
/*
uint32_t item_material_offset;

@ -0,0 +1,56 @@
################################################################################
# DFCONNECT
###
SET(DFCONNECT_HDRS
shms.h
mod-core.h
mod-maps.h
)
SET(PROJECT_SRCS
mod-core.cpp
mod-maps.cpp
#mod-creature40d.cpp
)
SET(PROJECT_HDRS_LINUX
)
SET(PROJECT_HDRS_WINDOWS
)
SET(PROJECT_SRCS_LINUX
shms-linux.cpp
)
SET(PROJECT_SRCS_WINDOWS
shms-windows.cpp
)
IF(UNIX)
LIST(APPEND PROJECT_HDRS ${PROJECT_HDRS_LINUX})
LIST(APPEND PROJECT_SRCS ${PROJECT_SRCS_LINUX})
ELSE(UNIX)
LIST(APPEND PROJECT_HDRS ${PROJECT_HDRS_WINDOWS})
LIST(APPEND PROJECT_SRCS ${PROJECT_SRCS_WINDOWS})
ENDIF(UNIX)
SET_SOURCE_FILES_PROPERTIES( ${PROJECT_HDRS} PROPERTIES HEADER_FILE_ONLY TRUE )
LIST(APPEND PROJECT_SRCS ${PROJECT_HDRS})
#IF(CMAKE_SIZEOF_VOID_P EQUAL 4)
add_definitions(-DBUILD_SHM)
IF(UNIX)
add_definitions(-DLINUX_BUILD)
SET(PROJECT_LIBS rt)
SET(CMAKE_CXX_FLAGS "-fvisibility=hidden")
ADD_LIBRARY(dfconnect SHARED ${PROJECT_SRCS})
TARGET_LINK_LIBRARIES(dfconnect ${PROJECT_LIBS})
ELSE(UNIX)
# SET(PROJECT_LIBS psapi)
ADD_LIBRARY(SDL SHARED ${PROJECT_SRCS})
TARGET_LINK_LIBRARIES(SDL ${PROJECT_LIBS})
ENDIF(UNIX)
#ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 4)