My gas is being corrosive?

  • tommig
    24th Nov 2011 Member 0 Permalink
    Hi guys!
    I'm having a problem with my N2O code, it seems to be randomly dissolving everything it touches! D=
    The code I have now is

    #include

    int update_NTRO(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(1>rand()%5000){
    if (1>rand()%3) create_part(i,x,y,PT_O2);
    else
    create_part(i,x,y,PT_NTRG);
    }
    if(pv[y/CELL][x/CELL]>15.0);{
    if ((r&0xFF)==PT_FIRE || (r&0xFF)==PT_PLSM)
    {
    part_change_type(i,x,y,PT_FIRE);
    }
    }

    if ((r&0xFF)==PT_HEXN || (r&0xFF)==PT_HEXV)
    {
    part_change_type(i,x,y,PT_NITR);
    kill_part(r>>8);
    }
    }
    }
    return 0;
    }

    All help appreciated
    Thanks
    Tommig
  • cctvdude99
    24th Nov 2011 Member 0 Permalink
    @tommig (View Post)
    Very strange.
    Try /*code here*/ parts and seeing whether it still happens, then you'll know which part is doing it.
  • tommig
    24th Nov 2011 Member 0 Permalink
    Ok, I was completely wrong, it's not NTRO that's corrosive, it's NTRG.
    The problems seems to originate from this code

    if ((r&0xFF)==PT_O2);
    {
    part_change_type(i,x,y,PT_NTRO);
    kill_part(r>>8);
    }

    I've isolated this code, and the problem stopped. So it's definitely here.
    If feel it's a problem with the if((r&0xFF)==PT_O2); but I'm unsure.

    EDIT:
    Scratch it, there was a semi colon on the end of the line accidentally!
    Problem solved!