Permalink
Browse files

STARTREK: Reduce a couple of variable scope, add a CHECKME

  • Loading branch information...
Strangerke committed Aug 10, 2018
1 parent 2c11e4d commit 0355ebdacfd9ff207fb7998c76dd0a98eb5bc2bb
Showing with 5 additions and 7 deletions.
  1. +1 −3 engines/startrek/actors.cpp
  2. +3 −3 engines/startrek/awaymission.cpp
  3. +1 −1 engines/startrek/events.cpp
@@ -41,13 +41,11 @@ void StarTrekEngine::initActors() {
int StarTrekEngine::loadActorAnim(int actorIndex, const Common::String &animName, int16 x, int16 y, Fixed8 scale) {
debugC(6, kDebugGraphics, "Load animation '%s' on actor %d", animName.c_str(), actorIndex);
Actor *actor = nullptr;
if (actorIndex == -1) {
// TODO
warning("loadActorAnim: actor == -1");
} else {
actor = &_actorList[actorIndex];
Actor *actor = &_actorList[actorIndex];
if (actor->spriteDrawn) {
releaseAnim(actor);
@@ -179,7 +179,6 @@ void StarTrekEngine::initAwayCrewPositions(int warpEntryIndex) {
void StarTrekEngine::handleAwayMissionEvents() {
TrekEvent event;
int clickedObject = -1;
if (popNextEvent(&event)) {
switch (event.type) {
@@ -244,13 +243,13 @@ void StarTrekEngine::handleAwayMissionEvents() {
case Common::KEYCODE_i:
if (_awayMission.activeAction == ACTION_USE) {
hideInventoryIcons();
clickedObject = showInventoryMenu(50, 50, true);
int clickedObject = showInventoryMenu(50, 50, true);
if (clickedObject == -1)
clickedObject = -2;
awayMissionUseObject(clickedObject);
} else if (_awayMission.activeAction == ACTION_LOOK) {
hideInventoryIcons();
clickedObject = showInventoryMenu(50, 50, true);
int clickedObject = showInventoryMenu(50, 50, true);
if (clickedObject == -1)
clickedObject = -2;
awayMissionGetLookOrTalk(clickedObject);
@@ -410,6 +409,7 @@ void StarTrekEngine::awayMissionUseObject(int16 clickedObject) {
tryWalkToHotspot = true;
else if (_awayMission.activeObject == OBJECT_MCCOY && _room->actionHasCode(ACTION_USE, OBJECT_IMEDKIT, _awayMission.passiveObject, 0))
tryWalkToHotspot = true;
// CHECKME: Identical to the previous check, thus never used
else if (_awayMission.activeObject == OBJECT_MCCOY && _room->actionHasCode(ACTION_USE, OBJECT_IMEDKIT, _awayMission.passiveObject, 0))
tryWalkToHotspot = true;
else if (_awayMission.activeObject == OBJECT_SPOCK && _room->actionHasCode(ACTION_USE, OBJECT_ISTRICOR, _awayMission.passiveObject, 0))
@@ -161,7 +161,7 @@ bool StarTrekEngine::popNextEvent(TrekEvent *e, bool poll) {
void StarTrekEngine::addEventToQueue(const TrekEvent &e) {
if (e.type == TREKEVENT_MOUSEMOVE && _mouseMoveEventInQueue) {
// Only allow one mouse move event at once
for (Common::List<TrekEvent>::iterator i = _eventQueue.begin(); i != _eventQueue.end(); i++) {
for (Common::List<TrekEvent>::iterator i = _eventQueue.begin(); i != _eventQueue.end(); ++i) {
if (i->type == TREKEVENT_MOUSEMOVE) {
*i = e;
return;

0 comments on commit 0355ebd

Please sign in to comment.