Beispiel #1
0
void cScreenMovieMaker::init()
{
	g_CurrentScreen = SCREEN_CREATEMOVIE;
	if(!g_InitWin)
		return;

	Focused();
	g_InitWin = false;
	
	// clear the lists
	ClearListBox(sceneslist_id);

	//get a list of all the column names, so we can find which data goes in that column
	vector<string> columnNames;
	m_ListBoxes[sceneslist_id]->GetColumnNames(columnNames);
	int numColumns = columnNames.size();
	string* Data = new string[numColumns];

	// Add scene to list
	for(int i=0; i<g_Studios.GetNumScenes(); i++)
	{
		sMovieScene* scene = g_Studios.GetScene(i);
		//if (selected_girl == gir)
		//	selection = i;
		unsigned int item_color = COLOR_BLUE;

		scene->OutputSceneRow(Data, columnNames);
		AddToListBox(sceneslist_id, i, Data, numColumns, item_color);
	}
	delete [] Data;
	
	lastNum = -1;
	g_InitWin = false;
}
Beispiel #2
0
//---------------------------------------------------------------------------
bool __fastcall TRightsFrame::HasFocus()
{
  return
    (Focused() ||
    ((Screen->ActiveControl != NULL) && (Screen->ActiveControl->Parent == this))) ||
    ((PopupParent != NULL) && PopupParent->Focused());
}
void cScreenMayor::init()
{
	g_CurrentScreen = SCREEN_MAYOR;
	if (!g_InitWin) { return; }
	Focused();
	g_InitWin = false;
	stringstream ss;
	ss << "Influence Details\n";
	if (SetBribe)
	{
		if (g_IntReturn >= 0)
		{
			g_Brothels.SetBribeRate(g_IntReturn);
			SetBribe = false;
		}
	}

	g_Brothels.UpdateBribeInfluence();

	int PlayersInfluence = g_Brothels.GetInfluence();
	cRival* rival = g_Brothels.GetRivals();
	if (rival)
	{
		long top[4];	// the top 4 rival influences
		for (int i = 0; i < 4; i++) top[i] = -1;
		int r = 0;
		while (rival)	// find the top 4 rival influences of the authorities
		{
			for (int i = 0; i<4; i++)
			{
				if (rival->m_Influence > top[i])
				{
					if (i + 3 < 4) top[i + 3] = top[i + 2];
					if (i + 2 < 4) top[i + 2] = top[i + 1];
					if (i + 1 < 4) top[i + 1] = top[i];
					top[i] = r;
					break;
				}
			}
			r++;
			rival = rival->m_Next;
		}
		ss << "Your influence: " << PlayersInfluence << "% costing " << g_Brothels.GetBribeRate() << " gold per week.";

		for (int i = 0; i < 4; i++)
		{
			if (top[i] != -1)
			{
				ss << "\n" << g_Brothels.GetRivalManager()->GetRival(top[i])->m_Name << " : " << g_Brothels.GetRivalManager()->GetRival(top[i])->m_Influence << "% influence";
			}
		}
	}
	else
	{
		ss << "Your influence: " << PlayersInfluence << "%\nNo Rivals";
	}
	ss << "\n\nNumber of girls in prison: " << g_Brothels.GetNumInPrison();
	EditTextItem(ss.str(), details_id);
}
void CGroup::UpdateFocus()
{
    if (m_pFocusedWidget)
        m_pFocusedWidget->SetFocus(Focused());
    else if (Focused())
        SetNextFocWidget(false);
    
    for (TChildList::iterator it=m_Childs.begin(); it!=m_Childs.end(); it++)
    {
        if ((*it == m_pFocusedWidget) || !(*it)->Enabled())
            continue;
        
        // Let all other widgets update their colors. The group has changed it's color which may affect any childs
        (*it)->TouchColor();
        (*it)->RequestQueuedDraw();
    }
}
Beispiel #5
0
void MainWindow::changeEvent(QEvent *event)
{
    if (event->type() == QEvent::ActivationChange && isActiveWindow()) {
        emit Focused(this);
    }

    QMainWindow::changeEvent(event);
}
void CButton::DoDraw()
{
    if (Focused() || has_colors())
    {
        int y = (Height()-1)/2; // Center
        AddCh(this, 0, y, '<');
        AddCh(this, Width()-1, y, '>');
    }
}
Beispiel #7
0
void ListboxItem::Render()
{
	int			x1, y1, x2, y2;
	GetBounds(x1, y1, x2, y2);

	if (Focused())
		theme.colorFrameFocused.Use();
	else
		theme.colorFrameNormal.Use();
	theme.FillRect(x1, y1, x2, y2);

	theme.colorLines.Use();
	theme.DrawRect(x1 + 2, y1 + 1, x2 - 1, y2 - 2);

	if (Focused())
		theme.colorTextFocused.Use();
	else
		theme.colorTextUnfocused.Use();
	theme.DrawString(x1 + 8, (y2-y1 + 1)/2 + y1, text, false);
}
Beispiel #8
0
//---------------------------------------------------------------------------
void __fastcall TRightsFrame::CloseUp()
{
  assert(FPopup);
  assert(Visible);
  if (!Focused())
  {
    // this can happen only if called from on-click handler of drop down button
    DoCloseUp();
  }
  FPopupParent->SetFocus();
}
void CButton::UpdateColors()
{
    if (m_pLabel)
    {
        TColorPair colors;
        
        if (Focused())
            colors = GetFColors();
        else
            colors = GetDFColors();
        
        m_pLabel->SetDFColors(colors);
        m_pLabel->RequestQueuedDraw();
    }
}
void cScreenBrothelManagement::init()
{
	if (g_InitWin)
	{
		Focused();
		g_CurrentScreen = SCREEN_BROTHEL;
		g_Building = BUILDING_BROTHEL;

		stringstream ss;
		ss << gettext("Day: ") << g_Day << gettext(" Month: ") << g_Month << gettext(" Year: ") << g_Year << gettext(" -- Brothel: ") << g_Brothels.GetName(g_CurrBrothel);
		EditTextItem(ss.str(), id_header);
		EditTextItem(g_Brothels.GetBrothelString(g_CurrBrothel), id_details);
		g_InitWin = false;
		// selected_girl = 0;

		SetImage(id_image, g_BrothelImages[g_CurrBrothel]);
	}
}
void CGroup::CoreFocusWidget(CWidget *w)
{
    if (w == m_pFocusedWidget)
        return;
    
    if (m_pFocusedWidget)
    {
        m_pFocusedWidget->SetFocus(false);
        m_pFocusedWidget->RequestQueuedDraw();
    }
    
    m_pFocusedWidget = w;
    
    if (w && Focused()) // If w == NULL the current focused widget is reset
    {
        w->SetFocus(true);
        w->RequestQueuedDraw();
    }
}
bool CGroup::SetPrevFocWidget(bool cont)
{
    if (m_Childs.empty())
        return false;

    TChildList::reverse_iterator it = m_Childs.rbegin();
    
    if (cont && m_pFocusedWidget && Focused())
    {
        TChildList::reverse_iterator f = std::find(m_Childs.rbegin(), m_Childs.rend(), m_pFocusedWidget);
        if (f != m_Childs.rend())
        {
            it = f;
            if (!CanFocusChilds(*it))
                it++;
        }
    }
    
    for (; it!=m_Childs.rend(); it++)
    {
        if (!(*it)->Enabled())
            continue;

        if (!(*it)->CanFocus())
        {
            if (CanFocusChilds(*it))
            {
                if (!GetGroupWidget(*it)->SetPrevFocWidget(cont))
                    continue;
            }
            else
                continue;
        }

        FocusWidget(*it);
        return true;
    }
    
    return false;
}
void CInputField::DoDraw()
{
    std::string::iterator first = m_Text.begin(), last;
    utf8::advance(first, m_StartPos, m_Text.end());
    last = first + GetMBLenFromW(std::string(first, m_Text.end()), Width()-2); // -2 for the border and cursor
    
    if (m_cOut)
    {
        TSTLStrSize charn = utf8::distance(first, last);
        AddStr(this, 1, 1, std::string(charn, m_cOut).c_str());
    }
    else
        AddStr(this, 1, 1, std::string(first, last).c_str());
    
    if (Focused())
    {
        std::string::iterator start = m_Text.begin();
        utf8::advance(start, m_StartPos, m_Text.end());
        int cursx = SafeConvert<int>(GetMBWidthFromC(m_Text, start, m_CursorPos)) + 1;
        TUI.LockCursor(GetWX(GetWin()) + cursx, GetWY(GetWin())+1);
    }
}
void cScreenGetInput::init()
{
	g_CurrentScreen = SCREEN_GETINPUT;

	if (g_InitWin)
	{
		Focused();

		g_InitWin = false;
		g_IntReturn = 0;
		g_EnterKey = false;

		switch (m_profile)
		{
			case MODE_STRING:
			{
				HideEditBox(id_textfield, false);
				EditTextItem("Enter Text:", id_textfield);
				break;
			}

			case MODE_INT:
			{
				HideEditBox(id_textfield, false);
				EditTextItem("Enter Value:", id_textfield);
				break;
			}

			case MODE_CONFIRM_EXIT:
			case MODE_CONFIRM:
			{
				HideEditBox(id_textfield, true);
				EditTextItem("Confirm?", id_textfield);
				break;
			}
		}
	}
}
void cScreenGetInput::CheckEvents_ConfirmExit()
{
	if (g_InitWin)
	{
		Focused();
		g_InitWin = false;
	}

	if (g_InterfaceEvents.GetNumEvents() == 0 && !g_EnterKey) {
		return;
	}

	if (g_InterfaceEvents.CheckButton(id_btn_cancel)) {
		g_ReturnText = "";
		g_InitWin = true;
		g_WinManager.Pop();
		return;
	}

	if (g_InterfaceEvents.CheckButton(id_btn_ok) || g_EnterKey) {
		g_EnterKey = false;
		g_ReturnText = "";

		g_InitWin = true;
		g_WinManager.Pop();
		g_WinManager.Pop();

		ResetInterface();

		// Schedule Quit Event -- To quit
		//SDL_Event ev;
		//ev->type = SDL_QUIT;
		//if (!SDL_PushEvent(ev))
		//	g_LogFile.write("SDL Quit Re-Scheduled!");
	}
}
void CLuaWidget::CoreActivateWidget()
{
    if (!Focused())
        ReqFocus();
}
CInputField::~CInputField(void)
{
    if (Focused())
        TUI.UnLockCursor();
}
void cScreenGirlDetails::init()
{
	if (selected_girl == 0)
	{
		g_WinManager.Pop();
		g_InitWin = true;
		g_LogFile.write("ERROR - girl details screen, selected_girl is null");
		/*
		*		adding this because the game will crash if we
		*		go past this point with a null girl
		*
		*		Now as to why it was null in the first place ...
		*		-- doc
		*/
		return;
	}

	g_CurrentScreen = SCREEN_GIRLDETAILS;
	if (!g_InitWin) return;

	Focused();
	g_InitWin = false;

	////////////////////
	if (selected_girl->health() <= 0)
	{
		// `J` instead of removing dead girls from the list which breaks the game, just skip past her in the list.
		NextGirl();								// `J` currently this prevents scrolling backwards past her - need to fix that.
//		selected_girl = remove_selected_girl();
		if (selected_girl == 0)
		{
			g_WinManager.Pop();
			g_InitWin = true;
			return;
		}
	}

	u_int job = (Day0Night1 ? selected_girl->m_NightJob : selected_girl->m_DayJob);
	SetJob = true;

	EditTextItem(selected_girl->m_Realname, girlname_id);

	string detail;
	if (DetailLevel == 0)		detail = g_Girls.GetDetailsString(selected_girl);
	else if (DetailLevel == 1)	detail = g_Girls.GetMoreDetailsString(selected_girl);
	else						detail = g_Girls.GetThirdDetailsString(selected_girl);
	EditTextItem(detail, girldesc_id);

	if (selected_girl)
	{
		if (lastsexact != -1)
		{
			PrepareImage(girlimage_id, selected_girl, lastsexact, true, ImageNum);
			lastsexact = -1;
		}
		else
		{
			if (selected_girl->m_newRandomFixed >= 0)
			{
				PrepareImage(girlimage_id, selected_girl, IMGTYPE_PROFILE, false, selected_girl->m_newRandomFixed);
			}
			else
			{
				PrepareImage(girlimage_id, selected_girl, IMGTYPE_PROFILE, true, ImageNum);
			}
		}
	}

	SliderRange(houseperc_id, 0, 100, g_Girls.GetStat(selected_girl, STAT_HOUSE), 10);
	ss.str("");
	ss << gettext("House Percentage: ") << SliderValue(houseperc_id) << gettext("%");
	EditTextItem(ss.str(), housepercval_id);

	ClearListBox(jobtypelist_id);

	// `J` Replacing accom buttons with slider
	if (accomdown_id != -1)	DisableButton(accomdown_id, selected_girl->m_AccLevel < 1);
	if (accomup_id != -1)	DisableButton(accomup_id, selected_girl->m_AccLevel > 9);
	if (accom_id != -1)
	{
		SliderRange(accom_id, 0, 9, selected_girl->m_AccLevel, 1);
		SliderMarker(accom_id, g_Girls.PreferredAccom(selected_girl));
	}
	if (accomval_id != -1)
	{
		stringstream acc;
		acc << "Accommodation: " << g_Girls.Accommodation(SliderValue(accom_id));
		if (cfg.debug.log_extradetails())
		{
			int val = SliderValue(accom_id) - g_Girls.PreferredAccom(selected_girl);
			if (val != 0) acc << "  ( " << (val > 0 ? "+" : "") << val << " )";
		}
		EditTextItem(acc.str(), accomval_id);
	}
	DisableButton(interact_id, (g_TalkCount <= 0));
	DisableButton(takegold_id, (selected_girl->m_Money <= 0));
	SetCheckBox(antipreg_id, (selected_girl->m_UseAntiPreg));

	bool InMovieStudio = (selected_girl->m_InStudio);
	bool InArena = (selected_girl->m_InArena);
	bool InCentre = (selected_girl->m_InCentre);
	bool InClinic = (selected_girl->m_InClinic);
	bool InHouse = (selected_girl->m_InHouse);
	bool InFarm = (selected_girl->m_InFarm);
	bool InDungeon = (selected_girl->m_DayJob == JOB_INDUNGEON);
	DisableButton(reldungeon_id, !InDungeon);
	DisableButton(senddungeon_id, InDungeon);

	// Disable dungeon if selected girl is in a non-brothel building
//	if (InMovieStudio || InArena || InCentre || InClinic || InFarm || InHouse) 
//	{
//		DisableButton(senddungeon_id, true);
//	}

	if (InArena)
	{
		ClearListBox(joblist_id);
		AddToListBox(jobtypelist_id, JOBFILTER_ARENASTAFF, g_Arena.m_JobManager.JobFilterName[JOBFILTER_ARENASTAFF]);
		AddToListBox(jobtypelist_id, JOBFILTER_ARENA, g_Arena.m_JobManager.JobFilterName[JOBFILTER_ARENA]);
		RefreshJobList();
		if (job >= g_Arena.m_JobManager.JobFilterIndex[JOBFILTER_ARENA] && job < g_Arena.m_JobManager.JobFilterIndex[JOBFILTER_ARENA + 1])
			SetSelectedItemInList(jobtypelist_id, JOBFILTER_ARENA);
		else // if (job >= g_Arena.m_JobManager.JobFilterIndex[JOBFILTER_ARENASTAFF] && job < g_Arena.m_JobManager.JobFilterIndex[JOBFILTER_ARENASTAFF + 1])
			SetSelectedItemInList(jobtypelist_id, JOBFILTER_ARENASTAFF);
		HideButton(day_id, false);
		HideButton(night_id, false);
		DisableButton(day_id, (Day0Night1 == SHIFT_DAY));
		DisableButton(night_id, (Day0Night1 == SHIFT_NIGHT));
	}
	else if (InClinic)
	{
		ClearListBox(joblist_id);
		AddToListBox(jobtypelist_id, JOBFILTER_CLINIC, g_Clinic.m_JobManager.JobFilterName[JOBFILTER_CLINIC]);
		AddToListBox(jobtypelist_id, JOBFILTER_CLINICSTAFF, g_Clinic.m_JobManager.JobFilterName[JOBFILTER_CLINICSTAFF]);
		RefreshJobList();
		if (job >= g_Clinic.m_JobManager.JobFilterIndex[JOBFILTER_CLINIC] && job < g_Clinic.m_JobManager.JobFilterIndex[JOBFILTER_CLINIC + 1])
			SetSelectedItemInList(jobtypelist_id, JOBFILTER_CLINIC);
		else SetSelectedItemInList(jobtypelist_id, JOBFILTER_CLINICSTAFF);
		HideButton(day_id, false);
		HideButton(night_id, false);
		DisableButton(day_id, (Day0Night1 == SHIFT_DAY));
		DisableButton(night_id, (Day0Night1 == SHIFT_NIGHT));
	}
	else if (InCentre)
	{
		ClearListBox(joblist_id);
		AddToListBox(jobtypelist_id, JOBFILTER_COMMUNITYCENTRE, g_Centre.m_JobManager.JobFilterName[JOBFILTER_COMMUNITYCENTRE]);
		AddToListBox(jobtypelist_id, JOBFILTER_COUNSELINGCENTRE, g_Centre.m_JobManager.JobFilterName[JOBFILTER_COUNSELINGCENTRE]);
		RefreshJobList();
		if (job >= g_Centre.m_JobManager.JobFilterIndex[JOBFILTER_COUNSELINGCENTRE] && job < g_Centre.m_JobManager.JobFilterIndex[JOBFILTER_COUNSELINGCENTRE + 1])
			SetSelectedItemInList(jobtypelist_id, JOBFILTER_COUNSELINGCENTRE);
		else SetSelectedItemInList(jobtypelist_id, JOBFILTER_COMMUNITYCENTRE);
		HideButton(day_id, false);
		HideButton(night_id, false);
		DisableButton(day_id, (Day0Night1 == SHIFT_DAY));
		DisableButton(night_id, (Day0Night1 == SHIFT_NIGHT));
	}
	else if (InHouse)
	{
		ClearListBox(joblist_id);
		AddToListBox(jobtypelist_id, JOBFILTER_HOUSE, g_House.m_JobManager.JobFilterName[JOBFILTER_HOUSE]);
		SetSelectedItemInList(jobtypelist_id, JOBFILTER_HOUSE);
		RefreshJobList();
		HideButton(day_id, false);
		HideButton(night_id, false);
		DisableButton(day_id, (Day0Night1 == SHIFT_DAY));
		DisableButton(night_id, (Day0Night1 == SHIFT_NIGHT));
	}
	else if (InMovieStudio)
	{
		Day0Night1 = SHIFT_NIGHT;
		ClearListBox(joblist_id);
		AddToListBox(jobtypelist_id, JOBFILTER_STUDIOCREW, g_Studios.m_JobManager.JobFilterName[JOBFILTER_STUDIOCREW]);
		AddToListBox(jobtypelist_id, JOBFILTER_MOVIESTUDIO, g_Studios.m_JobManager.JobFilterName[JOBFILTER_MOVIESTUDIO]);
		RefreshJobList();
		if (job >= g_Studios.m_JobManager.JobFilterIndex[JOBFILTER_MOVIESTUDIO] && job < g_Studios.m_JobManager.JobFilterIndex[JOBFILTER_MOVIESTUDIO + 1])
			SetSelectedItemInList(jobtypelist_id, JOBFILTER_MOVIESTUDIO);
		else SetSelectedItemInList(jobtypelist_id, JOBFILTER_STUDIOCREW);
		HideButton(day_id, true);
		HideButton(night_id, true);

	}
	else if (InFarm)
	{
		ClearListBox(joblist_id);
		AddToListBox(jobtypelist_id, JOBFILTER_FARMSTAFF, g_Farm.m_JobManager.JobFilterName[JOBFILTER_FARMSTAFF]);
		AddToListBox(jobtypelist_id, JOBFILTER_LABORERS, g_Farm.m_JobManager.JobFilterName[JOBFILTER_LABORERS]);
		AddToListBox(jobtypelist_id, JOBFILTER_PRODUCERS, g_Farm.m_JobManager.JobFilterName[JOBFILTER_PRODUCERS]);
		RefreshJobList();
		if (job >= g_Farm.m_JobManager.JobFilterIndex[JOBFILTER_LABORERS] && job < g_Farm.m_JobManager.JobFilterIndex[JOBFILTER_LABORERS + 1])
			SetSelectedItemInList(jobtypelist_id, JOBFILTER_LABORERS);
		else if (job >= g_Farm.m_JobManager.JobFilterIndex[JOBFILTER_PRODUCERS] && job < g_Farm.m_JobManager.JobFilterIndex[JOBFILTER_PRODUCERS + 1])
			SetSelectedItemInList(jobtypelist_id, JOBFILTER_PRODUCERS);
		else SetSelectedItemInList(jobtypelist_id, JOBFILTER_FARMSTAFF);
		HideButton(day_id, false);
		HideButton(night_id, false);
		DisableButton(day_id, (Day0Night1 == SHIFT_DAY));
		DisableButton(night_id, (Day0Night1 == SHIFT_NIGHT));

	}
	else if (!InDungeon)
	{  // if not in dungeon, set up job lists
		// add the job filters
		//	for(int i=0; i<NUMJOBTYPES; i++)  // loop through all job types
		for (unsigned int i = 0; i <= JOBFILTER_BROTHEL; i++)  // temporary limit to job types shown
		{
			AddToListBox(jobtypelist_id, i, g_Brothels.m_JobManager.JobFilterName[i]);
		}

		// set the job filter
		int jobtype = 0;
		for (unsigned int i = 0; i < NUMJOBTYPES; i++)
		{
			if (job >= g_Brothels.m_JobManager.JobFilterIndex[i] && job < g_Brothels.m_JobManager.JobFilterIndex[i + 1])
			{
				jobtype = i;
				break;
			}
		}
		SetSelectedItemInList(jobtypelist_id, jobtype);
		RefreshJobList();

		HideButton(day_id, false);
		HideButton(night_id, false);
		DisableButton(day_id, (Day0Night1 == SHIFT_DAY));
		DisableButton(night_id, (Day0Night1 == SHIFT_NIGHT));
	}
	else
	{  // if in dungeon, effectively disable job lists
		ClearListBox(joblist_id);
		AddToListBox(jobtypelist_id, -1, gettext("Languish in dungeon"));
		HideButton(day_id, true);
		HideButton(night_id, true);
	}

	ClearListBox(traitlist_id);
	for (int i = 0; i < MAXNUM_TRAITS; i++)
	{
		if (selected_girl->m_Traits[i])
		{
			stringstream st;
			st << selected_girl->m_Traits[i]->m_Name;
			if (selected_girl->m_TempTrait[i] > 0) st << "   (" << selected_girl->m_TempTrait[i] << ")";
			AddToListBox(traitlist_id, i, g_Traits.GetTranslateName(st.str()));
		}
	}
	EditTextItem("", traitdesc_id);
}
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;
}
Beispiel #20
0
void cScreenTown::init()
{
	if (BuyClinic != -1)
	{
		(g_ChoiceManager.GetChoice(0) == 0 ? GetClinic = true : BuyClinic = -1);
		g_ChoiceManager.Free();
	}
	if (GetClinic)
	{
		static_brothel_data *bpt = clinic_data + BuyClinic;
		g_Gold.brothel_cost(bpt->price);
		g_Clinic.NewBrothel(bpt->rooms, bpt->maxrooms);
		g_Clinic.SetName(0, gettext("Clinic"));
		GetClinic = false;
		BuyClinic = -1;
	}
	if (BuyCentre != -1)
	{
		(g_ChoiceManager.GetChoice(0) == 0 ? GetCentre = true : BuyCentre = -1);
		g_ChoiceManager.Free();
	}
	if (GetCentre)
	{
		static_brothel_data *bpt = centre_data + BuyCentre;
		g_Gold.brothel_cost(bpt->price);
		g_Centre.NewBrothel(bpt->rooms, bpt->maxrooms);
		g_Centre.SetName(0, gettext("Centre"));
		GetCentre = false;
		BuyCentre = -1;
	}
	if (BuyArena != -1)
	{
		(g_ChoiceManager.GetChoice(0) == 0 ? GetArena = true : BuyArena = -1);
		g_ChoiceManager.Free();
	}
	if (GetArena)
	{
		static_brothel_data *bpt = arena_data + BuyArena;

		g_Gold.brothel_cost(bpt->price);
		g_Arena.NewBrothel(bpt->rooms, bpt->maxrooms);
		g_Arena.SetName(0, gettext("Arena"));

		GetArena = false;
		BuyArena = -1;
	}
	if (BuyStudio != -1)
	{
		(g_ChoiceManager.GetChoice(0) == 0 ? GetStudio = true : BuyStudio = -1);
		g_ChoiceManager.Free();
	}
	if (GetStudio)
	{
		static_brothel_data *bpt = studio_data + BuyStudio;
		g_Gold.brothel_cost(bpt->price);
		g_Studios.NewBrothel(bpt->rooms, bpt->maxrooms);
		g_Studios.SetName(0, gettext("Studio"));
		GetStudio = false;
		BuyStudio = -1;
	}
	if (BuyFarm != -1)
	{
		(g_ChoiceManager.GetChoice(0) == 0 ? GetFarm = true : BuyFarm = -1);
		g_ChoiceManager.Free();
	}
	if (GetFarm)
	{
		static_brothel_data *bpt = farm_data + BuyFarm;
		g_Gold.brothel_cost(bpt->price);
		g_Farm.NewBrothel(bpt->rooms, bpt->maxrooms);
		g_Farm.SetName(0, gettext("Farm"));
		GetFarm = false;
		BuyFarm = -1;
	}
	if (GetName)
	{
		if (g_ReturnText != "")
		{
			if (g_Brothels.GetObjective() && g_Brothels.GetObjective()->m_Objective == OBJECTIVE_GETNEXTBROTHEL) 
				g_Brothels.PassObjective();
			static_brothel_data *bpt = brothel_data + BuyBrothel;
			g_Gold.brothel_cost(bpt->price);
			g_Brothels.NewBrothel(bpt->rooms, bpt->maxrooms);
			g_Brothels.SetName(g_Brothels.GetNumBrothels() - 1, g_ReturnText);
			g_InitWin = true;
		}
		GetName = false;
		BuyBrothel = -1;
	}
	if (BuyBrothel != -1)
	{
		if (g_ChoiceManager.GetChoice(0) == 0)
		{
			g_MessageQue.AddToQue("Enter a name for your new brothel.", 0);
			GetName = true;
			g_InitWin = true;
			g_WinManager.Push(GetString, &g_GetString);
		}
		else BuyBrothel = -1;
		g_ChoiceManager.Free();
		if (!GetName) BuyBrothel = -1;
		return;
	}
	g_CurrentScreen = SCREEN_TOWN;
	if (!g_InitWin) return;

	Focused();
	g_InitWin = false;

	// buttons enable/disable
	DisableButton(walk_id, g_WalkAround);

	HideButton(brothel2_id, (g_Brothels.GetBrothel(1) == 0));
	HideButton(brothel3_id, (g_Brothels.GetBrothel(2) == 0));
	HideButton(brothel4_id, (g_Brothels.GetBrothel(3) == 0));
	HideButton(brothel5_id, (g_Brothels.GetBrothel(4) == 0));
	HideButton(brothel6_id, (g_Brothels.GetBrothel(5) == 0));

	string brothel = "Current Brothel: ";
	brothel += g_Brothels.GetName(g_CurrBrothel);
	EditTextItem(brothel, curbrothel_id);
}
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;
}
Beispiel #22
0
void cScreenHouse::init()
{
	g_CurrentScreen = SCREEN_HOUSE;
	if (!g_InitWin) { return; }
	Focused();
	g_InitWin = false;

	locale syslocale("");
	stringstream ss;
	ss.imbue(syslocale);

	ss << gettext("CURRENT OBJECTIVE: ");
	sObjective* obj = g_Brothels.GetObjective();
	if (obj)
	{
		switch (obj->m_Objective)
		{
		case OBJECTIVE_REACHGOLDTARGET:
			ss << gettext("Gather ") << obj->m_Target << gettext(" gold");
			if (obj->m_Limit != -1) {
				ss << gettext(" in ") << obj->m_Limit << gettext(" weeks");
			}
			ss << gettext(", ") << g_Gold.ival() << gettext(" gathered so far.");
			break;
		case OBJECTIVE_GETNEXTBROTHEL:
			fmt_objective(ss, gettext("Purchase the next brothel"), obj->m_Limit);
			break;
			/*----
			case OBJECTIVE_PURCHASENEWGAMBLINGHALL:
			fmt_objective(ss, "Purchase a gambling hall", obj->m_Limit);
			break;
			case OBJECTIVE_PURCHASENEWBAR:
			fmt_objective(ss, "Purchase a bar", obj->m_Limit);
			break;
			----*/
		case OBJECTIVE_LAUNCHSUCCESSFULATTACK:
			fmt_objective(ss, gettext("Launch a successful attack"), obj->m_Limit);
			break;
		case OBJECTIVE_HAVEXGOONS:
			ss << gettext("Have ") << obj->m_Target << gettext(" gangs");
			fmt_objective(ss, "", obj->m_Limit);
			break;
		case OBJECTIVE_STEALXAMOUNTOFGOLD:
			ss << gettext("Steal ") << obj->m_Target << gettext(" gold");
			fmt_objective(ss, "", obj->m_Limit, obj->m_SoFar);
			break;
		case OBJECTIVE_CAPTUREXCATACOMBGIRLS:
			ss << gettext("Capture ") << obj->m_Target << gettext(" girls from the catacombs");
			fmt_objective(ss, "", obj->m_Limit, obj->m_SoFar);
			break;
		case OBJECTIVE_HAVEXMONSTERGIRLS:
			ss << gettext("Have a total of ") << obj->m_Target << gettext(" monster (non-human) girls");
			fmt_objective(ss, "", obj->m_Limit, g_Brothels.GetTotalNumGirls(true));
			break;
		case OBJECTIVE_KIDNAPXGIRLS:
			ss << gettext("Kidnap ") << obj->m_Target << gettext(" girls from the streets");
			fmt_objective(ss, "", obj->m_Limit, obj->m_SoFar);
			break;
		case OBJECTIVE_EXTORTXNEWBUSINESS:
			ss << gettext("Control ") << obj->m_Target << gettext(" city business");
			fmt_objective(ss, "", obj->m_Limit, obj->m_SoFar);
			break;
		case OBJECTIVE_HAVEXAMOUNTOFGIRLS:
			ss << gettext("Have a total of ") << obj->m_Target << gettext(" girls");
			fmt_objective(ss, "", obj->m_Limit, g_Brothels.GetTotalNumGirls(false));
			break;
		}
	}
	else ss << gettext("NONE\n");

	ss << gettext("\n")
		<< gettext("Current gold: ") << g_Gold.ival() << gettext("\n")
		<< gettext("Bank account: ") << g_Brothels.GetBankMoney() << gettext("\n")
		<< gettext("Businesses controlled: ")
		<< g_Gangs.GetNumBusinessExtorted()
		<< gettext("\n")
		;

	ss << gettext("\nCurrent number of runaways: ") << g_Brothels.GetNumRunaways() << gettext("\n");
	//	`J` added while loop to add runaway's names to the list 
	if (g_Brothels.GetNumRunaways() > 0)
	{
		sGirl* rgirl = g_Brothels.m_Runaways;
		while (rgirl)
		{
			ss << rgirl->m_Realname << gettext(" (") << rgirl->m_RunAway << gettext(")");
			rgirl = rgirl->m_Next;
			if (rgirl)	ss << gettext(" ,   ");
		}
	}

	EditTextItem(ss.str(), details_id);
	obj = 0;
}
void cScreenCentreManagement::init()
{

	if (FreeGirl)
	{
		if (g_ChoiceManager.GetChoice(0) == 0)
		{
			vector<int> girl_array;
			GetSelectedGirls(&girl_array);  // get and sort array of girls

			for (int i = girl_array.size(); i--> 0;)	// OK, we have the array, now step through it backwards
			{
				selected_girl = g_Centre.GetGirl(g_CurrCentre, girl_array[i]);
				if (GirlDead(selected_girl) || !selected_girl->is_slave()) continue;  // if dead or not a slave, can't free her
				if (selected_girl)
				{
					selected_girl->m_States &= ~(1 << STATUS_SLAVE);
					The_Player->disposition(5);
					g_Girls.UpdateStat(selected_girl, STAT_PCLOVE, 10);
					g_Girls.UpdateStat(selected_girl, STAT_PCFEAR, -20);
					g_Girls.UpdateStat(selected_girl, STAT_PCHATE, -25);
					g_Girls.UpdateStat(selected_girl, STAT_OBEDIENCE, 10);
					g_Girls.UpdateStat(selected_girl, STAT_HAPPINESS, 70);
					
					selected_girl->m_AccLevel = cfg.initial.girls_accom();
					selected_girl->m_Stats[STAT_HOUSE] = cfg.initial.girls_house_perc();
					g_InitWin = true;
				}
			}
		}
		g_ChoiceManager.Free();
		FreeGirl = false;
	}

	g_CurrentScreen = SCREEN_CENTRE;
	if (!g_InitWin) return;

	Focused();
	g_InitWin = false;


	////////////////////

	selection = GetSelectedItemFromList(girllist_id);
	string centre;
	centre += g_Centre.GetName(g_CurrCentre);
	EditTextItem(centre, curcentre_id);

	//selected_girl = 0;

	// clear the lists
	ClearListBox(girllist_id);
	ClearListBox(jobtypelist_id);

	// add the job filters
	//	for(int i=0; i<NUMJOBTYPES; i++)  // loop through all job types
	AddToListBox(jobtypelist_id, JOBFILTER_COMMUNITYCENTRE, g_Centre.m_JobManager.JobFilterName[JOBFILTER_COMMUNITYCENTRE]);
	AddToListBox(jobtypelist_id, JOBFILTER_COUNSELINGCENTRE, g_Centre.m_JobManager.JobFilterName[JOBFILTER_COUNSELINGCENTRE]);
	RefreshJobList();
	SetSelectedItemInList(jobtypelist_id, JOBFILTER_COMMUNITYCENTRE);

	//get a list of all the column names, so we can find which data goes in that column
	vector<string> columnNames;
	m_ListBoxes[girllist_id]->GetColumnNames(columnNames);
	int numColumns = columnNames.size();
	string* Data = new string[numColumns];

	// Add girls to list
	for (int i = 0; i<g_Centre.GetNumGirls(g_CurrCentre); i++)
	{
		sGirl* gir = g_Centre.GetGirl(g_CurrCentre, i);
		if (selected_girl == gir)
			selection = i;

		unsigned int item_color = COLOR_BLUE;
		if (g_Girls.GetStat(gir, STAT_HEALTH) <= 30 || g_Girls.GetStat(gir, STAT_TIREDNESS) >= 80 || g_Girls.GetStat(gir, STAT_HAPPINESS) <= 30)
			item_color = COLOR_RED;

		gir->OutputGirlRow(Data, columnNames);
		AddToListBox(girllist_id, i, Data, numColumns, item_color);
	}
	delete[] Data;

	lastNum = -1;
	g_InitWin = false;

	if (selection >= 0)
	{
		while (selection > GetListBoxSize(girllist_id) && selection != -1)
			selection--;
	}
	if (selection >= 0)
		SetSelectedItemInList(girllist_id, selection);
	else
		SetSelectedItemInList(girllist_id, 0);

	DisableButton(day_id, (Day0Night1 == SHIFT_DAY));
	DisableButton(night_id, (Day0Night1 == SHIFT_NIGHT));

	update_image();
}
void CInputField::UpdateFocus()
{
    if (!Focused())
        TUI.UnLockCursor();
}