diff --git a/library/DFCommonInternal.h b/library/DFCommonInternal.h index 1a98f8274..f873766ed 100644 --- a/library/DFCommonInternal.h +++ b/library/DFCommonInternal.h @@ -25,6 +25,8 @@ distribution. #ifndef DFCOMMONINTERNAL_H_INCLUDED #define DFCOMMONINTERNAL_H_INCLUDED +#include + #include #include #include @@ -36,22 +38,6 @@ using namespace std; #include #include -/* -#ifdef __KDE_HAVE_GCC_VISIBILITY -#define NO_EXPORT __attribute__ ((visibility("hidden"))) -#define EXPORT __attribute__ ((visibility("default"))) -#define IMPORT __attribute__ ((visibility("default"))) -#elif defined(_WIN32) || defined(_WIN64) -#define NO_EXPORT -#define EXPORT __declspec(dllexport) -#define IMPORT __declspec(dllimport) -#else -#define NO_EXPORT -#define EXPORT -#define IMPORT -#endif -*/ - #ifdef LINUX_BUILD #include #include @@ -116,7 +102,6 @@ namespace DFHack #define MEMXML_DATA_PATH . #endif - #if defined(_MSC_VER) && _MSC_VER >= 1400 #define fill_char_buf(buf, str) strcpy_s((buf), sizeof(buf) / sizeof((buf)[0]), (str).c_str()) #else diff --git a/library/DFHackAPI.cpp b/library/DFHackAPI.cpp index d2ce37bbc..2c5b8693b 100644 --- a/library/DFHackAPI.cpp +++ b/library/DFHackAPI.cpp @@ -271,7 +271,7 @@ bool API::WriteDirtyBit(uint32_t x, uint32_t y, uint32_t z, bool dirtybit) uint32_t addr_of_struct = g_pProcess->readDWord(addr); uint32_t dirtydword = g_pProcess->readDWord(addr_of_struct); dirtydword &= 0xFFFFFFF0; - dirtydword |= dirtybit; + dirtydword |= (uint32_t) dirtybit; g_pProcess->writeDWord (addr_of_struct, dirtydword); return true; } @@ -1036,7 +1036,7 @@ void API::getItemIndexesInBox(vector &indexes, uint32_t flags; }; temp2 temp2; - for(int i =0;ip_itm->at(i); g_pProcess->read(temp+sizeof(uint32_t),5 * sizeof(uint16_t), (uint8_t *) &temp2); if(temp2.flags & (1 << 0)){ @@ -1097,11 +1097,16 @@ bool API::ReadCreature (const int32_t &index, t_creature & furball) furball.profession = g_pProcess->readByte (temp + d->creature_profession_offset); // current job HACK: the job object isn't cleanly represented here uint32_t jobIdAddr = g_pProcess->readDWord (temp + d->creature_current_job_offset); - furball.current_job.active = jobIdAddr; + if (jobIdAddr) { + furball.current_job.active = true; furball.current_job.jobId = g_pProcess->readByte (jobIdAddr + d->creature_current_job_id_offset); } + else + { + furball.current_job.active = false; + } //likes DfVector likes(d->p->readVector(temp+d->creature_likes_offset,4)); @@ -1491,7 +1496,7 @@ bool API::ReadPauseState() assert (d->cursorWindowInited); uint32_t pauseState = g_pProcess->readDWord (d->pause_state_offset); - return (pauseState); + return pauseState & 1; } uint32_t API::ReadMenuState() diff --git a/library/DFHackAPI.h b/library/DFHackAPI.h index 0ebe6338f..3dbe045ed 100644 --- a/library/DFHackAPI.h +++ b/library/DFHackAPI.h @@ -25,6 +25,8 @@ distribution. #ifndef SIMPLEAPI_H_INCLUDED #define SIMPLEAPI_H_INCLUDED +#include + #include "Export.h" #include #include diff --git a/library/DFMemInfo.h b/library/DFMemInfo.h index abe99e492..f579aba68 100644 --- a/library/DFMemInfo.h +++ b/library/DFMemInfo.h @@ -25,6 +25,8 @@ distribution. #ifndef MEMINFO_H_INCLUDED #define MEMINFO_H_INCLUDED +#include + #include "Export.h" #include #include diff --git a/library/DFMemInfoManager.h b/library/DFMemInfoManager.h index 4fcc6f682..d4e7812d8 100644 --- a/library/DFMemInfoManager.h +++ b/library/DFMemInfoManager.h @@ -25,6 +25,8 @@ distribution. #ifndef MEMINFO_MANAGER_H_INCLUDED #define MEMINFO_MANAGER_H_INCLUDED +#include + namespace DFHack { class MemInfoManager diff --git a/library/DFProcess-windows-SHM.cpp b/library/DFProcess-windows-SHM.cpp index ec10171dd..7210f8aee 100644 --- a/library/DFProcess-windows-SHM.cpp +++ b/library/DFProcess-windows-SHM.cpp @@ -148,9 +148,6 @@ bool SHMProcess::Private::DF_GetPID(uint32_t & ret) SHMProcess::SHMProcess(vector & known_versions) : d(new Private()) { - char exe_link_name [256]; - char target_name[1024]; - int target_result; // get server and client mutex d->DFSVMutex = OpenMutex(SYNCHRONIZE,false, "DFSVMutex"); if(d->DFSVMutex == 0) @@ -427,7 +424,6 @@ bool SHMProcess::resume() bool SHMProcess::attach() { - int status; if(g_pProcess != 0) { cerr << "there's already a different process attached" << endl; diff --git a/library/DFProcess.h b/library/DFProcess.h index a48f0d7b3..194ac5715 100644 --- a/library/DFProcess.h +++ b/library/DFProcess.h @@ -25,6 +25,7 @@ distribution. #ifndef PROCESS_H_INCLUDED #define PROCESS_H_INCLUDED +#include #include "Export.h" namespace DFHack @@ -61,6 +62,8 @@ namespace DFHack class DFHACK_EXPORT Process { public: + // this is the single most important destructor ever. ~px + virtual ~Process(){}; // Set up stuff so we can read memory, suspends synchronously virtual bool attach() = 0; // detach from DF, resume its execution if it's suspended diff --git a/library/DFProcessEnumerator.h b/library/DFProcessEnumerator.h index eeeca9041..bc675e0d9 100644 --- a/library/DFProcessEnumerator.h +++ b/library/DFProcessEnumerator.h @@ -25,6 +25,7 @@ distribution. #ifndef PROCESSMANAGER_H_INCLUDED #define PROCESSMANAGER_H_INCLUDED +#include #include "Export.h" class TiXmlElement; diff --git a/library/DFTileTypes.h b/library/DFTileTypes.h index dd4edefe0..40ff113de 100644 --- a/library/DFTileTypes.h +++ b/library/DFTileTypes.h @@ -25,6 +25,8 @@ distribution. #ifndef TILETYPES_H_INCLUDED #define TILETYPES_H_INCLUDED +#include + namespace DFHack { enum TileClass diff --git a/library/DFTypes.h b/library/DFTypes.h index 50e36d898..7044220cd 100644 --- a/library/DFTypes.h +++ b/library/DFTypes.h @@ -25,6 +25,7 @@ distribution. #ifndef TYPES_H_INCLUDED #define TYPES_H_INCLUDED +#include #include "Export.h" namespace DFHack diff --git a/library/DFVector.h b/library/DFVector.h index d706e6681..580565cde 100644 --- a/library/DFVector.h +++ b/library/DFVector.h @@ -24,6 +24,9 @@ distribution. #ifndef DFVECTOR_H_INCLUDED #define DFVECTOR_H_INCLUDED + +#include + namespace DFHack { class DfVector diff --git a/library/DFWindow.h b/library/DFWindow.h index 1e0664b09..be24b5cd4 100644 --- a/library/DFWindow.h +++ b/library/DFWindow.h @@ -25,6 +25,7 @@ distribution. #ifndef KEYS_H_INCLUDED #define KEYS_H_INCLUDED +#include #include "Export.h" namespace DFHack diff --git a/library/Tranquility.h b/library/Tranquility.h new file mode 100644 index 000000000..bd52f0972 --- /dev/null +++ b/library/Tranquility.h @@ -0,0 +1,14 @@ +#ifndef DFHACK_TRANQUILITY +#define DFHACK_TRANQUILITY + +// This is here to keep MSVC from spamming the build output with nonsense +// Call it public domain. + +#ifdef _MSC_VER + // don't spew nonsense + #pragma warning( disable: 4251 ) + // don't display bogus 'deprecation' and 'unsafe' warnings + #pragma warning( disable: 4996 ) +#endif + +#endif