1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-08-11 17:51:04 +00:00

Game refactor [2/X]: Various moves (profilergraph, nodePlacementPrediction, create_formspec_menu)

* Move profilergraph to dedicated files
* Move nodePlacementPrediction to Game class
* Rename create_formspec_menu to GUIFormSpecMenu::create
This commit is contained in:
Loic Blot 2018-01-13 10:34:56 +01:00 committed by Loïc Blot
parent 362323cdc2
commit 64fe79b53b
6 changed files with 418 additions and 363 deletions

View file

@ -57,6 +57,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#if USE_FREETYPE && IRRLICHT_VERSION_MAJOR == 1 && IRRLICHT_VERSION_MINOR < 9
#include "intlGUIEditBox.h"
#include "mainmenumanager.h"
#endif
#define MY_CHECKPOS(a,b) \
@ -129,6 +131,28 @@ GUIFormSpecMenu::~GUIFormSpecMenu()
delete m_text_dst;
}
void GUIFormSpecMenu::create(GUIFormSpecMenu **cur_formspec, Client *client,
JoystickController *joystick, IFormSource *fs_src, TextDest *txt_dest)
{
if (*cur_formspec == 0) {
*cur_formspec = new GUIFormSpecMenu(joystick, guiroot, -1, &g_menumgr,
client, client->getTextureSource(), fs_src, txt_dest);
(*cur_formspec)->doPause = false;
/*
Caution: do not call (*cur_formspec)->drop() here --
the reference might outlive the menu, so we will
periodically check if *cur_formspec is the only
remaining reference (i.e. the menu was removed)
and delete it in that case.
*/
} else {
(*cur_formspec)->setFormSource(fs_src);
(*cur_formspec)->setTextDest(txt_dest);
}
}
void GUIFormSpecMenu::removeChildren()
{
const core::list<gui::IGUIElement*> &children = getChildren();