Why doesn't this code work

  • PizzaPlatypus
    11th Mar 2011 Member 0 Permalink
    Sorry, CBA using pastebin here it is:
    else if(t==PT_PLUT)
    {
    for(nx=-1; nx<1; nx++)<br /> for(ny=-1; ny<1; ny++)<br /> if(x+nx>=0 && y+ny>0 &&
    x+nx {
    r = pmap[y+ny][x+nx];
    if((r>>8)>=NPART || !r)
    continue;
    if((r&0xFF)!=PT_GRAS)
    {
    if ((r&0xFF)==PT_PRTN)
    {
    parts[i].type=PT_URAN;
    }
    }
    }
    }
    The Plut doesn't turn to uranium with prtn
    Also, the same problem with this:
    else if(t==PT_DEUT)
    {
    for(nx=-1; nx<1; nx++)<br /> for(ny=-1; ny<1; ny++)<br /> if(x+nx>=0 && y+ny>0 &&
    x+nx {
    r = pmap[y+ny][x+nx];
    if((r>>8)>=NPART || !r)
    continue;
    if((r&0xFF)!=PT_GRAS)
    {
    if ((r&0xFF)==PT_PRTN)
    {
    parts[i].type=PT_WATR;
    }
    }
    }
    }
  • ClaymoreTF2
    11th Mar 2011 Member 0 Permalink
    @PizzaPlatypus
    You code is right so it could work why doesn't?
  • PizzaPlatypus
    11th Mar 2011 Member 0 Permalink
    @marek11
    That's what I want to know! Also other reactions with the same code (protn turns something into something else) work
  • ClaymoreTF2
    11th Mar 2011 Member 0 Permalink
    I think you lose one semi-colons of that.
  • PizzaPlatypus
    11th Mar 2011 Member 0 Permalink
    But I copied and edited this code for the working ones
  • ClaymoreTF2
    11th Mar 2011 Member 0 Permalink
    @PizzaPlatypus
    Hmm I have Mod so i don't taht good at coding it should work. Sorry i can't help you.
  • PizzaPlatypus
    11th Mar 2011 Member 0 Permalink
    @marek11
    Thanks for trying
  • Pilihp64
    11th Mar 2011 Developer 0 Permalink
    could be other reasons than in the code you showed, there is technically nothing wrong with it, although the for loops checking around the particle would not work as intended.
    the other possibility is that your element numbering is messed up, so spawning what you think is PRTN is not actually PT_PRTN
  • pegosh2
    11th Mar 2011 Member 0 Permalink
    @PizzaPlatypus
    Is that C++?
  • PizzaPlatypus
    11th Mar 2011 Member 0 Permalink
    @pegosh2
    yes
    @cracker64
    I've checked the numbering and it's all right