fix crash when graphic for flipped missile is loaded already as sprite
This commit is contained in:
parent
538dc024bb
commit
22e5643611
2 changed files with 4 additions and 4 deletions
|
@ -174,7 +174,7 @@ public:
|
||||||
// minor programmatic editing features
|
// minor programmatic editing features
|
||||||
void OverlayGraphic(CGraphic *other, bool mask = false);
|
void OverlayGraphic(CGraphic *other, bool mask = false);
|
||||||
|
|
||||||
inline bool IsLoaded() const { return Surface != NULL; }
|
inline bool IsLoaded(bool flipped = false) const { return Surface != NULL && (!flipped || SurfaceFlip != NULL); }
|
||||||
|
|
||||||
//guichan
|
//guichan
|
||||||
virtual void *_getData() const { return Surface; }
|
virtual void *_getData() const { return Surface; }
|
||||||
|
|
|
@ -83,7 +83,7 @@ extern NumberDesc *Damage; /// Damage calculation for missile.
|
||||||
*/
|
*/
|
||||||
void MissileType::LoadMissileSprite()
|
void MissileType::LoadMissileSprite()
|
||||||
{
|
{
|
||||||
if (this->G && !this->G->IsLoaded()) {
|
if (this->G && !this->G->IsLoaded(this->Flip)) {
|
||||||
this->G->Load();
|
this->G->Load();
|
||||||
if (this->Flip) {
|
if (this->Flip) {
|
||||||
this->G->Flip();
|
this->G->Flip();
|
||||||
|
@ -495,7 +495,7 @@ static int MissileVisibleInViewport(const CViewport &vp, const Missile &missile)
|
||||||
void MissileType::DrawMissileType(int frame, const PixelPos &pos) const
|
void MissileType::DrawMissileType(int frame, const PixelPos &pos) const
|
||||||
{
|
{
|
||||||
#ifdef DYNAMIC_LOAD
|
#ifdef DYNAMIC_LOAD
|
||||||
if (!this->G->IsLoaded()) {
|
if (!this->G->IsLoaded(this->Flip)) {
|
||||||
((MissileType*)this)->LoadMissileSprite();
|
((MissileType*)this)->LoadMissileSprite();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -540,7 +540,7 @@ void Missile::DrawMissile(const CViewport &vp) const
|
||||||
// FIXME: I should copy SourcePlayer for second level missiles.
|
// FIXME: I should copy SourcePlayer for second level missiles.
|
||||||
if (sunit && sunit->Player) {
|
if (sunit && sunit->Player) {
|
||||||
#ifdef DYNAMIC_LOAD
|
#ifdef DYNAMIC_LOAD
|
||||||
if (!this->Type->G->IsLoaded()) {
|
if (!this->Type->G->IsLoaded(this->Type->Flip)) {
|
||||||
((MissileType*)this->Type)->LoadMissileSprite();
|
((MissileType*)this->Type)->LoadMissileSprite();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue