aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Kohaut2019-02-20 22:02:43 +0100
committerPeter Kohaut2019-02-20 23:02:05 +0100
commit4886b0581ee45f5360b96bccf061cec982ede9f3 (patch)
tree4c9247d8bcfa4deb3be6717f4c821705408a611d
parentdaa98e408fa9f799b12b60f1331f5bd043ec3240 (diff)
downloadscummvm-rg350-4886b0581ee45f5360b96bccf061cec982ede9f3.tar.gz
scummvm-rg350-4886b0581ee45f5360b96bccf061cec982ede9f3.tar.bz2
scummvm-rg350-4886b0581ee45f5360b96bccf061cec982ede9f3.zip
BLADERUNNER: Fix Coverity issues
-rw-r--r--engines/bladerunner/actor.cpp2
-rw-r--r--engines/bladerunner/archive.cpp4
-rw-r--r--engines/bladerunner/bladerunner.cpp4
-rw-r--r--engines/bladerunner/dialogue_menu.cpp2
-rw-r--r--engines/bladerunner/obstacles.h2
-rw-r--r--engines/bladerunner/script/ai/izo.cpp2
-rw-r--r--engines/bladerunner/script/ai/steele.cpp2
-rw-r--r--engines/bladerunner/script/scene_script.cpp4
-rw-r--r--engines/bladerunner/text_resource.cpp1
-rw-r--r--engines/bladerunner/ui/kia_section_load.cpp8
-rw-r--r--engines/bladerunner/ui/kia_section_save.cpp7
11 files changed, 28 insertions, 10 deletions
diff --git a/engines/bladerunner/actor.cpp b/engines/bladerunner/actor.cpp
index f0bc39919f..80bfe249d3 100644
--- a/engines/bladerunner/actor.cpp
+++ b/engines/bladerunner/actor.cpp
@@ -1057,7 +1057,7 @@ void Actor::combatModeOn(int initialState, bool rangedAttack, int enemyId, int w
_animationModeCombatWalk = animationModeCombatWalk;
_animationModeCombatRun = animationModeCombatRun;
_inCombat = true;
- if (_id != kActorMcCoy) {
+ if (_id != kActorMcCoy && enemyId != -1) {
_combatInfo->combatOn(_id, initialState, rangedAttack, enemyId, waypointType, fleeRatio, coverRatio, attackRatio, damage, range, unstoppable);
}
stopWalking(false);
diff --git a/engines/bladerunner/archive.cpp b/engines/bladerunner/archive.cpp
index 18134c70e5..e29ed0a9a9 100644
--- a/engines/bladerunner/archive.cpp
+++ b/engines/bladerunner/archive.cpp
@@ -34,13 +34,13 @@ MIXArchive::MIXArchive() {
MIXArchive::~MIXArchive() {
if (_fd.isOpen()) {
- debug("~MIXArchive: fd not closed: %s", _fd.getName());
+ warning("~MIXArchive: File not closed: %s", _fd.getName());
}
}
bool MIXArchive::open(const Common::String &filename) {
if (!_fd.open(filename)) {
- debug("MIXArchive::open(): Could not open %s", filename.c_str());
+ warning("MIXArchive::open(): Can not open %s", filename.c_str());
return false;
}
diff --git a/engines/bladerunner/bladerunner.cpp b/engines/bladerunner/bladerunner.cpp
index 04af9a147a..0ea6cae86d 100644
--- a/engines/bladerunner/bladerunner.cpp
+++ b/engines/bladerunner/bladerunner.cpp
@@ -165,6 +165,8 @@ BladeRunnerEngine::BladeRunnerEngine(OSystem *syst, const ADGameDescription *des
_gameInfo = nullptr;
_waypoints = nullptr;
_gameVars = nullptr;
+ _cosTable1024 = nullptr;
+ _sinTable1024 = nullptr;
_view = nullptr;
_sceneObjects = nullptr;
_gameFlags = nullptr;
@@ -1907,8 +1909,6 @@ void BladeRunnerEngine::newGame(int difficulty) {
_gameFlags->clear();
- _gameInfo->getGlobalVarCount();
-
for (uint i = 0; i < _gameInfo->getGlobalVarCount(); ++i) {
_gameVars[i] = 0;
}
diff --git a/engines/bladerunner/dialogue_menu.cpp b/engines/bladerunner/dialogue_menu.cpp
index 1901503a2f..17bd9c2201 100644
--- a/engines/bladerunner/dialogue_menu.cpp
+++ b/engines/bladerunner/dialogue_menu.cpp
@@ -159,7 +159,7 @@ bool DialogueMenu::addToListNeverRepeatOnceSelected(int answer, int priorityPoli
bool DialogueMenu::removeFromList(int answer) {
int index = getAnswerIndex(answer);
- if (index != -1) {
+ if (index < 0) {
return false;
}
if (index < _listSize - 1) {
diff --git a/engines/bladerunner/obstacles.h b/engines/bladerunner/obstacles.h
index f07f3909f6..af17184393 100644
--- a/engines/bladerunner/obstacles.h
+++ b/engines/bladerunner/obstacles.h
@@ -57,7 +57,7 @@ class Obstacles {
Vector2 vertices[kPolygonVertexCount];
VertexType vertexType[kPolygonVertexCount];
- Polygon() : isPresent(false), verticeCount(0)
+ Polygon() : isPresent(false), verticeCount(0), vertexType()
{}
};
diff --git a/engines/bladerunner/script/ai/izo.cpp b/engines/bladerunner/script/ai/izo.cpp
index 9e48995816..ce1c15c208 100644
--- a/engines/bladerunner/script/ai/izo.cpp
+++ b/engines/bladerunner/script/ai/izo.cpp
@@ -192,7 +192,7 @@ void AIScriptIzo::OtherAgentExitedThisScene(int otherActorId) {
void AIScriptIzo::OtherAgentEnteredCombatMode(int otherActorId, int combatMode) {
if (Actor_Query_Goal_Number(kActorIzo) == kGoalIzoRC03Walk) {
- Game_Flag_Query(kFlagIzoIsReplicant);
+ Game_Flag_Query(kFlagIzoIsReplicant); // bug in the game?
}
return; //false;
}
diff --git a/engines/bladerunner/script/ai/steele.cpp b/engines/bladerunner/script/ai/steele.cpp
index 1715f6d6ed..f5e9f05ad4 100644
--- a/engines/bladerunner/script/ai/steele.cpp
+++ b/engines/bladerunner/script/ai/steele.cpp
@@ -1963,7 +1963,7 @@ bool AIScriptSteele::UpdateAnimation(int *animation, int *frame) {
bool AIScriptSteele::ChangeAnimationMode(int mode) {
switch (mode) {
- case kGoalSteeleDefault:
+ case kAnimationModeIdle:
if (Game_Flag_Query(kFlagSteeleAimingAtGordo)) {
_var1 = 3;
} else {
diff --git a/engines/bladerunner/script/scene_script.cpp b/engines/bladerunner/script/scene_script.cpp
index c4a5a1bc3f..77ebaa2a98 100644
--- a/engines/bladerunner/script/scene_script.cpp
+++ b/engines/bladerunner/script/scene_script.cpp
@@ -27,7 +27,9 @@ namespace BladeRunner {
SceneScript::SceneScript(BladeRunnerEngine *vm)
: _vm(vm)
, _inScriptCounter(0)
- , _currentScript(nullptr) {}
+ , _currentScript(nullptr)
+ , _mouseX(0)
+ , _mouseY(0) {}
SceneScript::~SceneScript() {
delete _currentScript;
diff --git a/engines/bladerunner/text_resource.cpp b/engines/bladerunner/text_resource.cpp
index b583bc609a..8afc0a3c75 100644
--- a/engines/bladerunner/text_resource.cpp
+++ b/engines/bladerunner/text_resource.cpp
@@ -49,6 +49,7 @@ bool TextResource::open(const Common::String &name) {
Common::String resName = Common::String::format("%s.TR%s", name.c_str(), _vm->_languageCode.c_str());
Common::ScopedPtr<Common::SeekableReadStream> s(_vm->getResourceStream(resName));
if (!s) {
+ warning("TextResource::open(): Can not open %s", resName.c_str());
return false;
}
diff --git a/engines/bladerunner/ui/kia_section_load.cpp b/engines/bladerunner/ui/kia_section_load.cpp
index a512188b43..4d91fb51b0 100644
--- a/engines/bladerunner/ui/kia_section_load.cpp
+++ b/engines/bladerunner/ui/kia_section_load.cpp
@@ -42,6 +42,14 @@ KIASectionLoad::KIASectionLoad(BladeRunnerEngine *vm) : KIASectionBase(vm) {
_uiContainer = new UIContainer(_vm);
_scrollBox = new UIScrollBox(_vm, scrollBoxCallback, this, 1025, 0, true, Common::Rect(155, 158, 461, 346), Common::Rect(506, 160, 506, 350));
_uiContainer->add(_scrollBox);
+
+ _timeLast = 0;
+ _timeLeft = 0;
+
+ _hoveredLineId = -1;
+ _newGameEasyLineId = -1;
+ _newGameMediumLineId = -1;
+ _newGameHardLineId = -1;
}
KIASectionLoad::~KIASectionLoad() {
diff --git a/engines/bladerunner/ui/kia_section_save.cpp b/engines/bladerunner/ui/kia_section_save.cpp
index 07873e39b7..46ee0384d2 100644
--- a/engines/bladerunner/ui/kia_section_save.cpp
+++ b/engines/bladerunner/ui/kia_section_save.cpp
@@ -54,6 +54,11 @@ KIASectionSave::KIASectionSave(BladeRunnerEngine *vm) : KIASectionBase(vm) {
_buttons = new UIImagePicker(_vm, 3);
+ _timeLast = 0;
+ _timeLeft = 0;
+
+ _state = kStateNormal;
+
_mouseX = 0;
_mouseY = 0;
@@ -384,6 +389,8 @@ void KIASectionSave::save() {
Common::OutSaveFile *saveFile = BladeRunner::SaveFileManager::openForSaving(_vm->getTargetName(), slot);
if (saveFile == nullptr || saveFile->err()) {
delete saveFile;
+ error("Can not open savegame file for writing");
+ return;
}
BladeRunner::SaveFileHeader header;