NLPACS::CMoveCell Class Reference

#include <move_cell.h>


Detailed Description

Move cell

Author:
Cyril 'Hulud' Corvazier

Nevrax France

Date:
2001

Definition at line 44 of file move_cell.h.

Public Member Functions

 CMoveCell ()
 Constructor.

CMoveElementgetFirstX () const
CMoveElementgetLastX () const
CMoveElementgetRootX ()
void linkFirstX (CMoveElement *element)
 Update sorted lists for an element.

void linkLastX (CMoveElement *element)
 Update sorted lists for an element.

void unlinkX (CMoveElement *element)
void updateSortedLists (CMoveElement *element, uint8 worldImage)
 Update sorted lists for an element.


Private Member Functions

void linkX (CMoveElement *previous, CMoveElement *element, CMoveElement *next)

Private Attributes

CMoveElement_FirstX
CMoveElement_LastX


Constructor & Destructor Documentation

NLPACS::CMoveCell::CMoveCell  ) 
 

Constructor.

Definition at line 37 of file move_cell.cpp.

References _FirstX.

00038 {
00039         _FirstX=NULL;
00040         _LastX=NULL;
00041         /*_FirstY=NULL;
00042         _LastY=NULL;*/
00043 }


Member Function Documentation

CMoveElement* NLPACS::CMoveCell::getFirstX  )  const [inline]
 

Definition at line 85 of file move_cell.h.

References _FirstX.

00086         {
00087                 return _FirstX;
00088         }

CMoveElement* NLPACS::CMoveCell::getLastX  )  const [inline]
 

Definition at line 91 of file move_cell.h.

00092         {
00093                 return _LastX;
00094         }

CMoveElement* NLPACS::CMoveCell::getRootX  )  [inline]
 

Definition at line 97 of file move_cell.h.

References _FirstX.

00098         {
00099                 return _FirstX;
00100         }

void NLPACS::CMoveCell::linkFirstX CMoveElement element  )  [inline]
 

Update sorted lists for an element.

Definition at line 52 of file move_cell.h.

References _FirstX, and linkX().

Referenced by NLPACS::CPrimitiveWorldImage::addMoveElement().

00053         {
00054                 linkX (NULL, element, _FirstX);
00055         }

void NLPACS::CMoveCell::linkLastX CMoveElement element  )  [inline]
 

Update sorted lists for an element.

Definition at line 58 of file move_cell.h.

References linkX().

Referenced by NLPACS::CPrimitiveWorldImage::addMoveElement().

00059         {
00060                 linkX (_LastX, element, NULL);
00061         }

void NLPACS::CMoveCell::linkX CMoveElement previous,
CMoveElement element,
CMoveElement next
[private]
 

Definition at line 82 of file move_cell.cpp.

References _FirstX, NLPACS::CMoveElement::NextX, and NLPACS::CMoveElement::PreviousX.

Referenced by linkFirstX(), linkLastX(), and updateSortedLists().

00083 {
00084         // Link the element
00085         element->NextX=next;
00086         element->PreviousX=previous;
00087 
00088         // Link to others
00089         if (previous)
00090                 previous->NextX=element;
00091         if (next)
00092                 next->PreviousX=element;
00093 
00094         // Check first / last
00095         if (previous==NULL)
00096                 _FirstX=element;
00097         if (next==NULL)
00098                 _LastX=element;
00099 }

void NLPACS::CMoveCell::unlinkX CMoveElement element  ) 
 

Definition at line 47 of file move_cell.cpp.

References _FirstX, NLPACS::CMoveElement::NextX, and NLPACS::CMoveElement::PreviousX.

Referenced by updateSortedLists().

00048 {
00049         // Check first last
00050         if (_FirstX==element)
00051                 _FirstX=element->NextX;
00052         if (_LastX==element)
00053                 _LastX=element->PreviousX;
00054 
00055         // Relink to others
00056         if (element->NextX)
00057                 element->NextX->PreviousX=element->PreviousX;
00058         if (element->PreviousX)
00059                 element->PreviousX->NextX=element->NextX;
00060 }

void NLPACS::CMoveCell::updateSortedLists CMoveElement element,
uint8  worldImage
 

Update sorted lists for an element.

Definition at line 124 of file move_cell.cpp.

References NLPACS::CPrimitiveWorldImage::getBBXMin(), NLPACS::CMovePrimitive::getWorldImage(), linkX(), NLPACS::CMoveElement::NextX, NLPACS::CMoveElement::PreviousX, NLPACS::CMoveElement::Primitive, uint8, and unlinkX().

Referenced by NLPACS::CPrimitiveWorldImage::addMoveElement().

00125 {
00126         // ** Update sorted list on X
00127 
00128         // Primitive pointer
00129         CMovePrimitive *primitive=element->Primitive;
00130 
00131         // Get the world image
00132         CPrimitiveWorldImage *wI=primitive->getWorldImage (worldImage);
00133 
00134         // Test if we will go to the right
00135         CMoveElement *ptr=element->NextX;
00136         if (ptr && (wI->getBBXMin() > ptr->Primitive->getWorldImage (worldImage)->getBBXMin()) )
00137         {
00138                 // Unlink
00139                 unlinkX (element);
00140 
00141                 // Adjust the list localisation
00142                 while (ptr->NextX && (wI->getBBXMin() > ptr->NextX->Primitive->getWorldImage (worldImage)->getBBXMin()) )
00143                 {
00144                         // Next ptr
00145                         ptr=ptr->NextX;
00146                 }
00147 
00148                 // Here we go
00149                 linkX (ptr, element, ptr->NextX);
00150         }
00151         else
00152         {
00153                 // Test if we will go to the left
00154                 ptr=element->PreviousX;
00155                 if (ptr && (ptr->Primitive->getWorldImage (worldImage)->getBBXMin() > wI->getBBXMin()) )
00156                 {
00157                         // Unlink
00158                         unlinkX (element);
00159 
00160                         // Adjust the list localisation
00161                         while (ptr->PreviousX && (ptr->PreviousX->Primitive->getWorldImage (worldImage)->getBBXMin() > wI->getBBXMin()) )
00162                         {
00163                                 // Next ptr
00164                                 ptr=ptr->PreviousX;
00165                         }
00166 
00167                         // Here we go
00168                         linkX (ptr->PreviousX, element, ptr);
00169                 }
00170         }
00171 
00172 /*      // ** Update sorted list on Y
00173 
00174         // Test if we will go to the right
00175         ptr=element->NextY;
00176         if (ptr && (primitive->getBBYMin() > ptr->Primitive->getBBYMin()) )
00177         {
00178                 // Unlink
00179                 unlinkY (element);
00180 
00181                 // Adjust the list localisation
00182                 while (ptr->NextY && (primitive->getBBYMin() > ptr->NextY->Primitive->getBBYMin()) )
00183                 {
00184                         // Next ptr
00185                         ptr=ptr->NextY;
00186                 }
00187 
00188                 // Here we go
00189                 linkY (ptr, element, ptr->NextY);
00190         }
00191         else
00192         {
00193                 // Test if we will go to the left
00194                 ptr=element->PreviousY;
00195                 if (ptr && (ptr->Primitive->getBBYMin() > primitive->getBBYMin()) )
00196                 {
00197                         // Unlink
00198                         unlinkY (element);
00199 
00200                         // Adjust the list localisation
00201                         while (ptr->PreviousY && (ptr->PreviousY->Primitive->getBBYMin() > primitive->getBBYMin()) )
00202                         {
00203                                 // Next ptr
00204                                 ptr=ptr->PreviousY;
00205                         }
00206 
00207                         // Here we go
00208                         linkY (ptr->PreviousY, element, ptr);
00209                 }
00210         }*/
00211 }


Field Documentation

CMoveElement* NLPACS::CMoveCell::_FirstX [private]
 

Definition at line 110 of file move_cell.h.

Referenced by CMoveCell(), getFirstX(), getRootX(), linkFirstX(), linkX(), and unlinkX().

CMoveElement* NLPACS::CMoveCell::_LastX [private]
 

Definition at line 111 of file move_cell.h.


The documentation for this class was generated from the following files:
Generated on Tue Mar 16 14:16:43 2004 for NeL by doxygen 1.3.6