static void Init_cl_Device_Api() { static bool initialized = false; if(initialized == true) return; initialized = true; clInternalInitializeConfig("opencl_config.xml"); if(clInternalConfigGetPresent("cpu_generic")) InitCpu(); if(clInternalConfigGetPresent("accel_cell")) InitCell(); if(clInternalConfigGetPresent("gpu_nvidia")) InitGpu(); }
void main (void) { FILE * infile; string choice; class_p clas; ship_p ship; ship_p cell[NUM_ROWS][NUM_COLS]; int ship_num; coord history[100]; Randomize(); choice=StartGame(); infile=GetFile(); InitCell(cell); InitHistory(history); ship=GetData(infile,&clas,&ship,&ship_num); InitGraphics(); DrawStartingBoard(choice); PlacingShips(clas,ship,cell,ship_num); PlayGame(history,cell,clas,ship,ship_num,choice); }
void LockBarrierBase::Load(rapidxml::xml_node<> *xml_elem) { _pos = xml_elem; InitCell(); }
void Game::RestartLevel(bool restart) { bool done = false; while (!done) { InitCell(); GhostList().clear(); ItemList().clear(); // add player if (CurrentLevel < 8) GhostList().emplace_back(this, pEngineCore); else GhostList().emplace_back(this, pEngineCore, GameObject::GOT_PLAYER, ColorYellow(), 0, 0); // add AUX object if (!pNearest) pNearest = new Item(this, pEngineCore); // add exit from level ItemList().emplace_back(this, pEngineCore, GameObject::GOT_EXIT, 7, 7, 5); // add score items for (int i = 0; i < ScoreNumber; ++i) ItemList().emplace_back(this, pEngineCore); // add ghosts and special items GhostList().emplace_back(this, pEngineCore, GameObject::GOT_BLUE_GHOST, ColorBlue()); if (CurrentLevel > 1) GhostList().emplace_back(this, pEngineCore, GameObject::GOT_RED_GHOST, ColorRed()); if (CurrentLevel > 2) { for (int i = 0; i < BlackScoreNumber; ++i) ItemList().emplace_back(this, pEngineCore, GameObject::GOT_BLACK_SCORE, 7); SetBlackFlag(false); } if (CurrentLevel > 3) GhostList().emplace_back(this, pEngineCore, GameObject::GOT_PURPLE_GHOST, ColorPurple()); if (CurrentLevel > 4) { ItemList().emplace_back(this, pEngineCore, GameObject::GOT_BIG_SCORE, 8, 5, 7); GhostList().emplace_back(this, pEngineCore, GameObject::GOT_GREEN_GHOST, ColorGreen(), 5, 7); } if (CurrentLevel > 5) GhostList().emplace_back(this, pEngineCore, GameObject::GOT_OLIVE_GHOST, ColorOlive(), 5, 5); if (CurrentLevel > 6) { ItemList().emplace_back(this, pEngineCore, GameObject::GOT_HELP_SCORE, 8, 7, 5); SetHelpFlag(false); GhostList().emplace_back(this, pEngineCore, GameObject::GOT_AQUA_GHOST, ColorAqua()); GhostList().emplace_back(this, pEngineCore, GameObject::GOT_TEAL_GHOST, ColorTeal()); } // if player cannot interact with some objects -> restart initialization done = true; if (GetMode() != "s") { for (auto it = cItemList().cbegin(); it != cItemList().cend() && done; ++it) if (!cGhostList().cbegin()->Pathfind(*it)) done = false; // if (!done) the following loop is unnecessary and will not execute // some ghosts can be walled up if manually disable the following loop (it can be usefull for medium difficulty level) //for (auto it = ++cGhostList().cbegin(); it != cGhostList().cend() && done; ++it) // if (!cGhostList().cbegin()->Pathfind(*it)) // done = false; } } if (restart) CurrentScore = PreviousScore; else { PreviousScore = CurrentScore; if (IncreaseLivesFlag) Lives++; } SetIncreaseLivesFlag(false); }