From d33e9a9770f5a14dcc213e82182cedb7fc94c0a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Sat, 3 Mar 2012 23:18:12 +0100 Subject: [PATCH] Sort layer materials in prospector by depth. --- library/Core.cpp | 1 + library/include/modules/Gui.h | 23 ++------------------- plugins/prospector.cpp | 38 +++++++++++++++++++++++------------ 3 files changed, 28 insertions(+), 34 deletions(-) diff --git a/library/Core.cpp b/library/Core.cpp index af44a79ff..4f75eed90 100644 --- a/library/Core.cpp +++ b/library/Core.cpp @@ -47,6 +47,7 @@ using namespace std; #include "modules/Gui.h" #include "modules/World.h" #include "modules/Graphic.h" +//#include "modules/Windows.h" using namespace DFHack; #include "SDL_events.h" diff --git a/library/include/modules/Gui.h b/library/include/modules/Gui.h index 70231ba00..59d1e789e 100644 --- a/library/include/modules/Gui.h +++ b/library/include/modules/Gui.h @@ -23,9 +23,6 @@ distribution. */ #pragma once -#ifndef CL_MOD_GUI -#define CL_MOD_GUI - #include "Export.h" #include "Module.h" #include "Virtual.h" @@ -95,18 +92,6 @@ namespace DFHack DFHACK_EXPORT void showAnnouncement(std::string message, int color = 7, bool bright = true); DFHACK_EXPORT void showPopupAnnouncement(std::string message, int color = 7, bool bright = true); - /** - * One tile of the screen. - * \ingroup grp_gui - */ - struct t_screen - { - uint8_t symbol; - uint8_t foreground; - uint8_t background; - uint8_t bright; - }; - /* * Cursor and window coords */ @@ -126,12 +111,10 @@ namespace DFHack /// Get the current top-level view-screen DFHACK_EXPORT df::viewscreen * GetCurrentScreen(); - /* - * Window size in tiles - */ + /// get the size of the window buffer DFHACK_EXPORT bool getWindowSize(int32_t & width, int32_t & height); - /* + /** *Menu width: *3:3 - menu and area map closed *2:3 - menu open single width @@ -144,5 +127,3 @@ namespace DFHack DFHACK_EXPORT bool setMenuWidth(const uint8_t menu_width, const uint8_t area_map_width); } } -#endif - diff --git a/plugins/prospector.cpp b/plugins/prospector.cpp index a52ef756c..91f0c446a 100644 --- a/plugins/prospector.cpp +++ b/plugins/prospector.cpp @@ -76,6 +76,18 @@ bool operator>(const matdata & q1, const matdata & q2) return q1.count > q2.count; } +template +struct shallower : public binary_function<_Tp, _Tp, bool> +{ + bool operator()(const _Tp& top, const _Tp& bottom) const + { + float topavg = (top.lower_z + top.upper_z)/2.0f; + float btmavg = (bottom.lower_z + bottom.upper_z)/2.0f; + return topavg > btmavg; + } +}; + + typedef std::map MatMap; typedef std::vector< pair > MatSorter; @@ -90,10 +102,10 @@ template