sample, edited code: "I want an armed freighter: auxiliary warship, carrier or PFT tender"
In this enhanced shiplist code tidbit:
- a quick test to see if it's actually an enhanced shiplist that the modified shiplist API loaded.
- an initial filter is done based on a given race
- ships with SPECIAL is filtered out.
- class type filter: narrow it down further using the enhanced shiplist code. Filter based on auxiliary class
- role type filter: we want that auxiliary to be a warship, pftender or carrier.
neat huh? This is a modified/simplified tidbit on something I did to make a better Convoy Escort mission. This is part of the qship code, mostly in case a qship failed to be picked. I modified NW's version of convoy escort mission.
if (gST.narrowed_sl.mIsEnhancedShiplist()) {
int32 fShiplistCount = 0;
ShipList aux_sl = gST.narrowed_sl;
tTeamInfo* freighterTeam = fMissionInfo->mGetTeamHandle( static_cast<eTeamID>( kFreighterTeam ) );
eRaceName freighterRace = freighterTeam->mGetRace();
std::list< eRace > raceList;
raceList.push_back(freighterRace);
fShiplistCount = aux_sl.Subset(raceList);
gST.mDebug_fprintf("subset for race (%d) filter completed. ships: %d\n", freighterRace, fShiplistCount);
// Strip out ships with SPECIAL
std::list< eClassTypes > classTypeList;
classTypeList.push_back(kClassSpecial);
fShiplistCount = aux_sl.Subset(classTypeList, false);
gST.mDebug_fprintf("subset for eClassTypes (no SPECIAL) completed. ships: %d\n", fShiplistCount);
fShiplistCount = aux_sl.Subset(auxClassTypeList, true);
std::list< eEnhancedClassTypes > auxClassTypeList_take2;
auxClassTypeList_take2.push_back(kEClassSmallAuxiliary);
auxClassTypeList_take2.push_back(kEClassLargeAuxiliary);
fShiplistCount = aux_sl.Subset(auxClassTypeList_take2, true);
gST.mDebug_fprintf("subset for auxiliary filter completed. ships: %d\n", fShiplistCount);
// aux classes: warship, carrier, PFT
std::list< eEnhancedRoles > auxRolesList;
auxRolesList.push_back(kWarShip);
auxRolesList.push_back(kCarrier);
auxRolesList.push_back(kPFTender);
fShiplistCount = aux_sl.Subset(auxRolesList, true);
gST.mDebug_fprintf("subset for auxiliary eEnhancedRoles completed. ships: %d\n", fShiplistCount);
}