示例#1
0
CTitleWidget::~CTitleWidget()
{
	DELETE_POINTER(m_titleLabel);
	DELETE_POINTER(m_iconLabel);
	DELETE_POINTER(m_minimumBtn);
	DELETE_POINTER(m_closeBtn);
	qDebug() << "~CTitleWidget()";
}
示例#2
0
CSystemTrayIcon::~CSystemTrayIcon()
{
	qDebug() << "~CSystemTrayIcon()";
	DELETE_POINTER(m_hideShowAct);
	DELETE_POINTER(m_aboutAct);
	DELETE_POINTER(m_exitAct);
	DELETE_POINTER(m_TrayIconMenu);
}
示例#3
0
文件: device.c 项目: suborb/reelvdr
cSatipDevice::~cSatipDevice()
{
  debug("cSatipDevice::%s(%u)", __FUNCTION__, deviceIndexM);
  // Stop section handler
  StopSectionHandler();
  DELETE_POINTER(pSectionFilterHandlerM);
  DELETE_POINTER(pTunerM);
  DELETE_POINTER(tsBufferM);
}
示例#4
0
CSMonitorClient::~CSMonitorClient()
{
	qDebug() << "~CSMonitorClient()";
	DELETE_POINTER(m_trayIcon);
	DELETE_POINTER(m_titleWidget);
	DELETE_POINTER(m_stackedWidget);
	DELETE_POINTER(m_sideBarWidget);
	//DELETE_POINTER(m_mainFrame);
}
示例#5
0
cSatipDevice::~cSatipDevice()
{
  debug1("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM);
  // Stop section handler
  StopSectionHandler();
  DELETE_POINTER(pSectionFilterHandlerM);
  DELETE_POINTER(pTunerM);
  DELETE_POINTER(tsBufferM);
}
void CharacterUpdaterPlayer::goToUsingPath(const CCVector3 &target)
{
    const CCPathFinderNetwork::PathNode *targetNode = pathFinderNetwork->findClosestNode( player, &target, false );
    if( targetNode == NULL )
    {
        DELETE_POINTER( path );
        goTo( target );
        return;
    }

    if( path == NULL )
    {
        findNewAnchor = true;
        path = new CCPathFinderNetwork::Path();
    }
    getClosestNode();

    pathAnchorNode = anchorNode;
    if( pathAnchorNode != NULL )
    {
        pathFinderNetwork->findPath( *path, pathAnchorNode, targetNode );
    }

    if( path->endDirection == 0 )
    {
        // See if we can head straight to our target
        CCObjectCollideable *hitObject = CCMovementOctreeCollisionCheck( player, *player->positionPtr, target );
        if( hitObject == NULL )
        {
            DELETE_POINTER( path );
        }
    }

    // Check if we can head straight to our first path
    else
    {
        const int pathDirection = path->directions[0];
        if( pathAnchorNode != NULL && pathDirection < pathAnchorNode->numberOfConnections )
        {
            const CCPathFinderNetwork::PathNode::PathConnection *usingConnection = &pathAnchorNode->connections[pathDirection];
            const CCVector3 *pathTarget = &usingConnection->node->point;
            CCObjectCollideable *hitObject = CCMovementOctreeCollisionCheck( player, *player->positionPtr, *pathTarget );
            currentPath = hitObject == NULL ? 0 : -1;
        }
        else
        {
            currentPath = 0;
        }
    }

    goTo( target );
}
示例#7
0
TileSocialProfile::TileSocialProfile(CCSceneBase *scene, const float size, const char *userSeed) :
    TileSocial( scene, size, size )
{
    drawOrder = 200;

    fbInfoDownloadedCallback = NULL;
    photosDownloadedCallback = NULL;
    
    rotationSpeed = 180.0f;

    taggedPhotosRefreshing = false;
    
    // Set a default profile photo
    CCModelBase *f7u12Model = new CCModelBase();
    model->addModel( f7u12Model );
    f7u12Photo = new CCPrimitiveSquare();
    f7u12Photo->setupZFacing( collisionBounds.x - borderWidth, collisionBounds.y - borderWidth );
    f7u12Photo->setTexture( GetDefaultProfilePhoto(), Resource_Packaged );
    f7u12Model->addPrimitive( f7u12Photo );
    f7u12Model->setColour( CCColour( 1.0f ) );
    f7u12ColourInterpolator.setup( f7u12Model->getColour(), *f7u12Model->getColour() );
    f7u12ColourInterpolator.setDuration( 0.25f );

    // Provisionally set the userID to be the userSeed value
    // Which will be confirmed by the FBApi
    setUserID( userSeed );
    
    scaleInterpolator.clear();
    DELETE_POINTER( scale );
}
void MONGE_AMPERE_SOLVER::InitializeLinearSolver(const POISSON_SOLVER_TYPE linear_solver_type)
{
	DELETE_POINTER(sub_linear_solver);

	switch (linear_solver_type)
	{
	case GS:
		sub_linear_solver = new GAUSS_SEIDEL_METHOD();
		break;
	
	case SOR:
        sub_linear_solver = new SOR_METHOD();
        break;

	case BICG:
		sub_linear_solver = new BICGSTAB_METHOD();
		break;

	case NO_SOLVER:

	default:
		sub_linear_solver = 0;
		break;
	}

	sub_linear_solver->Initialize(tolerance, max_iteration_for_sub_linear_solver, multithreading);
}
void CharacterUpdaterPlayer::goToScan(const CCVector3 &target)
{
    CCObjectCollideable *hitObject = CCMovementOctreeCollisionCheck( player, *player->positionPtr, target );
    if( hitObject != NULL )
    {
        if( CCText::Equals( hitObject->getType(), "health" ) )
        {
            PickupBase *pickup = (PickupBase*)( hitObject );
            if( pickup != NULL )
            {
                hitObject = NULL;
            }
        }
    }

    if( hitObject == NULL )
    {
        DELETE_POINTER( path );
        goTo( target );
    }
    else
    {
        goToUsingPath( target );
    }
}
示例#10
0
// CCPrimitiveBase
void CCPrimitiveSquare::adjustTextureUVs()
{
	// We scale the textures to be square on Android
#ifndef ANDROID
    const int textureHandleIndex = textureInfo->primaryIndex;
    CCTextureHandle *textureHandle = gEngine->textureManager->getTextureHandle( textureHandleIndex );
    const CCTextureBase *texture = textureHandle->texture;
    //ASSERT( texture != NULL );
    if( texture != NULL )
    {
        const float width = texture->getImageWidth();
        const float height = texture->getImageHeight();
        const float allocatedWidth = texture->getAllocatedWidth();
        const float allocatedHeight = texture->getAllocatedHeight();
        
        if( width == allocatedWidth && height == allocatedHeight )
        {
            if( customUVs != NULL )
            {
                DELETE_POINTER( customUVs );
            }
        }
        else
        {
        	CCPrimitiveSquareUVs::Setup( &customUVs, 0.0f, 0.0f, width / allocatedWidth, height / allocatedHeight );
        }
    }
#endif
}
示例#11
0
/*F+F+++F+++F+++F+++F+++F+++F+++F+++F+++F+++F+++F+++F+++F+++F+++F+++F+++F+++F
  Function: DllGetClassObject

  Summary:  The standard exported function that the COM service library
            uses to obtain an object class of the class factory for a
            specified component provided by this server DLL.

  Args:     REFCLSID rclsid,
              [in] The CLSID of the requested Component.
            REFIID riid,
              [in] The requested interface on the Class Factory.
            PPVOID ppv)
              [in/out] The output interface pointer to the Class Factory.

  Returns:  HRESULT
              E_FAIL if requested component isn't supported.
              E_OUTOFMEMORY if out of memory.
              Error code out of the QueryInterface.
F---F---F---F---F---F---F---F---F---F---F---F---F---F---F---F---F---F---F-F*/
STDAPI DllGetClassObject(
         REFCLSID rclsid,
         REFIID riid,
         PPVOID ppv)
{
  HRESULT hr = CLASS_E_CLASSNOTAVAILABLE;
  IUnknown* pCob = NULL;

  if (CLSID_Ball == rclsid)
  {
    hr = E_OUTOFMEMORY;
    pCob = new CFBall(NULL, g_pServer);
  }

  if (NULL != pCob)
  {
    g_pServer->ObjectsUp();
    hr = pCob->QueryInterface(riid, ppv);
    if (FAILED(hr))
    {
      g_pServer->ObjectsDown();
	DELETE_POINTER(pCob);
    }
  }

  return hr;
}
示例#12
0
void CCText::SetLastWord(const char *inBuffer, CCText &outText)
{
    CCText nameData = inBuffer;
    CCList<char> *nameDataSplit = nameData.split( " " );
    ASSERT( nameDataSplit->length > 0 );
    outText = nameDataSplit->list[nameDataSplit->length-1];
    DELETE_POINTER( nameDataSplit );
}
// CCSceneObject
void CCTile3DButton::update(const CCTime &gameTime)
{
    super::update( gameTime );

    if( scale != NULL )
    {
        const float speed = gameTime.delta * 1.0f;
        if( scaleInterpolator.update( speed ) )
        {
            dirtyModelMatrix();
        }
        else
        {
            DELETE_POINTER( scale );
        }
    }

    // Touch depress: On update
    if( touchDepressRange > 0.0f )
    {
        if( touchDepressInterpolator.update( gameTime.delta ) )
        {
            dirtyModelMatrix();
        }
    }

    if( touchRotationAllowed )
    {
        const float speed = touching || touchReleased ? 3.0f : touchRotationSpeed;
        if( touchRotationInterpolator.update( gameTime.delta * speed ) )
        {
            const float magnitudeSquared = rotation.x * rotation.x + rotation.y * rotation.y;
            touchRotationMagnitude = sqrtf( magnitudeSquared );
            touchRotationMagnitude = MIN( touchRotationMagnitude, 1.0f );

            dirtyModelMatrix();
        }
    }

    if( touching )
    {
        touchingTime += gameTime.real;
    }
    else if( touchReleased )
    {
        if( touchDepressInterpolator.finished() && touchRotationInterpolator.finished() )
        {
            handleTouchRelease();
        }
    }

    colourInterpolator.update( gameTime.delta );

    if( textModel != NULL )
    {
        textModel->colourInterpolator.update( gameTime.delta );
    }
}
示例#14
0
void CCText::stripDirectory()
{
    CCList<char> *directorySplit = split( "/" );
    if( directorySplit->length > 1 )
    {
        set( directorySplit->list[directorySplit->length-1] );
    }
    DELETE_POINTER( directorySplit );
}
void CharacterUpdaterPlayer::destruct()
{
    if( shootingState != state_stopped )
    {
        stopShooting();
    }

    DELETE_POINTER( path );

    super::destruct();
}
    // ---------------------------------------------------------------------------------
    // Destructor
    // ---------------------------------------------------------------------------------
    ~Deck()
    {
        // Deallocate memory
        for (int i = 0; i < deckSize_; ++i)
        {
            DELETE_POINTER(ppCards_[i]);
        }
        DELETE_POINTER_ARRAY(pPresentInDeck_);
        DELETE_POINTER_ARRAY(ppCards_);

    }
const bool CCTextureFontPageFile::load(const char *name, const CCResourceType resourceType, const bool generateMipMap)
{
    CCText textureFilename( name );
    textureFilename += ".png";
    texturePageIndex = gEngine->textureManager->assignTextureIndex( textureFilename.buffer, resourceType, true, generateMipMap );
    
    CCText filename( name );
    filename += ".data";
    
	// Load the descriptor file
    char *fileData = NULL;
    CCFileManager::getPackagedFile( filename.buffer, &fileData );
    CCText textData( fileData );
    FREE_POINTER( fileData );
    
    CCList<char> *lettersSplit = textData.split( "\n" );
    CCText rawLetterData;
    for( int i=0; i<lettersSplit->length; ++i )
    {
        const char *raw = lettersSplit->list[i];
        rawLetterData.set( raw );
        
        CCList<char> *letterDataSplit = rawLetterData.split( "," );
        ASSERT( letterDataSplit->length == 4 );
        
        Letters &letter = letters[i];
        letter.start.x = (float)atof( letterDataSplit->list[0] );
        letter.start.y = (float)atof( letterDataSplit->list[1] );
        letter.end.x = (float)atof( letterDataSplit->list[2] );
        letter.end.y = (float)atof( letterDataSplit->list[3] );

        // 16.0f because there's 16 tiles per font page
        letter.size.width = ( letter.end.x - letter.start.x ) * 16.0f;
        letter.size.height = ( letter.end.y - letter.start.y ) * 16.0f;
        
        DELETE_POINTER( letterDataSplit );
    }
    DELETE_POINTER( lettersSplit );
	
	return true;
}
示例#18
0
/*F+F+++F+++F+++F+++F+++F+++F+++F+++F+++F+++F+++F+++F+++F+++F+++F+++F+++F+++F
  Function: DllMain

  Summary:  Like WinMain is for an EXE application, this DllMain function
            is the main entry point for this DLL.  It is called when the
            DLL is loaded by a process, and when new threads are created
            by a process that has already loaded this DLL.  DllMain is
            also called when threads of a process that has loaded the DLL
            exit cleanly and when the process itself unloads the DLL.

            If you want to use C runtime libraries, keep this function
            named "DllMain" and you won't have to do anything special to
            initialize the runtime libraries.

            When fdwReason == DLL_PROCESS_ATTACH, the return value is used
            to determine if the DLL should remain loaded, or should be
            immediately unloaded depending upon whether the DLL could be
            initialized properly.  For all other values of fdwReason, the
            return value is ignored.

  Args:     HINSTANCE hDLLInst,
              Instance handle of the DLL.
            DWORD fdwReason,
              Process attach/detach or thread attach/detach.
              Reason for calling.
            LPVOID lpvReserved)
              Reserved and not used.

  Returns:  BOOL,
              Return value is used only when fdwReason == DLL_PROCESS_ATTACH.
              TRUE  -  Used to signify that the DLL should remain loaded.
              FALSE -  Used to signify that the DLL should be
                immediately unloaded.
F---F---F---F---F---F---F---F---F---F---F---F---F---F---F---F---F---F---F-F*/
BOOL WINAPI DllMain(
              HINSTANCE hDllInst,
              DWORD fdwReason,
              LPVOID )
{
  BOOL bResult = TRUE;

  // Dispatch this main call based on the reason it was called.
  switch (fdwReason)
  {
    case DLL_PROCESS_ATTACH:
      // The DLL is being loaded for the first time by a given process.
      // Perform per-process initialization here.  If the initialization
      // is successful, return TRUE; if unsuccessful, return FALSE.
      bResult = FALSE;
      if (UnicodeOk())
      {
        // Instantiate the CServer utility class.
        g_pServer = new CServer;
        if (NULL != g_pServer)
        {
          // Remember the DLL Instance handle.
          g_pServer->m_hDllInst = hDllInst;
          bResult = TRUE;
        }
      }
      break;

    case DLL_PROCESS_DETACH:
      // The DLL is being unloaded by a given process.  Do any
      // per-process clean up here, such as undoing what was done in
      // DLL_PROCESS_ATTACH.  The return value is ignored.
      DELETE_POINTER(g_pServer);
      break;

    case DLL_THREAD_ATTACH:
      // A thread is being created in a process that has already loaded
      // this DLL.  Perform any per-thread initialization here.  The
      // return value is ignored.
      break;

    case DLL_THREAD_DETACH:
      // A thread is exiting cleanly in a process that has already
      // loaded this DLL.  Perform any per-thread clean up here.  The
      // return value is ignored.
      break;

    default:
      break;
  }

  return (bResult);
}
示例#19
0
void CCText::strip(const char *token)
{
    CCList<char> *tokenSplit = split( token );
    if( tokenSplit->length > 1 )
    {
        set( tokenSplit->list[0] );
        for( int i=1; i<tokenSplit->length; ++i )
        {
            *this += tokenSplit->list[i];
        }
    }
    DELETE_POINTER( tokenSplit );
}
示例#20
0
void CCText::splitAfter(CCText source, const char *after)
{
    CCList<char> *list1 = source.split( after, true );
    if( list1->length > 1 )
    {
        set( list1->list[1] );
        for( int i=2; i<list1->length; ++i )
        {
            *this += after;
            *this += list1->list[i];
        }
    }
    DELETE_POINTER( list1 );
}
示例#21
0
void CCText::removeBetweenIncluding(const char *from, const char *to)
{
    CCText start( buffer );
    CCList<char> *list1 = split( from );
    if( list1->length > 1 )
    {
        CCText end( list1->list[1] );
        start.set( list1->list[0] );
        end.splitAfter( end, to );

        set( start.buffer );
        *this += end.buffer;
    }
    DELETE_POINTER( list1 );
}
示例#22
0
void CCText::replaceChars(const char *token, const char *replace)
{
    CCList<char> *tokenSplit = split( token );
    CCText newText;
    for( int i=0; i<tokenSplit->length; ++i )
    {
        const char *rawData = tokenSplit->list[i];
        newText += rawData;
        
        if( i < tokenSplit->length-1 )
        {
            newText += replace;
        }
    }
    DELETE_POINTER( tokenSplit );
    
    set( newText.buffer );
}
// CCSceneObject
void CCTile3DButton::update(const CCTime &gameTime)
{
    super::update( gameTime );

    if( scale != NULL )
    {
        const float speed = gameTime.delta * 1.0f;
        if( scaleInterpolator.update( speed ) )
        {
            dirtyModelMatrix();
        }
        else
        {
            DELETE_POINTER( scale );
        }
    }

    colourInterpolator.update( gameTime.delta );

    if( textModel != NULL )
    {
        textModel->colourInterpolator.update( gameTime.delta );
    }
}
int main(int argc, const char * argv[])
{
    Deck *pDeck = new Deck(NUMBER_OF_DECKS, Deck::JPT_NO_JOKERS);   // Remove jokers
    Deck &deck = *pDeck;

    deck.showCards();

    printf("\n\nShuffling...\n\n");
    deck.shuffle();

    deck.showCards();

    printf("\n\nDealing...\n\n");

    // Play war by dealing the deck evenly to 2 hands
    // For now the hands are just pointers to lists of cards
    // Later we may actually encapsulate as a Hand as a means
    // to reference the cards from the deck... i.e., we never
    // really want to move the card data, just its reference.
    Card *pHandA = deck.deal();
    Card *pHandB = deck.deal();

    // Deal the rest of the cards until the deck is empty
    // May want to create a dealer that can handle multiple hands
    // and input to decide how much to deal.
    for(;;)
    {
        Card *pNext = deck.deal();
        if (pNext != NULL)
        {
            pHandA->add(pNext);
        }
        else
        {
            break;
        }

        pNext = deck.deal();
        if(pNext != NULL)
        {
            pHandB->add(pNext);
        }
        else
        {
            break;
        }
    }

    printf("\n\nHand A\n");
    pHandA->showCards();

    printf("\n\nHand B\n");
    pHandB->showCards();

    // Pull the first two cards
    // To prevent needing to traverse the list each time
    // we will retain some information in each pass

    Card *pTopA = pHandA->getFirst();
    Card *pTopB = pHandB->getFirst();

    Card *pNextA = pTopA->getNext();
    Card *pNextB = pTopB->getNext();

    Card *pLastA = pTopA->getLast();
    Card *pLastB = pTopB->getLast();

    Card *pDiscardA = pTopA->remove();
    Card *pDiscardB = pTopB->remove();

    Card *pNextDiscardToReturn[2];

    pTopA = pNextA;
    pNextA = pNextA->getNext();

    pTopB = pNextB;
    pNextB = pNextB->getNext();

    unsigned int cycleCount = 0;
    while (((pTopA != NULL)     &&
            (pTopB != NULL))
               ||
           ((pDiscardA != NULL) &&
            (pDiscardB != NULL)))
    {
        ++cycleCount;

        unsigned int countA = pTopA==NULL?0:pTopA->count();
        unsigned int countB = pTopB==NULL?0:pTopB->count();
        unsigned int discardCountA = pDiscardA==NULL?0:pDiscardA->count();
        unsigned int discardCountB = pDiscardB==NULL?0:pDiscardB->count();

        // Play war
        if (pDiscardA->getRank() > pDiscardB->getRank())
        {
            printf("%4d %4d %2d %2d = %4d ------A WINS------- Cycle %6d\n",
                   countA,
                   countB,
                   discardCountA,
                   discardCountB,
                   countA + countB + discardCountA + discardCountB,
                   cycleCount);

            // Put both cards in Hand A and update the discard piles
            // Randomly select which to do first to prevent the cards
            // from sorting themselves into a war-free configuration
            unsigned int aOrB = rand() % 2;

            pNextDiscardToReturn[aOrB & 0x1] = pDiscardA;
            pNextDiscardToReturn[~aOrB & 0x1] = pDiscardB;

            for (unsigned int i = 0; i < DIM(pNextDiscardToReturn); ++i)
            {
                while (pNextDiscardToReturn[i] != NULL)
                {
                    if (pLastA != NULL)
                    {
                        pNextDiscardToReturn[i] = pLastA->add(pNextDiscardToReturn[i]);
                        pLastA = pLastA->getNext();
                    }
                    else
                    {
                        Card *pNextReturn = pNextDiscardToReturn[i]->getNext();
                        pLastA = pNextDiscardToReturn[i]->remove();
                        pTopA = pLastA;
                        pNextDiscardToReturn[i] = pNextReturn;
                    }
                }
            }

            pNextA = pTopA->getNext();
            pDiscardA = NULL;
            pDiscardB = NULL;

        }
        else if (pDiscardA->getRank() < pDiscardB->getRank())
        {
            printf("%4d %4d %2d %2d = %4d ------B WINS------- Cycle %6d\n",
                   countA,
                   countB,
                   discardCountA,
                   discardCountB,
                   countA + countB + discardCountA + discardCountB,
                   cycleCount);

            // Put both cards in Hand B and update the discard piles
            // Randomly select which to do first to prevent the cards
            // from sorting themselves into a war-free configuration
            unsigned int aOrB = rand() % 2;

            pNextDiscardToReturn[aOrB & 0x1] = pDiscardB;
            pNextDiscardToReturn[~aOrB & 0x1] = pDiscardA;

            for (unsigned int i = 0; i < DIM(pNextDiscardToReturn); ++i)
            {
                while (pNextDiscardToReturn[i] != NULL)
                {
                    if (pLastB != NULL)
                    {
                        pNextDiscardToReturn[i] = pLastB->add(pNextDiscardToReturn[i]);
                        pLastB = pLastB->getNext();
                    }
                    else
                    {
                        Card *pNextReturn = pNextDiscardToReturn[i]->getNext();
                        pLastB = pNextDiscardToReturn[i]->remove();
                        pTopB = pLastB;
                        pNextDiscardToReturn[i] = pNextReturn;
                    }
                }
            }

            pNextB = pTopB->getNext();
            pDiscardA = NULL;
            pDiscardB = NULL;
        }
        else
        {
            printf("%4d %4d %2d %2d = %4d --------WAR-------- Cycle %6d\n",
                   countA,
                   countB,
                   discardCountA,
                   discardCountB,
                   countA + countB + discardCountA + discardCountB,
                   cycleCount);

            // Put a new card on top of each discard pile
            if ((pTopA != NULL) &&
                (pDiscardA != NULL))
            {
                pDiscardA = pDiscardA->insertBefore(pTopA->remove());
            }

            if ((pTopB != NULL) &&
                (pDiscardA != NULL))
            {
                pDiscardB = pDiscardB->insertBefore(pTopB->remove());
            }

            pTopA = pNextA;
            if (pNextA != NULL)
            {
                pNextA = pNextA->getNext();
            }
            else
            {
                pLastA = NULL;
            }

            pTopB = pNextB;
            if (pNextB != NULL)
            {
                pNextB = pNextB->getNext();
            }
            else
            {
                pLastB = NULL;
            }
        }

        // Pull two more cards if we know we
        // can play another round
        if ((pTopA != NULL) &&
            (pTopB != NULL))
        {
            if (pDiscardA == NULL)
            {
                if (pTopA != NULL)
                {
                    pDiscardA = pTopA->remove();
                }
            }
            else
            {
                if (pTopA != NULL)
                {
                    pDiscardA = pDiscardA->insertBefore(pTopA->remove());
                }
            }

            if (pDiscardB == NULL)
            {
                if (pTopB != NULL)
                {
                    pDiscardB = pTopB->remove();
                }
            }
            else
            {
                if (pTopB != NULL)
                {
                    pDiscardB = pDiscardB->insertBefore(pTopB->remove());
                }
            }

            pTopA = pNextA;
            if (pNextA != NULL)
            {
               pNextA = pNextA->getNext();
            }
            else
            {
                pLastA = NULL;
            }

            pTopB = pNextB;
            if (pNextB != NULL)
            {
               pNextB = pNextB->getNext();
            }
            else
            {
                pLastB = NULL;
            }
        }
    }


    if (pTopA != NULL)
    {
        printf("A CARDS--------\n");
        pTopA->showCards();
    }
    if (pTopB != NULL)
    {
        printf("B CARDS--------\n");
        pTopB->showCards();
    }
    if (pDiscardA != NULL)
    {
        printf("CARDS on Table from A\n");
        pDiscardA->showCards();
    }
    if (pDiscardB != NULL)
    {
        printf("CARDS on Table from B\n");
        pDiscardB->showCards();
    }
    printf("%s Wins in %d draws!\n", (pTopA == NULL)?"B":"A", cycleCount);

//    printf("Gathering Deck...\n");
//    deck.gather();
//    deck.showCards();

    DELETE_POINTER(pDeck);

    return 0;
}
示例#25
0
void CCText::splitBefore(CCText source, const char *before)
{
    CCList<char> *list1 = source.split( before, true );
    set( list1->list[0] );
    DELETE_POINTER( list1 );
}
void CharacterUpdaterPlayer::movePlayer(const float delta)
{
    if( moving )
    {
        if( path != NULL )
        {
            if( currentPath == -1 )
            {
                const CCVector3 *target = &pathAnchorNode->point;
                movePlayerRotation( *target, delta );

                const float distance = CCVector3DistanceCheck2D( *player->positionPtr, *target, false );
                if( distance < 1.0f )
                {
                    currentPath = 0;
                }
            }
            else
            {
                bool validPath = false;
                if( currentPath < path->endDirection )
                {
                    const int pathDirection = path->directions[currentPath];
                    if( pathDirection < pathAnchorNode->numberOfConnections )
                    {
                        const CCPathFinderNetwork::PathNode::PathConnection *usingConnection = &pathAnchorNode->connections[pathDirection];
                        const CCVector3 *target = &usingConnection->node->point;
                        if( target != NULL )
                        {
                            validPath = true;

                            movePlayerRotation( *target, delta );

                            const float distance = CCVector3DistanceCheck2D( *player->positionPtr, *target, false );
                            if( distance < 20.0f )
                            {
                                bool goToNext = distance < 0.1f + player->collisionBounds.y;
                                if( goToNext == false )
                                {
                                    const CCVector3 *testTarget = &positionTarget;
                                    if( currentPath+1 < path->endDirection )
                                    {
                                        const CCPathFinderNetwork::PathNode::PathConnection *nextConnection = &usingConnection->node->connections[path->directions[currentPath+1]];
                                        testTarget = &nextConnection->node->point;
                                        if( testTarget == NULL )
                                        {
                                            testTarget = &positionTarget;
                                        }
                                    }
                                    CCObjectCollideable *hitObject = CCMovementOctreeCollisionCheck( player, *player->positionPtr, *testTarget );
                                    goToNext = hitObject == NULL;
                                }

                                if( goToNext )
                                {
                                    pathAnchorNode = usingConnection->node;
                                    anchorNode = pathAnchorNode;
                                    currentPath++;
                                    if( currentPath >= path->endDirection )
                                    {
                                        DELETE_POINTER( path );
                                    }
                                }
                            }
                        }
                    }
                }

                if( validPath == false )
                {
                    // Try again?
                    goTo( positionTarget );
                }
            }
        }
        else
        {
            const float distance = CCVector3DistanceCheck2D( player->getPosition(), positionTarget, false );
            if( distance > 5.0f )
            {
                movePlayerRotation( positionTarget, delta );
            }
            else
            {
                landPlayerOnTarget( distance, delta );
            }
        }

        player->dirtyModelMatrix();
    }
}