void cScreenGangs::init() { g_CurrentScreen = SCREEN_GANGMANAGEMENT; if (!g_InitWin) return; Focused(); g_InitWin = false; selection = GetLastSelectedItemFromList(ganglist_id); sel_recruit = GetLastSelectedItemFromList(recruitlist_id); ClearListBox(missionlist_id); AddToListBox(missionlist_id, 0, "GUARDING"); AddToListBox(missionlist_id, 1, "SABOTAGE"); AddToListBox(missionlist_id, 2, "SPY ON GIRLS"); AddToListBox(missionlist_id, 3, "RECAPTURE"); AddToListBox(missionlist_id, 4, "ACQUIRE TERRITORY"); AddToListBox(missionlist_id, 5, "PETTY THEFT"); AddToListBox(missionlist_id, 6, "GRAND THEFT"); AddToListBox(missionlist_id, 7, "KIDNAPPING"); AddToListBox(missionlist_id, 8, "CATACOMBS"); AddToListBox(missionlist_id, 9, "TRAINING"); AddToListBox(missionlist_id, 10, "RECRUITING"); AddToListBox(missionlist_id, 11, "SERVICE"); SetCheckBox(controlcatacombs_id, (g_Gangs.Control_Gangs())); SliderRange(girlspercslider_id, 0, 100, g_Gangs.Gang_Gets_Girls(), 1); SliderRange(itemspercslider_id, 0, 100, g_Gangs.Gang_Gets_Girls() + g_Gangs.Gang_Gets_Items(), 1); ss.str(""); ss << "Girls : " << g_Gangs.Gang_Gets_Girls() << "%"; EditTextItem(ss.str(), ganggetsgirls_id); ss.str(""); ss << "Items : " << g_Gangs.Gang_Gets_Items() << "%"; EditTextItem(ss.str(), ganggetsitems_id); ss.str(""); ss << "Beasts : " << g_Gangs.Gang_Gets_Beast() << "%"; EditTextItem(ss.str(), ganggetsbeast_id); SetCheckBox(netautobuy_id, (g_Gangs.GetNetRestock() > 0)); SetCheckBox(healautobuy_id, (g_Gangs.GetHealingRestock() > 0)); // weapon upgrades int *wlev = g_Gangs.GetWeaponLevel(); ss.str(""); ss << "Weapon Level: " << *wlev; if ((*wlev) < 4) { EnableButton(weaponup_id); ss << " Next: " << tariff.goon_weapon_upgrade(*wlev) << "g"; } else DisableButton(weaponup_id); g_LogFile.ss() << "weapon text = '" << ss.str() << "'" << endl; g_LogFile.ssend(); EditTextItem(ss.str(), weaponlevel_id); int *nets = g_Gangs.GetNets(); ss.str(""); ss << "Nets (" << tariff.nets_price(1) << "g each): " << *nets; EditTextItem(ss.str(), netdesc_id); DisableButton(netbuy_id, *nets >= 60); DisableButton(netbuy10_id, *nets >= 60); DisableButton(netbuy20_id, *nets >= 60); DisableCheckBox(netautobuy_id, *nets < 1); int *potions = g_Gangs.GetHealingPotions(); ss.str(""); ss << "Heal Potions (" << tariff.healing_price(1) << "g each): " << *potions; EditTextItem(ss.str(), healdesc_id); DisableButton(healbuy_id, *potions >= 200); DisableButton(healbuy10_id, *potions >= 200); DisableButton(healbuy20_id, *potions >= 200); DisableCheckBox(healautobuy_id, *potions < 1); int cost = 0; if (g_Gangs.GetNumGangs() > 0) { for (int i = 0; i < g_Gangs.GetNumGangs(); i++) { sGang* g = g_Gangs.GetGang(i); if (g == 0) g = g_Gangs.GetGang(i - 1); cost += tariff.goon_mission_cost(g->m_MissionID); } } ss.str(""); ss << "Weekly Cost: " << cost; EditTextItem(ss.str(), totalcost_id); if (gold_id >= 0) { ss.str(""); ss << "Gold: " << g_Gold.ival(); EditTextItem(ss.str(), gold_id); } ClearListBox(ganglist_id); int num = 0; sGang* current = g_Gangs.GetGang(0); // loop through the gangs, populating the list box g_LogFile.write("Setting gang mission descriptions\n"); for (current = g_Gangs.GetGang(0); current; current = current->m_Next) { // format the string with the gang name, mission and number of men string Data[11]; ss.str(""); ss << current->m_Name; Data[0] = ss.str(); ss.str(""); ss << current->m_Num; Data[1] = ss.str(); ss.str(""); ss << short_mission_desc(current->m_MissionID); Data[2] = ss.str(); ss.str(""); ss << current->m_Skills[SKILL_COMBAT] << "%"; Data[3] = ss.str(); ss.str(""); ss << current->m_Skills[SKILL_MAGIC] << "%"; Data[4] = ss.str(); ss.str(""); ss << current->m_Stats[STAT_INTELLIGENCE] << "%"; Data[5] = ss.str(); ss.str(""); ss << current->m_Stats[STAT_AGILITY] << "%"; Data[6] = ss.str(); ss.str(""); ss << current->m_Stats[STAT_CONSTITUTION] << "%"; Data[7] = ss.str(); ss.str(""); ss << current->m_Stats[STAT_CHARISMA] << "%"; Data[8] = ss.str(); ss.str(""); ss << current->m_Stats[STAT_STRENGTH] << "%"; Data[9] = ss.str(); ss.str(""); ss << current->m_Skills[SKILL_SERVICE] << "%"; Data[10] = ss.str(); // cerr << "Gang:\t" << Data[0] << "\t" << Data[1] << "\t" << Data[2] // << "\t" << Data[3] << "\t" << Data[4] << "\t" << Data[5] << "\t" << Data[6] << endl; /* * add the box to the list; red highlight gangs that are low on numbers */ int color = (current->m_Num < 6 ? COLOR_RED : COLOR_BLUE); if (current->m_Num < 6 && (current->m_MissionID == MISS_SERVICE || current->m_MissionID == MISS_TRAINING)) color = COLOR_YELLOW; AddToListBox(ganglist_id, num++, Data, 11, color); } ClearListBox(recruitlist_id); num = 0; current = g_Gangs.GetHireableGang(0); // loop through the gangs, populating the list box g_LogFile.write("Setting recruitable gang info\n"); for (current = g_Gangs.GetHireableGang(0); current; current = current->m_Next) { // format the string with the gang name, mission and number of men string Data[10]; ss.str(""); ss << current->m_Name; Data[0] = ss.str(); ss.str(""); ss << current->m_Num; Data[1] = ss.str(); ss.str(""); ss << current->m_Skills[SKILL_COMBAT] << "%"; Data[2] = ss.str(); ss.str(""); ss << current->m_Skills[SKILL_MAGIC] << "%"; Data[3] = ss.str(); ss.str(""); ss << current->m_Stats[STAT_INTELLIGENCE] << "%"; Data[4] = ss.str(); ss.str(""); ss << current->m_Stats[STAT_AGILITY] << "%"; Data[5] = ss.str(); ss.str(""); ss << current->m_Stats[STAT_CONSTITUTION] << "%"; Data[6] = ss.str(); ss.str(""); ss << current->m_Stats[STAT_CHARISMA] << "%"; Data[7] = ss.str(); ss.str(""); ss << current->m_Stats[STAT_STRENGTH] << "%"; Data[8] = ss.str(); ss.str(""); ss << current->m_Skills[SKILL_SERVICE] << "%"; Data[9] = ss.str(); // cerr << "Recruitable\t" << Data[0] << "\t" << Data[1] << "\t" << Data[2] // << "\t" << Data[3] << "\t" << Data[4] << "\t" << Data[5] << endl; /* * add the box to the list */ int color = (current->m_Num < 6 ? COLOR_RED : COLOR_BLUE); AddToListBox(recruitlist_id, num++, Data, 10, color); } if (selection == -1 && GetListBoxSize(ganglist_id) >= 1) selection = 0; if (selection >= 0) { while (selection > GetListBoxSize(ganglist_id) && selection != -1) selection--; } if (selection >= 0) SetSelectedItemInList(ganglist_id, selection); if (sel_recruit == -1 && GetListBoxSize(recruitlist_id) >= 1) sel_recruit = 0; if (sel_recruit >= 0) SetSelectedItemInList(recruitlist_id, sel_recruit); DisableButton(ganghire_id, (g_Gangs.GetNumHireableGangs() <= 0) || (g_Gangs.GetNumGangs() >= g_Gangs.GetMaxNumGangs()) || (sel_recruit == -1)); DisableButton(gangfire_id, (g_Gangs.GetNumGangs() <= 0) || (selection == -1)); potions = wlev = nets = 0; }
void cScreenGangs::init() { if(!g_InitWin) return; Focused(); g_InitWin = false; //////////////////// cConfig cfg; selection = GetLastSelectedItemFromList(ganglist_id); sel_recruit = GetLastSelectedItemFromList(recruitlist_id); int cost = tariff.goon_mission_cost(MISS_GUARDING); ss.str(""); ss << "Gangs: " << cost << " gold / week"; EditTextItem(ss.str(), gangcost_id); ClearListBox(missionlist_id); AddToListBox(missionlist_id, 0, "GUARDING"); AddToListBox(missionlist_id, 1, "SABOTAGE"); AddToListBox(missionlist_id, 2, "SPY ON GIRLS"); AddToListBox(missionlist_id, 3, "RECAPTURE"); AddToListBox(missionlist_id, 4, "ACQUIRE TERRITORY"); AddToListBox(missionlist_id, 5, "PETTY THEFT"); AddToListBox(missionlist_id, 6, "GRAND THEFT"); AddToListBox(missionlist_id, 7, "KIDNAPPING"); AddToListBox(missionlist_id, 8, "CATACOMBS"); AddToListBox(missionlist_id, 9, "TRAINING"); AddToListBox(missionlist_id, 10, "RECRUITING"); SetCheckBox(netautobuy_id, (g_Gangs.GetNetRestock() > 0)); SetCheckBox(healautobuy_id, (g_Gangs.GetHealingRestock() > 0)); // weapon upgrades int *wlev = g_Gangs.GetWeaponLevel(); ss.str(""); ss << "Weapon Level: " << *wlev; if((*wlev) < 4) { EnableButton(weaponup_id); ss << " Next: " << tariff.goon_weapon_upgrade(*wlev) << "g"; } else DisableButton(weaponup_id); std::string s = ss.str(); g_LogFile.ss() << "weapon text = '" << s << "'" << std::endl; g_LogFile.ssend(); EditTextItem(s, weaponlevel_id); int *nets = g_Gangs.GetNets(); ss.str(""); ss << "Nets (" << tariff.nets_price(1) << "g each): " << *nets; DisableButton(netbuy_id, *nets >= 60); DisableCheckBox(netautobuy_id, *nets < 1); EditTextItem(ss.str(), netdesc_id); int *potions = g_Gangs.GetHealingPotions(); ss.str(""); ss << "Heal Potions (" << tariff.healing_price(1) << "g each): " << *potions ; EditTextItem(ss.str(), healdesc_id); DisableButton(healbuy_id, *potions >= 200); DisableCheckBox(healautobuy_id, *potions < 1); std::string message; buffer[0] = '\0'; if(g_Gangs.GetNumGangs() > 0) { cost = 0; for(int i=0; i < g_Gangs.GetNumGangs(); i++) { sGang* g = g_Gangs.GetGang(i); if (g == nullptr) g = g_Gangs.GetGang(i-1); cost += tariff.goon_mission_cost(g->m_MissionID); } message = "Weekly Cost: "; message += toString(cost); } else message = "Weekly Cost: 0"; EditTextItem(message, totalcost_id); ClearListBox(ganglist_id); int num = 0; sGang* current = g_Gangs.GetGang(0); /* * loop through the gangs, populating the list box */ g_LogFile.ss() << "Setting gang mission descriptions" << std::endl; g_LogFile.ssend(); for(current = g_Gangs.GetGang(0); current; current = current->m_Next) { /* * format the string with the gang name, mission and number of men */ std::string Data[9]; ss.str(""); ss << current->m_Name; Data[0] = ss.str(); ss.str(""); ss << current->m_Num; Data[1] = ss.str(); ss.str(""); ss << short_mission_desc(current->m_MissionID); Data[2] = ss.str(); ss.str(""); ss << (int)current->m_Skills[SKILL_COMBAT] << "%"; Data[3] = ss.str(); ss.str(""); ss << (int)current->m_Skills[SKILL_MAGIC] << "%"; Data[4] = ss.str(); ss.str(""); ss << (int)current->m_Stats[STAT_INTELLIGENCE] << "%"; Data[5] = ss.str(); ss.str(""); ss << (int)current->m_Stats[STAT_AGILITY] << "%"; Data[6] = ss.str(); ss.str(""); ss << (int)current->m_Stats[STAT_CONSTITUTION] << "%"; Data[7] = ss.str(); ss.str(""); ss << (int)current->m_Stats[STAT_CHARISMA] << "%"; Data[8] = ss.str(); // g_LogFile.ss() << "Gang:\t" << Data[0] << "\t" << Data[1] << "\t" << Data[2] // << "\t" << Data[3] << "\t" << Data[4] << "\t" << Data[5] << "\t" << Data[6] << std::endl; // g_LogFile.ssend(); /* * add the box to the list; red highlight gangs that are low on numbers */ AddToListBox( ganglist_id, num++, Data, 9, (current->m_Num < 6 ? LISTBOX_RED : LISTBOX_BLUE) ); } ClearListBox(recruitlist_id); num = 0; current = g_Gangs.GetHireableGang(0); /* * loop through the gangs, populating the list box */ g_LogFile.ss() << "Setting recruitable gang info" << std::endl; g_LogFile.ssend(); for(current = g_Gangs.GetHireableGang(0); current; current = current->m_Next) { /* * format the string with the gang name, mission and number of men */ std::string Data[8]; ss.str(""); ss << current->m_Name; Data[0] = ss.str(); ss.str(""); ss << current->m_Num; Data[1] = ss.str(); ss.str(""); ss << (int)current->m_Skills[SKILL_COMBAT] << "%"; Data[2] = ss.str(); ss.str(""); ss << (int)current->m_Skills[SKILL_MAGIC] << "%"; Data[3] = ss.str(); ss.str(""); ss << (int)current->m_Stats[STAT_INTELLIGENCE] << "%"; Data[4] = ss.str(); ss.str(""); ss << (int)current->m_Stats[STAT_AGILITY] << "%"; Data[5] = ss.str(); ss.str(""); ss << (int)current->m_Stats[STAT_CONSTITUTION] << "%"; Data[6] = ss.str(); ss.str(""); ss << (int)current->m_Stats[STAT_CHARISMA] << "%"; Data[7] = ss.str(); // g_LogFile.ss() << "Recruitable\t" << Data[0] << "\t" << Data[1] << "\t" << Data[2] // << "\t" << Data[3] << "\t" << Data[4] << "\t" << Data[5] << std::endl; // g_LogFile.ssend(); /* * add the box to the list */ AddToListBox( recruitlist_id, num++, Data, 8, (current->m_Num < 6 ? LISTBOX_RED : LISTBOX_BLUE) ); } if(selection == -1 && GetListBoxSize(ganglist_id) >= 1) selection = 0; if(selection >= 0) { while(selection > GetListBoxSize(ganglist_id) && selection != -1) selection--; } if(selection >= 0) SetSelectedItemInList(ganglist_id, selection); if(sel_recruit == -1 && GetListBoxSize(recruitlist_id) >= 1) sel_recruit = 0; if(sel_recruit >= 0) SetSelectedItemInList(recruitlist_id, sel_recruit); DisableButton(ganghire_id, (g_Gangs.GetNumHireableGangs() <= 0) || (g_Gangs.GetNumGangs() >= 8) || (sel_recruit == -1)); DisableButton(gangfire_id, (g_Gangs.GetNumGangs() <= 0) || (selection == -1)); potions = nullptr; wlev = nullptr; nets = nullptr; }