well I attempted these two. They are spliced from the GetSlaves in CanBuildUnit and bool addcityreferencetoplayer (it had the clearest expression of GetCityData, though I saw "CD" used also which might be the same
and
the problem I ran into was how to get into the city's resources because I got this (on the first one which is actually the second I did), but the error messages were similar:
i think I got pretty close but how do i access the m_buyingresources etc in the citydata?
Code:
if(rec->GetNumNeedsCityGoodAnyCity()) {
sint32 i, g, n = m_all_cities->Num();
for(i = 0; i < n; i++) {
if((m_all_cities->Access(i).AccessData()->GetCityData()->HasResource[rec->GetNeedsCityGoodAnyCityIndex(g)] + m_all_cities->Access(i).AccessData()->GetCityData()->IsLocalResource[rec->GetNeedsCityGoodAnyCityIndex(g)]) == 0)
return FALSE;
}
}
Code:
if(rec->GetNumNeedsCityGoodAnyCity()) {
sint32 i, g, n = m_all_cities->Num();
for(i = 0; i < n; i++) {
if((m_all_cities->Access(i).AccessData()->GetCityData()->m_buyingResources[rec->GetNeedsCityGoodAnyCityIndex(g)] + m_all_cities->Access(i).AccessData()->GetCityData()->m_collectingResources[rec->GetNeedsCityGoodAnyCityIndex(g)]) == 0)
return FALSE;
}
}
Code:
F:\SVN-Code\trunk\ctp2_code\gs\gameobj\Player.cpp(10147) : error C2109: subscript requires array or pointer type F:\SVN-Code\trunk\ctp2_code\gs\gameobj\Player.cpp(10147) : error C2109: subscript requires array or pointer type F:\SVN-Code\trunk\ctp2_code\gs\gameobj\Player.cpp(10147) : error C2296: '+' : illegal, left operand has type 'int (__thiscall CityData::*)(long) const' F:\SVN-Code\trunk\ctp2_code\gs\gameobj\Player.cpp(10147) : error C2297: '+' : illegal, right operand has type 'int (__thiscall CityData::*)(long) const'
However this should work, even if I prefer in a c++ file bool as return type instead of BOOL.
Comment