本文整理汇总了C++中common::List::end方法的典型用法代码示例。如果您正苦于以下问题:C++ List::end方法的具体用法?C++ List::end怎么用?C++ List::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common::List
的用法示例。
在下文中一共展示了List::end方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: endGFXTransaction
OSystem::TransactionError OpenGLGraphicsManager::endGFXTransaction() {
assert(_transactionMode == kTransactionActive);
uint transactionError = OSystem::kTransactionSuccess;
bool setupNewGameScreen = false;
if ( _oldState.gameWidth != _currentState.gameWidth
|| _oldState.gameHeight != _currentState.gameHeight) {
setupNewGameScreen = true;
}
#ifdef USE_RGB_COLOR
if (_oldState.gameFormat != _currentState.gameFormat) {
setupNewGameScreen = true;
}
// Check whether the requested format can actually be used.
Common::List<Graphics::PixelFormat> supportedFormats = getSupportedFormats();
// In case the requested format is not usable we will fall back to CLUT8.
if (Common::find(supportedFormats.begin(), supportedFormats.end(), _currentState.gameFormat) == supportedFormats.end()) {
_currentState.gameFormat = Graphics::PixelFormat::createFormatCLUT8();
transactionError |= OSystem::kTransactionFormatNotSupported;
}
#endif
do {
uint requestedWidth = _currentState.gameWidth;
uint requestedHeight = _currentState.gameHeight;
const uint desiredAspect = getDesiredGameScreenAspect();
requestedHeight = intToFrac(requestedWidth) / desiredAspect;
if (!loadVideoMode(requestedWidth, requestedHeight,
#ifdef USE_RGB_COLOR
_currentState.gameFormat
#else
Graphics::PixelFormat::createFormatCLUT8()
#endif
)
// HACK: This is really nasty but we don't have any guarantees of
// a context existing before, which means we don't know the maximum
// supported texture size before this. Thus, we check whether the
// requested game resolution is supported over here.
|| ( _currentState.gameWidth > (uint)g_context.maxTextureSize
|| _currentState.gameHeight > (uint)g_context.maxTextureSize)) {
if (_transactionMode == kTransactionActive) {
// Try to setup the old state in case its valid and is
// actually different from the new one.
if (_oldState.valid && _oldState != _currentState) {
// Give some hints on what failed to set up.
if ( _oldState.gameWidth != _currentState.gameWidth
|| _oldState.gameHeight != _currentState.gameHeight) {
transactionError |= OSystem::kTransactionSizeChangeFailed;
}
#ifdef USE_RGB_COLOR
if (_oldState.gameFormat != _currentState.gameFormat) {
transactionError |= OSystem::kTransactionFormatNotSupported;
}
#endif
if (_oldState.aspectRatioCorrection != _currentState.aspectRatioCorrection) {
transactionError |= OSystem::kTransactionAspectRatioFailed;
}
if (_oldState.graphicsMode != _currentState.graphicsMode) {
transactionError |= OSystem::kTransactionModeSwitchFailed;
}
if (_oldState.filtering != _currentState.filtering) {
transactionError |= OSystem::kTransactionFilteringFailed;
}
// Roll back to the old state.
_currentState = _oldState;
_transactionMode = kTransactionRollback;
// Try to set up the old state.
continue;
}
}
// DON'T use error(), as this tries to bring up the debug
// console, which WON'T WORK now that we might no have a
// proper screen.
warning("OpenGLGraphicsManager::endGFXTransaction: Could not load any graphics mode!");
g_system->quit();
}
// In case we reach this we have a valid state, yay.
_transactionMode = kTransactionNone;
_currentState.valid = true;
} while (_transactionMode == kTransactionRollback);
if (setupNewGameScreen) {
delete _gameScreen;
_gameScreen = nullptr;
#ifdef USE_RGB_COLOR
_gameScreen = createSurface(_currentState.gameFormat);
#else
//.........这里部分代码省略.........
示例2: processVideoEvents
void VideoPlayer::processVideoEvents(Common::List<Common::Event> &stopEvents) {
Common::Event curEvent;
Common::EventManager *eventMan = g_system->getEventManager();
// Process events, and skip video if esc is pressed
while (eventMan->pollEvent(curEvent)) {
if (curEvent.type == Common::EVENT_RTL || curEvent.type == Common::EVENT_QUIT) {
_skipVideo = true;
}
for (Common::List<Common::Event>::const_iterator iter = stopEvents.begin(); iter != stopEvents.end(); iter++) {
if (curEvent.type == iter->type) {
if (iter->type == Common::EVENT_KEYDOWN || iter->type == Common::EVENT_KEYUP) {
if (curEvent.kbd.keycode == iter->kbd.keycode) {
_skipVideo = true;
break;
}
} else {
_skipVideo = true;
break;
}
}
}
}
}
示例3: kLock
reg_t kLock(EngineState *s, int argc, reg_t *argv) {
// NOTE: In SSCI, kLock uses a boolean lock flag, not a lock counter.
// ScummVM's current counter-based implementation should be better than SSCI
// at dealing with game scripts that unintentionally lock & unlock the same
// resource multiple times (e.g. through recursion), but it will introduce
// memory bugs (resource leaks lasting until the engine is restarted, or
// destruction of kernel locks that lead to a use-after-free) that are
// masked by ResourceManager's LRU cache if scripts rely on kLock being
// idempotent like it was in SSCI.
//
// Like SSCI, resource locks are not persisted in save games in ScummVM
// until GK2, so it is also possible that kLock bugs will appear only after
// restoring a save game.
//
// See also kUnLoad.
ResourceType type = g_sci->getResMan()->convertResType(argv[0].toUint16());
if (type == kResourceTypeSound && getSciVersion() >= SCI_VERSION_1_1) {
type = g_sci->_soundCmd->getSoundResourceType(argv[1].toUint16());
}
const ResourceId id(type, argv[1].toUint16());
const bool lock = argc > 2 ? argv[2].toUint16() : true;
#ifdef ENABLE_SCI32
// SSCI GK2+SCI3 also saves lock states for View, Pic, and Sync resources,
// but so far it seems like audio resources are the only ones that actually
// need to be handled
if (g_sci->_features->hasSci3Audio() && type == kResourceTypeAudio) {
g_sci->_audio32->lockResource(id, lock);
return s->r_acc;
}
#endif
if (getSciVersion() == SCI_VERSION_1_1 &&
(type == kResourceTypeAudio36 || type == kResourceTypeSync36)) {
return s->r_acc;
}
if (lock) {
g_sci->getResMan()->findResource(id, true);
} else {
if (getSciVersion() < SCI_VERSION_2 && id.getNumber() == 0xFFFF) {
// Unlock all resources of the requested type
Common::List<ResourceId> resources = g_sci->getResMan()->listResources(type);
Common::List<ResourceId>::iterator itr;
for (itr = resources.begin(); itr != resources.end(); ++itr) {
Resource *res = g_sci->getResMan()->testResource(*itr);
if (res->isLocked())
g_sci->getResMan()->unlockResource(res);
}
} else {
Resource *which = g_sci->getResMan()->findResource(id, false);
if (which)
g_sci->getResMan()->unlockResource(which);
else {
if (id.getType() == kResourceTypeInvalid)
warning("[resMan] Attempt to unlock resource %i of invalid type %i", id.getNumber(), argv[0].toUint16());
else
// Happens in CD games (e.g. LSL6CD) with the message
// resource. It isn't fatal, and it's usually caused
// by leftover scripts.
debugC(kDebugLevelResMan, "[resMan] Attempt to unlock non-existent resource %s", id.toString().c_str());
}
}
}
return s->r_acc;
}
示例4: walkTo
void Actor::walkTo(const Math::Vector3d &p) {
if (p == _pos)
_walking = false;
else {
_walking = true;
_destPos = p;
_path.clear();
if (_constrain) {
g_grim->getCurrSet()->findClosestSector(p, NULL, &_destPos);
Common::List<PathNode *> openList;
Common::List<PathNode *> closedList;
PathNode *start = new PathNode;
start->parent = NULL;
start->pos = _pos;
start->dist = 0.f;
start->cost = 0.f;
openList.push_back(start);
g_grim->getCurrSet()->findClosestSector(_pos, &start->sect, NULL);
Common::List<Sector *> sectors;
for (int i = 0; i < g_grim->getCurrSet()->getSectorCount(); ++i) {
Sector *s = g_grim->getCurrSet()->getSectorBase(i);
int type = s->getType();
if ((type == Sector::WalkType || type == Sector::HotType || type == Sector::FunnelType) && s->isVisible()) {
sectors.push_back(s);
}
}
Sector *endSec = NULL;
g_grim->getCurrSet()->findClosestSector(_destPos, &endSec, NULL);
do {
PathNode *node = NULL;
float cost = -1.f;
for (Common::List<PathNode *>::iterator j = openList.begin(); j != openList.end(); ++j) {
PathNode *n = *j;
float c = n->dist + n->cost;
if (cost < 0.f || c < cost) {
cost = c;
node = n;
}
}
closedList.push_back(node);
openList.remove(node);
Sector *sector = node->sect;
if (sector == endSec) {
PathNode *n = closedList.back();
// Don't put the start position in the list, or else
// the first angle calculated in updateWalk() will be
// meaningless. The only node without parent is the start
// one.
while (n->parent) {
_path.push_back(n->pos);
n = n->parent;
}
break;
}
for (Common::List<Sector *>::iterator i = sectors.begin(); i != sectors.end(); ++i) {
Sector *s = *i;
bool inClosed = false;
for (Common::List<PathNode *>::iterator j = closedList.begin(); j != closedList.end(); ++j) {
if ((*j)->sect == s) {
inClosed = true;
break;
}
}
if (inClosed)
continue;
Common::List<Math::Line3d> bridges = sector->getBridgesTo(s);
if (bridges.empty())
continue; // The sectors are not adjacent.
Math::Vector3d closestPoint = s->getClosestPoint(_destPos);
Math::Vector3d best;
float bestDist = 1e6f;
Math::Line3d l(node->pos, closestPoint);
while (!bridges.empty()) {
Math::Line3d bridge = bridges.back();
Math::Vector3d pos;
const bool useXZ = (g_grim->getGameType() == GType_MONKEY4);
if (!bridge.intersectLine2d(l, &pos, useXZ)) {
pos = bridge.middle();
}
float dist = (pos - closestPoint).getMagnitude();
if (dist < bestDist) {
bestDist = dist;
best = pos;
}
bridges.pop_back();
}
best = handleCollisionTo(node->pos, best);
PathNode *n = NULL;
//.........这里部分代码省略.........