Originally posted by Martin Gühmann
It goes into the difficulty database, but not into the current CTP1 one. However I already have replaced it with the new one in my working copy, but first I would like to do some playtesting.
Great! I'll wait until you get it going. I think I need to add one with shields too. I have that in readiness and it maybe causing BureauBerts latest Governor/readiness crash
Originally posted by Martin Gühmann
As far as I was able to see it CityData::AddWonder is called in Player::AddWonder, therefore it shouldn't be a problem. Of course I should have a look at it again.
I don't see it there...should we add it there or back into cityevent?
Code:
void Player::AddWonder(sint32 wonder, Unit &city)
{
DPRINTF(k_DBG_GAMESTATE, ("Player %d built wonder %d\n", m_owner, wonder));
m_builtWonders |= ((uint64)1 << wonder);
if(wonderutil_Get(wonder)->GetPollutersToParks()) {
if(!g_network.IsClient() || g_network.IsLocalPlayer(m_owner)) {
sint32 polluters;
wonderutil_Get(wonder)->GetPollutersToParks(polluters);
Unit *ua = new Unit[polluters];
for(sint32 i = 0; i < polluters; i++) {
ua[i].m_id = (0);
}
sint32 pl, c, po, mv;
for(pl = 0; pl < k_MAX_PLAYERS; pl++) {
if(!g_player[pl]) continue;
int numCities=g_player[pl]->m_all_cities->Num() ;
for(c = 0; c m_all_cities->Access(c));
if(city.AccessData()->GetCityData()->GetBuiltWonders() & (uint64(1) << wonder))
continue;
if(city.GetPollution() < 1)
continue;
for(po = 0; po < polluters; po++) {
if(ua[po].m_id == (0)) {
ua[po] = city;
break;
} else if(city.GetPollution() > ua[po].GetPollution()) {
for(mv = polluters - 1; mv > po; mv--) {
ua[mv] = ua[mv -1];
}
ua[po] = city;
break;
}
}
}
}
for(po = 0; po < polluters; po++) {
if(ua[po].m_id != (0)) {
ua[po].CityToPark(m_owner);
}
}
delete [] ua;
}
}
if(wonderutil_GetFreeSlaves((uint64)1 << wonder)) {
sint32 i, n = m_all_cities->Num();
for(i = 0; i < n; i++) {
m_all_cities->Access(i).FreeSlaves();
}
for(i = m_all_units->Num() - 1; i >= 0; i--) {
const UnitRecord *rec = m_all_units->Access(i).GetDBRec();
if(rec->GetSlaveRaids() || rec->GetSettlerSlaveRaids() ||
rec->GetSlaveUprising()) {
m_all_units->Access(i).Kill(CAUSE_REMOVE_ARMY_EMANCIPATION, -1);
}
}
for(i = 0; i < k_MAX_PLAYERS; i++) {
if(g_player[i] && i != m_owner) {
g_player[i]->Emancipate();
}
}
}
sint32 hpBonus = wonderutil_GetIncreaseHP((uint64)1 << wonder);
if(hpBonus > 0) {
sint32 i, n = m_all_units->Num();
for(i = 0; i < n; i++) {
m_all_units->Access(i).AddWonderHPBonus(hpBonus);
}
}
sint32 fullHappinessTurns = wonderutil_GetTemporaryFullHappiness(
((uint64)1 << wonder));
if(fullHappinessTurns > 0) {
sint32 i, n = m_all_cities->Num();
for(i = 0; i < n; i++) {
m_all_cities->Access(i).SetFullHappinessTurns(fullHappinessTurns);
}
}
sint32 readinessReduction = wonderutil_GetReadinessCostReduction((uint64)1 << wonder);
if(readinessReduction > 0) {
m_readiness->RecalcCost();
}
if(wonderutil_GetNukesEliminated((uint64) 1 << wonder)) {
sint32 i, p;
SlicObject *so = new SlicObject("251NaniteDefuseEliminatesNukes");
so->AddWonder(wonder);
so->AddCivilisation(m_owner);
for(p = 0; p < k_MAX_PLAYERS; p++) {
if(g_player[p]) {
so->AddRecipient(p);
for(i = 0; i < g_player[p]->m_all_cities->Num(); i++) {
g_player[p]->m_all_cities->Access(i).AccessData()->GetCityData()->EliminateNukes();
}
for(i = g_player[p]->m_all_units->Num() - 1; i >= 0; i--) {
if(g_player[p]->m_all_units->Access(i).GetDBRec()->GetNuclearAttack()) {
g_player[p]->m_all_units->Access(i).Kill(CAUSE_REMOVE_ARMY_NUKES_ELIMINATED, m_owner);
}
}
}
}
g_slicEngine->Execute(so);
}
if(wonderutil_GetCloseEmbassies((uint64)1 << wonder)) {
sint32 p;
for(p = 0; p < k_MAX_PLAYERS; p++) {
if(g_player[p]) {
g_player[p]->CloseEmbassy(m_owner);
g_player[p]->SetDiplomaticState(m_owner, DIPLOMATIC_STATE_NEUTRAL);
SetDiplomaticState(p, DIPLOMATIC_STATE_NEUTRAL);
}
}
}
if(wonderutil_GetEmbassiesEverywhereEvenAtWar((uint64)1 << wonder)) {
sint32 p;
for(p = 0; p < k_MAX_PLAYERS; p++) {
if(g_player[p]) {
g_player[p]->SetDiplomaticState(m_owner, DIPLOMATIC_STATE_NEUTRAL);
SetDiplomaticState(p, DIPLOMATIC_STATE_NEUTRAL);
}
}
}
if(wonderutil_Get(wonder)->GetPreventConversion()) {
sint32 i;
for(i = 0; i < m_all_cities->Num(); i++) {
m_all_cities->Access(i).GetData()->GetCityData()->Unconvert(FALSE);
}
}
if(wonderutil_Get(wonder)->GetGlobalRadar()) {
m_hasGlobalRadar = TRUE;
g_theWonderTracker->SetGlobeSatFlags(g_theWonderTracker->GlobeSatFlags() | (1 << m_owner));
sint32 p;
for(p = 0; p < k_MAX_PLAYERS; p++) {
sint32 u;
if(!g_player[p] || m_owner == p)
continue;
ContactMade(p);
for(u = 0; u < g_player[p]->m_all_units->Num(); u++) {
if(g_player[p]->m_all_units->Access(u).GetDBRec()->GetVisionClassStandard()) {
g_player[p]->m_all_units->Access(u).SetVisible(m_owner);
}
}
sint32 c;
for(c = 0; c < g_player[p]->m_all_cities->Num(); c++) {
g_player[p]->m_all_cities->Access(c).SetVisible(m_owner);
}
}
m_vision->SetTheWholeWorldExplored();
m_vision->ClearUnseen();
if(m_owner == g_selected_item->GetVisiblePlayer()) {
g_director->AddCopyVision();
}
}
sint32 i;
for(i = 0; i < m_all_cities->Num(); i++) {
m_all_cities->Access(i).GetData()->GetCityData()->GetBuildQueue()->RemoveIllegalItems();
}
sint32 pl, c;
for(pl = 0; pl < k_MAX_PLAYERS; pl++) {
if(pl == m_owner ||
!g_player[pl]) {
continue;
}
int numCities=g_player[pl]->m_all_cities->Num() ;
for(c = 0; c m_all_cities->Access(c).GetData()->GetCityData()->GetBuildQueue()->
RemoveIllegalItems(TRUE);
}
}
const WonderRecord *wrec = g_theWonderDB->Get(wonder);
sint32 buildingIndex;
if(wrec->GetBuildingEverywhereIndex(buildingIndex)) {
m_wonderBuildings |= ((uint64)1 << buildingIndex);
}
}
I don't see it there...should we add it there or back into cityevent?
Bookmarks