src/graph_gui.cpp
branchcpp_gui
changeset 6308 646711c5feaa
parent 6303 84c215fc8eb8
equal deleted inserted replaced
6307:f40e88cff863 6308:646711c5feaa
    24 /************************/
    24 /************************/
    25 /* GENERIC GRAPH DRAWER */
    25 /* GENERIC GRAPH DRAWER */
    26 /************************/
    26 /************************/
    27 
    27 
    28 enum {
    28 enum {
    29 	GRAPH_MAX_DATASETS = 16,
    29 	GRAPH_MAX_DATASETS = 32,
    30 	GRAPH_AXIS_LABEL_COLOUR = 16,
    30 	GRAPH_AXIS_LABEL_COLOUR = 16,
    31 	GRAPH_AXIS_LINE_COLOUR  = 215,
    31 	GRAPH_AXIS_LINE_COLOUR  = 215,
    32 
    32 
    33 	GRAPH_X_POSITION_BEGINNING  = 44,  ///< Start the graph 44 pixels from gw->left
    33 	GRAPH_X_POSITION_BEGINNING  = 44,  ///< Start the graph 44 pixels from gw->left
    34 	GRAPH_X_POSITION_SEPARATION = 22,  ///< There are 22 pixels between each X value
    34 	GRAPH_X_POSITION_SEPARATION = 22,  ///< There are 22 pixels between each X value
   220 					/* XXX: This can overflow if x_axis_offset * datapoint is
   220 					/* XXX: This can overflow if x_axis_offset * datapoint is
   221 					 * too big to fit in an int64. */
   221 					 * too big to fit in an int64. */
   222 					y = gw->top + x_axis_offset - (x_axis_offset * datapoint) / highest_value;
   222 					y = gw->top + x_axis_offset - (x_axis_offset * datapoint) / highest_value;
   223 
   223 
   224 					/* Draw the point. */
   224 					/* Draw the point. */
   225 					GfxFillRect(x-1, y-1, x+1, y+1, color);
   225 					GfxFillRect(x - 1, y - 1, x + 1, y + 1, color);
   226 
   226 
   227 					/* Draw the line connected to the previous point. */
   227 					/* Draw the line connected to the previous point. */
   228 					if (prev_x != INVALID_DATAPOINT_POS) GfxDrawLine(prev_x, prev_y, x, y, color);
   228 					if (prev_x != INVALID_DATAPOINT_POS) GfxDrawLine(prev_x, prev_y, x, y, color);
   229 
   229 
   230 					prev_x = x;
   230 					prev_x = x;
   267 			w->DrawWidgets();
   267 			w->DrawWidgets();
   268 
   268 
   269 			FOR_ALL_PLAYERS(p) {
   269 			FOR_ALL_PLAYERS(p) {
   270 				if (!p->is_active) continue;
   270 				if (!p->is_active) continue;
   271 
   271 
   272 				DrawPlayerIcon(p->index, 4, 18+p->index*12);
   272 				DrawPlayerIcon(p->index, 4, 18 + p->index * 12);
   273 
   273 
   274 				SetDParam(0, p->name_1);
   274 				SetDParam(0, p->name_1);
   275 				SetDParam(1, p->name_2);
   275 				SetDParam(1, p->name_2);
   276 				SetDParam(2, GetPlayerNameString(p->index, 3));
   276 				SetDParam(2, GetPlayerNameString(p->index, 3));
   277 				DrawString(21, 17 + p->index * 12, STR_7021, HASBIT(_legend_excluded_players, p->index) ? 0x10 : 0xC);
   277 				DrawString(21, 17 + p->index * 12, STR_7021, HASBIT(_legend_excluded_players, p->index) ? 0x10 : 0xC);
   329 static void SetupGraphDrawerForPlayers(GraphDrawer *gd)
   329 static void SetupGraphDrawerForPlayers(GraphDrawer *gd)
   330 {
   330 {
   331 	const Player* p;
   331 	const Player* p;
   332 	uint excluded_players = _legend_excluded_players;
   332 	uint excluded_players = _legend_excluded_players;
   333 	byte nums;
   333 	byte nums;
   334 	int mo,yr;
   334 	int mo, yr;
   335 
   335 
   336 	/* Exclude the players which aren't valid */
   336 	/* Exclude the players which aren't valid */
   337 	FOR_ALL_PLAYERS(p) {
   337 	FOR_ALL_PLAYERS(p) {
   338 		if (!p->is_active) SETBIT(excluded_players, p->index);
   338 		if (!p->is_active) SETBIT(excluded_players, p->index);
   339 	}
   339 	}
   907 	CompanyLeagueWndProc
   907 	CompanyLeagueWndProc
   908 };
   908 };
   909 
   909 
   910 void ShowCompanyLeagueTable()
   910 void ShowCompanyLeagueTable()
   911 {
   911 {
   912 	BaseWindow::AllocateFront(&_company_league_desc,0);
   912 	BaseWindow::AllocateFront(&_company_league_desc, 0);
   913 }
   913 }
   914 
   914 
   915 /*****************************/
   915 /*****************************/
   916 /* PERFORMANCE RATING DETAIL */
   916 /* PERFORMANCE RATING DETAIL */
   917 /*****************************/
   917 /*****************************/