aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2016-09-01 19:10:36 -0400
committerPaul Gilbert2016-09-01 19:10:36 -0400
commit33737ea2dcd97026706dd75f8c2c27fa148c165a (patch)
tree29784cf3e7c9270b02a67f0fe02829d3bab9bbd2 /engines
parentac740c8e39113f0cd50def490dba1c6d51e07e99 (diff)
downloadscummvm-rg350-33737ea2dcd97026706dd75f8c2c27fa148c165a.tar.gz
scummvm-rg350-33737ea2dcd97026706dd75f8c2c27fa148c165a.tar.bz2
scummvm-rg350-33737ea2dcd97026706dd75f8c2c27fa148c165a.zip
TITANIC: Convert many static_casts to dynamic_cast
Diffstat (limited to 'engines')
-rw-r--r--engines/titanic/carry/arm.cpp4
-rw-r--r--engines/titanic/carry/brain.cpp2
-rw-r--r--engines/titanic/carry/bridge_piece.cpp2
-rw-r--r--engines/titanic/carry/carry.cpp4
-rw-r--r--engines/titanic/carry/carry_parrot.cpp12
-rw-r--r--engines/titanic/carry/chicken.cpp4
-rw-r--r--engines/titanic/carry/magazine.cpp2
-rw-r--r--engines/titanic/carry/napkin.cpp2
-rw-r--r--engines/titanic/carry/phonograph_cylinder.cpp2
-rw-r--r--engines/titanic/core/game_object.cpp28
-rw-r--r--engines/titanic/core/mail_man.cpp4
-rw-r--r--engines/titanic/core/project_item.cpp2
-rw-r--r--engines/titanic/core/view_item.cpp2
-rw-r--r--engines/titanic/debugger.cpp2
-rw-r--r--engines/titanic/game/maitred/maitred_prod_receptor.cpp8
-rw-r--r--engines/titanic/game/sauce_dispensor.cpp4
-rw-r--r--engines/titanic/input_handler.cpp2
-rw-r--r--engines/titanic/npcs/parrot.cpp2
-rw-r--r--engines/titanic/pet_control/pet_control.cpp16
-rw-r--r--engines/titanic/pet_control/pet_drag_chev.cpp2
-rw-r--r--engines/titanic/pet_control/pet_inventory_glyphs.cpp12
-rw-r--r--engines/titanic/pet_control/pet_remote_glyphs.cpp6
-rw-r--r--engines/titanic/pet_control/pet_rooms.cpp4
-rw-r--r--engines/titanic/pet_control/pet_rooms_glyphs.cpp8
-rw-r--r--engines/titanic/support/avi_surface.cpp2
-rw-r--r--engines/titanic/true_talk/tt_parser.cpp8
-rw-r--r--engines/titanic/true_talk/tt_sentence.cpp4
-rw-r--r--engines/titanic/true_talk/tt_string_node.cpp2
-rw-r--r--engines/titanic/true_talk/tt_synonym.cpp2
-rw-r--r--engines/titanic/true_talk/tt_vocab.cpp16
-rw-r--r--engines/titanic/true_talk/tt_word.cpp2
31 files changed, 86 insertions, 86 deletions
diff --git a/engines/titanic/carry/arm.cpp b/engines/titanic/carry/arm.cpp
index 880c93d309..a67937ebdf 100644
--- a/engines/titanic/carry/arm.cpp
+++ b/engines/titanic/carry/arm.cpp
@@ -163,7 +163,7 @@ bool CArm::MaitreDHappyMsg(CMaitreDHappyMsg *msg) {
if (!_field158)
playSound("z#47.wav", 100, 0, 0);
if (_string6 == "Key" || _string6 == "AuditoryCentre") {
- CGameObject *child = static_cast<CGameObject *>(getFirstChild());
+ CGameObject *child = dynamic_cast<CGameObject *>(getFirstChild());
if (child) {
child->setVisible(true);
petAddToInventory();
@@ -184,7 +184,7 @@ bool CArm::MaitreDHappyMsg(CMaitreDHappyMsg *msg) {
bool CArm::PETGainedObjectMsg(CPETGainedObjectMsg *msg) {
if (_field158) {
if (_string6 == "Key" || _string6 == "AuditoryCentre") {
- CCarry *child = static_cast<CCarry *>(getFirstChild());
+ CCarry *child = dynamic_cast<CCarry *>(getFirstChild());
if (child) {
_visibleFrame = _field170;
loadFrame(_visibleFrame);
diff --git a/engines/titanic/carry/brain.cpp b/engines/titanic/carry/brain.cpp
index 8df0de9961..102d8d9049 100644
--- a/engines/titanic/carry/brain.cpp
+++ b/engines/titanic/carry/brain.cpp
@@ -55,7 +55,7 @@ void CBrain::load(SimpleFile *file) {
}
bool CBrain::UseWithOtherMsg(CUseWithOtherMsg *msg) {
- CBrainSlot *slot = static_cast<CBrainSlot *>(msg->_other);
+ CBrainSlot *slot = dynamic_cast<CBrainSlot *>(msg->_other);
if (slot) {
if (slot->getName() == "CentralCore") {
setVisible(false);
diff --git a/engines/titanic/carry/bridge_piece.cpp b/engines/titanic/carry/bridge_piece.cpp
index 6a22df3243..a2cb23add6 100644
--- a/engines/titanic/carry/bridge_piece.cpp
+++ b/engines/titanic/carry/bridge_piece.cpp
@@ -52,7 +52,7 @@ void CBridgePiece::load(SimpleFile *file) {
}
bool CBridgePiece::UseWithOtherMsg(CUseWithOtherMsg *msg) {
- CShipSetting *shipSetting = static_cast<CShipSetting *>(msg->_other);
+ CShipSetting *shipSetting = dynamic_cast<CShipSetting *>(msg->_other);
if (!shipSetting) {
return CCarry::UseWithOtherMsg(msg);
} else if (shipSetting->_itemName != "NULL") {
diff --git a/engines/titanic/carry/carry.cpp b/engines/titanic/carry/carry.cpp
index 75b3b6f35b..03798e8713 100644
--- a/engines/titanic/carry/carry.cpp
+++ b/engines/titanic/carry/carry.cpp
@@ -127,7 +127,7 @@ bool CCarry::MouseDragEndMsg(CMouseDragEndMsg *msg) {
return true;
}
- CCharacter *npc = static_cast<CCharacter *>(msg->_dropTarget);
+ CCharacter *npc = dynamic_cast<CCharacter *>(msg->_dropTarget);
if (npc) {
CUseWithCharMsg charMsg(npc);
charMsg.execute(this, nullptr, 0);
@@ -157,7 +157,7 @@ bool CCarry::MouseDragEndMsg(CMouseDragEndMsg *msg) {
}
bool CCarry::UseWithCharMsg(CUseWithCharMsg *msg) {
- CSuccUBus *succubus = static_cast<CSuccUBus *>(msg->_character);
+ CSuccUBus *succubus = dynamic_cast<CSuccUBus *>(msg->_character);
if (succubus) {
CSubAcceptCCarryMsg carryMsg;
carryMsg._item = this;
diff --git a/engines/titanic/carry/carry_parrot.cpp b/engines/titanic/carry/carry_parrot.cpp
index 8a453e348c..b0461ded26 100644
--- a/engines/titanic/carry/carry_parrot.cpp
+++ b/engines/titanic/carry/carry_parrot.cpp
@@ -133,7 +133,7 @@ bool CCarryParrot::MouseDragEndMsg(CMouseDragEndMsg *msg) {
actMsg.execute("ParrotCage");
}
} else {
- CCharacter *character = static_cast<CCharacter *>(msg->_dropTarget);
+ CCharacter *character = dynamic_cast<CCharacter *>(msg->_dropTarget);
if (character) {
CUseWithCharMsg charMsg(character);
charMsg.execute(this, nullptr, 0);
@@ -167,7 +167,7 @@ bool CCarryParrot::PassOnDragStartMsg(CPassOnDragStartMsg *msg) {
return CCarry::PassOnDragStartMsg(msg);
}
- CTrueTalkNPC *npc = static_cast<CTrueTalkNPC *>(getRoot()->findByName(_string6));
+ CTrueTalkNPC *npc = dynamic_cast<CTrueTalkNPC *>(getRoot()->findByName(_string6));
if (npc)
startTalking(npc, 0x446BF);
@@ -181,7 +181,7 @@ bool CCarryParrot::PassOnDragStartMsg(CPassOnDragStartMsg *msg) {
bool CCarryParrot::PreEnterViewMsg(CPreEnterViewMsg *msg) {
loadSurface();
- CCarryParrot *parrot = static_cast<CCarryParrot *>(getRoot()->findByName("CarryParrot"));
+ CCarryParrot *parrot = dynamic_cast<CCarryParrot *>(getRoot()->findByName("CarryParrot"));
if (parrot)
parrot->_fieldE0 = 0;
@@ -189,7 +189,7 @@ bool CCarryParrot::PreEnterViewMsg(CPreEnterViewMsg *msg) {
}
bool CCarryParrot::UseWithCharMsg(CUseWithCharMsg *msg) {
- CSuccUBus *succubus = static_cast<CSuccUBus *>(msg->_character);
+ CSuccUBus *succubus = dynamic_cast<CSuccUBus *>(msg->_character);
if (succubus)
CParrot::_v4 = 3;
@@ -198,7 +198,7 @@ bool CCarryParrot::UseWithCharMsg(CUseWithCharMsg *msg) {
bool CCarryParrot::ActMsg(CActMsg *msg) {
if (msg->_action == "FreeParrot" && (CParrot::_v4 == 4 || CParrot::_v4 == 1)) {
- CTrueTalkNPC *npc = static_cast<CTrueTalkNPC *>(getRoot()->findByName(_string6));
+ CTrueTalkNPC *npc = dynamic_cast<CTrueTalkNPC *>(getRoot()->findByName(_string6));
if (npc)
startTalking(npc, 0x446BF);
@@ -212,7 +212,7 @@ bool CCarryParrot::ActMsg(CActMsg *msg) {
playSound("z#475.wav", 100, 0, 0);
if (!_field140) {
- CCarry *feathers = static_cast<CCarry *>(getRoot()->findByName("Feathers"));
+ CCarry *feathers = dynamic_cast<CCarry *>(getRoot()->findByName("Feathers"));
if (feathers) {
feathers->setVisible(true);
feathers->petAddToInventory();
diff --git a/engines/titanic/carry/chicken.cpp b/engines/titanic/carry/chicken.cpp
index 65404dc65d..0e8f6b3653 100644
--- a/engines/titanic/carry/chicken.cpp
+++ b/engines/titanic/carry/chicken.cpp
@@ -80,7 +80,7 @@ bool CChicken::UseWithOtherMsg(CUseWithOtherMsg *msg) {
petAddToInventory();
} else {
- CSauceDispensor *dispensor = static_cast<CSauceDispensor *>(msg->_other);
+ CSauceDispensor *dispensor = dynamic_cast<CSauceDispensor *>(msg->_other);
if (!dispensor || _string6 == "None") {
return CCarry::UseWithOtherMsg(msg);
} else {
@@ -94,7 +94,7 @@ bool CChicken::UseWithOtherMsg(CUseWithOtherMsg *msg) {
}
bool CChicken::UseWithCharMsg(CUseWithCharMsg *msg) {
- CSuccUBus *succubus = static_cast<CSuccUBus *>(msg->_character);
+ CSuccUBus *succubus = dynamic_cast<CSuccUBus *>(msg->_character);
if (succubus) {
setPosition(Point(330, 300));
CSubAcceptCCarryMsg acceptMsg;
diff --git a/engines/titanic/carry/magazine.cpp b/engines/titanic/carry/magazine.cpp
index cdf92fc707..e68c63f8f9 100644
--- a/engines/titanic/carry/magazine.cpp
+++ b/engines/titanic/carry/magazine.cpp
@@ -52,7 +52,7 @@ void CMagazine::load(SimpleFile *file) {
}
bool CMagazine::UseWithCharMsg(CUseWithCharMsg *msg) {
- CDeskbot *deskbot = static_cast<CDeskbot *>(msg->_character);
+ CDeskbot *deskbot = dynamic_cast<CDeskbot *>(msg->_character);
if (deskbot) {
if (deskbot->_deskbotActive) {
setVisible(false);
diff --git a/engines/titanic/carry/napkin.cpp b/engines/titanic/carry/napkin.cpp
index d25e8b5975..d0ee9acc1a 100644
--- a/engines/titanic/carry/napkin.cpp
+++ b/engines/titanic/carry/napkin.cpp
@@ -43,7 +43,7 @@ void CNapkin::load(SimpleFile *file) {
}
bool CNapkin::UseWithOtherMsg(CUseWithOtherMsg *msg) {
- CChicken *chicken = static_cast<CChicken *>(msg->_other);
+ CChicken *chicken = dynamic_cast<CChicken *>(msg->_other);
if (chicken) {
if (chicken->_string6 == "None" || chicken->_field12C) {
CActMsg actMsg("Clean");
diff --git a/engines/titanic/carry/phonograph_cylinder.cpp b/engines/titanic/carry/phonograph_cylinder.cpp
index de0ed0a67c..3dedbc4ac9 100644
--- a/engines/titanic/carry/phonograph_cylinder.cpp
+++ b/engines/titanic/carry/phonograph_cylinder.cpp
@@ -102,7 +102,7 @@ void CPhonographCylinder::load(SimpleFile *file) {
}
bool CPhonographCylinder::UseWithOtherMsg(CUseWithOtherMsg *msg) {
- CPhonograph *phonograph = static_cast<CPhonograph *>(msg->_other);
+ CPhonograph *phonograph = dynamic_cast<CPhonograph *>(msg->_other);
if (phonograph) {
CSetVarMsg varMsg("m_RecordStatus", 1);
return true;
diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp
index 07358b8115..aa6ffda0e3 100644
--- a/engines/titanic/core/game_object.cpp
+++ b/engines/titanic/core/game_object.cpp
@@ -871,15 +871,15 @@ CViewItem *CGameObject::parseView(const CString &viewString) {
return nullptr;
// Find the designated node within the room
- CNodeItem *node = static_cast<CNodeItem *>(room->findChildInstanceOf(CNodeItem::_type));
+ CNodeItem *node = dynamic_cast<CNodeItem *>(room->findChildInstanceOf(CNodeItem::_type));
while (node && node->getName() != nodeName)
- node = static_cast<CNodeItem *>(room->findNextInstanceOf(CNodeItem::_type, node));
+ node = dynamic_cast<CNodeItem *>(room->findNextInstanceOf(CNodeItem::_type, node));
if (!node)
return nullptr;
- CViewItem *view = static_cast<CViewItem *>(node->findChildInstanceOf(CViewItem::_type));
+ CViewItem *view = dynamic_cast<CViewItem *>(node->findChildInstanceOf(CViewItem::_type));
while (view && view->getName() != viewName)
- view = static_cast<CViewItem *>(node->findNextInstanceOf(CViewItem::_type, view));
+ view = dynamic_cast<CViewItem *>(node->findNextInstanceOf(CViewItem::_type, view));
if (!view)
return nullptr;
@@ -964,12 +964,12 @@ CGameObject *CGameObject::getNextMail(CGameObject *prior) {
}
CGameObject *CGameObject::findRoomObject(const CString &name) const {
- return static_cast<CGameObject *>(findRoom()->findByName(name));
+ return dynamic_cast<CGameObject *>(findRoom()->findByName(name));
}
CGameObject *CGameObject::findInRoom(const CString &name) {
CRoomItem *room = getRoom();
- return room ? static_cast<CGameObject *>(room->findByName(name)) : nullptr;
+ return room ? dynamic_cast<CGameObject *>(room->findByName(name)) : nullptr;
}
Found CGameObject::find(const CString &name, CGameObject **item, int findAreas) {
@@ -996,7 +996,7 @@ Found CGameObject::find(const CString &name, CGameObject **item, int findAreas)
}
if (findAreas & FIND_GLOBAL) {
- go = static_cast<CGameObject *>(getRoot()->findByName(name));
+ go = dynamic_cast<CGameObject *>(getRoot()->findByName(name));
if (go) {
*item = go;
return FOUND_GLOBAL;
@@ -1227,7 +1227,7 @@ void CGameObject::dragMove(const Point &pt) {
CGameObject *CGameObject::getDraggingObject() const {
CTreeItem *item = getGameManager()->_dragItem;
- return static_cast<CGameObject *>(item);
+ return dynamic_cast<CGameObject *>(item);
}
Point CGameObject::getControid() const {
@@ -1255,7 +1255,7 @@ CDontSaveFileItem *CGameObject::getDontSave() const {
}
CPetControl *CGameObject::getPetControl() const {
- return static_cast<CPetControl *>(getDontSaveChild(CPetControl::_type));
+ return dynamic_cast<CPetControl *>(getDontSaveChild(CPetControl::_type));
}
CMailMan *CGameObject::getMailMan() const {
@@ -1294,7 +1294,7 @@ CRoomItem *CGameObject::locateRoom(const CString &name) const {
CGameObject *CGameObject::getHiddenObject(const CString &name) const {
CRoomItem *room = getHiddenRoom();
- return room ? static_cast<CGameObject *>(findUnder(room, name)) : nullptr;
+ return room ? dynamic_cast<CGameObject *>(findUnder(room, name)) : nullptr;
}
CTreeItem *CGameObject::findUnder(CTreeItem *parent, const CString &name) const {
@@ -1506,7 +1506,7 @@ CTreeItem *CGameObject::petContainerRemove(CGameObject *obj) {
if (!obj->compareRoomNameTo("CarryParcel"))
return obj;
- CGameObject *item = static_cast<CGameObject *>(pet->getLastChild());
+ CGameObject *item = dynamic_cast<CGameObject *>(pet->getLastChild());
if (item)
item->detach();
@@ -1601,11 +1601,11 @@ void CGameObject::petUnlockInput() {
/*------------------------------------------------------------------------*/
CStarControl *CGameObject::getStarControl() const {
- CStarControl *starControl = static_cast<CStarControl *>(getDontSaveChild(CStarControl::_type));
+ CStarControl *starControl = dynamic_cast<CStarControl *>(getDontSaveChild(CStarControl::_type));
if (!starControl) {
CViewItem *view = getGameManager()->getView();
if (view)
- starControl = static_cast<CStarControl *>(view->findChildInstanceOf(CStarControl::_type));
+ starControl = dynamic_cast<CStarControl *>(view->findChildInstanceOf(CStarControl::_type));
}
return starControl;
@@ -1625,7 +1625,7 @@ bool CGameObject::starFn2() {
/*------------------------------------------------------------------------*/
void CGameObject::startTalking(const CString &npcName, uint id, CViewItem *view) {
- CTrueTalkNPC *npc = static_cast<CTrueTalkNPC *>(getRoot()->findByName(npcName));
+ CTrueTalkNPC *npc = dynamic_cast<CTrueTalkNPC *>(getRoot()->findByName(npcName));
startTalking(npc, id, view);
}
diff --git a/engines/titanic/core/mail_man.cpp b/engines/titanic/core/mail_man.cpp
index afe13bebad..11e17fc4e5 100644
--- a/engines/titanic/core/mail_man.cpp
+++ b/engines/titanic/core/mail_man.cpp
@@ -37,14 +37,14 @@ void CMailMan::load(SimpleFile *file) {
}
CGameObject *CMailMan::getFirstObject() const {
- return static_cast<CGameObject *>(getFirstChild());
+ return dynamic_cast<CGameObject *>(getFirstChild());
}
CGameObject *CMailMan::getNextObject(CGameObject *prior) const {
if (!prior || prior->getParent() != this)
return nullptr;
- return static_cast<CGameObject *>(prior->getNextSibling());
+ return dynamic_cast<CGameObject *>(prior->getNextSibling());
}
void CMailMan::addMail(CGameObject *obj, int id) {
diff --git a/engines/titanic/core/project_item.cpp b/engines/titanic/core/project_item.cpp
index 76293233b0..df48bad501 100644
--- a/engines/titanic/core/project_item.cpp
+++ b/engines/titanic/core/project_item.cpp
@@ -85,7 +85,7 @@ void CProjectItem::buildFilesList() {
CTreeItem *treeItem = getFirstChild();
while (treeItem) {
if (treeItem->isFileItem()) {
- CString name = static_cast<CFileItem *>(treeItem)->getFilename();
+ CString name = dynamic_cast<CFileItem *>(treeItem)->getFilename();
_files.add()->_name = name;
}
diff --git a/engines/titanic/core/view_item.cpp b/engines/titanic/core/view_item.cpp
index 03e2753839..333b092ea4 100644
--- a/engines/titanic/core/view_item.cpp
+++ b/engines/titanic/core/view_item.cpp
@@ -169,7 +169,7 @@ void CViewItem::enterView(CViewItem *newView) {
CLinkItem *CViewItem::findLink(CViewItem *newView) {
for (CTreeItem *treeItem = getFirstChild(); treeItem;
treeItem = scan(treeItem)) {
- CLinkItem *link = static_cast<CLinkItem *>(treeItem);
+ CLinkItem *link = dynamic_cast<CLinkItem *>(treeItem);
if (link && link->connectsTo(newView))
return link;
}
diff --git a/engines/titanic/debugger.cpp b/engines/titanic/debugger.cpp
index 37fc546851..a9da83f724 100644
--- a/engines/titanic/debugger.cpp
+++ b/engines/titanic/debugger.cpp
@@ -231,7 +231,7 @@ bool Debugger::cmdItem(int argc, const char **argv) {
}
// Get the item
- CCarry *item = static_cast<CCarry *>(
+ CCarry *item = dynamic_cast<CCarry *>(
g_vm->_window->_project->findByName(argv[1]));
assert(item);
diff --git a/engines/titanic/game/maitred/maitred_prod_receptor.cpp b/engines/titanic/game/maitred/maitred_prod_receptor.cpp
index 66533a542f..2977d417a2 100644
--- a/engines/titanic/game/maitred/maitred_prod_receptor.cpp
+++ b/engines/titanic/game/maitred/maitred_prod_receptor.cpp
@@ -51,7 +51,7 @@ void CMaitreDProdReceptor::load(SimpleFile *file) {
}
bool CMaitreDProdReceptor::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
- if (_fieldBC == 2 && static_cast<CGameObject *>(getParent())->hasActiveMovie()) {
+ if (_fieldBC == 2 && dynamic_cast<CGameObject *>(getParent())->hasActiveMovie()) {
return false;
} else {
CProdMaitreDMsg prodMsg(126);
@@ -61,7 +61,7 @@ bool CMaitreDProdReceptor::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
}
bool CMaitreDProdReceptor::MouseMoveMsg(CMouseMoveMsg *msg) {
- if (_fieldBC == 2 && static_cast<CGameObject *>(getParent())->hasActiveMovie())
+ if (_fieldBC == 2 && dynamic_cast<CGameObject *>(getParent())->hasActiveMovie())
return false;
else if (++_counter < 20)
return true;
@@ -80,7 +80,7 @@ bool CMaitreDProdReceptor::MouseMoveMsg(CMouseMoveMsg *msg) {
else if (isEquals("Perch"))
prodMsg._value = 125;
- CMaitreD *maitreD = static_cast<CMaitreD *>(findRoomObject("MaitreD"));
+ CMaitreD *maitreD = dynamic_cast<CMaitreD *>(findRoomObject("MaitreD"));
if (maitreD->_field100 <= 0)
prodMsg.execute(this);
@@ -89,7 +89,7 @@ bool CMaitreDProdReceptor::MouseMoveMsg(CMouseMoveMsg *msg) {
bool CMaitreDProdReceptor::ProdMaitreDMsg(CProdMaitreDMsg *msg) {
if (_fieldC4) {
- CMaitreD *maitreD = static_cast<CMaitreD *>(findRoomObject("MaitreD"));
+ CMaitreD *maitreD = dynamic_cast<CMaitreD *>(findRoomObject("MaitreD"));
if (maitreD->_field100 <= 0) {
CViewItem *view = findView();
startTalking(maitreD, msg->_value, view);
diff --git a/engines/titanic/game/sauce_dispensor.cpp b/engines/titanic/game/sauce_dispensor.cpp
index 29f0be7ee4..adc0b828a2 100644
--- a/engines/titanic/game/sauce_dispensor.cpp
+++ b/engines/titanic/game/sauce_dispensor.cpp
@@ -69,7 +69,7 @@ bool CSauceDispensor::Use(CUse *msg) {
CVisibleMsg visibleMsg(true);
if (msg->_item->isEquals("Chicken")) {
- CChicken *chicken = static_cast<CChicken *>(msg->_item);
+ CChicken *chicken = dynamic_cast<CChicken *>(msg->_item);
_field104 = true;
if (_fieldF0) {
playSound("b#15.wav", 50);
@@ -98,7 +98,7 @@ bool CSauceDispensor::Use(CUse *msg) {
petDisplayMessage(1, "Sadly, this dispenser is currently empty.");
} else if (msg->_item->isEquals("BeerGlass")) {
- CGlass *glass = static_cast<CGlass *>(msg->_item);
+ CGlass *glass = dynamic_cast<CGlass *>(msg->_item);
_field108 = true;
if (_field104 || _fieldF0) {
diff --git a/engines/titanic/input_handler.cpp b/engines/titanic/input_handler.cpp
index 7c35a5d855..2c51f3ece7 100644
--- a/engines/titanic/input_handler.cpp
+++ b/engines/titanic/input_handler.cpp
@@ -150,7 +150,7 @@ CGameObject *CInputHandler::dragEnd(const Point &pt, CTreeItem *dragItem) {
// Scan through the view items to find the item being dropped on
CGameObject *target = nullptr;
for (CTreeItem *treeItem = view->scan(view); treeItem; treeItem = treeItem->scan(view)) {
- CGameObject *gameObject = static_cast<CGameObject *>(treeItem);
+ CGameObject *gameObject = dynamic_cast<CGameObject *>(treeItem);
if (gameObject && gameObject != dragItem) {
if (gameObject->checkPoint(pt))
target = gameObject;
diff --git a/engines/titanic/npcs/parrot.cpp b/engines/titanic/npcs/parrot.cpp
index 53e6884415..6e7aa4ec57 100644
--- a/engines/titanic/npcs/parrot.cpp
+++ b/engines/titanic/npcs/parrot.cpp
@@ -386,7 +386,7 @@ bool CParrot::MouseDragStartMsg(CMouseDragStartMsg *msg) {
startTalking(this, 280129);
performAction(true);
- CCarry *item = static_cast<CCarry *>(getRoot()->findByName(_string2));
+ CCarry *item = dynamic_cast<CCarry *>(getRoot()->findByName(_string2));
if (item) {
item->_fieldE0 = 1;
CPassOnDragStartMsg passMsg;
diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp
index a0f8fab267..7ab76ddc1d 100644
--- a/engines/titanic/pet_control/pet_control.cpp
+++ b/engines/titanic/pet_control/pet_control.cpp
@@ -152,7 +152,7 @@ void CPetControl::postLoad() {
if (!_activeNPCName.empty() && root)
_activeNPC = root->findByName(_activeNPCName);
if (!_remoteTargetName.empty() && root)
- _remoteTarget = static_cast<CGameObject *>(root->findByName(_remoteTargetName));
+ _remoteTarget = dynamic_cast<CGameObject *>(root->findByName(_remoteTargetName));
setArea(_currentArea);
loaded();
@@ -255,7 +255,7 @@ CRoomItem *CPetControl::getHiddenRoom() {
CGameObject *CPetControl::getHiddenObject(const CString &name) {
CRoomItem *room = getHiddenRoom();
- return room ? static_cast<CGameObject *>(findUnder(room, name)) : nullptr;
+ return room ? dynamic_cast<CGameObject *>(findUnder(room, name)) : nullptr;
}
bool CPetControl::containsPt(const Common::Point &pt) const {
@@ -381,21 +381,21 @@ void CPetControl::displayMessage(const CString &msg) const {
}
CGameObject *CPetControl::getFirstObject() const {
- return static_cast<CGameObject *>(getFirstChild());
+ return dynamic_cast<CGameObject *>(getFirstChild());
}
CGameObject *CPetControl::getNextObject(CGameObject *prior) const {
if (!prior || prior->getParent() != this)
return nullptr;
- return static_cast<CGameObject *>(prior->getNextSibling());
+ return dynamic_cast<CGameObject *>(prior->getNextSibling());
}
void CPetControl::addToInventory(CGameObject *item) {
item->detach();
if (item->getName() == "CarryParcel") {
- CCarry *child = static_cast<CCarry *>(getLastChild());
+ CCarry *child = dynamic_cast<CCarry *>(getLastChild());
if (child)
child->detach();
@@ -546,7 +546,7 @@ bool CPetControl::isBotInView(const CString &name) const {
// Iterate to find NPC
for (CTreeItem *child = view->getFirstChild(); child; child = child->scan(view)) {
- CGameObject *gameObject = static_cast<CGameObject *>(child);
+ CGameObject *gameObject = dynamic_cast<CGameObject *>(child);
if (gameObject) {
if (!gameObject->getName().compareToIgnoreCase(name))
return true;
@@ -614,7 +614,7 @@ bool CPetControl::isDoorOrBellbotPresent() const {
for (CTreeItem *treeItem = view->getFirstChild(); treeItem;
treeItem = treeItem->scan(view)) {
CString name = treeItem->getName();
- if (static_cast<CGameObject *>(treeItem) &&
+ if (dynamic_cast<CGameObject *>(treeItem) &&
(name.contains("Doorbot") || name.contains("BellBot")))
return true;
}
@@ -643,7 +643,7 @@ void CPetControl::setTimerPersisent(int id, bool flag) {
CGameObject *CPetControl::findBot(const CString &name, CTreeItem *root) {
for (CTreeItem *item = root; item; item = item->scan(root)) {
if (!item->getName().compareToIgnoreCase(name)) {
- CGameObject *obj = static_cast<CGameObject *>(item);
+ CGameObject *obj = dynamic_cast<CGameObject *>(item);
if (obj)
return obj;
}
diff --git a/engines/titanic/pet_control/pet_drag_chev.cpp b/engines/titanic/pet_control/pet_drag_chev.cpp
index d437d43799..7816570a23 100644
--- a/engines/titanic/pet_control/pet_drag_chev.cpp
+++ b/engines/titanic/pet_control/pet_drag_chev.cpp
@@ -55,7 +55,7 @@ bool CPetDragChev::MouseDragMoveMsg(CMouseDragMoveMsg *msg) {
bool CPetDragChev::MouseDragEndMsg(CMouseDragEndMsg *msg) {
if (msg->_dropTarget) {
- CSuccUBus *succubus = static_cast<CSuccUBus *>(msg->_dropTarget);
+ CSuccUBus *succubus = dynamic_cast<CSuccUBus *>(msg->_dropTarget);
if (succubus) {
CSetChevRoomBits chevMsg(_id);
diff --git a/engines/titanic/pet_control/pet_inventory_glyphs.cpp b/engines/titanic/pet_control/pet_inventory_glyphs.cpp
index ae306649a2..783a8a9717 100644
--- a/engines/titanic/pet_control/pet_inventory_glyphs.cpp
+++ b/engines/titanic/pet_control/pet_inventory_glyphs.cpp
@@ -165,7 +165,7 @@ void CPetInventoryGlyph::getTooltip(CPetText *text) {
bool CPetInventoryGlyph::doAction(CGlyphAction *action) {
CInventoryGlyphAction *invAction = static_cast<CInventoryGlyphAction *>(action);
- CPetInventoryGlyphs *owner = static_cast<CPetInventoryGlyphs *>(_owner);
+ CPetInventoryGlyphs *owner = dynamic_cast<CPetInventoryGlyphs *>(_owner);
if (!invAction)
return false;
@@ -203,8 +203,8 @@ void CPetInventoryGlyph::setItem(CGameObject *item, int val) {
if (_owner && item) {
int v1 = populateItem(item, val);
- _background = static_cast<CPetInventoryGlyphs *>(_owner)->getBackground(v1);
- _image = static_cast<CPetInventory *>(getPetSection())->getImage(v1);
+ _background = dynamic_cast<CPetInventoryGlyphs *>(_owner)->getBackground(v1);
+ _image = dynamic_cast<CPetInventory *>(getPetSection())->getImage(v1);
}
}
@@ -293,7 +293,7 @@ int CPetInventoryGlyph::subMode(CGameObject *item, int val) {
void CPetInventoryGlyph::startBackgroundMovie() {
if (_owner) {
- CPetInventory *section = static_cast<CPetInventory *>(_owner->getOwner());
+ CPetInventory *section = dynamic_cast<CPetInventory *>(_owner->getOwner());
if (section)
section->playMovie(_background, 1);
}
@@ -301,7 +301,7 @@ void CPetInventoryGlyph::startBackgroundMovie() {
void CPetInventoryGlyph::startForegroundMovie() {
if (_owner) {
- CPetInventory *section = static_cast<CPetInventory *>(_owner->getOwner());
+ CPetInventory *section = dynamic_cast<CPetInventory *>(_owner->getOwner());
if (section)
section->playMovie(_image, 1);
}
@@ -309,7 +309,7 @@ void CPetInventoryGlyph::startForegroundMovie() {
void CPetInventoryGlyph::stopMovie() {
if (_owner) {
- CPetInventory *section = static_cast<CPetInventory *>(_owner->getOwner());
+ CPetInventory *section = dynamic_cast<CPetInventory *>(_owner->getOwner());
if (section)
section->playMovie(nullptr, 1);
}
diff --git a/engines/titanic/pet_control/pet_remote_glyphs.cpp b/engines/titanic/pet_control/pet_remote_glyphs.cpp
index 6b7c8cb4ae..35a7ab39ac 100644
--- a/engines/titanic/pet_control/pet_remote_glyphs.cpp
+++ b/engines/titanic/pet_control/pet_remote_glyphs.cpp
@@ -29,7 +29,7 @@
namespace Titanic {
CPetRemote *CPetRemoteGlyphs::getOwner() const {
- return static_cast<CPetRemote *>(_owner);
+ return dynamic_cast<CPetRemote *>(_owner);
}
void CPetRemoteGlyphs::generateMessage(RemoteMessage msgNum, const CString &name, int num) {
@@ -44,11 +44,11 @@ void CPetRemoteGlyph::setDefaults(const CString &name, CPetControl *petControl)
}
CPetRemoteGlyphs *CPetRemoteGlyph::getOwner() const {
- return static_cast<CPetRemoteGlyphs *>(_owner);
+ return dynamic_cast<CPetRemoteGlyphs *>(_owner);
}
CPetGfxElement *CPetRemoteGlyph::getElement(uint id) const {
- CPetRemote *remote = static_cast<CPetRemote *>(_owner->getOwner());
+ CPetRemote *remote = dynamic_cast<CPetRemote *>(_owner->getOwner());
return remote->getElement(id);
}
diff --git a/engines/titanic/pet_control/pet_rooms.cpp b/engines/titanic/pet_control/pet_rooms.cpp
index 2415c96966..2ec66b08e2 100644
--- a/engines/titanic/pet_control/pet_rooms.cpp
+++ b/engines/titanic/pet_control/pet_rooms.cpp
@@ -304,7 +304,7 @@ CPetRoomsGlyph *CPetRooms::addRoom(uint roomFlags, bool highlight_) {
// Do a preliminary scan of the glyph list for any glyph that is
// no longer valid, and thus can be removed
for (CPetRoomsGlyphs::iterator i = _glyphs.begin(); i != _glyphs.end(); ++i) {
- CPetRoomsGlyph *glyph = static_cast<CPetRoomsGlyph *>(*i);
+ CPetRoomsGlyph *glyph = dynamic_cast<CPetRoomsGlyph *>(*i);
if (!glyph->isAssigned()) {
_glyphs.erase(i);
break;
@@ -340,7 +340,7 @@ bool CPetRooms::changeLocationClass(int newClassNum) {
bool CPetRooms::hasRoomFlags(uint roomFlags) const {
for (CPetRoomsGlyphs::const_iterator i = _glyphs.begin(); i != _glyphs.end(); ++i) {
- const CPetRoomsGlyph *glyph = static_cast<const CPetRoomsGlyph *>(*i);
+ const CPetRoomsGlyph *glyph = dynamic_cast<const CPetRoomsGlyph *>(*i);
if (glyph->isAssigned() && glyph->getRoomFlags() == roomFlags)
return true;
}
diff --git a/engines/titanic/pet_control/pet_rooms_glyphs.cpp b/engines/titanic/pet_control/pet_rooms_glyphs.cpp
index d9e19b1f67..d7ac634f5d 100644
--- a/engines/titanic/pet_control/pet_rooms_glyphs.cpp
+++ b/engines/titanic/pet_control/pet_rooms_glyphs.cpp
@@ -141,7 +141,7 @@ bool CPetRoomsGlyph::dragGlyph(const Point &topLeft, CMouseDragStartMsg *msg) {
void CPetRoomsGlyph::getTooltip(CPetText *text) {
CRoomFlags roomFlags(_roomFlags);
- CPetRooms *owner = static_cast<CPetRooms *>(getPetSection());
+ CPetRooms *owner = dynamic_cast<CPetRooms *>(getPetSection());
CString msg;
if (isCurrentlyAssigned()) {
@@ -172,7 +172,7 @@ void CPetRoomsGlyph::saveGlyph(SimpleFile *file, int indent) {
}
bool CPetRoomsGlyph::proc33(CPetGlyph *glyph) {
- CPetRoomsGlyph *roomGlyph = static_cast<CPetRoomsGlyph *>(glyph);
+ CPetRoomsGlyph *roomGlyph = dynamic_cast<CPetRoomsGlyph *>(glyph);
return CPetGlyph::proc33(glyph) && _roomFlags == roomGlyph->_roomFlags;
}
@@ -236,7 +236,7 @@ void CPetRoomsGlyphs::saveGlyphs(SimpleFile *file, int indent) {
CPetRoomsGlyph *CPetRoomsGlyphs::findAssignedRoom() const {
for (const_iterator i = begin(); i != end(); ++i) {
- CPetRoomsGlyph *glyph = static_cast<CPetRoomsGlyph *>(*i);
+ CPetRoomsGlyph *glyph = dynamic_cast<CPetRoomsGlyph *>(*i);
if (glyph->isCurrentlyAssigned())
return glyph;
}
@@ -246,7 +246,7 @@ CPetRoomsGlyph *CPetRoomsGlyphs::findAssignedRoom() const {
CPetRoomsGlyph *CPetRoomsGlyphs::findGlyphByFlags(uint flags) const {
for (const_iterator i = begin(); i != end(); ++i) {
- CPetRoomsGlyph *glyph = static_cast<CPetRoomsGlyph *>(*i);
+ CPetRoomsGlyph *glyph = dynamic_cast<CPetRoomsGlyph *>(*i);
if (glyph->getRoomFlags() == flags)
return glyph;
}
diff --git a/engines/titanic/support/avi_surface.cpp b/engines/titanic/support/avi_surface.cpp
index ac6cc6dbe7..d4ebd5cef1 100644
--- a/engines/titanic/support/avi_surface.cpp
+++ b/engines/titanic/support/avi_surface.cpp
@@ -33,7 +33,7 @@ namespace Titanic {
Video::AVIDecoder::AVIVideoTrack &AVIDecoder::getVideoTrack() {
for (TrackListIterator it = getTrackListBegin(); it != getTrackListEnd(); it++)
if ((*it)->getTrackType() == Track::kTrackTypeVideo)
- return *static_cast<AVIVideoTrack *>(*it);
+ return *dynamic_cast<AVIVideoTrack *>(*it);
error("Could not find video track");
}
diff --git a/engines/titanic/true_talk/tt_parser.cpp b/engines/titanic/true_talk/tt_parser.cpp
index 1d9c199054..95a302d53c 100644
--- a/engines/titanic/true_talk/tt_parser.cpp
+++ b/engines/titanic/true_talk/tt_parser.cpp
@@ -575,7 +575,7 @@ int TTparser::loadRequests(TTword *word) {
if (_sentenceConcept) {
if (_sentenceConcept->get18() == 0 || _sentenceConcept->get18() == 2) {
- TTaction *action = static_cast<TTaction *>(word);
+ TTaction *action = dynamic_cast<TTaction *>(word);
_sentenceConcept->set18(action->getVal());
}
}
@@ -1273,7 +1273,7 @@ int TTparser::considerRequests(TTword *word) {
break;
}
- TTparserNode *nextP = static_cast<TTparserNode *>(nodeP->_nextP);
+ TTparserNode *nextP = dynamic_cast<TTparserNode *>(nodeP->_nextP);
if (flag)
delete nodeP;
nodeP = nextP;
@@ -1375,7 +1375,7 @@ void TTparser::removeConcept(TTconcept *concept) {
void TTparser::removeNode(TTparserNode *node) {
if (!node->_priorP)
// Node is the head of the chain, so reset parser's nodes pointer
- _nodesP = static_cast<TTparserNode *>(node->_nextP);
+ _nodesP = dynamic_cast<TTparserNode *>(node->_nextP);
delete node;
}
@@ -1525,7 +1525,7 @@ int TTparser::fn2(TTword *word) {
case 602:
case 607:
- return checkReferent(static_cast<TTpronoun *>(word));
+ return checkReferent(dynamic_cast<TTpronoun *>(word));
case 608:
return 1;
diff --git a/engines/titanic/true_talk/tt_sentence.cpp b/engines/titanic/true_talk/tt_sentence.cpp
index 9588ee021e..f187710de7 100644
--- a/engines/titanic/true_talk/tt_sentence.cpp
+++ b/engines/titanic/true_talk/tt_sentence.cpp
@@ -83,7 +83,7 @@ void TTsentence::copyFrom(const TTsentence &src) {
if (src._nodesP) {
// Source has processed nodes, so duplicate them
for (TTsentenceNode *node = src._nodesP; node;
- node = static_cast<TTsentenceNode *>(node->_nextP)) {
+ node = dynamic_cast<TTsentenceNode *>(node->_nextP)) {
TTsentenceNode *newNode = new TTsentenceNode(node->_wordP);
if (_nodesP)
_nodesP->addToTail(newNode);
@@ -319,7 +319,7 @@ bool TTsentence::localWord(const char *str) const {
bool result = false;
for (TTsentenceNode *nodeP = _nodesP; nodeP && !result;
- nodeP = static_cast<TTsentenceNode *>(nodeP->_nextP)) {
+ nodeP = dynamic_cast<TTsentenceNode *>(nodeP->_nextP)) {
TTsynonym syn;
if (!nodeP->_wordP)
continue;
diff --git a/engines/titanic/true_talk/tt_string_node.cpp b/engines/titanic/true_talk/tt_string_node.cpp
index 2bb0c5a74b..5a21d73a9b 100644
--- a/engines/titanic/true_talk/tt_string_node.cpp
+++ b/engines/titanic/true_talk/tt_string_node.cpp
@@ -55,7 +55,7 @@ void TTstringNode::initialize(TTstringNode *oldNode) {
}
TTstringNode *TTstringNode::findByName(const TTstring &str, int mode) {
- for (TTstringNode *nodeP = this; nodeP; nodeP = static_cast<TTstringNode *>(nodeP->_nextP)) {
+ for (TTstringNode *nodeP = this; nodeP; nodeP = dynamic_cast<TTstringNode *>(nodeP->_nextP)) {
if (nodeP->_mode == mode || (mode == 3 && nodeP->_mode < 3)) {
if (nodeP->_string == str)
return nodeP;
diff --git a/engines/titanic/true_talk/tt_synonym.cpp b/engines/titanic/true_talk/tt_synonym.cpp
index 0f56c5cb22..b476efefcb 100644
--- a/engines/titanic/true_talk/tt_synonym.cpp
+++ b/engines/titanic/true_talk/tt_synonym.cpp
@@ -60,7 +60,7 @@ TTsynonym *TTsynonym::copyFrom(const TTsynonym *src) {
}
int TTsynonym::save(SimpleFile *file) {
- for (TTstringNode *synP = this; synP; synP = static_cast<TTstringNode *>(synP->_nextP)) {
+ for (TTstringNode *synP = this; synP; synP = dynamic_cast<TTstringNode *>(synP->_nextP)) {
file->writeFormat("%s", " 0 ");
synP->_string.save(file);
file->writeFormat("%c", ' ');
diff --git a/engines/titanic/true_talk/tt_vocab.cpp b/engines/titanic/true_talk/tt_vocab.cpp
index 08d6e9e1a7..1d4d2ebbf2 100644
--- a/engines/titanic/true_talk/tt_vocab.cpp
+++ b/engines/titanic/true_talk/tt_vocab.cpp
@@ -288,7 +288,7 @@ TTword *TTvocab::getSuffixedWord(TTstring &str) const {
if (word) {
if (word->_wordClass == WC_ACTION) {
- static_cast<TTaction *>(word)->setVal(1);
+ dynamic_cast<TTaction *>(word)->setVal(1);
}
} else {
tempStr = str;
@@ -311,7 +311,7 @@ TTword *TTvocab::getSuffixedWord(TTstring &str) const {
if (word) {
if (word->_wordClass == WC_ADJECTIVE) {
- TTadj *adj = static_cast<TTadj *>(word);
+ TTadj *adj = dynamic_cast<TTadj *>(word);
int val1 = word->proc15();
int val2 = word->proc15();
@@ -331,7 +331,7 @@ TTword *TTvocab::getSuffixedWord(TTstring &str) const {
if (word) {
if (word->_wordClass == WC_ADJECTIVE) {
- TTadj *adj = static_cast<TTadj *>(word);
+ TTadj *adj = dynamic_cast<TTadj *>(word);
int val1 = word->proc15();
int val2 = word->proc15();
@@ -350,7 +350,7 @@ TTword *TTvocab::getSuffixedWord(TTstring &str) const {
word = getPrimeWord(tempStr);
if (word && word->_wordClass == WC_ADJECTIVE) {
- TTadj *adj = static_cast<TTadj *>(word);
+ TTadj *adj = dynamic_cast<TTadj *>(word);
int val1 = word->proc15();
int val2 = word->proc15();
@@ -373,7 +373,7 @@ TTword *TTvocab::getSuffixedWord(TTstring &str) const {
if (word) {
if (word->_wordClass == WC_ADJECTIVE) {
- TTadj *adj = static_cast<TTadj *>(word);
+ TTadj *adj = dynamic_cast<TTadj *>(word);
int val1 = word->proc15();
int val2 = word->proc15();
@@ -393,7 +393,7 @@ TTword *TTvocab::getSuffixedWord(TTstring &str) const {
if (word) {
if (word->_wordClass == WC_ADJECTIVE) {
- TTadj *adj = static_cast<TTadj *>(word);
+ TTadj *adj = dynamic_cast<TTadj *>(word);
int val1 = word->proc15();
int val2 = word->proc15();
@@ -412,7 +412,7 @@ TTword *TTvocab::getSuffixedWord(TTstring &str) const {
word = getPrimeWord(tempStr);
if (word) {
- TTadj *adj = static_cast<TTadj *>(word);
+ TTadj *adj = dynamic_cast<TTadj *>(word);
int val1 = word->proc15();
int val2 = word->proc15();
@@ -529,7 +529,7 @@ TTword *TTvocab::getPrefixedWord(TTstring &str) const {
if (!word)
tempStr = str;
else if (word->_wordClass == WC_ADJECTIVE) {
- TTadj *adj = static_cast<TTadj *>(word);
+ TTadj *adj = dynamic_cast<TTadj *>(word);
int val1 = word->proc15();
int val2 = word->proc15();
diff --git a/engines/titanic/true_talk/tt_word.cpp b/engines/titanic/true_talk/tt_word.cpp
index df6ee5c7bc..c8676e4b1e 100644
--- a/engines/titanic/true_talk/tt_word.cpp
+++ b/engines/titanic/true_talk/tt_word.cpp
@@ -173,7 +173,7 @@ bool TTword::findSynByName(const TTstring &str, TTsynonym *dest, int mode) const
if (!_synP)
return false;
- const TTsynonym *synP = static_cast<const TTsynonym *>(_synP->findByName(str, mode));
+ const TTsynonym *synP = dynamic_cast<const TTsynonym *>(_synP->findByName(str, mode));
if (synP) {
dest->copyFrom(synP);
dest->_priorP = nullptr;