summaryrefslogtreecommitdiffstats
path: root/src/object/object.cpp
diff options
context:
space:
mode:
authorPiotr Dziwinski <piotrdz@gmail.com>2012-09-22 17:36:10 +0200
committerPiotr Dziwinski <piotrdz@gmail.com>2012-09-22 17:36:10 +0200
commitb1edcc822f95bdf619e1164e0d42325a71073452 (patch)
treebe8c39560b809ab0f75143df3960323b135cca6b /src/object/object.cpp
parentfd09071c29452bdfea2c519f0defbffebee42f4c (diff)
downloadcolobot-b1edcc822f95bdf619e1164e0d42325a71073452.tar.gz
colobot-b1edcc822f95bdf619e1164e0d42325a71073452.tar.bz2
colobot-b1edcc822f95bdf619e1164e0d42325a71073452.zip
Various fixes
- disabled UserDir() in path lookup - fixed crashes on loading missions in CObject - fixed texture bug in CTerrain - changed mouse move event handling to avoid flooding event queue - enabled all missions for testing
Diffstat (limited to 'src/object/object.cpp')
-rw-r--r--src/object/object.cpp60
1 files changed, 42 insertions, 18 deletions
diff --git a/src/object/object.cpp b/src/object/object.cpp
index 953de94..e93fa1e 100644
--- a/src/object/object.cpp
+++ b/src/object/object.cpp
@@ -7528,49 +7528,73 @@ void CObject::DeleteDeselList(CObject* pObj)
bool CObject::GetTraceDown()
{
- CMotionVehicle* mv;
- if ( m_motion == 0 ) return false;
- mv = dynamic_cast<CMotionVehicle*>(m_motion);
+ if (m_motion == nullptr) return false;
+ CMotionVehicle* mv = dynamic_cast<CMotionVehicle*>(m_motion);
+ if (mv == nullptr)
+ {
+ GetLogger()->Warn("GetTraceDown() invalid m_motion class!\n");
+ return false;
+ }
return mv->GetTraceDown();
}
void CObject::SetTraceDown(bool bDown)
{
- CMotionVehicle* mv;
- if ( m_motion == 0 ) return;
- mv = dynamic_cast<CMotionVehicle*>(m_motion);
+ if (m_motion == nullptr) return;
+ CMotionVehicle* mv = dynamic_cast<CMotionVehicle*>(m_motion);
+ if (mv == nullptr)
+ {
+ GetLogger()->Warn("SetTraceDown() invalid m_motion class!\n");
+ return;
+ }
mv->SetTraceDown(bDown);
}
int CObject::GetTraceColor()
{
- CMotionVehicle* mv;
- if ( m_motion == 0 ) return 0;
- mv = dynamic_cast<CMotionVehicle*>(m_motion);
+ if (m_motion == nullptr) return 0;
+ CMotionVehicle* mv = dynamic_cast<CMotionVehicle*>(m_motion);
+ if (mv == nullptr)
+ {
+ GetLogger()->Warn("GetTraceColor() invalid m_motion class!\n");
+ return 0;
+ }
return mv->GetTraceColor();
}
void CObject::SetTraceColor(int color)
{
- CMotionVehicle* mv;
- if ( m_motion == 0 ) return;
- mv = dynamic_cast<CMotionVehicle*>(m_motion);
+ if (m_motion == nullptr) return;
+ CMotionVehicle* mv = dynamic_cast<CMotionVehicle*>(m_motion);
+ if (mv == nullptr)
+ {
+ GetLogger()->Warn("SetTraceColor() invalid m_motion class!\n");
+ return;
+ }
mv->SetTraceColor(color);
}
float CObject::GetTraceWidth()
{
- CMotionVehicle* mv;
- if ( m_motion == 0 ) return 0.0f;
- mv = dynamic_cast<CMotionVehicle*>(m_motion);
+ if (m_motion == nullptr) return 0.0f;
+ CMotionVehicle* mv = dynamic_cast<CMotionVehicle*>(m_motion);
+ if (mv == nullptr)
+ {
+ GetLogger()->Warn("GetTraceWidth() invalid m_motion class!\n");
+ return 0.0f;
+ }
return mv->GetTraceWidth();
}
void CObject::SetTraceWidth(float width)
{
- CMotionVehicle* mv;
- if ( m_motion == 0 ) return;
- mv = dynamic_cast<CMotionVehicle*>(m_motion);
+ if (m_motion == nullptr) return;
+ CMotionVehicle* mv = dynamic_cast<CMotionVehicle*>(m_motion);
+ if (mv == nullptr)
+ {
+ GetLogger()->Warn("SetTraceWidth() invalid m_motion class!\n");
+ return;
+ }
mv->SetTraceWidth(width);
}