This commit is contained in:
jsalmon3 2003-04-22 05:03:12 +00:00
parent 46ae15d8bb
commit 36352b5262
2 changed files with 30 additions and 17 deletions

View file

@ -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;

View file

@ -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;
}
}
/**