diff options
| author | jacksonmj <mj-pt@jacksonmj.co.uk> | 2011-12-13 09:16:17 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2011-12-18 14:04:48 (GMT) |
| commit | 33271ce3e29a0cea246e32e823388db7a8f39abc (patch) | |
| tree | e1f98b88831e8ad0f103f6ae74b2bb8d36df89d3 /src | |
| parent | 46068833d130eecc95942613cd8cc9c4cb6188fe (diff) | |
| download | powder-33271ce3e29a0cea246e32e823388db7a8f39abc.zip powder-33271ce3e29a0cea246e32e823388db7a8f39abc.tar.gz | |
Fix creating particles in autorun.lua
Diffstat (limited to 'src')
| -rw-r--r-- | src/main.c | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -545,7 +545,6 @@ int parse_save(void *save, int size, int replace, int x0, int y0, unsigned char int nf=0, new_format = 0, ttv = 0; particle *parts = partsptr; int *fp = malloc(NPART*sizeof(int)); - parts_lastActiveIndex = NPART-1; //New file header uses PSv, replacing fuC. This is to detect if the client uses a new save format for temperatures //This creates a problem for old clients, that display and "corrupt" error instead of a "newer version" error @@ -630,6 +629,7 @@ int parse_save(void *save, int size, int replace, int x0, int y0, unsigned char } clear_sim(); } + parts_lastActiveIndex = NPART-1; m = calloc(XRES*YRES, sizeof(int)); // make a catalog of free parts @@ -1124,13 +1124,16 @@ corrupt: void clear_sim(void) { - int x, y; + int i, x, y; memset(bmap, 0, sizeof(bmap)); memset(emap, 0, sizeof(emap)); memset(signs, 0, sizeof(signs)); memset(parts, 0, sizeof(particle)*NPART); - pfree = -1; - parts_lastActiveIndex = NPART-1; + for (i=0; i<NPART-1; i++) + parts[i].life = i+1; + parts[NPART-1].life = -1; + pfree = 0; + parts_lastActiveIndex = 0; memset(pmap, 0, sizeof(pmap)); memset(pv, 0, sizeof(pv)); memset(vx, 0, sizeof(vx)); |
