aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic/pet_control
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/titanic/pet_control
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/titanic/pet_control')
-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
6 files changed, 24 insertions, 24 deletions
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;
}