This commit is contained in:
jsalmon3 2004-03-14 22:42:45 +00:00
parent 6cdd673007
commit ef1fb05827

View file

@ -1942,7 +1942,7 @@ global void DrawUnit(const Unit* unit)
}
/**
** FIXME: docu
** FIXME: docu
*/
local int DrawLevelCompare(const void* v1, const void* v2) {
@ -1950,8 +1950,7 @@ local int DrawLevelCompare(const void* v1, const void* v2) {
const Unit* c2;
int drawlevel1;
int drawlevel2;
int diffpos;
int diffpos;
c1 = *(Unit**)v1;
c2 = *(Unit**)v2;
@ -1967,12 +1966,12 @@ local int DrawLevelCompare(const void* v1, const void* v2) {
drawlevel2 = c2->Type->DrawLevel;
}
if (drawlevel1 == drawlevel2) {
// diffpos compares unit's Y positions (bottom of sprite) on the map and uses
// X position in case Y positions are equal.
// FIXME: Use BoxHeight?
diffpos = c1->Y * TileSizeY + c1->Type->Height + c1->IY - c2->Y * TileSizeY -
c2->Type->Height - c2->IY;
return diffpos ? diffpos : c1->X - c2->X ? c1->X - c2->X : c1->Slot - c2->Slot;
// diffpos compares unit's Y positions (bottom of sprite) on the map
// and uses X position in case Y positions are equal.
// FIXME: Use BoxHeight?
diffpos = c1->Y * TileSizeY + c1->IY + c1->Type->Height -
(c2->Y * TileSizeY + c2->IY + c2->Type->Height);
return diffpos ? diffpos : c1->X - c2->X ? c1->X - c2->X : c1->Slot - c2->Slot;
} else {
return drawlevel1 <= drawlevel2 ? -1 : 1;
}