for cultureOnly...
Code:
//----------------------------------------------------------------------------
//
// Name : Player::CanBuildUnit
//
// Description: Checks whether the city can build the unit specified by type.
//
// Parameters : type: The unit type for that is checked whether the player can
// build it.
//
// Globals : g_player: The list of players
// g_theUnitDB: The unit database
// g_theWonderTracker: The wonder tracker
// g_exclusions: The exclusions data
//
// Returns : Whether the city can build the unit specified by type.
//
// Remark(s) : CultureOnly flag added by E. It allows only civilizations with
// the same CityStyle as CultureOnly's style to build that unit
//
//----------------------------------------------------------------------------
BOOL Player::CanBuildUnit(const sint32 type) const
{
const UnitRecord *rec = g_theUnitDB->Get(type);
if (!HasAdvance(rec->GetEnableAdvanceIndex()))
return FALSE;
sint32 o;
for(o = rec->GetNumObsoleteAdvance() - 1; o >= 0; o--) {
if(HasAdvance(rec->GetObsoleteAdvanceIndex(o)))
return FALSE;
}
if(g_exclusions->IsUnitExcluded(type))
return FALSE;
if(rec->GetCantBuild()) {
return FALSE;
}
if(rec->GetNumGovernmentType() > 0) {
sint32 i;
bool found = false;
for(i = 0; i < rec->GetNumGovernmentType(); i++) {
if(rec->GetGovernmentTypeIndex(i) == m_government_type) {
found = true;
break;
}
}
if(!found)
return FALSE;
}
if(rec->GetNuclearAttack() &&
wonderutil_GetNukesEliminated(g_theWonderTracker->GetBuiltWonders())) {
return FALSE;
}
if(rec->GetSlaveRaids() || rec->GetSettlerSlaveRaids() ||
rec->GetSlaveUprising()) {
if(wonderutil_GetFreeSlaves(g_theWonderTracker->GetBuiltWonders())) {
return FALSE;
}
}
if(rec->GetSlaveRaids() || rec->GetSettlerSlaveRaids()) {
sint32 i, n = m_all_units->Num();
for(i = 0; i < n; i++) {
if(m_all_units->Access(i).GetDBRec()->GetNoSlaves())
return FALSE;
}
}
if(rec->GetNoSlaves()) {
sint32 i, n = m_all_cities->Num();
for(i = 0; i < n; i++) {
if(m_all_cities->Access(i).CountSlaves() > 0)
return FALSE;
}
n = g_player[m_owner]->m_all_units->Num();
for(i = 0; i < n; i++) {
if(m_all_units->Access(i).GetDBRec()->GetSlaveRaids())
return FALSE;
}
}
if(rec->GetCreateParks() &&
!wonderutil_GetParkRangersEnabled(g_theWonderTracker->GetBuiltWonders())) {
return FALSE;
}[b]
#if !defined(ACTIVISION_ORIGINAL)
if(rec->GetNumCultureOnly() > 0) {
sint32 s;
for(s = 0; s < rec->GetNumCultureOnly(); s++) {
if(rec->GetCultureOnlyIndex(s) == GetCivilisation()->GetCityStyle()) {
return TRUE;
}
}
return FALSE;
}
#endif [/b]
return TRUE;
}

Comment