diff options
author | Eugene Sandulenko | 2016-05-23 19:12:56 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2016-05-23 19:12:56 +0200 |
commit | fb816708a2ff6faf8d8b6a5d7df9137d2bfbb1db (patch) | |
tree | 00748dada3cad79ced5c1ee43c4431e442da4491 /engines/scumm/he | |
parent | 70ffcf91f5538765847f373ce2acbc611aec77c5 (diff) | |
download | scummvm-rg350-fb816708a2ff6faf8d8b6a5d7df9137d2bfbb1db.tar.gz scummvm-rg350-fb816708a2ff6faf8d8b6a5d7df9137d2bfbb1db.tar.bz2 scummvm-rg350-fb816708a2ff6faf8d8b6a5d7df9137d2bfbb1db.zip |
SCUMM HE: Fix warnings
Diffstat (limited to 'engines/scumm/he')
-rw-r--r-- | engines/scumm/he/moonbase/ai_defenseunit.cpp | 8 | ||||
-rw-r--r-- | engines/scumm/he/moonbase/ai_main.cpp | 7 | ||||
-rw-r--r-- | engines/scumm/he/moonbase/ai_node.h | 4 | ||||
-rw-r--r-- | engines/scumm/he/moonbase/ai_targetacquisition.h | 2 | ||||
-rw-r--r-- | engines/scumm/he/moonbase/ai_traveller.cpp | 16 | ||||
-rw-r--r-- | engines/scumm/he/moonbase/ai_tree.cpp | 27 | ||||
-rw-r--r-- | engines/scumm/he/moonbase/ai_tree.h | 4 | ||||
-rw-r--r-- | engines/scumm/he/moonbase/ai_types.cpp | 1 | ||||
-rw-r--r-- | engines/scumm/he/moonbase/ai_weapon.cpp | 1 |
9 files changed, 52 insertions, 18 deletions
diff --git a/engines/scumm/he/moonbase/ai_defenseunit.cpp b/engines/scumm/he/moonbase/ai_defenseunit.cpp index f1f0251dc6..ba180bac66 100644 --- a/engines/scumm/he/moonbase/ai_defenseunit.cpp +++ b/engines/scumm/he/moonbase/ai_defenseunit.cpp @@ -30,6 +30,13 @@ namespace Scumm { DefenseUnit::DefenseUnit() { _state = DUS_ON; + + _id = -1; + _distanceTo = 0; + _state = 0; + _radius = 0; + _armor = 0; + _cost = 0; } DefenseUnit::DefenseUnit(DefenseUnit *inUnit) { @@ -40,6 +47,7 @@ DefenseUnit::DefenseUnit(DefenseUnit *inUnit) { _state = inUnit->getState(); _radius = inUnit->getRadius(); _armor = inUnit->getArmor(); + _cost = inUnit->getCost(); } DefenseUnit::~DefenseUnit() { diff --git a/engines/scumm/he/moonbase/ai_main.cpp b/engines/scumm/he/moonbase/ai_main.cpp index 934c74e413..1357dda382 100644 --- a/engines/scumm/he/moonbase/ai_main.cpp +++ b/engines/scumm/he/moonbase/ai_main.cpp @@ -938,7 +938,7 @@ int masterControlProgram(const int paramCount, const int32 *params) { } } - delete launchAction; + delete[] launchAction; launchAction = NULL; AIstate = STATE_CHOOSE_BEHAVIOR; @@ -1880,7 +1880,7 @@ int *approachTarget(Tree *myTree, int &xTarget, int &yTarget, Node **currentNode int *retVal = NULL; *currentNode = NULL; - Node *retNode = myTree->aStarSearch_singlePass(currentNode); + Node *retNode = myTree->aStarSearch_singlePass(); if (*currentNode != NULL) warning("########################################### Got a possible solution"); @@ -1988,8 +1988,7 @@ int *acquireTarget(int targetX, int targetY, Tree *myTree, int &errorCode) { int currentPlayer = getCurrentPlayer(); int *retVal = NULL; - Node *currentNode = NULL; - Node *retNode = myTree->aStarSearch_singlePass(¤tNode); + Node *retNode = myTree->aStarSearch_singlePass(); if (myTree->IsBaseNode(retNode)) return acquireTarget(targetX, targetY); diff --git a/engines/scumm/he/moonbase/ai_node.h b/engines/scumm/he/moonbase/ai_node.h index 0a60dee9ca..0c3ef2f023 100644 --- a/engines/scumm/he/moonbase/ai_node.h +++ b/engines/scumm/he/moonbase/ai_node.h @@ -40,8 +40,8 @@ protected: virtual float calcH() { return 0; } public: - IContainedObject() { _valueG = 0; } - IContainedObject(float inG) { _valueG = inG; } + IContainedObject() { _valueG = 0; _objID = -1; } + IContainedObject(float inG) { _valueG = inG; _objID = -1; } IContainedObject(IContainedObject &sourceContainedObject); virtual ~IContainedObject() {} diff --git a/engines/scumm/he/moonbase/ai_targetacquisition.h b/engines/scumm/he/moonbase/ai_targetacquisition.h index cf8f295c70..6ac9e34751 100644 --- a/engines/scumm/he/moonbase/ai_targetacquisition.h +++ b/engines/scumm/he/moonbase/ai_targetacquisition.h @@ -47,7 +47,7 @@ private: public: - Sortie() {} + Sortie() { _unitType = 0; _shotPosX = _shotPosY = 0; } virtual ~Sortie(); static void setSourcePos(int x, int y) { diff --git a/engines/scumm/he/moonbase/ai_traveller.cpp b/engines/scumm/he/moonbase/ai_traveller.cpp index 68cf0c0d76..755ae36779 100644 --- a/engines/scumm/he/moonbase/ai_traveller.cpp +++ b/engines/scumm/he/moonbase/ai_traveller.cpp @@ -36,6 +36,14 @@ Traveller::Traveller() { _waterFlag = 0; setValueG(0); unsetDisabled(); + + _sourceHub = 0; + _angleTo = 0; + _powerTo = 0; + _waterSourceX = 0; + _waterSourceY = 0; + _waterDestX = 0; + _waterDestY = 0; } Traveller::Traveller(int originX, int originY) { @@ -45,6 +53,14 @@ Traveller::Traveller(int originX, int originY) { _posX = originX; _posY = originY; + + _sourceHub = 0; + _angleTo = 0; + _powerTo = 0; + _waterSourceX = 0; + _waterSourceY = 0; + _waterDestX = 0; + _waterDestY = 0; } void Traveller::adjustPosX(int offsetX) { diff --git a/engines/scumm/he/moonbase/ai_tree.cpp b/engines/scumm/he/moonbase/ai_tree.cpp index 7bd44f6644..2571928074 100644 --- a/engines/scumm/he/moonbase/ai_tree.cpp +++ b/engines/scumm/he/moonbase/ai_tree.cpp @@ -33,6 +33,8 @@ Tree::Tree() { pBaseNode = new Node; _maxDepth = MAX_DEPTH; _maxNodes = MAX_NODES; + _currentNode = 0; + _currentChildIndex = 0; _currentMap = new Common::SortedArray<TreeNode *>(compareTreeNodes); } @@ -42,6 +44,8 @@ Tree::Tree(IContainedObject *contents) { pBaseNode->setContainedObject(contents); _maxDepth = MAX_DEPTH; _maxNodes = MAX_NODES; + _currentNode = 0; + _currentChildIndex = 0; _currentMap = new Common::SortedArray<TreeNode *>(compareTreeNodes); } @@ -51,6 +55,8 @@ Tree::Tree(IContainedObject *contents, int maxDepth) { pBaseNode->setContainedObject(contents); _maxDepth = maxDepth; _maxNodes = MAX_NODES; + _currentNode = 0; + _currentChildIndex = 0; _currentMap = new Common::SortedArray<TreeNode *>(compareTreeNodes); } @@ -60,6 +66,8 @@ Tree::Tree(IContainedObject *contents, int maxDepth, int maxNodes) { pBaseNode->setContainedObject(contents); _maxDepth = maxDepth; _maxNodes = maxNodes; + _currentNode = 0; + _currentChildIndex = 0; _currentMap = new Common::SortedArray<TreeNode *>(compareTreeNodes); } @@ -81,6 +89,8 @@ Tree::Tree(const Tree *sourceTree) { _maxDepth = sourceTree->getMaxDepth(); _maxNodes = sourceTree->getMaxNodes(); _currentMap = new Common::SortedArray<TreeNode *>(compareTreeNodes); + _currentNode = 0; + _currentChildIndex = 0; duplicateTree(sourceTree->getBaseNode(), pBaseNode); } @@ -151,7 +161,7 @@ Node *Tree::aStarSearch() { Node *Tree::aStarSearch_singlePassInit() { Node *retNode = NULL; - currentChildIndex = 1; + _currentChildIndex = 1; float temp = pBaseNode->getContainedObject()->calcT(); @@ -164,18 +174,17 @@ Node *Tree::aStarSearch_singlePassInit() { return retNode; } -Node *Tree::aStarSearch_singlePass(Node **currentNode) { - currentNode = NULL; - float currentT; +Node *Tree::aStarSearch_singlePass() { + float currentT = 0.0; Node *retNode = NULL; static int maxTime = 0; - if (currentChildIndex == 1) { + if (_currentChildIndex == 1) { maxTime = getPlayerMaxTime(); } - if (currentChildIndex) { + if (_currentChildIndex) { if (!(_currentMap->size())) { retNode = _currentNode; return retNode; @@ -187,13 +196,13 @@ Node *Tree::aStarSearch_singlePass(Node **currentNode) { if ((_currentNode->getDepth() < _maxDepth) && (Node::getNodeCount() < _maxNodes) && ((!maxTime) || (getTimerValue(3) < maxTime))) { // Generate nodes - currentChildIndex = _currentNode->generateChildren(); + _currentChildIndex = _currentNode->generateChildren(); - if (currentChildIndex) { + if (_currentChildIndex) { Common::Array<Node *> vChildren = _currentNode->getChildren(); if (!vChildren.size() && !_currentMap->size()) { - currentChildIndex = 0; + _currentChildIndex = 0; retNode = _currentNode; } diff --git a/engines/scumm/he/moonbase/ai_tree.h b/engines/scumm/he/moonbase/ai_tree.h index 908786ad9a..5da5b3a920 100644 --- a/engines/scumm/he/moonbase/ai_tree.h +++ b/engines/scumm/he/moonbase/ai_tree.h @@ -45,7 +45,7 @@ private: int _maxDepth; int _maxNodes; - int currentChildIndex; + int _currentChildIndex; Common::SortedArray<TreeNode *> *_currentMap; Node *_currentNode; @@ -70,7 +70,7 @@ public: Node *aStarSearch(); Node *aStarSearch_singlePassInit(); - Node *aStarSearch_singlePass(Node **currentNode); + Node *aStarSearch_singlePass(); int IsBaseNode(Node *thisNode); }; diff --git a/engines/scumm/he/moonbase/ai_types.cpp b/engines/scumm/he/moonbase/ai_types.cpp index 1674e03777..e134f5ee12 100644 --- a/engines/scumm/he/moonbase/ai_types.cpp +++ b/engines/scumm/he/moonbase/ai_types.cpp @@ -27,6 +27,7 @@ namespace Scumm { AIEntity::AIEntity(int id) { switch (id) { + default: case BRUTAKAS: warning("BRUTAKAS"); _id = id; diff --git a/engines/scumm/he/moonbase/ai_weapon.cpp b/engines/scumm/he/moonbase/ai_weapon.cpp index b13d1efebe..ba50aae4d1 100644 --- a/engines/scumm/he/moonbase/ai_weapon.cpp +++ b/engines/scumm/he/moonbase/ai_weapon.cpp @@ -27,6 +27,7 @@ namespace Scumm { Weapon::Weapon(int typeID) { //, float damage, int radius) switch (typeID) { + default: case ITEM_BOMB: becomeBomb(); break; |