diff --git a/src/stratagus/missile.cpp b/src/stratagus/missile.cpp index 4ab706c49..21afe41e3 100644 --- a/src/stratagus/missile.cpp +++ b/src/stratagus/missile.cpp @@ -691,15 +691,21 @@ global void DrawMissile(const MissileType* mtype,int frame,int x,int y) } } -local int MissileDrawLevelCompare(const void *v1, const void *v2) +/** +** FIXME: docu +*/ +local int MissileDrawLevelCompare(const void* v1, const void* v2) { - const Missile *c1 = *(Missile**)v1; - const Missile *c2 = *(Missile**)v2; + const Missile* c1; + const Missile* c2; - if ( c1->Type->DrawLevel == c2->Type->DrawLevel ) { + c1 = *(Missile**)v1; + c2 = *(Missile**)v2; + + if( c1->Type->DrawLevel == c2->Type->DrawLevel ) { return c1->MissileSlot < c2->MissileSlot ? -1 : 1; } else { - return c1->Type->DrawLevel <= c2->Type->DrawLevel ? -1 : 1; + return c1->Type->DrawLevel <= c2->Type->DrawLevel ? -1 : 1; } } /** @@ -707,7 +713,7 @@ local int MissileDrawLevelCompare(const void *v1, const void *v2) ** ** @param vp Viewport pointer. */ -global int FindAndSortMissiles(const Viewport* vp, Missile **table) +global int FindAndSortMissiles(const Viewport* vp, Missile** table) { Missile* missile; Missile* const* missiles; diff --git a/src/unit/unit_draw.cpp b/src/unit/unit_draw.cpp index e61aa31bc..97690644a 100644 --- a/src/unit/unit_draw.cpp +++ b/src/unit/unit_draw.cpp @@ -1889,26 +1889,33 @@ global void DrawUnit(const Unit* unit) #endif } -local int DrawLevelCompare(const void *v1, const void *v2) { +/** +** FIXME: docu +*/ +local int DrawLevelCompare(const void* v1, const void* v2) { + + const Unit* c1; + const Unit* c2; + int drawlevel1; + int drawlevel2; + + c1 = *(Unit**)v1; + c2 = *(Unit**)v2; - const Unit *c1 = *(Unit**)v1; - const Unit *c2 = *(Unit**)v2; - int DrawLevelA; - int DrawLevelB; if( c1->Orders[0].Action == UnitActionDie && c1->Type->CorpseType) { - DrawLevelA = c1->Type->CorpseType->DrawLevel; + drawlevel1 = c1->Type->CorpseType->DrawLevel; } else { - DrawLevelA = c1->Type->DrawLevel; + drawlevel1 = c1->Type->DrawLevel; } if( c2->Orders[0].Action == UnitActionDie && c2->Type->CorpseType) { - DrawLevelB = c2->Type->CorpseType->DrawLevel; + drawlevel2 = c2->Type->CorpseType->DrawLevel; } else { - DrawLevelB = c2->Type->DrawLevel; + drawlevel2 = c2->Type->DrawLevel; } - if( DrawLevelA == DrawLevelB ) { + if( drawlevel1 == drawlevel2 ) { return c1->Slot < c2->Slot ? -1 : 1; } else { - return DrawLevelA <= DrawLevelB ? -1 : 1; + return drawlevel1 <= drawlevel2 ? -1 : 1; } } /**