diff options
| author | Simon Robertshaw <simon@hardwired.org.uk> | 2012-08-02 23:47:39 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2012-08-02 23:47:39 (GMT) |
| commit | b16561926625e92dc3525664e71890d8239ab8c3 (patch) | |
| tree | 7e76652b66ab32adf9bd8213f52c22de31b24c59 /src/cat | |
| parent | 94bb1ad2dfbe4b75b388819d028dd80e74c9a09e (diff) | |
| download | powder-b16561926625e92dc3525664e71890d8239ab8c3.zip powder-b16561926625e92dc3525664e71890d8239ab8c3.tar.gz | |
Update menus on element change from lua, addresses issue #42
Diffstat (limited to 'src/cat')
| -rw-r--r-- | src/cat/LuaScriptInterface.cpp | 8 | ||||
| -rw-r--r-- | src/cat/LuaScriptInterface.h | 2 |
2 files changed, 7 insertions, 3 deletions
diff --git a/src/cat/LuaScriptInterface.cpp b/src/cat/LuaScriptInterface.cpp index 57ed1d9..7b98fa3 100644 --- a/src/cat/LuaScriptInterface.cpp +++ b/src/cat/LuaScriptInterface.cpp @@ -543,6 +543,8 @@ int luacon_element_getproperty(char * key, int * format, unsigned int * modified if (strcmp(key, "name")==0){ offset = offsetof(Element, Name); *format = 2; + if(modified_stuff) + *modified_stuff |= LUACON_EL_MODIFIED_MENUS; } else if (strcmp(key, "color")==0){ offset = offsetof(Element, Colour); @@ -651,6 +653,8 @@ int luacon_element_getproperty(char * key, int * format, unsigned int * modified else if (strcmp(key, "description")==0){ offset = offsetof(Element, Description); *format = 2; + if(modified_stuff) + *modified_stuff |= LUACON_EL_MODIFIED_MENUS; } else { return -1; @@ -761,8 +765,8 @@ int luacon_elementwrite(lua_State* l){ } if (modified_stuff) { - //if (modified_stuff & LUACON_EL_MODIFIED_MENUS) - //luacon_model->notifyMenuListChanged(); + if (modified_stuff & LUACON_EL_MODIFIED_MENUS) + luacon_model->BuildMenus(); if (modified_stuff & LUACON_EL_MODIFIED_CANMOVE) luacon_sim->init_can_move(); if (modified_stuff & LUACON_EL_MODIFIED_GRAPHICS) diff --git a/src/cat/LuaScriptInterface.h b/src/cat/LuaScriptInterface.h index 4015109..3d6f0b9 100644 --- a/src/cat/LuaScriptInterface.h +++ b/src/cat/LuaScriptInterface.h @@ -16,7 +16,7 @@ extern "C" } #include "CommandInterface.h" -#include "simulation/Simulation.h"; +#include "simulation/Simulation.h" //Because lua only has bindings for C, we're going to have to go outside "outside" the LuaScriptInterface, this means we can only have one instance :( |
