diff options
| author | Simon Robertshaw <simon@hardwired.org.uk> | 2011-12-30 02:06:53 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2011-12-30 02:06:53 (GMT) |
| commit | 5b21f4a66c77dbeaceb54b7a3ce3cde5efd7af3f (patch) | |
| tree | 3000d7b1d85f6a031181454377f2c0920d319868 /src/luaconsole.c | |
| parent | 86369670aaa11b8cd2ddcbd46413fb9482e4e58f (diff) | |
| parent | f04577598b48c9e294b102395afc94023df8c92c (diff) | |
| download | powder-5b21f4a66c77dbeaceb54b7a3ce3cde5efd7af3f.zip powder-5b21f4a66c77dbeaceb54b7a3ce3cde5efd7af3f.tar.gz | |
Merge branch 'master' of github.com:FacialTurd/The-Powder-Toy
Diffstat (limited to 'src/luaconsole.c')
| -rw-r--r-- | src/luaconsole.c | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/src/luaconsole.c b/src/luaconsole.c index e7632dd..65bda4d 100644 --- a/src/luaconsole.c +++ b/src/luaconsole.c @@ -431,7 +431,7 @@ int luacon_transitionwrite(lua_State* l){ } return 0; } -int luacon_element_getproperty(char * key, int * format) +int luacon_element_getproperty(char * key, int * format, unsigned int * modified_stuff) { int offset; if (strcmp(key, "name")==0){ @@ -441,10 +441,14 @@ int luacon_element_getproperty(char * key, int * format) else if (strcmp(key, "color")==0){ offset = offsetof(part_type, pcolors); *format = 0; + if (modified_stuff) + *modified_stuff |= LUACON_EL_MODIFIED_GRAPHICS; } else if (strcmp(key, "colour")==0){ offset = offsetof(part_type, pcolors); *format = 0; + if (modified_stuff) + *modified_stuff |= LUACON_EL_MODIFIED_GRAPHICS; } else if (strcmp(key, "advection")==0){ offset = offsetof(part_type, advection); @@ -501,6 +505,8 @@ int luacon_element_getproperty(char * key, int * format) else if (strcmp(key, "menu")==0){ offset = offsetof(part_type, menu); *format = 0; + if (modified_stuff) + *modified_stuff |= LUACON_EL_MODIFIED_MENUS; } else if (strcmp(key, "enabled")==0){ offset = offsetof(part_type, enabled); @@ -509,10 +515,14 @@ int luacon_element_getproperty(char * key, int * format) else if (strcmp(key, "weight")==0){ offset = offsetof(part_type, weight); *format = 0; + if (modified_stuff) + *modified_stuff |= LUACON_EL_MODIFIED_CANMOVE; } else if (strcmp(key, "menusection")==0){ offset = offsetof(part_type, menusection); *format = 0; + if (modified_stuff) + *modified_stuff |= LUACON_EL_MODIFIED_MENUS; } else if (strcmp(key, "heat")==0){ offset = offsetof(part_type, heat); @@ -529,6 +539,8 @@ int luacon_element_getproperty(char * key, int * format) else if (strcmp(key, "properties")==0){ offset = offsetof(part_type, properties); *format = 0; + if (modified_stuff) + *modified_stuff |= LUACON_EL_MODIFIED_GRAPHICS | LUACON_EL_MODIFIED_CANMOVE; } else if (strcmp(key, "description")==0){ offset = offsetof(part_type, descs); @@ -546,7 +558,7 @@ int luacon_elementread(lua_State* l){ float tempfloat; int i; char * key = mystrdup(luaL_optstring(l, 2, "")); - offset = luacon_element_getproperty(key, &format); + offset = luacon_element_getproperty(key, &format, NULL); free(key); //Get Raw Index value for element @@ -588,8 +600,9 @@ int luacon_elementwrite(lua_State* l){ int tempinteger; float tempfloat; int i; + unsigned int modified_stuff = 0; char * key = mystrdup(luaL_optstring(l, 2, "")); - offset = luacon_element_getproperty(key, &format); + offset = luacon_element_getproperty(key, &format, &modified_stuff); //Get Raw Index value for element lua_pushstring(l, "id"); @@ -640,6 +653,15 @@ int luacon_elementwrite(lua_State* l){ *((unsigned char*)(((void*)&ptypes[i])+offset)) = luaL_optinteger(l, 3, 0); break; } + if (modified_stuff) + { + if (modified_stuff & LUACON_EL_MODIFIED_MENUS) + menu_count(); + if (modified_stuff & LUACON_EL_MODIFIED_CANMOVE) + init_can_move(); + if (modified_stuff & LUACON_EL_MODIFIED_GRAPHICS) + memset(graphicscache, 0, sizeof(gcache_item)*PT_NUM); + } free(key); return 0; } |
