Why doesn't this code work

  • PizzaPlatypus
    7th Sep 2011 Member 0 Permalink
    @me4502 (View Post)
    this:

    #include

    int update_GBOB(UPDATE_FUNC_ARGS) {
    int r,rx,ry;
    for (rx=-2; rx<3; rx++)<br/> for (ry=-2; ry<3; ry++)<br/> if (x+rx>=0 && y+ry>0 && x+rx {
    r = pmap[y+ry][x+rx];
    if ((r>>8)>=NPART || !r)
    continue;
    if ((r&0xFF)!=PT_GBOB)
    {
    pv[y/CELL][x/CELL]+=5;
    part_change_type(i, x, y, PT_HSLF);
    }
    }
    return 0;
    }
  • jenn4
    7th Sep 2011 Member 0 Permalink
    this pretty same as my problem. It should work.
  • PizzaPlatypus
    7th Sep 2011 Member 0 Permalink
    @jenn4 (View Post)
    Does anybody know why it doesn't??
  • jenn4
    7th Sep 2011 Member 0 Permalink
    I don't know, but im finding out. Maybe transistion should be first function. But try to change int values to something else, it helped once.
  • PizzaPlatypus
    7th Sep 2011 Member 0 Permalink
    bump please help me!
  • jenn4
    7th Sep 2011 Member 0 Permalink
    did you tried what I said

    jenn4:

    Maybe transistion should be first
    function, try to change int
    values to something else, it
    helped once.
  • PizzaPlatypus
    7th Sep 2011 Member 0 Permalink
    @jenn4 (View Post)
    what does that mean!
  • jenn4
    7th Sep 2011 Member 0 Permalink
    try to changing int: x, rx, ry to something else. And maybe change {
    pv[y/CELL][x/CELL]+=5;
    part_change_type(i, x, y,
    PT_HSLF);
    } to first function.
  • PizzaPlatypus
    7th Sep 2011 Member 0 Permalink
    @jenn4 (View Post)
    I've now tried that, still only an explosion with no HSLF. Also whilst we have a thread about code not working here's another thing:
    else if (rt==PT_SPCR) {
    if (parts[i].life>=3&&parts[r>>8].life==0)
    {
    flood_parts(x+rx,y+ry,PT_SPRK,PT_SPCR,-1);//spark the wire
    }
    }

    This is in SPRK.c just after the code for INST
    I also put this in the list of conditions for conduction:
    if (ct==PT_SPCR && !parts[i].temp<=73.15f)<br/> conduct_sprk = 0;

    What I want it to do is act like INST but only when extremely cold it does this but only works once, after that no matter what the heat it doesn't work again.
    The code that was the reason for originally making this thread now works.
  • firefly431
    7th Sep 2011 Member 0 Permalink
    Oh I know: create a whole bunch of it, kill_part(i). That should work.