TITANIC: Convert some dynamic_casts back to static_cast as appropriate

This commit is contained in:
Paul Gilbert 2016-09-05 10:06:21 -04:00
parent f5ce9c167c
commit 610aab1c63
9 changed files with 17 additions and 17 deletions

View File

@ -1630,7 +1630,7 @@ bool CGameObject::starFn2() {
/*------------------------------------------------------------------------*/
void CGameObject::startTalking(const CString &npcName, uint id, CViewItem *view) {
CTrueTalkNPC *npc = dynamic_cast<CTrueTalkNPC *>(getRoot()->findByName(npcName));
CTrueTalkNPC *npc = static_cast<CTrueTalkNPC *>(getRoot()->findByName(npcName));
startTalking(npc, id, view);
}

View File

@ -85,7 +85,7 @@ void CProjectItem::buildFilesList() {
CTreeItem *treeItem = getFirstChild();
while (treeItem) {
if (treeItem->isFileItem()) {
CString name = dynamic_cast<CFileItem *>(treeItem)->getFilename();
CString name = static_cast<CFileItem *>(treeItem)->getFilename();
_files.add()->_name = name;
}

View File

@ -51,7 +51,7 @@ void CMaitreDProdReceptor::load(SimpleFile *file) {
}
bool CMaitreDProdReceptor::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
if (_fieldBC == 2 && dynamic_cast<CGameObject *>(getParent())->hasActiveMovie()) {
if (_fieldBC == 2 && static_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 && dynamic_cast<CGameObject *>(getParent())->hasActiveMovie())
if (_fieldBC == 2 && static_cast<CGameObject *>(getParent())->hasActiveMovie())
return false;
else if (++_counter < 20)
return true;
@ -81,7 +81,7 @@ bool CMaitreDProdReceptor::MouseMoveMsg(CMouseMoveMsg *msg) {
prodMsg._value = 125;
CMaitreD *maitreD = dynamic_cast<CMaitreD *>(findRoomObject("MaitreD"));
if (maitreD->_field100 <= 0)
if (maitreD && maitreD->_field100 <= 0)
prodMsg.execute(this);
return true;
@ -89,7 +89,7 @@ bool CMaitreDProdReceptor::MouseMoveMsg(CMouseMoveMsg *msg) {
bool CMaitreDProdReceptor::ProdMaitreDMsg(CProdMaitreDMsg *msg) {
if (_fieldC4) {
CMaitreD *maitreD = dynamic_cast<CMaitreD *>(findRoomObject("MaitreD"));
CMaitreD *maitreD = static_cast<CMaitreD *>(findRoomObject("MaitreD"));
if (maitreD->_field100 <= 0) {
CViewItem *view = findView();
startTalking(maitreD, msg->_value, view);

View File

@ -69,7 +69,7 @@ bool CSauceDispensor::Use(CUse *msg) {
CVisibleMsg visibleMsg(true);
if (msg->_item->isEquals("Chicken")) {
CChicken *chicken = dynamic_cast<CChicken *>(msg->_item);
CChicken *chicken = static_cast<CChicken *>(msg->_item);
_field104 = true;
if (_fieldF0) {
playSound("b#15.wav", 50);

View File

@ -203,8 +203,8 @@ void CPetInventoryGlyph::setItem(CGameObject *item, bool isLoading) {
if (_owner && item) {
int v1 = populateItem(item, isLoading);
_background = dynamic_cast<CPetInventoryGlyphs *>(_owner)->getBackground(v1);
_image = dynamic_cast<CPetInventory *>(getPetSection())->getImage(v1);
_background = static_cast<CPetInventoryGlyphs *>(_owner)->getBackground(v1);
_image = static_cast<CPetInventory *>(getPetSection())->getImage(v1);
}
}

View File

@ -48,7 +48,7 @@ CPetRemoteGlyphs *CPetRemoteGlyph::getOwner() const {
}
CPetGfxElement *CPetRemoteGlyph::getElement(uint id) const {
CPetRemote *remote = dynamic_cast<CPetRemote *>(_owner->getOwner());
CPetRemote *remote = static_cast<CPetRemote *>(_owner->getOwner());
return remote->getElement(id);
}

View File

@ -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 = dynamic_cast<const CPetRoomsGlyph *>(*i);
const CPetRoomsGlyph *glyph = static_cast<const CPetRoomsGlyph *>(*i);
if (glyph->isAssigned() && glyph->getRoomFlags() == roomFlags)
return true;
}

View File

@ -141,7 +141,7 @@ bool CPetRoomsGlyph::dragGlyph(const Point &topLeft, CMouseDragStartMsg *msg) {
void CPetRoomsGlyph::getTooltip(CPetText *text) {
CRoomFlags roomFlags(_roomFlags);
CPetRooms *owner = dynamic_cast<CPetRooms *>(getPetSection());
CPetRooms *owner = static_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 = dynamic_cast<CPetRoomsGlyph *>(glyph);
CPetRoomsGlyph *roomGlyph = static_cast<CPetRoomsGlyph *>(glyph);
return CPetGlyph::proc33(glyph) && _roomFlags == roomGlyph->_roomFlags;
}
@ -246,7 +246,7 @@ CPetRoomsGlyph *CPetRoomsGlyphs::findAssignedRoom() const {
CPetRoomsGlyph *CPetRoomsGlyphs::findGlyphByFlags(uint flags) const {
for (const_iterator i = begin(); i != end(); ++i) {
CPetRoomsGlyph *glyph = dynamic_cast<CPetRoomsGlyph *>(*i);
CPetRoomsGlyph *glyph = static_cast<CPetRoomsGlyph *>(*i);
if (glyph->getRoomFlags() == flags)
return glyph;
}

View File

@ -311,7 +311,7 @@ TTword *TTvocab::getSuffixedWord(TTstring &str) const {
if (word) {
if (word->_wordClass == WC_ADJECTIVE) {
TTadj *adj = dynamic_cast<TTadj *>(word);
TTadj *adj = static_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 = dynamic_cast<TTadj *>(word);
TTadj *adj = static_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 = dynamic_cast<TTadj *>(word);
TTadj *adj = static_cast<TTadj *>(word);
int val1 = word->proc15();
int val2 = word->proc15();