aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Sandulenko2016-05-30 13:58:43 +0200
committerEugene Sandulenko2016-05-30 19:32:49 +0200
commit0b240ff4a09d2966a181f4368a4a881398bfe379 (patch)
tree23b3ecc26aac81113b1bbccdc666fad9264d46da
parentc8f28986e59b9f7bacd46f4928a3575df8bbd40d (diff)
downloadscummvm-rg350-0b240ff4a09d2966a181f4368a4a881398bfe379.tar.gz
scummvm-rg350-0b240ff4a09d2966a181f4368a4a881398bfe379.tar.bz2
scummvm-rg350-0b240ff4a09d2966a181f4368a4a881398bfe379.zip
SCUMM HE: Fixed initialization in Moonbase AI
-rw-r--r--engines/scumm/he/moonbase/ai_main.cpp2
-rw-r--r--engines/scumm/he/moonbase/ai_targetacquisition.cpp9
-rw-r--r--engines/scumm/he/moonbase/ai_targetacquisition.h2
-rw-r--r--engines/scumm/he/moonbase/ai_traveller.cpp2
4 files changed, 13 insertions, 2 deletions
diff --git a/engines/scumm/he/moonbase/ai_main.cpp b/engines/scumm/he/moonbase/ai_main.cpp
index fa13b33d3d..98a577bdba 100644
--- a/engines/scumm/he/moonbase/ai_main.cpp
+++ b/engines/scumm/he/moonbase/ai_main.cpp
@@ -2110,7 +2110,7 @@ int *AI::energizeTarget(int &targetX, int &targetY, int index) {
break;
}
- testDist = ((((n - attempt) / n) * .5) + .5) * (getDistance(getHubX(nextUnit), getHubY(nextUnit), targetX, targetY) / .8);
+ testDist = (((((double)n - (double)attempt) / n) * .5) + .5) * (getDistance(getHubX(nextUnit), getHubY(nextUnit), targetX, targetY) / .8);
xPos = getHubX(nextUnit) + testDist * cos(degToRad(testAngle));
yPos = getHubY(nextUnit) + testDist * sin(degToRad(testAngle));
}
diff --git a/engines/scumm/he/moonbase/ai_targetacquisition.cpp b/engines/scumm/he/moonbase/ai_targetacquisition.cpp
index 02c49dc1a7..313ea7a411 100644
--- a/engines/scumm/he/moonbase/ai_targetacquisition.cpp
+++ b/engines/scumm/he/moonbase/ai_targetacquisition.cpp
@@ -320,6 +320,15 @@ void Sortie::printEnemyDefenses() {
}
}
+Defender::Defender(AI *ai) : _ai(ai) {
+ _sourceX = _sourceY = 0;
+ _targetX = _targetY = 0;
+ _sourceUnit = 0;
+ _power = 0;
+ _angle = 0;
+ _unit = 0;
+}
+
int Defender::calculateDefenseUnitPosition(int targetX, int targetY, int index) {
int currentPlayer = _ai->getCurrentPlayer();
diff --git a/engines/scumm/he/moonbase/ai_targetacquisition.h b/engines/scumm/he/moonbase/ai_targetacquisition.h
index 9afe0f50ab..5e6cfed8bc 100644
--- a/engines/scumm/he/moonbase/ai_targetacquisition.h
+++ b/engines/scumm/he/moonbase/ai_targetacquisition.h
@@ -112,7 +112,7 @@ private:
AI *_ai;
public:
- Defender(AI *ai) : _ai(ai) {}
+ Defender(AI *ai);
void setSourceX(int sourceX) { _sourceX = sourceX; }
void setSourceY(int sourceY) { _sourceY = sourceY; }
void setTargetX(int targetX) { _targetX = targetX; }
diff --git a/engines/scumm/he/moonbase/ai_traveller.cpp b/engines/scumm/he/moonbase/ai_traveller.cpp
index b1c9985b9d..d6eea67b41 100644
--- a/engines/scumm/he/moonbase/ai_traveller.cpp
+++ b/engines/scumm/he/moonbase/ai_traveller.cpp
@@ -46,6 +46,8 @@ Traveller::Traveller(AI *ai) : _ai(ai) {
_waterSourceY = 0;
_waterDestX = 0;
_waterDestY = 0;
+
+ _posX = _posY = 0;
}
Traveller::Traveller(int originX, int originY, AI *ai) : _ai(ai) {