mirror of
https://github.com/minetest/minetest.git
synced 2024-12-22 06:02:23 +01:00
Use irr_ptr for Game::gui_chat_console
This commit is contained in:
parent
37b374cb92
commit
17c041a65c
@ -890,7 +890,7 @@ private:
|
||||
QuicktuneShortcutter *quicktune = nullptr;
|
||||
|
||||
std::unique_ptr<GameUI> m_game_ui;
|
||||
GUIChatConsole *gui_chat_console = nullptr; // Free using ->Drop()
|
||||
irr_ptr<GUIChatConsole> gui_chat_console;
|
||||
MapDrawControl *draw_control = nullptr;
|
||||
Camera *camera = nullptr;
|
||||
irr_ptr<Clouds> clouds;
|
||||
@ -1265,8 +1265,7 @@ void Game::shutdown()
|
||||
|
||||
clouds.reset();
|
||||
|
||||
if (gui_chat_console)
|
||||
gui_chat_console->drop();
|
||||
gui_chat_console.reset();
|
||||
|
||||
if (sky)
|
||||
sky->drop();
|
||||
@ -1581,7 +1580,7 @@ bool Game::initGui()
|
||||
chat_backend->applySettings();
|
||||
|
||||
// Chat backend and console
|
||||
gui_chat_console = new GUIChatConsole(guienv, guienv->getRootGUIElement(),
|
||||
gui_chat_console = make_irr<GUIChatConsole>(guienv, guienv->getRootGUIElement(),
|
||||
-1, chat_backend, client, &g_menumgr);
|
||||
|
||||
if (g_settings->getBool("touch_controls")) {
|
||||
@ -2037,7 +2036,7 @@ void Game::updateStats(RunStats *stats, const FpsControl &draw_times,
|
||||
void Game::processUserInput(f32 dtime)
|
||||
{
|
||||
// Reset input if window not active or some menu is active
|
||||
if (!device->isWindowActive() || isMenuActive() || guienv->hasFocus(gui_chat_console)) {
|
||||
if (!device->isWindowActive() || isMenuActive() || guienv->hasFocus(gui_chat_console.get())) {
|
||||
if (m_game_focused) {
|
||||
m_game_focused = false;
|
||||
infostream << "Game lost focus" << std::endl;
|
||||
@ -2060,7 +2059,7 @@ void Game::processUserInput(f32 dtime)
|
||||
m_game_focused = true;
|
||||
}
|
||||
|
||||
if (!guienv->hasFocus(gui_chat_console) && gui_chat_console->isOpen()) {
|
||||
if (!guienv->hasFocus(gui_chat_console.get()) && gui_chat_console->isOpen()) {
|
||||
gui_chat_console->closeConsoleAtOnce();
|
||||
}
|
||||
|
||||
@ -4217,7 +4216,8 @@ void Game::updateFrame(ProfilerGraph *graph, RunStats *stats, f32 dtime,
|
||||
updateShadows();
|
||||
}
|
||||
|
||||
m_game_ui->update(*stats, client, draw_control, cam, runData.pointed_old, gui_chat_console, dtime);
|
||||
m_game_ui->update(*stats, client, draw_control, cam, runData.pointed_old,
|
||||
gui_chat_console.get(), dtime);
|
||||
|
||||
/*
|
||||
make sure menu is on top
|
||||
|
Loading…
Reference in New Issue
Block a user