1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Fix formspec replacement handling for in game formspecs

This commit is contained in:
sapier 2014-04-20 02:40:25 +02:00
parent e7ef4f07cb
commit 127f354e7a
4 changed files with 124 additions and 122 deletions

View file

@ -190,7 +190,10 @@ public:
IMenuManager *menumgr,
InventoryManager *invmgr,
IGameDef *gamedef,
ISimpleTextureSource *tsrc
ISimpleTextureSource *tsrc,
IFormSource* fs_src,
TextDest* txt_dst,
GUIFormSpecMenu** ext_ptr
);
~GUIFormSpecMenu();
@ -206,12 +209,18 @@ public:
// form_src is deleted by this GUIFormSpecMenu
void setFormSource(IFormSource *form_src)
{
if (m_form_src != NULL) {
delete m_form_src;
}
m_form_src = form_src;
}
// text_dst is deleted by this GUIFormSpecMenu
void setTextDest(TextDest *text_dst)
{
if (m_text_dst != NULL) {
delete m_text_dst;
}
m_text_dst = text_dst;
}
@ -268,8 +277,6 @@ protected:
std::string m_formspec_string;
InventoryLocation m_current_inventory_location;
IFormSource *m_form_src;
TextDest *m_text_dst;
std::vector<ListDrawSpec> m_inventorylists;
std::vector<ImageDrawSpec> m_backgrounds;
@ -305,6 +312,10 @@ protected:
video::SColor m_slotbg_h;
video::SColor m_slotbordercolor;
private:
IFormSource* m_form_src;
TextDest* m_text_dst;
GUIFormSpecMenu** m_ext_ptr;
typedef struct {
v2s32 size;
s32 helptext_h;
@ -360,16 +371,13 @@ private:
class FormspecFormSource: public IFormSource
{
public:
FormspecFormSource(std::string formspec,FormspecFormSource** game_formspec)
FormspecFormSource(std::string formspec)
{
m_formspec = formspec;
m_game_formspec = game_formspec;
}
~FormspecFormSource()
{
*m_game_formspec = 0;
}
{}
void setForm(std::string formspec) {
m_formspec = formspec;
@ -381,7 +389,6 @@ public:
}
std::string m_formspec;
FormspecFormSource** m_game_formspec;
};
#endif