Example #1
0
/*
	DisplayStats: Fills out controls for statistics dialog.
*/
BOOL DisplayStats(HWND dialog)
{
	// TODO: split this into model/view

	UINT total = 0, i;
	UINT ne = 0, nc = 0;
	Trigger *t_parse;
	Player *p_parse;

	/* total enabled players */
	SetDlgItemInt(dialog, IDC_S_PLAYERS, scen.getPlayerCount(), FALSE);

	/* Units (including buildings, GAIA stuff, etc.) */
	total = 0;
	p_parse = scen.players;
	for (i = 0; i < NUM_PLAYERS; i++, p_parse++)
	{
		int count = p_parse->units.size();
		if (i <= GAIA_INDEX)
			SetDlgItemInt(dialog, IDC_S_UNITS1 + i, count, FALSE);
		total += count;
	}
	SetDlgItemInt(dialog, IDC_S_UNITS, total, FALSE);

	/* Disabled (techs only) */
	total = 0;
	p_parse = scen.players;
	for (i = 0; i < NUM_PLAYERS; i++, p_parse++)
	{
		int count = p_parse->ndis_t;
		if (i <= GAIA_INDEX)
			SetDlgItemInt(dialog, IDC_S_DISABLE1 + i, count, FALSE);
		total += count;
	}
	SetDlgItemInt(dialog, IDC_S_DISABLE, total, FALSE);

	/* total triggers */
	SetDlgItemInt(dialog, IDC_S_TRIGGERS, scen.triggers.size(), FALSE);

	/* total effects & conditions */
	total = scen.triggers.size();
	if (total > 0) {
	    t_parse = &(*scen.triggers.begin());
	    while (total--)
	    {
		    ne += t_parse->effects.size();
		    nc += t_parse->conds.size();
		    t_parse++;
	    }
	}
	SetDlgItemInt(dialog, IDC_S_CONDITIONS, nc, FALSE);
	SetDlgItemInt(dialog, IDC_S_EFFECTS, ne, FALSE);

	/* map size (why here?) */
	SetDlgItemInt(dialog, IDC_S_MAPSIZE, scen.map.x, FALSE);

	return TRUE;
}