void ChangePartManager::showPart( ulong ulPart, bool bShow) { //验证 if (ulPart <= static_cast<ulong>(EEntityPart_Invalid) || ulPart >= static_cast<ulong>(EEntityPart_Max) ) return; switch( ulPart) { case EEntityPart_Armet: showArmet(bShow); break; case EEntityPart_Armor: showBody(bShow); break; case EEntityPart_Suit_Armet: showSuitArmet(bShow); break; case EEntityPart_Suit_Armor: showBody(!bShow); break; case EEntityPart_Weapon://by cjl showWeapon(bShow); break; default: break; } return; }
/* Function for sorting bodies */ static int compareBodies(const void* _a, const void* _b) { const Body* a = (const Body*) _a; const Body* b = (const Body*) _b; int rc; char* bufA; char* bufB; if ((rc = compareComponents(Mass(a), Mass(b)))) return rc; /* Masses equal, compare positions */ rc = compareVectors(Pos(a), Pos(b)); if (rc == 0) { bufA = showBody(a); bufB = showBody(b); mw_panic("Comparing bodies with equal positions: %s, %s\n", bufA, bufB); free(bufA); /* Never reached */ free(bufB); } return rc; }
void printBody(const Body* p) { char* buf = showBody(p); puts(buf); free(buf); }