Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 3 additions & 15 deletions library/ColorText.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,24 +35,12 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/


#include <stdarg.h>
#include <errno.h>
#include <stdio.h>
#include <iostream>
#include <fstream>
#include <istream>
#include <string>
#include <ostream>
#include <algorithm>

#include "ColorText.h"
#include "MiscUtils.h"

#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <sstream>

using namespace std;
using namespace DFHack;

bool color_ostream::log_errors_to_stderr = false;
Expand Down Expand Up @@ -81,7 +69,7 @@ void color_ostream::end_batch()
flush_proxy();
}

color_ostream::color_ostream() : ostream(new buffer(this)), cur_color(COLOR_RESET)
color_ostream::color_ostream() : std::ostream(new buffer(this)), cur_color(COLOR_RESET)
{
//
}
Expand Down
83 changes: 53 additions & 30 deletions library/Core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,40 +26,43 @@ distribution.

#include "Internal.h"

#include "Error.h"
#include "MemAccess.h"
#include "ColorText.h"
#include "Commands.h"
#include "Console.h"
#include "CoreDefs.h"
#include "DataDefs.h"
#include "Debug.h"
#include "Console.h"
#include "DFHackVersion.h"
#include "Error.h"
#include "Format.h"
#include "LuaTools.h"
#include "MemAccess.h"
#include "MemoryPatcher.h"
#include "MiscUtils.h"
#include "MiscUtils.h"
#include "Module.h"
#include "VersionInfoFactory.h"
#include "VersionInfo.h"
#include "PluginManager.h"
#include "ModuleFactory.h"
#include "PluginManager.h"
#include "RemoteServer.h"
#include "RemoteTools.h"
#include "LuaTools.h"
#include "DFHackVersion.h"
#include "md5wrapper.h"
#include "Format.h"

#include "Commands.h"
#include "VersionInfo.h"
#include "VersionInfoFactory.h"

#include "modules/DFSDL.h"
#include "modules/DFSteam.h"
#include "modules/EventManager.h"
#include "modules/Filesystem.h"
#include "modules/Graphic.h"
#include "modules/Gui.h"
#include "modules/Hotkey.h"
#include "modules/Persistence.h"
#include "modules/Textures.h"
#include "modules/World.h"
#include "modules/Persistence.h"

#include "df/init.h"
#include "df/gamest.h"
#include "df/global_objects.h"
#include "df/graphic.h"
#include "df/init.h"
#include "df/interfacest.h"
#include "df/plotinfost.h"
#include "df/viewscreen_dwarfmodest.h"
Expand All @@ -68,35 +71,54 @@ distribution.
#include "df/viewscreen_loadgamest.h"
#include "df/viewscreen_new_regionst.h"
#include "df/viewscreen_savegamest.h"
#include "df/world.h"
#include "df/world_data.h"
#include "df/world.h"

#include <stdio.h>
#include <iomanip>
#include <stdlib.h>
#include <algorithm>
#include <cassert>
#include <condition_variable>
#include <cstdarg>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <filesystem>
#include <forward_list>
#include <fstream>
#include <thread>
#include <iomanip>
#include <iostream>
#include <istream>
#include <map>
#include <memory>
#include <mutex>
#include <condition_variable>
#include <string>
#include <vector>
#include <ostream>
#include <ranges>
#include <span>
#include <map>
#include <set>
#include <cstdio>
#include <cstring>
#include <span>
#include <sstream>
#include <forward_list>
#include <string_view>
#include <string>
#include <system_error>
#include <thread>
#include <type_traits>
#include <cstdarg>
#include <filesystem>
#include <utility>
#include <vector>

#include "md5wrapper.h"

#include <fmt/base.h>

#include <SDL_events.h>
#include <SDL_keycode.h>
#include <SDL_video.h>

#include <lua.h>

#ifdef _WIN32
#ifdef WIN32
#define NOMINMAX
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
#include <processthreadsapi.h>
#endif

#ifdef LINUX_BUILD
Expand All @@ -105,6 +127,7 @@ distribution.

using namespace DFHack;
using namespace df::enums;

using df::global::init;
using df::global::world;
using std::string;
Expand Down
15 changes: 11 additions & 4 deletions library/DataIdentity.cpp
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
#include <stddef.h>
#include "DataIdentity.h"

#include "BitArray.h"
#include "DataDefs.h"

#include <condition_variable>
#include <cstdint>
#include <filesystem>
#include <fstream>
#include <functional>
#include <future>
#include <memory>
#include <mutex>
#include <optional>
#include <string>
#include <vector>
#include <variant>
#include <vector>

#include "DataFuncs.h"
#include "DataIdentity.h"

// the space after the uses of "type" in OPAQUE_IDENTITY_TRAITS_NAME is _required_
// without it the macro generates a syntax error when type is a template specification
Expand Down
64 changes: 37 additions & 27 deletions library/MiscUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,39 +22,49 @@ must not be misrepresented as being the original software.
distribution.
*/

#include "Internal.h"
#include "Export.h"
#include "MiscUtils.h"
#include "ColorText.h"

#include "modules/DFSDL.h"
#include <array>
#include <algorithm>
#include <cctype>
#include <cstdarg>
#include <cstdlib>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstring>
#include <exception>
#include <iomanip>
#include <ios>
#include <iostream>
#include <locale>
#include <map>
#include <ostream>
#include <sstream>
#include <string>
#include <utility>
#include <vector>

#ifndef LINUX_BUILD
// We don't want min and max macros
#ifdef WIN32
// Suppress warning which occurs in header on some WinSDK versions
// See dfhack/dfhack#5147 for more information
#define NOMINMAX
#include <Windows.h>
// Suppress warning which occurs in header on some WinSDK versions
// See dfhack/dfhack#5147 for more information
#pragma warning(push)
#pragma warning(disable:4091)
#include <DbgHelp.h>
#pragma warning(pop)
#else
#include <sys/time.h>
#include <ctime>
#include <cxxabi.h>
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
#include <sysinfoapi.h>
#pragma warning(push)
#pragma warning(disable:4091)
#include <DbgHelp.h>
#pragma warning(pop)
#endif

#include <ctype.h>
#include <stdarg.h>
#include <string.h>
#include <cstdlib>
#include <cmath>

#include <sstream>
#include <map>
#include <array>
#include <unordered_map>
#ifdef LINUX_BUILD
#include <sys/time.h>
#include <ctime>
#include <cxxabi.h>
#endif

NumberFormatType preferred_number_format_type = NumberFormatType::DEFAULT;

Expand Down Expand Up @@ -499,8 +509,8 @@ uint64_t GetTimeMs64()
/* Character decoding */

// See http://bjoern.hoehrmann.de/utf-8/decoder/dfa/ for details.
#define UTF8_ACCEPT 0
#define UTF8_REJECT 12
constexpr auto UTF8_ACCEPT = 0;
constexpr auto UTF8_REJECT = 12;

static const uint8_t utf8d[] = {
// The first part of the table maps bytes to character classes that
Expand Down
9 changes: 1 addition & 8 deletions library/PlugLoad.cpp
Original file line number Diff line number Diff line change
@@ -1,19 +1,12 @@
#include "Core.h"
#include "Debug.h"
#include "Export.h"
#include "PluginManager.h"
#include "Hooks.h"

#include <iostream>
#include <map>
#include <string>
#include <vector>

#include <stdio.h>
#include <stdint.h>

#ifdef WIN32
#define NOMINMAX
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <libloaderapi.h>
#define global_search_handle() GetModuleHandle(nullptr)
Expand Down
50 changes: 31 additions & 19 deletions library/PluginManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,36 +22,48 @@ must not be misrepresented as being the original software.
distribution.
*/

#include "modules/EventManager.h"
#include "modules/Filesystem.h"
#include "modules/Screen.h"
#include "modules/World.h"
#include "Internal.h"
#include "PluginManager.h"

#include "ColorText.h"
#include "Core.h"
#include "CoreDefs.h"
#include "LuaWrapper.h"
#include "LuaTools.h"
#include "MemAccess.h"
#include "PluginManager.h"
#include "MiscUtils.h"
#include "RemoteServer.h"
#include "Console.h"
#include "Types.h"
#include "VersionInfo.h"

#include "DataDefs.h"
#include "MiscUtils.h"
#include "DFHackVersion.h"

#include "LuaWrapper.h"
#include "LuaTools.h"

using namespace DFHack;
#include "modules/EventManager.h"
#include "modules/Filesystem.h"
#include "modules/Screen.h"
#include "modules/World.h"

#include <algorithm>
#include <condition_variable>
#include <cassert>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <filesystem>
#include <iostream>
#include <map>
#include <mutex>
#include <string>
#include <vector>
#include <map>

using std::string;
#include <fmt/base.h>
#include <fmt/format.h>

#include "df/viewscreen.h"

#include <assert.h>
#include <lauxlib.h>
#include <lua.h>

using namespace DFHack;
using std::string;

#if defined(_LINUX)
static const string plugin_suffix = ".plug.so";
Expand Down Expand Up @@ -871,7 +883,7 @@ void PluginManager::init()
loadAll();

bool any_loaded = false;
for (auto p : all_plugins)
for (auto& p : all_plugins)
{
if (p.second->getState() == Plugin::PS_LOADED)
{
Expand Down
Loading
Loading