本文整理汇总了C++中FilePtr::exists方法的典型用法代码示例。如果您正苦于以下问题:C++ FilePtr::exists方法的具体用法?C++ FilePtr::exists怎么用?C++ FilePtr::exists使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FilePtr
的用法示例。
在下文中一共展示了FilePtr::exists方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: update
void CavePacker::update (uint32_t deltaTime)
{
_map.autoStart();
if (!_map.isActive() || deltaTime == 0)
return;
if (!_serviceProvider->getNetwork().isServer()) {
_map.resetCurrentMap();
return;
}
if (_map.isPause())
return;
_map.update(deltaTime);
const bool isDone = _map.isDone();
if (isDone && !_map.isRestartInitialized()) {
const uint32_t moves = _map.getMoves();
const uint32_t pushes = _map.getPushes();
const uint8_t stars = getStars();
_campaignManager->getAutoActiveCampaign();
if (!_campaignManager->updateMapValues(_map.getName(), moves, pushes, stars, true))
error(LOG_SERVER, "Could not save the values for the map");
if (stars == 3) {
const int n = SDL_arraysize(fullStarsAchievements);
for (int i = 0; i < n; ++i) {
fullStarsAchievements[i]->unlock();
}
}
if (_map.getPlayers().size() == 1) {
const Player* player = _map.getPlayers()[0];
const std::string& solution = player->getSolution();
info(LOG_SERVER, "solution: " + solution);
SDL_SetClipboardText(solution.c_str());
#if 0
FilePtr solutionFilePtr = FS.getFile(_map.getName() + ".sol");
if (!solutionFilePtr->exists()) {
FS.writeFile(solutionFilePtr->getName(), reinterpret_cast<const uint8_t*>(solution.c_str()), solution.size(), true);
}
#endif
if (!_map.isAutoSolve()) {
const std::string solutionId = "solution" + _map.getName();
System.track(solutionId, solution);
const int n = SDL_arraysize(puzzleAchievements);
for (int i = 0; i < n; ++i) {
puzzleAchievements[i]->unlock();
}
} else {
System.track("autosolve", _map.getName());
}
if (!_campaignManager->addAdditionMapData(_map.getName(), solution))
error(LOG_SERVER, "Could not save the solution for the map");
} else {
info(LOG_SERVER, "no solution in multiplayer games");
}
System.track("mapstate", String::format("finished: %s with %i moves and %i pushes - got %i stars", _map.getName().c_str(), moves, pushes, stars));
_map.abortAutoSolve();
const FinishedMapMessage msg(_map.getName(), moves, pushes, stars);
_serviceProvider->getNetwork().sendToAllClients(msg);
} else if (!isDone && _map.isFailed()) {
debug(LOG_SERVER, "map failed");
const uint32_t delay = 1000;
_map.restart(delay);
}
}