From 347eb66d218601acefb9af72a5ba4fc535274130 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Fri, 26 Feb 2010 22:22:10 +0100 Subject: [PATCH] Changes for better SWIG support --- examples/materialtest.cpp | 9 +- library/DFCommonInternal.h | 2 +- library/DFHackAPI.h | 42 +++-- library/DFMemInfo.h | 2 +- library/DFMemInfoManager.h | 2 +- library/DFProcess.h | 2 +- library/DFProcessEnumerator.h | 2 +- library/DFTileTypes.h | 2 +- library/DFTypes.h | 340 ++++++++++++++++++---------------- library/DFVector.h | 2 +- library/DFWindow.h | 2 +- library/Export.h | 28 +-- 12 files changed, 230 insertions(+), 205 deletions(-) diff --git a/examples/materialtest.cpp b/examples/materialtest.cpp index d0bb7bffc..a4d5ac474 100644 --- a/examples/materialtest.cpp +++ b/examples/materialtest.cpp @@ -1,6 +1,3 @@ -// Attach test -// attachtest - 100x attach/detach, 100x reads, 100x writes - #include #include #include @@ -39,6 +36,12 @@ int main (void) cout << "Metal: " << Metals[0].id << endl; cout << "Stone: " << Stones[0].id << endl; cout << "Creature: " << CreatureTypes[0].id << endl; + cout << endl; + cout << "Dumping all stones!" << endl; + for(int i = 0; i < Stones.size();i++) + { + cout << Stones[i].id << "$" << endl;; + } DF.Detach(); #ifndef LINUX_BUILD diff --git a/library/DFCommonInternal.h b/library/DFCommonInternal.h index f873766ed..8b724f912 100644 --- a/library/DFCommonInternal.h +++ b/library/DFCommonInternal.h @@ -25,7 +25,7 @@ distribution. #ifndef DFCOMMONINTERNAL_H_INCLUDED #define DFCOMMONINTERNAL_H_INCLUDED -#include +#include "Tranquility.h" #include #include diff --git a/library/DFHackAPI.h b/library/DFHackAPI.h index 417c1201e..4f47e8b07 100644 --- a/library/DFHackAPI.h +++ b/library/DFHackAPI.h @@ -25,14 +25,14 @@ distribution. #ifndef SIMPLEAPI_H_INCLUDED #define SIMPLEAPI_H_INCLUDED -#include - +#include "Tranquility.h" #include "Export.h" #include #include #include #include "integers.h" #include "DFTileTypes.h" +#include "DFTypes.h" #include "DFWindow.h" namespace DFHack @@ -44,7 +44,7 @@ namespace DFHack class Private; Private * const d; public: - API(const string path_to_xml); + API(const std::string path_to_xml); ~API(); bool Attach(); bool Detach(); @@ -76,12 +76,12 @@ namespace DFHack * I'll keep it like this, even with the code duplication as it will hopefully get more features and separate data types later. * Yay for nebulous plans for a rock survey tool that tracks how much of which metal could be smelted from available resorces */ - bool ReadStoneMatgloss(vector & output); - bool ReadWoodMatgloss (vector & output); - bool ReadMetalMatgloss(vector & output); - bool ReadPlantMatgloss(vector & output); - bool ReadPlantMatgloss (vector & plants); - bool ReadCreatureMatgloss(vector & output); + bool ReadStoneMatgloss(std::vector & output); + bool ReadWoodMatgloss (std::vector & output); + bool ReadMetalMatgloss(std::vector & output); + bool ReadPlantMatgloss(std::vector & output); + bool ReadPlantMatgloss (std::vector & plants); + bool ReadCreatureMatgloss(std::vector & output); // read region surroundings, get their vectors of geolayers so we can do translation (or just hand the translation table to the client) // returns an array of 9 vectors of indices into stone matgloss @@ -114,7 +114,7 @@ namespace DFHack } } */ - bool ReadGeology( vector < vector >& assign ); + bool ReadGeology( std::vector < std::vector >& assign ); /* * BLOCK DATA @@ -151,7 +151,7 @@ namespace DFHack bool ReadRegionOffsets(uint32_t blockx, uint32_t blocky, uint32_t blockz, uint8_t *buffer); // 16 * sizeof(uint8_t) /// read aggregated veins of a block - bool ReadVeins(uint32_t blockx, uint32_t blocky, uint32_t blockz, vector & veins, vector & ices); + bool ReadVeins(uint32_t blockx, uint32_t blocky, uint32_t blockz, std::vector & veins, std::vector & ices); /** * Buildings, constructions, plants, all pretty straighforward. InitReadBuildings returns all the building types as a mapping between a numeric values and strings @@ -185,9 +185,9 @@ namespace DFHack bool ReadNote(const int32_t &index, t_note & note); void FinishReadNotes(); - bool InitReadSettlements( uint32_t & numsettlements ); + bool InitReadSettlements( uint32_t & numsettlements ); bool ReadSettlement(const int32_t &index, t_settlement & settlement); - bool ReadCurrentSettlement(t_settlement & settlement); + bool ReadCurrentSettlement(t_settlement & settlement); void FinishReadSettlements(); bool InitReadHotkeys( ); @@ -200,13 +200,15 @@ namespace DFHack bool setCursorCoords (const int32_t &x, const int32_t &y, const int32_t &z); /// This returns false if there is nothing under the cursor, it puts the addresses in a vector if there is - bool getCurrentCursorCreatures(vector &addresses); + bool getCurrentCursorCreatures(std::vector &addresses); bool InitViewSize(); bool getWindowSize(int32_t & width, int32_t & height); + /* unimplemented bool setWindowSize(const int32_t & width, const int32_t & height); + */ - void getItemIndexesInBox(vector &indexes, + void getItemIndexesInBox(std::vector &indexes, const uint16_t &x1, const uint16_t &y1, const uint16_t &z1, const uint16_t &x2, const uint16_t &y2, const uint16_t &z2); /* @@ -219,12 +221,12 @@ namespace DFHack vector getTraits(const uint32_t &index); vector getLabors(const uint32_t &index); */ - bool InitReadNameTables (map< string, vector > & nameTable); + bool InitReadNameTables (std::map< std::string, std::vector > & nameTable); void FinishReadNameTables(); - string TranslateName(const t_lastname & last, const map< string, vector< string > > &nameTable,const string & language="GENERIC"); - string TranslateName(const t_squadname & squad, const map< string, vector< string > > &nameTable,const string & language="GENERIC"); - string TranslateName (const int names[], int size, const map > & nameTable, const string & language="GENERIC"); + std::string TranslateName(const t_lastname & last, const std::map< std::string, std::vector< std::string > > &nameTable,const std::string & language="GENERIC"); + std::string TranslateName(const t_squadname & squad, const std::map< std::string, std::vector< std::string > > &nameTable,const std::string & language="GENERIC"); + std::string TranslateName (const int names[], int size, const std::map > &nameTable, const std::string & language="GENERIC"); void WriteLabors(const uint32_t &index, uint8_t labors[NUM_CREATURE_LABORS]); @@ -239,7 +241,7 @@ namespace DFHack // FIXME: BAD! bool ReadAllMatgloss(vector< vector< string > > & all); */ - bool ReadItemTypes(vector< vector< t_itemType > > & itemTypes); + bool ReadItemTypes(std::vector< std::vector< t_itemType > > & itemTypes); }; } // namespace DFHack #endif // SIMPLEAPI_H_INCLUDED diff --git a/library/DFMemInfo.h b/library/DFMemInfo.h index e029214cc..b4ae92e7d 100644 --- a/library/DFMemInfo.h +++ b/library/DFMemInfo.h @@ -25,7 +25,7 @@ distribution. #ifndef MEMINFO_H_INCLUDED #define MEMINFO_H_INCLUDED -#include +#include "Tranquility.h" #include "Export.h" #include diff --git a/library/DFMemInfoManager.h b/library/DFMemInfoManager.h index ef5bf0a20..f35a7184f 100644 --- a/library/DFMemInfoManager.h +++ b/library/DFMemInfoManager.h @@ -25,7 +25,7 @@ distribution. #ifndef MEMINFO_MANAGER_H_INCLUDED #define MEMINFO_MANAGER_H_INCLUDED -#include +#include "Tranquility.h" namespace DFHack { diff --git a/library/DFProcess.h b/library/DFProcess.h index 13d32c7af..7eac5fe18 100644 --- a/library/DFProcess.h +++ b/library/DFProcess.h @@ -25,7 +25,7 @@ distribution. #ifndef PROCESS_H_INCLUDED #define PROCESS_H_INCLUDED -#include +#include "Tranquility.h" #include "Export.h" namespace DFHack diff --git a/library/DFProcessEnumerator.h b/library/DFProcessEnumerator.h index bc675e0d9..517acf5ce 100644 --- a/library/DFProcessEnumerator.h +++ b/library/DFProcessEnumerator.h @@ -25,7 +25,7 @@ distribution. #ifndef PROCESSMANAGER_H_INCLUDED #define PROCESSMANAGER_H_INCLUDED -#include +#include "Tranquility.h" #include "Export.h" class TiXmlElement; diff --git a/library/DFTileTypes.h b/library/DFTileTypes.h index 40ff113de..0601c1502 100644 --- a/library/DFTileTypes.h +++ b/library/DFTileTypes.h @@ -25,7 +25,7 @@ distribution. #ifndef TILETYPES_H_INCLUDED #define TILETYPES_H_INCLUDED -#include +#include "Tranquility.h" namespace DFHack { diff --git a/library/DFTypes.h b/library/DFTypes.h index 83c7f1a82..9959526d5 100644 --- a/library/DFTypes.h +++ b/library/DFTypes.h @@ -25,7 +25,7 @@ distribution. #ifndef TYPES_H_INCLUDED #define TYPES_H_INCLUDED -#include +#include "Tranquility.h" #include "Export.h" namespace DFHack @@ -269,52 +269,54 @@ bits: 31 Is an important historical figure */ +struct naked_creaturflags1 +{ + unsigned int move_state : 1; // Can the dwarf move or are they waiting for their movement timer + unsigned int dead : 1; // might also be set for incoming/leaving critters that are alive + unsigned int has_mood : 1; // Currently in mood + unsigned int had_mood : 1; // Had a mood + + unsigned int marauder : 1; // wide class of invader/inside creature attackers + unsigned int drowning : 1; + unsigned int merchant : 1; // active merchant + unsigned int forest : 1; // used for units no longer linked to merchant/diplomacy, they just try to leave mostly + + unsigned int left : 1; // left the map + unsigned int rider : 1; + unsigned int incoming : 1; + unsigned int diplomat : 1; + + unsigned int zombie : 1; + unsigned int skeleton : 1; + unsigned int can_swap : 1; // Can swap tiles during movement (prevents multiple swaps) + unsigned int on_ground : 1; // can be conscious + + unsigned int projectile : 1; + unsigned int active_invader : 1; // for organized ones + unsigned int hidden_in_ambush : 1; + unsigned int invader_origin : 1; // could be inactive and fleeing + + unsigned int coward : 1; // Will flee if invasion turns around + unsigned int hidden_ambusher : 1; // maybe + unsigned int invades : 1; // Active marauder/invader moving inward + unsigned int check_flows : 1; // Check against flows next time you get a chance + + // 0100 0000 - 8000 0000 + unsigned int ridden : 1; + unsigned int caged : 1; + unsigned int tame : 1; + unsigned int chained : 1; + + unsigned int royal_guard : 1; + unsigned int fortress_guard : 1; + unsigned int suppress_wield : 1; // Suppress wield for beatings/etc + unsigned int important_historical_figure : 1; // Is an important historical figure +}; + union t_creaturflags1 { uint32_t whole; - struct { - unsigned int move_state : 1; // Can the dwarf move or are they waiting for their movement timer - unsigned int dead : 1; // might also be set for incoming/leaving critters that are alive - unsigned int has_mood : 1; // Currently in mood - unsigned int had_mood : 1; // Had a mood - - unsigned int marauder : 1; // wide class of invader/inside creature attackers - unsigned int drowning : 1; - unsigned int merchant : 1; // active merchant - unsigned int forest : 1; // used for units no longer linked to merchant/diplomacy, they just try to leave mostly - - unsigned int left : 1; // left the map - unsigned int rider : 1; - unsigned int incoming : 1; - unsigned int diplomat : 1; - - unsigned int zombie : 1; - unsigned int skeleton : 1; - unsigned int can_swap : 1; // Can swap tiles during movement (prevents multiple swaps) - unsigned int on_ground : 1; // can be conscious - - unsigned int projectile : 1; - unsigned int active_invader : 1; // for organized ones - unsigned int hidden_in_ambush : 1; - unsigned int invader_origin : 1; // could be inactive and fleeing - - unsigned int coward : 1; // Will flee if invasion turns around - unsigned int hidden_ambusher : 1; // maybe - unsigned int invades : 1; // Active marauder/invader moving inward - unsigned int check_flows : 1; // Check against flows next time you get a chance - - // 0100 0000 - 8000 0000 - unsigned int ridden : 1; - unsigned int caged : 1; - unsigned int tame : 1; - unsigned int chained : 1; - - unsigned int royal_guard : 1; - unsigned int fortress_guard : 1; - unsigned int suppress_wield : 1; // Suppress wield for beatings/etc - unsigned int important_historical_figure : 1; // Is an important historical figure - - } bits; + naked_creaturflags1 bits; }; /* @@ -360,53 +362,55 @@ bits: 30 Roaming wilderness population source 31 Roaming wilderness population source -- not a map feature */ - +struct naked_creaturflags2 +{ + unsigned int swimming : 1; + unsigned int sparring : 1; + unsigned int no_notify : 1; // Do not notify about level gains (for embark etc) + unsigned int unused : 1; + + unsigned int calculated_nerves : 1; + unsigned int calculated_bodyparts : 1; + unsigned int important_historical_figure : 1; // slight variation + unsigned int killed : 1; // killed by kill() function + + unsigned int cleanup_1 : 1; // Must be forgotten by forget function (just cleanup) + unsigned int cleanup_2 : 1; // Must be deleted (cleanup) + unsigned int cleanup_3 : 1; // Recently forgotten (cleanup) + unsigned int for_trade : 1; // Offered for trade + + unsigned int trade_resolved : 1; + unsigned int has_breaks : 1; + unsigned int gutted : 1; + unsigned int circulatory_spray : 1; + + unsigned int locked_in_for_trading : 1; + unsigned int slaughter : 1; // marked for slaughter + unsigned int underworld : 1; // Underworld creature + unsigned int resident : 1; // Current resident + + unsigned int cleanup_4 : 1; // Marked for special cleanup as unused load from unit block on disk + unsigned int calculated_insulation : 1; // Insulation from clothing calculated + unsigned int visitor_uninvited : 1; // Uninvited guest + unsigned int visitor : 1; // visitor + + unsigned int calculated_inventory : 1; // Inventory order calculated + unsigned int vision_good : 1; // Vision -- have good part + unsigned int vision_damaged : 1; // Vision -- have damaged part + unsigned int vision_missing : 1; // Vision -- have missing part + + unsigned int breathing_good : 1; // Breathing -- have good part + unsigned int breathing_problem : 1; // Breathing -- having a problem + unsigned int roaming_wilderness_population_source : 1; + unsigned int roaming_wilderness_population_source_not_a_map_feature : 1; + +}; union t_creaturflags2 { uint32_t whole; - struct { - unsigned int swimming : 1; - unsigned int sparring : 1; - unsigned int no_notify : 1; // Do not notify about level gains (for embark etc) - unsigned int unused : 1; - - unsigned int calculated_nerves : 1; - unsigned int calculated_bodyparts : 1; - unsigned int important_historical_figure : 1; // slight variation - unsigned int killed : 1; // killed by kill() function - - unsigned int cleanup_1 : 1; // Must be forgotten by forget function (just cleanup) - unsigned int cleanup_2 : 1; // Must be deleted (cleanup) - unsigned int cleanup_3 : 1; // Recently forgotten (cleanup) - unsigned int for_trade : 1; // Offered for trade - - unsigned int trade_resolved : 1; - unsigned int has_breaks : 1; - unsigned int gutted : 1; - unsigned int circulatory_spray : 1; - - unsigned int locked_in_for_trading : 1; - unsigned int slaughter : 1; // marked for slaughter - unsigned int underworld : 1; // Underworld creature - unsigned int resident : 1; // Current resident - - unsigned int cleanup_4 : 1; // Marked for special cleanup as unused load from unit block on disk - unsigned int calculated_insulation : 1; // Insulation from clothing calculated - unsigned int visitor_uninvited : 1; // Uninvited guest - unsigned int visitor : 1; // visitor - - unsigned int calculated_inventory : 1; // Inventory order calculated - unsigned int vision_good : 1; // Vision -- have good part - unsigned int vision_damaged : 1; // Vision -- have damaged part - unsigned int vision_missing : 1; // Vision -- have missing part - - unsigned int breathing_good : 1; // Breathing -- have good part - unsigned int breathing_problem : 1; // Breathing -- having a problem - unsigned int roaming_wilderness_population_source : 1; - unsigned int roaming_wilderness_population_source_not_a_map_feature : 1; - - } bits; + naked_creaturflags2 bits; }; + /* struct t_labor { @@ -559,54 +563,57 @@ struct t_item_df40d uint32_t ID; // not complete }; + //From http://dwarffortresswiki.net/index.php/User:Rick/Memory_research //They all seem to be valid on 40d as well +struct naked_itemflags +{ + unsigned int on_ground : 1; // Item on ground + unsigned int in_job : 1; // item currently being used in a job + unsigned int in_inventory : 1; // Item in a creatures inventory + unsigned int u_ngrd1 : 1; // only occurs when not on ground, unknown function + + unsigned int in_workshop : 1; // Item is in a workshops inventory + unsigned int u_ngrd2 : 1; // only occurs when not on ground, unknown function + unsigned int u_ngrd3 : 1; // only occurs when not on ground, unknown function + unsigned int rotten : 1; // Item is rotten + + unsigned int unk1 : 1; // unknown function + unsigned int u_ngrd4 : 1; // only occurs when not on ground, unknown function + unsigned int unk2 : 1; // unknown function + unsigned int u_ngrd5 : 1; // only occurs when not on ground, unknown function + + unsigned int unk3 : 1; // unknown function + unsigned int u_ngrd6 : 1; // only occurs when not on ground, unknown function + unsigned int narrow : 1; // Item is narrow + unsigned int u_ngrd7 : 1; // only occurs when not on ground, unknown function + + unsigned int worn : 1; // item shows wear + unsigned int unk4 : 1; // unknown function + unsigned int u_ngrd8 : 1; // only occurs when not on ground, unknown function + unsigned int forbid : 1; // designate forbid item + + unsigned int unk5 : 1; // unknown function + unsigned int dump : 1; // designate dump item + unsigned int on_fire: 1; //indicates if item is on fire, Will Set Item On Fire if Set! + unsigned int melt : 1; // designate melt item, if item cannot be melted, does nothing it seems + + // 0100 0000 - 8000 0000 + unsigned int hidden : 1; // designate hide item + unsigned int u_ngrd9 : 1; // only occurs when not on ground, unknown function + unsigned int unk6 : 1; // unknown function + unsigned int unk7 : 1; // unknown function + + unsigned int unk8 : 1; // unknown function + unsigned int unk9 : 1; // unknown function + unsigned int unk10 : 1; // unknown function + unsigned int unk11 : 1; // unknown function +}; + union t_itemflags { uint32_t whole; - struct { - unsigned int on_ground : 1; // Item on ground - unsigned int in_job : 1; // item currently being used in a job - unsigned int in_inventory : 1; // Item in a creatures inventory - unsigned int u_ngrd1 : 1; // only occurs when not on ground, unknown function - - unsigned int in_workshop : 1; // Item is in a workshops inventory - unsigned int u_ngrd2 : 1; // only occurs when not on ground, unknown function - unsigned int u_ngrd3 : 1; // only occurs when not on ground, unknown function - unsigned int rotten : 1; // Item is rotten - - unsigned int unk1 : 1; // unknown function - unsigned int u_ngrd4 : 1; // only occurs when not on ground, unknown function - unsigned int unk2 : 1; // unknown function - unsigned int u_ngrd5 : 1; // only occurs when not on ground, unknown function - - unsigned int unk3 : 1; // unknown function - unsigned int u_ngrd6 : 1; // only occurs when not on ground, unknown function - unsigned int narrow : 1; // Item is narrow - unsigned int u_ngrd7 : 1; // only occurs when not on ground, unknown function - - unsigned int worn : 1; // item shows wear - unsigned int unk4 : 1; // unknown function - unsigned int u_ngrd8 : 1; // only occurs when not on ground, unknown function - unsigned int forbid : 1; // designate forbid item - - unsigned int unk5 : 1; // unknown function - unsigned int dump : 1; // designate dump item - unsigned int on_fire: 1; //indicates if item is on fire, Will Set Item On Fire if Set! - unsigned int melt : 1; // designate melt item, if item cannot be melted, does nothing it seems - - // 0100 0000 - 8000 0000 - unsigned int hidden : 1; // designate hide item - unsigned int u_ngrd9 : 1; // only occurs when not on ground, unknown function - unsigned int unk6 : 1; // unknown function - unsigned int unk7 : 1; // unknown function - - unsigned int unk8 : 1; // unknown function - unsigned int unk9 : 1; // unknown function - unsigned int unk10 : 1; // unknown function - unsigned int unk11 : 1; // unknown function - - } bits; + naked_itemflags bits; }; //cooked @@ -659,37 +666,35 @@ enum e_designation designation_7 // whatever }; -union t_designation +struct naked_designation { - uint32_t whole; - struct { unsigned int flow_size : 3; // how much liquid is here? unsigned int pile : 1; // stockpile? -/* - * All the different dig designations... needs more info, probably an enum - */ + /* + * All the different dig designations... needs more info, probably an enum + */ e_designation dig : 3; unsigned int smooth : 2; unsigned int hidden : 1; -/* - * This one is rather involved, but necessary to retrieve the base layer matgloss index - * see http://www.bay12games.com/forum/index.php?topic=608.msg253284#msg253284 for details - */ + /* + * This one is rather involved, but necessary to retrieve the base layer matgloss index + * see http://www.bay12games.com/forum/index.php?topic=608.msg253284#msg253284 for details + */ unsigned int geolayer_index :4; unsigned int light : 1; unsigned int subterranean : 1; // never seen the light of day? unsigned int skyview : 1; // sky is visible now, it rains in here when it rains -/* - * Probably similar to the geolayer_index. Only with a different set of offsets and different data. - * we don't use this yet - */ + /* + * Probably similar to the geolayer_index. Only with a different set of offsets and different data. + * we don't use this yet + */ unsigned int biome : 4; -/* -0 = water -1 = magma -*/ + /* + * 0 = water + * 1 = magma + */ unsigned int liquid_type : 1; unsigned int water_table : 1; // srsly. wtf? unsigned int rained : 1; // does this mean actual rain (as in the blue blocks) or a wet tile? @@ -699,14 +704,17 @@ union t_designation unsigned int moss : 1;// I LOVE MOSS unsigned int feature_present : 1; // another wtf... is this required for magma pipes to work? unsigned int liquid_character : 2; // those ripples on streams? - } bits; }; -// occupancy flags (rat,dwarf,horse,built wall,not build wall,etc) -union t_occupancy +union t_designation { uint32_t whole; - struct { + naked_designation bits; +}; + +// occupancy flags (rat,dwarf,horse,built wall,not build wall,etc) +struct naked_occupancy +{ unsigned int building : 3;// building type... should be an enum? // 7 = door unsigned int unit : 1; @@ -736,16 +744,24 @@ union t_occupancy unsigned int blood2 : 1; unsigned int broken_arrows_variant : 1; unsigned int snow : 1; - } bits; - struct { - unsigned int building : 3;// building type... should be an enum? - // 7 = door - unsigned int unit : 1; - unsigned int unit_grounded : 1; - unsigned int item : 1; - // splatter. everyone loves splatter. - unsigned int splatter : 26; - } unibits; +}; + +struct naked_occupancy_grouped +{ + unsigned int building : 3;// building type... should be an enum? + // 7 = door + unsigned int unit : 1; + unsigned int unit_grounded : 1; + unsigned int item : 1; + // splatter. everyone loves splatter. + unsigned int splatter : 26; +}; + +union t_occupancy +{ + uint32_t whole; + naked_occupancy bits; + naked_occupancy_grouped unibits; }; struct t_viewscreen diff --git a/library/DFVector.h b/library/DFVector.h index 580565cde..7ac24871b 100644 --- a/library/DFVector.h +++ b/library/DFVector.h @@ -25,7 +25,7 @@ distribution. #ifndef DFVECTOR_H_INCLUDED #define DFVECTOR_H_INCLUDED -#include +#include "Tranquility.h" namespace DFHack { diff --git a/library/DFWindow.h b/library/DFWindow.h index be24b5cd4..99e5f37ba 100644 --- a/library/DFWindow.h +++ b/library/DFWindow.h @@ -25,7 +25,7 @@ distribution. #ifndef KEYS_H_INCLUDED #define KEYS_H_INCLUDED -#include +#include "Tranquility.h" #include "Export.h" namespace DFHack diff --git a/library/Export.h b/library/Export.h index 1e3834f3b..820c046ab 100644 --- a/library/Export.h +++ b/library/Export.h @@ -23,17 +23,21 @@ distribution. */ #ifdef LINUX_BUILD -# ifndef DFHACK_EXPORT -# define DFHACK_EXPORT __attribute__ ((visibility("default"))) -# endif +#ifndef DFHACK_EXPORT +#ifndef SWIGIMPORTED +#define DFHACK_EXPORT __attribute__ ((visibility("default"))) #else -# ifdef BUILD_DFHACK_LIB -# ifndef DFHACK_EXPORT -# define DFHACK_EXPORT __declspec(dllexport) -# endif -# else -# ifndef DFHACK_EXPORT -# define DFHACK_EXPORT __declspec(dllimport) -# endif -# endif +#define DFHACK_EXPORT +#endif +#endif +#else +#ifdef BUILD_DFHACK_LIB +#ifndef DFHACK_EXPORT +#define DFHACK_EXPORT __declspec(dllexport) +#endif +#else +#ifndef DFHACK_EXPORT +#define DFHACK_EXPORT __declspec(dllimport) +#endif +#endif #endif