Mensaje    Asunto: una tonteria...iluminar celdas de alrededor de una celda... Responder citando

Hola Amigos

a ver que mente brillante sabe porque falla esto.....la cuestion que que quiero iluminar las celdas hexagonales de alrededor de una celda en concreto....a veces sale bien pero otras 2 de las celdas laterales salen como desplazadas mas alla

Código:
void Check_MOVEMENT_TO_FREE_CELLS(int x, int y)
{


  TPoint pos = PosPt(x, y);



  if(celda[x][y-2].icon == 0)
  {    pos = PosPt(x, y-2);
/* --> */   celda[x][y-2].rect = TRect(pos.x, pos.y, pos.x + Form1->hexbitmap1->Width, pos.y + Form1->hexbitmap1->Height);
   Form1->TABLERO->Canvas->Draw(pos.x, pos.y, Form1->hex_bluecell3->Picture->Graphic);
  }

  pos = PosPt(x, y);
   if(celda[x][y+2].icon == 0)
  {
   pos = PosPt(x, y+2);
/* --> */   celda[x][y+2].rect = TRect(pos.x, pos.y, pos.x + Form1->hexbitmap1->Width, pos.y + Form1->hexbitmap1->Height);
   Form1->TABLERO->Canvas->Draw(pos.x, pos.y, Form1->hex_bluecell3->Picture->Graphic);
  }

 pos = PosPt(x, y);
   if(celda[x+1][y-1].icon == 0)
  {
  pos = PosPt(x+1, y-1);

/* --> */   celda[x+1][y-1].rect = TRect(pos.x, pos.y, pos.x + Form1->hexbitmap1->Width, pos.y + Form1->hexbitmap1->Height);
   Form1->TABLERO->Canvas->Draw(pos.x, pos.y, Form1->hex_bluecell3->Picture->Graphic);
  }

  pos = PosPt(x, y);
   if(celda[x+1][y+1].icon == 0)
  {
  pos = PosPt(x+1, y+1);

/* --> */   celda[x+1][y+1].rect = TRect(pos.x, pos.y, pos.x + Form1->hexbitmap1->Width, pos.y + Form1->hexbitmap1->Height);
   Form1->TABLERO->Canvas->Draw(pos.x, pos.y, Form1->hex_bluecell3->Picture->Graphic);
  }

 pos = PosPt(x, y);
   if(celda[x][y+1].icon == 0)
  {
  pos = PosPt(x, y+1);

/* --> */   celda[x][y+1].rect = TRect(pos.x, pos.y, pos.x + Form1->hexbitmap1->Width, pos.y + Form1->hexbitmap1->Height);
   Form1->TABLERO->Canvas->Draw(pos.x, pos.y, Form1->hex_bluecell3->Picture->Graphic);
  }

   pos = PosPt(x, y);
   if(celda[x][y-1].icon == 0)
  {
  pos = PosPt(x, y-1);

/* --> */   celda[x][y-1].rect = TRect(pos.x, pos.y, pos.x + Form1->hexbitmap1->Width, pos.y + Form1->hexbitmap1->Height);
   Form1->TABLERO->Canvas->Draw(pos.x, pos.y, Form1->hex_bluecell3->Picture->Graphic);
  }
}
//---------------------------------------------------------------------------