Skip to content

Commit 9fe9295

Browse files
committed
lint. fix build
1 parent 1a48796 commit 9fe9295

4 files changed

Lines changed: 13 additions & 12 deletions

File tree

library/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,8 @@ target_include_directories(dfhack-run PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/includ
398398
add_executable(binpatch binpatch.cpp)
399399
target_link_libraries(binpatch dfhack-md5)
400400

401+
target_include_directories(dfhack-test PRIVATE ${SDL2_INCLUDE_DIRS})
402+
401403
if(WIN32)
402404
set_target_properties(dfhack PROPERTIES OUTPUT_NAME "dfhooks_dfhack" )
403405
set_target_properties(dfhack PROPERTIES COMPILE_FLAGS "/FI\"Export.h\"" )

library/Console-sdl.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -224,10 +224,8 @@ SDLConsoleDriver::SDLConsoleDriver() : Console(this)
224224
SDLConsoleDriver::~SDLConsoleDriver()
225225
{
226226
assert(!inited);
227-
if(wlock)
228-
delete wlock;
229-
if(d)
230-
delete d;
227+
delete wlock;
228+
delete d;
231229
}
232230

233231
/**

library/SDLConsole_impl.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -966,7 +966,7 @@ class Property {
966966
return default_value;
967967
}
968968

969-
if (std::holds_alternative<T>(it->second) == false) {
969+
if (!std::holds_alternative<T>(it->second)) {
970970
return default_value; // TODO: log error
971971
}
972972
return std::get<T>(it->second);
@@ -1208,7 +1208,7 @@ class Font : public SignalEmitter {
12081208

12091209
void render(const std::u32string_view& text, int x, int y)
12101210
{
1211-
for (auto& ch : text) {
1211+
for (const auto& ch : text) {
12121212
char32_t index;
12131213
if (ch <= 127)
12141214
index = ch;
@@ -3174,7 +3174,7 @@ int set_draw_color(SDL_Renderer* renderer, const SDL_Color& color)
31743174
struct SDLConsole_pshare {
31753175
Property props;
31763176
std::weak_ptr<SDLConsole_impl> impl_weak;
3177-
std::thread::id render_thread_id{};
3177+
std::thread::id render_thread_id;
31783178
};
31793179

31803180
class SDLConsole_impl : public std::enable_shared_from_this<SDLConsole_impl> {
@@ -3216,7 +3216,7 @@ class SDLConsole_impl : public std::enable_shared_from_this<SDLConsole_impl> {
32163216
#endif
32173217

32183218
OutputPane& outpane() {
3219-
return *main_window.outpane.get();
3219+
return *main_window.outpane;
32203220
}
32213221

32223222
bool sdl_event_hook(SDL_Event& e)
@@ -3287,7 +3287,7 @@ class SDLConsole_impl : public std::enable_shared_from_this<SDLConsole_impl> {
32873287
}
32883288
};
32893289

3290-
SDLConsole::SDLConsole() : state()
3290+
SDLConsole::SDLConsole()
32913291
{
32923292
pshare = std::make_unique<SDLConsole_pshare>();
32933293
state.set_state(State::inactive);
@@ -3305,7 +3305,7 @@ bool SDLConsole::init()
33053305
if (state.is_failed()) return false;
33063306
if (!state.is_inactive()) return true;
33073307
bool success = true;
3308-
//std::cerr << "SDLConsole: init() from thread: " << std::this_thread::get_id() << std::endl;
3308+
std::cerr << "SDLConsole: init() from thread: " << std::this_thread::get_id() << std::endl;
33093309
pshare->render_thread_id = std::this_thread::get_id();
33103310
try {
33113311
bind_sdl_symbols();

library/include/SDLConsoleDriver.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,7 @@ namespace DFHack
6565
void gotoxy(int x, int y) override;
6666
/// Enable or disable the caret/cursor
6767
void cursor(bool enable = true) override;
68-
/// Waits given number of milliseconds before continuing.
69-
void msleep(unsigned int msec) override;
68+
7069
/// get the current number of columns
7170
int get_columns(void) override;
7271
/// get the current number of rows
@@ -80,6 +79,8 @@ namespace DFHack
8079
bool sdl_event_hook(SDL_Event& event);
8180
bool init_sdl();
8281
void cleanup() override;
82+
83+
static constexpr ConsoleType type_tag = ConsoleType::SDL;
8384
private:
8485
Private * d;
8586
std::recursive_mutex * wlock;

0 commit comments

Comments
 (0)