dipwizard.cpp
Martin,
Ive opted to make diplomacy the priority. I could live with the LDL changes I made but I'd really like to change the set upp to be more like Civ3/Civ4 so I think to get rid of the offer/request tab problem do I just have to create a new stage and edit where the offer and request go to, specifically in these files?
the other question is that I like the "table" of proposals where you can you build a list of wants and ask for wants instead of the ctp2 only request one thing and offer one thing. Is this where I need to look?
Martin,
Ive opted to make diplomacy the priority. I could live with the LDL changes I made but I'd really like to change the set upp to be more like Civ3/Civ4 so I think to get rid of the offer/request tab problem do I just have to create a new stage and edit where the offer and request go to, specifically in these files?
Code:
DipWizard::DipWizard(AUI_ERRCODE *err) [i]... some code...[/i] m_propList[DIP_WIZ_PROP_TAB_REQUEST] = (ctp2_ListBox *)aui_Ldl::GetObject(s_dipWizardBlock, "Stage1.Tabs.Request.TabPanel.List"); m_propList[DIP_WIZ_PROP_TAB_OFFER] = (ctp2_ListBox *)aui_Ldl::GetObject(s_dipWizardBlock, "Stage1.Tabs.Offer.TabPanel.List"); m_propList[DIP_WIZ_PROP_TAB_TREATY] = (ctp2_ListBox *)aui_Ldl::GetObject(s_dipWizardBlock, "Stage1.Tabs.Treaty.TabPanel.List"); m_exchList[DIP_WIZ_PROP_TAB_REQUEST] = (ctp2_ListBox *)aui_Ldl::GetObject(s_dipWizardBlock, "Stage2.Tabs.Request.TabPanel.List"); m_exchList[DIP_WIZ_PROP_TAB_OFFER] = (ctp2_ListBox *)aui_Ldl::GetObject(s_dipWizardBlock, "Stage2.Tabs.Offer.TabPanel.List"); m_exchList[DIP_WIZ_PROP_TAB_TREATY] = (ctp2_ListBox *)aui_Ldl::GetObject(s_dipWizardBlock, "Stage2.Tabs.Treaty.TabPanel.List"); aui_Ldl::SetActionFuncAndCookie(s_dipWizardBlock, "Stage1.Tabs.Request", ProposalTabCallback, (void *)DIP_WIZ_PROP_TAB_REQUEST); aui_Ldl::SetActionFuncAndCookie(s_dipWizardBlock, "Stage1.Tabs.Offer", ProposalTabCallback, (void *)DIP_WIZ_PROP_TAB_OFFER); aui_Ldl::SetActionFuncAndCookie(s_dipWizardBlock, "Stage1.Tabs.Treaty", ProposalTabCallback, (void *)DIP_WIZ_PROP_TAB_TREATY); aui_Ldl::SetActionFuncAndCookie(s_dipWizardBlock, "Stage2.Tabs.Request", ExchangeTabCallback, (void *)DIP_WIZ_PROP_TAB_REQUEST); aui_Ldl::SetActionFuncAndCookie(s_dipWizardBlock, "Stage2.Tabs.Offer", ExchangeTabCallback, (void *)DIP_WIZ_PROP_TAB_OFFER); aui_Ldl::SetActionFuncAndCookie(s_dipWizardBlock, "Stage2.Tabs.Treaty", ExchangeTabCallback, (void *)DIP_WIZ_PROP_TAB_TREATY);
Code:
void DipWizard::FillProposalLists()
{
sint32 pr;
ctp2_ListBox *propList = NULL, *exchList = NULL;
sint32 i;
for(i = 0; i < DIP_WIZ_PROP_TAB_MAX; i++) {
m_propList[i]->Clear();
m_exchList[i]->Clear();
m_propList[i]->SetActionFuncAndCookie(PropListCallback, (void *)i);
m_exchList[i]->SetActionFuncAndCookie(ExchListCallback, (void *)i);
}
const Diplomat & diplomat =
Diplomat::GetDiplomat(g_selected_item->GetVisiblePlayer());
for(pr = 0; pr < g_theDiplomacyProposalDB->NumRecords(); pr++) {
const DiplomacyProposalRecord *rec = g_theDiplomacyProposalDB->Get(pr);
if(!rec) continue;
if (diplomat.InvalidNewProposal(m_recipient, rec))
continue;
if(rec->GetArg1HisCity() && m_recipient >= 0 && m_recipient < k_MAX_PLAYERS && g_player[m_recipient]) {
sint32 c;
bool seenOne = false;
for(c = 0; c < g_player[m_recipient]->m_all_cities->Num(); c++) {
if(g_player[m_recipient]->m_all_cities->Access(c)->GetEverVisible() & (1 << g_selected_item->GetVisiblePlayer())) {
seenOne = true;
break;
}
}
if(!seenOne)
continue;
}
if(rec->GetCategoryRequest()) {
propList = m_propList[DIP_WIZ_PROP_TAB_REQUEST];
exchList = m_exchList[DIP_WIZ_PROP_TAB_REQUEST];
}
if(rec->GetCategoryGift()) {
propList = m_propList[DIP_WIZ_PROP_TAB_OFFER];
exchList = m_exchList[DIP_WIZ_PROP_TAB_OFFER];
}
if(rec->GetCategoryTreaty()) {
propList = m_propList[DIP_WIZ_PROP_TAB_TREATY];
exchList = m_exchList[DIP_WIZ_PROP_TAB_TREATY];
}
AddProposalItem(propList, rec);
AddProposalItem(exchList, rec);
}
if(m_threatList) {
m_threatList->Clear();
if(GetStage() == DIP_WIZ_STAGE_MAKE_THREAT) {
m_sendButton->Enable(FALSE);
}
sint32 threatenee = m_recipient;
if(threatenee > 0 && threatenee < k_MAX_PLAYERS) {
for(i = 1; i < g_theDiplomacyThreatDB->NumRecords(); i++) {
const DiplomacyThreatRecord *rec = g_theDiplomacyThreatDB->Get(i);
switch(rec->GetArg1()) {
case k_DiplomacyThreat_Arg1_HisCity_Bit:
case k_DiplomacyThreat_Arg1_SpecialAttack_Bit:
{
if(m_recipient < 0 || m_recipient >= k_MAX_PLAYERS || !g_player[threatenee])
continue;
bool foundCity = false;
sint32 c;
for(c = 0; c < g_player[threatenee]->m_all_cities->Num(); c++) {
if(g_player[threatenee]->m_all_cities->Access(c).GetEverVisible() & (1 << g_selected_item->GetVisiblePlayer())) {
foundCity = true;
break;
}
}
if(!foundCity)
continue;
break;
}
case k_DiplomacyThreat_Arg1_ThirdParty_Bit:
{
sint32 p;
bool foundThirdParty = false;
for(p = 1; p < k_MAX_PLAYERS; p++) {
if(!g_player[p]) continue;
if(p == g_selected_item->GetVisiblePlayer())
continue;
if(p == threatenee)
continue;
if(!g_player[g_selected_item->GetVisiblePlayer()]->HasContactWith(p))
continue;
foundThirdParty = true;
break;
}
if(!foundThirdParty)
continue;
break;
}
case k_DiplomacyThreat_Arg1_AgreementId_Bit:
{
if(m_recipient < 0 || m_recipient >= k_MAX_PLAYERS || !g_player[threatenee])
continue;
const Diplomat & diplomat = Diplomat::GetDiplomat(g_selected_item->GetVisiblePlayer());
ai::Agreement pact;
bool has_pacts = diplomat.GetAgreementToBreak(threatenee, pact);
if (!has_pacts)
continue;
break;
}
default:
break;
}
ctp2_ListItem *item = (ctp2_ListItem *)aui_Ldl::BuildHierarchyFromRoot("DipWizThreatItem");
Assert(item);
if(!item)
break;
item->SetUserData((void *)i);
ctp2_Static *text = (ctp2_Static *)item->GetChildByIndex(0);
Assert(text);
if(!text)
break;
text->SetText(g_theStringDB->GetNameStr(rec->GetTitle()));
m_threatList->AddItem(item);
}
}
}
}
.
Comment