// returns 0 if NOT in check after the move // return 1 if in check after the move int simCheck(struct board * b, struct piece * p, struct pos * move, struct piece * k ) { struct piece * inactivePiece = NULL; struct pos * tempLoc; struct board * nBoard = copyBoard(b); struct pos * nMove = makeLoc(move->x, move->y); nMove->type = move->type; if(move->type ==4) { nMove->additionalM1 = move->additionalM1; nMove->additionalM2 = move->additionalM2; nMove->additionalP = getSpace(nBoard, move->x, move->y); } int temp = getOrder(b, p); int temp1; if(move->taken != NULL) { temp1 = getOrder(b,move->taken); nMove->taken = nBoard->pieces[temp1]; } else{ nMove->taken = NULL; } // printAllMoves(nBoard); movePiece(nBoard,nBoard->pieces[temp],nMove); updateAllMovesSim(nBoard); free(nMove); if(move->type == 4) { if(incheckCheck(nBoard,move->additionalP,move->additionalP->loc) == 1) { deleteBoard(nBoard); return 1; } deleteBoard(nBoard); return 0; } if(incheckCheck(nBoard,k,k->loc) == 1) { deleteBoard(nBoard); return 1; } deleteBoard(nBoard); return 0; }
int main(void){ //initialize stuff init_zobrist(); srand(time(NULL)); //create a new board Board_t* goal = newBoard(); //create a new visited cache HashTable_t* visited = newHashTable(32); //create a cloned state of the board and scrable it Board_t* scrabled = cloneBoard(goal); scramble_times(scrabled, TIMES_TO_SCRAMBLE); printf("Starting search...\n"); SearchNode_t* root = newSearchNode(scrabled, 0, NULL); SearchNode_t* result = idf_search(root, goal, visited, 30); //print out the search if(result!=NULL){ printf("Search Path:\n"); printSearchNode(result); } else printf("Search failed.\n"); //clean up deleteSearchNode(root, visited); assert(TOTAL_SEARCH_NODES==0); assert(TOTAL_HASH_NODES==0); deleteHashTable(visited); deleteBoard(goal); return 0; }
int Settings::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QWidget::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: refreshViews(); break; case 1: preInitialize(); break; case 2: initialize(); break; case 3: load(); break; case 4: createGUI(); break; case 5: lexiconChanged((*reinterpret_cast< const QString(*)>(_a[1]))); break; case 6: alphabetChanged((*reinterpret_cast< const QString(*)>(_a[1]))); break; case 7: boardChanged((*reinterpret_cast< const QString(*)>(_a[1]))); break; case 8: addBoard(); break; case 9: editBoard(); break; case 10: deleteBoard(); break; case 11: setQuackleToUseLexiconName((*reinterpret_cast< const string(*)>(_a[1]))); break; case 12: setQuackleToUseAlphabetName((*reinterpret_cast< const string(*)>(_a[1]))); break; case 13: setQuackleToUseBoardName((*reinterpret_cast< const QString(*)>(_a[1]))); break; } _id -= 14; } return _id; }
/* Main */ int main(int argc, char * argv[]) { resizeScreen(); printf("Hello Army!\n\n"); /* Create board */ cell ** board = createBoard(width, height); /* Clear board */ cleanBoard(board); /* Read board from file */ readBoard(board); for (int i = 0; i < 1000; i++) { /* Print board */ printBoard(board); /* Day */ day(board); /* Wait for enter */ char c = getchar(); } /* Delete board */ deleteBoard(board); /* stop the program from exiting */ char c = getchar(); }
void Board::newBoard(int x, int y) { deleteBoard(); size_.x = x; size_.y = y; calculateBoardPos(); allocBoard(); resetBoard(); }
int main(){ board *board = createBoard(); pawnTest(board); bishopTest(board); kingTest(board); /*clean up all the mallocs*/ deleteAllCells(board); /*deletes all pieces as well*/ printf("All cells and pieces freed\n"); deleteBoard(board); printf("Board freed\n"); exit(0); return 0; }
BoardSetupDialog::BoardSetupDialog(QWidget *parent) : QDialog(parent) { resize(700,550); setSizeGripEnabled(true); // construct the board BoardSetupFactory factory; BRB * brb = new BRB(&factory); m_boardFrame = static_cast<BoardSetup *>(brb->getBoardView())->boardFrame(); initializeBoardName(); // construct the UI elements m_horizontalSymmetry = new QCheckBox(tr("Horizontal")); m_verticalSymmetry = new QCheckBox(tr("Vertical")); m_diagonalSymmetry = new QCheckBox(tr("Diagonal")); m_horizontalSymmetry->setCheckState(Qt::Checked); m_verticalSymmetry->setCheckState(Qt::Checked); m_diagonalSymmetry->setCheckState(Qt::Checked); m_horizontalDimension = constructDimensionComboBox(QUACKLE_BOARD_PARAMETERS->width()); m_verticalDimension = constructDimensionComboBox(QUACKLE_BOARD_PARAMETERS->height()); m_boardName = new QLineEdit(QuackleIO::Util::uvStringToQString(QUACKLE_BOARD_PARAMETERS->name())); m_saveChanges = new QPushButton(tr("&Save Changes")); m_cancel = new QPushButton(tr("&Cancel")); m_undoAll = new QPushButton(tr("&Undo All Changes")); m_deleteBoard = new QPushButton(tr("&Delete Board")); QVBoxLayout * superLayout = new QVBoxLayout; Geometry::setupFramedLayout(superLayout); QHBoxLayout * mainLayout = new QHBoxLayout; Geometry::setupInnerLayout(mainLayout); QVBoxLayout * leftSideLayout = new QVBoxLayout; Geometry::setupInnerLayout(leftSideLayout); QLabel * boardNameLabel = new QLabel(tr("&Board name:")); boardNameLabel->setBuddy(m_boardName); QGroupBox * dimensionGroup = new QGroupBox(tr("Board dimensions")); QHBoxLayout * dimensionRow = new QHBoxLayout(dimensionGroup); Geometry::setupFramedLayout(dimensionRow); QLabel * dimensionLabel = new QLabel(tr(" by ")); QGroupBox * symmetryGroup = new QGroupBox(tr("Board symmetry")); QVBoxLayout * symmetryCol = new QVBoxLayout(symmetryGroup); Geometry::setupFramedLayout(symmetryCol); QHBoxLayout * buttonRow = new QHBoxLayout; Geometry::setupInnerLayout(buttonRow); // build the layout dimensionRow->addWidget(m_horizontalDimension); dimensionRow->addWidget(dimensionLabel); dimensionRow->addWidget(m_verticalDimension); dimensionRow->addStretch(); symmetryCol->addWidget(m_horizontalSymmetry); symmetryCol->addWidget(m_verticalSymmetry); symmetryCol->addWidget(m_diagonalSymmetry); buttonRow->addStretch(1); buttonRow->addWidget(m_cancel); buttonRow->addWidget(m_saveChanges); leftSideLayout->addWidget(boardNameLabel); leftSideLayout->addWidget(m_boardName); leftSideLayout->addWidget(dimensionGroup); leftSideLayout->addWidget(symmetryGroup); leftSideLayout->addWidget(m_undoAll); if (!m_originalName.isEmpty()) leftSideLayout->addWidget(m_deleteBoard); leftSideLayout->addStretch(); mainLayout->addLayout(leftSideLayout); mainLayout->addWidget(brb); mainLayout->setStretchFactor(leftSideLayout, 0); mainLayout->setStretchFactor(brb, 10); superLayout->addLayout(mainLayout); superLayout->addLayout(buttonRow); setLayout(superLayout); m_saveChanges->setDefault(true); // hook up signals and slots connect(m_horizontalDimension, SIGNAL(activated(const QString &)), this, SLOT(parametersChanged(const QString &))); connect(m_horizontalDimension, SIGNAL(activated(const QString &)), this, SLOT(symmetryChanged())); connect(m_verticalDimension, SIGNAL(activated(const QString &)), this, SLOT(parametersChanged(const QString &))); connect(m_verticalDimension, SIGNAL(activated(const QString &)), this, SLOT(symmetryChanged())); connect(m_boardName, SIGNAL(textEdited(const QString &)), this, SLOT(parametersChanged(const QString &))); connect(m_saveChanges, SIGNAL(clicked()), this, SLOT(accept())); connect(m_cancel, SIGNAL(clicked()), this, SLOT(reject())); connect(m_undoAll, SIGNAL(clicked()), this, SLOT(undoAllChanges())); connect(m_deleteBoard, SIGNAL(clicked()), this, SLOT(deleteBoard())); connect(m_horizontalSymmetry, SIGNAL(stateChanged(int)), this, SLOT(symmetryChanged())); connect(m_verticalSymmetry, SIGNAL(stateChanged(int)), this, SLOT(symmetryChanged())); connect(m_diagonalSymmetry, SIGNAL(stateChanged(int)), this, SLOT(symmetryChanged())); setWindowTitle(tr("Configure Board - Quackle")); // sync game board with control states and draw board ostringstream boardStream; QUACKLE_BOARD_PARAMETERS->Serialize(boardStream); m_serializedOriginalBoard = boardStream.str(); parametersChanged(QString()); symmetryChanged(); }
std::pair<Move, int> AIShell::IDSearchRecurse(int depth, int** state, int turn, int alpha, int beta, struct timeval& start) { std::pair<Move, int> inValid = std::make_pair(Move(-1, -1), -1); //AI_PIECE bigger better (MAX); HU_PIECE smaller better (MIN). int thisAlpha = alpha; int thisBeta = beta; // Create a copy of the current gameState int** tempGameState = new int*[numCols]; for (int col = 0; col < numCols; col++) { tempGameState[col] = new int[numRows]; for(int row = 0; row < numRows; row++) { tempGameState[col][row] = state[col][row]; } } // Makes sure time is still under the limit if(!isUnderLimit(start)) {return inValid;} // Base Case for MinMax if (depth == 0) //At leaf node, actual move is not important since we just care the eval of this node { Move dummyMove; int hValue = heuristicEval(state, turn, start); std::pair<Move, int> dummyMoveEval = std::make_pair(dummyMove, hValue); return dummyMoveEval; } // Recursive Step for MinMax else { // Search for threats (k-1 in a row) on the board std::vector<int> evalNodes; std::vector<std::pair<int, int> > movesList = threats(tempGameState); // If there are no threats find all available moves if(movesList.size() == 0 && isUnderLimit(start)) { movesList = emptyBlock(tempGameState); } // Makes sure time is still under the limit if(!isUnderLimit(start)) {return inValid;} for (int i = 0; i < movesList.size(); i++) { // If there's only 1 possible move. if(movesList.size() == 1) { Move bestMove(movesList[i].first, movesList[i].second); std::pair<Move, int> evalValue = std::make_pair(bestMove, 0); return evalValue; } // If there's more than 1 possible move. tempGameState[movesList[i].first][movesList[i].second] = turn; if (turn == AI_PIECE){ int nextLevelEval = IDSearchRecurse(depth - 1, tempGameState, HUMAN_PIECE, thisAlpha, thisBeta, start).second; // Makes sure time is still under the limit if(!isUnderLimit(start)) {return inValid;} evalNodes.push_back(nextLevelEval); if (nextLevelEval >= thisBeta){ sort(movesList, i); evalNodes[0] = nextLevelEval; break; } if (nextLevelEval >= thisAlpha){ sort(movesList, i); evalNodes[0] = nextLevelEval; thisAlpha=nextLevelEval; } // Makes sure time is still under the limit if(!isUnderLimit(start)) {return inValid;} } else{ int nextLevelEval = IDSearchRecurse(depth - 1, tempGameState, AI_PIECE, thisAlpha, thisBeta, start).second; // Makes sure time is still under the limit if(!isUnderLimit(start)) {return inValid;} evalNodes.push_back(nextLevelEval); if (nextLevelEval <= thisAlpha){ sort(movesList, i); evalNodes[0] = nextLevelEval; break; } if (nextLevelEval <= thisBeta){ sort(movesList, i); evalNodes[0] = nextLevelEval; thisBeta = nextLevelEval; } // Makes sure time is still under the limit if(!isUnderLimit(start)) {return inValid;} } tempGameState[movesList[i].first][movesList[i].second] = 0; //Set the block back // Makes sure time is still under the limit if(!isUnderLimit(start)) {return inValid;} } if (turn == AI_PIECE) { Move bestMove(movesList[0].first, movesList[0].second); std::pair<Move, int> evalValue = std::make_pair(bestMove, evalNodes[0]); deleteBoard(tempGameState); // Makes sure time is still under the limit if(!isUnderLimit(start)) {return inValid;} return evalValue; } else { Move bestMove(movesList[0].first, movesList[0].second); std::pair<Move, int> evalValue = std::make_pair(bestMove, evalNodes[0]); deleteBoard(tempGameState); // Makes sure time is still under the limit if(!isUnderLimit(start)) {return inValid;} return evalValue; } } }
Hardware::Hardware(QWidget *parent) : QDialog(parent), ui(new Ui::Hardware) { xBasicConfig = new XBasicConfig(); ui->setupUi(this); connect(ui->comboBoxBoard,SIGNAL(activated(int)),this,SLOT(boardChanged(int))); connect(ui->pushButtonDelete,SIGNAL(clicked()),this,SLOT(deleteBoard())); ui->comboBoxBoard->setEditable(true); ui->tabWidget->setCurrentIndex(0); ui->comboBoxClkMode->addItem(tr("RCFAST")); ui->comboBoxClkMode->addItem(tr("RCSLOW")); ui->comboBoxClkMode->addItem(tr("XINPUT")); ui->comboBoxClkMode->addItem(tr("XTAL1+PLL1X")); ui->comboBoxClkMode->addItem(tr("XTAL1+PLL2X")); ui->comboBoxClkMode->addItem(tr("XTAL1+PLL4X")); ui->comboBoxClkMode->addItem(tr("XTAL1+PLL8X")); ui->comboBoxClkMode->addItem(tr("XTAL1+PLL16X")); ui->comboBoxClkMode->addItem(tr("XTAL2+PLL1X")); ui->comboBoxClkMode->addItem(tr("XTAL2+PLL2X")); ui->comboBoxClkMode->addItem(tr("XTAL2+PLL4X")); ui->comboBoxClkMode->addItem(tr("XTAL2+PLL8X")); ui->comboBoxClkMode->addItem(tr("XTAL2+PLL16X")); ui->comboBoxClkMode->addItem(tr("XTAL3+PLL1X")); ui->comboBoxClkMode->addItem(tr("XTAL3+PLL2X")); ui->comboBoxClkMode->addItem(tr("XTAL3+PLL4X")); ui->comboBoxClkMode->addItem(tr("XTAL3+PLL8X")); ui->comboBoxClkMode->addItem(tr("XTAL3+PLL16X")); ui->comboBoxBaudrate->addItem(tr("9600")); ui->comboBoxBaudrate->addItem(tr("19200")); ui->comboBoxBaudrate->addItem(tr("38400")); ui->comboBoxBaudrate->addItem(tr("56000")); ui->comboBoxBaudrate->addItem(tr("115200")); ui->comboBoxDataMemory->addItem(tr("HUB")); ui->comboBoxDataMemory->addItem(tr("RAM")); ui->comboBoxCodeMemory->addItem(tr("HUB")); ui->comboBoxCodeMemory->addItem(tr("RAM")); ui->comboBoxCodeMemory->addItem(tr("FLASH")); ui->comboBoxCacheSize->addItem(tr("")); ui->comboBoxCacheSize->addItem(tr("2K")); ui->comboBoxCacheSize->addItem(tr("4K")); ui->comboBoxCacheSize->addItem(tr("8K")); ui->comboBoxExternalFlashSize->addItem(tr("")); ui->comboBoxExternalFlashSize->addItem(tr("16M")); ui->comboBoxExternalFlashSize->addItem(tr("8M")); ui->comboBoxExternalFlashSize->addItem(tr("4M")); ui->comboBoxExternalFlashSize->addItem(tr("2M")); ui->comboBoxExternalFlashSize->addItem(tr("1M")); ui->comboBoxExternalFlashSize->addItem(tr("512K")); ui->comboBoxExternalFlashSize->addItem(tr("256K")); ui->comboBoxExternalFlashSize->setEditable(true); ui->comboBoxExternalRamSize->addItem(tr("")); ui->comboBoxExternalRamSize->addItem(tr("32M")); ui->comboBoxExternalRamSize->addItem(tr("16M")); ui->comboBoxExternalRamSize->addItem(tr("8M")); ui->comboBoxExternalRamSize->addItem(tr("4M")); ui->comboBoxExternalRamSize->addItem(tr("2M")); ui->comboBoxExternalRamSize->addItem(tr("1M")); ui->comboBoxExternalRamSize->addItem(tr("512K")); ui->comboBoxExternalRamSize->addItem(tr("256K")); ui->comboBoxExternalRamSize->addItem(tr("64K")); ui->comboBoxExternalRamSize->addItem(tr("32K")); ui->comboBoxExternalRamSize->setEditable(true); ui->lineEditClkFreq->setText(tr("80000000")); ui->lineEditRxPin->setText(tr("31")); ui->lineEditTxPin->setText(tr("30")); ui->lineEditTvPin->setText(tr("12")); }
MapMgr::~MapMgr() { if (_loaded) { deleteBoard(); } }
void MapMgr::loadMap(const char* filename) { if (_loaded) { _portals.clear(); _walls.clear(); _wave_list.clear(); deleteBoard(); } if (!(_fd = sceIoOpen(filename, O_RDONLY, 0777))) { std::cerr << "Error: Couldn't load mapfile" << std::endl; _loaded = false; } else { //TODO Read from real file _size.x = 22; _size.y = 12; t_2dindex start = {0, 0}; t_2dindex dest = {9, 9}; _portals[1] = std::pair< t_2dindex, t_2dindex >(start, dest); t_2dindex s = {9, 9}; t_2dindex d = {0, 4}; _portals[2] = std::pair< t_2dindex, t_2dindex >(s, d); t_2dindex ignore1 = {8, 8}; t_2dindex ignore2 = {9, 8}; t_2dindex ignore3 = {9, 0}; _walls.push_front(ignore1); _walls.push_front(ignore2); _walls.push_front(ignore3); t_wave wave1; wave1.waveNo = 1; wave1.portalNo = 1; wave1.type = GRUNT; wave1.count = 5; wave1.delay = 20; wave1.rate = 60; t_wave wave2; wave2.waveNo = 2; wave2.portalNo = 1; wave2.type = GRUNT; wave2.count = 2; wave2.delay = 10; wave2.rate = 120; t_wave wave3; wave3.waveNo = 3; wave3.portalNo = 1; wave3.type = GRUNT; wave3.count = 10; wave3.delay = 0; wave3.rate = 80; _wave_list.push_back(wave1); _wave_list.push_back(wave2); _wave_list.push_back(wave3); allocBoard(); //Set ignored cells for (std::list<t_2dindex>::iterator i = _walls.begin(); i != _walls.end(); ++i) { _board[i->x][i->y].setBlocked(true); } _loaded = true; } }
Board::~Board() { deleteBoard(); }
int main(int argc, char **argv) { SDL_Window *win = NULL; SDL_Renderer *ren = NULL; SDL_Event e; Board B; B.num = numNodes; int quit = GAME_UNDERWAY; int turn = rand() % 2; // TODO!!! // Add a simple menu here that shows up in the black console window to choose PvP or Computer vs. Player int isCutCPU, isShortCPU; //THE MENU NEED IMPROVEMENT. iT TESTS FOR INPUT BUT IT EXITS IF WRONG. //A LOOP IS NEEDED TO GET INPUTS UNTIL SOMETHING VALID // Main menu printf("Make a choice:\n"); printf("1) Player versus player\n"); printf("2) Player versus CPU (Player as Short)\n"); printf("3) Player versus CPU (Player as Cut)\n"); printf("4) CPU versus CPU\n"); printf("Enter your choice: "); //I found this one while looking for minimax algortihm. //I tought it was interesting so I gave it a try int choice; if (scanf_s("%i", &choice) != 1 || choice < 1 || choice > 4) { printf("Unable to read your input.\n"); return 1; } choice--; isCutCPU = choice & 0x1; isShortCPU = (choice & 0x02) >> 1; // Probably don't need to modify anything else below initializeGraphicsWindow(&win, &ren); SDL_SetRenderDrawColor(ren, 255, 255, 255, 255); // creates a white background for the board SDL_RenderClear(ren); //clears the game board to ensure it is plain white SDL_RenderPresent(ren); //renders the gameboard to the screen if (turn){ stringColor(ren, 5, 5, "Short's Turn:", white); } //displays initial turn else{ stringColor(ren, 5, 5, "Cut's Turn:", black); } createAndDrawBoard(ren,&B);//generates random planar graph and draws it //This is the main loop. //It calls executeTurn once per mouse click until the user quits or someone wins while (quit==GAME_UNDERWAY){ while (SDL_PollEvent(&e) != 0) //Loops through event queue { //User requests quit if (e.type == SDL_QUIT) //allows user to x out of program { quit = USER_QUIT; } if (e.type == SDL_MOUSEBUTTONDOWN) //handles mouse button events { turn = executeTurn(turn, ren, e.button, &B); quit = determineWinner(&B); //returns 0,2,or 3 as defined above inline with the declaration of quit } } SDL_RenderPresent(ren); //presents changes to the screen that result from the execution of one turn if (isCutCPU && turn == 0) { executeCutCPU(ren, &B); turn = 1; if (quit = determineWinner(&B)) break; SDL_RenderPresent(ren); SDL_Delay(1000); } else if (isShortCPU && turn == 1) { executeShortCPU(ren, &B); turn = 0; if (quit = determineWinner(&B)) break; SDL_RenderPresent(ren); SDL_Delay(1000); } } // Display who won displayWinBanner(ren, quit); while ((quit == CUT_WINS) || (quit == SHORT_WINS)) //if there was a winner hold the screen until the game window is closed. { SDL_RenderPresent(ren); //present changes to the screen // wait until the user closes the window while (SDL_PollEvent(&e) != 0) { //User requests quit if (e.type == SDL_QUIT) { quit = USER_QUIT; } } } freeGraphicsWindow(&win, &ren);//Terminate SDL and end program deleteBoard(&B); //deallocates dynamic memory return 0; }
bool MyFrameListener::frameStarted(const Ogre::FrameEvent& evt) { Ogre::Vector3 vt(0,0,0); Ogre::Real deltaT = evt.timeSinceLastFrame; Ogre::Real tSpeed = 20.0; int fps = 1.0 / deltaT; _keyboard->capture(); if(_keyboard->isKeyDown(OIS::KC_ESCAPE)) return false; if(_keyboard->isKeyDown(OIS::KC_0)) // reset { if (_gameState == 1) { _gameState = 0; deleteBoard(); _overlayManager->getByName("Title")->show(); } } if(_keyboard->isKeyDown(OIS::KC_1)) // jugar { if (_gameState == 0) { _gameState = 1; createBoard(); _overlayManager->getByName("Title")->hide(); _overlayManager->getByName("Win")->hide(); _overlayManager->getByName("Lose")->hide(); } } //if(_keyboard->isKeyDown(OIS::KC_2)) return false; // Captura del raton _mouse->capture(); int posx = _mouse->getMouseState().X.abs; int posy = _mouse->getMouseState().Y.abs; // Dibujado del cursor Ogre::OverlayElement *oe; oe = _overlayManager->getOverlayElement("cursor"); oe->setLeft(posx); oe->setTop(posy); // Accion del raton bool mbleft = _mouse->getMouseState().buttonDown(OIS::MB_Left); if (mbleft) { Ogre::Ray r = setRayQuery(posx, posy, 1); Ogre::RaySceneQueryResult &result = _raySceneQuery->execute(); Ogre::RaySceneQueryResult::iterator it; it = result.begin(); //AGUA if (it != result.end()) { if (it->movable->getParentSceneNode()->getName() != "nodeG") { Ogre::Vector3 pos = it->movable->getParentSceneNode()->getPosition(); it->movable->detachFromParent(); // tirada del CPU. int lResult = 0; do { lResult = playCPU(); if (endGame()!=0) { _gameState = 0; deleteBoard(); _overlayManager->getByName("Title")->show(); _overlayManager->getByName("Lose")->show(); } } while ((lResult == 1) && (_gameState==1)); } } //TOCADO r = setRayQuery(posx, posy, 2); Ogre::RaySceneQueryResult &resultShip = _raySceneQuery->execute(); it = resultShip.begin(); if (it != resultShip.end()) { if (it->movable->getParentSceneNode()->getName() != "nodeG") { Ogre::Vector3 pos = it->movable->getParentSceneNode()->getPosition(); it->movable->detachFromParent(); // Creacion de otro cubo para cuando haya barco. Ogre::Entity* ent1; ent1 = _sceneManager->createEntity("CuboBarco.mesh"); ent1->setQueryFlags(4); Ogre::SceneNode* node1 = _sceneManager->createSceneNode(); node1->attachObject(ent1); node1->translate(pos.x,pos.y,pos.z); _sceneManager->getRootSceneNode()->addChild(node1); _maxFires--; // no tira CPU if (endGame()!=0) { _gameState = 0; deleteBoard(); _overlayManager->getByName("Title")->show(); _overlayManager->getByName("Win")->show(); } } } } return true; }