From 23d6823bc3b877451e40103d2007dee9ddb10cb0 Mon Sep 17 00:00:00 2001 From: jacksonmj Date: Sun, 25 Dec 2011 03:07:24 +0800 Subject: [PATCH 1/3] Fix gravmap memset, and restrict_flt for temperatures --- src/elements/bang.c | 6 +++--- src/elements/ignt.c | 2 +- src/main.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/elements/bang.c b/src/elements/bang.c index 2c5c90408..9a374c2d8 100644 --- a/src/elements/bang.c +++ b/src/elements/bang.c @@ -45,12 +45,12 @@ int update_BANG(UPDATE_FUNC_ARGS) { if(!(rand()%2)) { create_part(i, x, y, PT_FIRE); - parts[i].temp = (MAX_TEMP/4)+otemp; + parts[i].temp = restrict_flt((MAX_TEMP/4)+otemp, MIN_TEMP, MAX_TEMP); } else { create_part(i, x, y, PT_SMKE); - parts[i].temp = (MAX_TEMP/4)+otemp; + parts[i].temp = restrict_flt((MAX_TEMP/4)+otemp, MIN_TEMP, MAX_TEMP); } } else @@ -60,7 +60,7 @@ int update_BANG(UPDATE_FUNC_ARGS) { create_part(i, x, y, PT_BOMB); parts[i].tmp = 1; parts[i].life = 50; - parts[i].temp = (MAX_TEMP/3)+otemp; + parts[i].temp = restrict_flt((MAX_TEMP/3)+otemp, MIN_TEMP, MAX_TEMP); parts[i].vx = rand()%20-10; parts[i].vy = rand()%20-10; } diff --git a/src/elements/ignt.c b/src/elements/ignt.c index c11fccf95..f002e2dbd 100644 --- a/src/elements/ignt.c +++ b/src/elements/ignt.c @@ -31,7 +31,7 @@ int update_IGNT(UPDATE_FUNC_ARGS) { parts[nb].life = 30; parts[nb].vx = rand()%20-10; parts[nb].vy = rand()%20-10; - parts[nb].temp = 400.0f+parts[i].temp-273.15; + parts[nb].temp = restrict_flt(400.0f+parts[i].temp-273.15, MIN_TEMP, MAX_TEMP); } } else diff --git a/src/main.c b/src/main.c index fd4f34e71..74074cec4 100644 --- a/src/main.c +++ b/src/main.c @@ -1865,7 +1865,7 @@ int main(int argc, char *argv[]) gravity_update_async(); //Check for updated velocity maps from gravity thread if (!sys_pause||framerender) //Only update if not paused - memset(gravmap, 0, sizeof(gravmap)); //Clear the old gravmap + memset(gravmap, 0, (XRES/CELL)*(YRES/CELL)*sizeof(float)); //Clear the old gravmap if (framerender) { framerender = 0; From 2553dac942b9b5c3ad6b834d32c9053d3592faaf Mon Sep 17 00:00:00 2001 From: jacksonmj Date: Sun, 25 Dec 2011 07:44:00 +0800 Subject: [PATCH 2/3] Update can_move, recount menu items and clear graphics cache when tpt.el is changed --- includes/luaconsole.h | 7 ++++++- src/interface.c | 9 ++++++++- src/luaconsole.c | 28 +++++++++++++++++++++++++--- 3 files changed, 39 insertions(+), 5 deletions(-) diff --git a/includes/luaconsole.h b/includes/luaconsole.h index fc5e2c436..e55948269 100644 --- a/includes/luaconsole.h +++ b/includes/luaconsole.h @@ -19,6 +19,11 @@ #define LUACON_KDOWN 1 #define LUACON_KUP 2 +//Bitmasks for things that might need recalculating after changes to tpt.el +#define LUACON_EL_MODIFIED_CANMOVE 0x1 +#define LUACON_EL_MODIFIED_GRAPHICS 0x2 +#define LUACON_EL_MODIFIED_MENUS 0x4 + int *lua_el_func, *lua_el_mode; void luacon_open(); @@ -39,7 +44,7 @@ int luacon_transitionread(lua_State* l); int luacon_transitionwrite(lua_State* l); int luacon_particle_getproperty(char * key, int * format); int luacon_transition_getproperty(char * key, int * format); -int luacon_element_getproperty(char * key, int * format); +int luacon_element_getproperty(char * key, int * format, unsigned int * modified_stuff); int process_command_lua(pixel *vid_buf, char *console, char *console_error); int getPartIndex_curIdx; diff --git a/src/interface.c b/src/interface.c index 472fd9b29..f62bd5104 100644 --- a/src/interface.c +++ b/src/interface.c @@ -92,11 +92,18 @@ int drawgrav_enable = 0; void menu_count(void)//puts the number of elements in each section into .itemcount { int i=0; + for (i=0;i Date: Thu, 29 Dec 2011 06:15:55 +0800 Subject: [PATCH 3/3] Fix creation of invalid wall tiles by sign tool --- src/main.c | 3 +-- src/powder.c | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main.c b/src/main.c index 74074cec4..d021e1927 100644 --- a/src/main.c +++ b/src/main.c @@ -3109,8 +3109,7 @@ int main(int argc, char *argv[]) if (!bq) add_sign_ui(vid_buf, x, y); } - - if (c==PT_FIGH) + else if (c==PT_FIGH) { if (!bq) create_part(-1, x, y, PT_FIGH); diff --git a/src/powder.c b/src/powder.c index 4acd33404..ca629cf5f 100644 --- a/src/powder.c +++ b/src/powder.c @@ -2940,7 +2940,7 @@ int create_parts(int x, int y, int rx, int ry, int c, int flags) { if (wall==r) { - if (c == SPC_AIR || c == SPC_HEAT || c == SPC_COOL || c == SPC_VACUUM || c == SPC_PGRV || c == SPC_NGRV) + if (c == SPC_AIR || c == SPC_HEAT || c == SPC_COOL || c == SPC_VACUUM || c == SPC_PGRV || c == SPC_NGRV || wall == WL_SIGN) break; if (wall == WL_ERASE) b = 0;