Index: src/group_gui.cpp =================================================================== --- src/group_gui.cpp (revision 11039) +++ src/group_gui.cpp (working copy) @@ -134,6 +134,7 @@ GRP_WIDGET_START_ALL, GRP_WIDGET_EMPTY_BOTTOM_RIGHT, GRP_WIDGET_RESIZE, + GRP_WIDGET_GROUP_STATS, }; @@ -142,10 +143,10 @@ { WWT_CAPTION, RESIZE_RIGHT, 14, 11, 447, 0, 13, 0x0, STR_018C_WINDOW_TITLE_DRAG_THIS}, { WWT_STICKYBOX, RESIZE_LR, 14, 448, 459, 0, 13, 0x0, STR_STICKY_BUTTON}, { WWT_PANEL, RESIZE_NONE, 14, 0, 200, 14, 25, 0x0, STR_NULL}, -{ WWT_PANEL, RESIZE_NONE, 14, 0, 200, 26, 38, 0x0, STR_NULL}, -{ WWT_PANEL, RESIZE_NONE, 14, 0, 200, 39, 52, 0x0, STR_NULL}, -{ WWT_MATRIX, RESIZE_BOTTOM, 14, 0, 188, 52, 168, 0x701, STR_GROUPS_CLICK_ON_GROUP_FOR_TIP}, -{ WWT_SCROLLBAR, RESIZE_BOTTOM, 14, 189, 200, 26, 168, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST}, +{ WWT_PANEL, RESIZE_NONE, 14, 0, 188, 26, 38, 0x0, STR_NULL}, +{ WWT_PANEL, RESIZE_NONE, 14, 0, 188, 39, 51, 0x0, STR_NULL}, +{ WWT_MATRIX, RESIZE_BOTTOM, 14, 0, 188, 52, 142, 0x701, STR_GROUPS_CLICK_ON_GROUP_FOR_TIP}, +{ WWT_SCROLLBAR, RESIZE_BOTTOM, 14, 189, 200, 26, 142, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST}, { WWT_PUSHTXTBTN, RESIZE_NONE, 14, 201, 281, 14, 25, STR_SORT_BY, STR_SORT_ORDER_TIP}, { WWT_PANEL, RESIZE_NONE, 14, 282, 435, 14, 25, 0x0, STR_SORT_CRITERIA_TIP}, { WWT_TEXTBTN, RESIZE_NONE, 14, 436, 447, 14, 25, STR_0225, STR_SORT_CRITERIA_TIP}, @@ -165,6 +166,7 @@ { WWT_PUSHIMGBTN, RESIZE_TB, 14, 436, 447, 182, 193, SPR_FLAG_VEH_RUNNING, STR_MASS_START_LIST_TIP}, { WWT_PANEL, RESIZE_RTB, 14, 448, 447, 182, 193, 0x0, STR_NULL}, { WWT_RESIZEBOX, RESIZE_LRTB, 14, 448, 459, 182, 193, 0x0, STR_RESIZE_BUTTON}, +{ WWT_PANEL, RESIZE_TB, 14, 0, 200, 143, 168, 0x0, STR_NULL}, { WIDGETS_END}, }; @@ -183,13 +185,13 @@ default: NOT_REACHED(); case VEH_TRAIN: case VEH_ROAD: - w->vscroll.cap = 9; + w->vscroll.cap = 7; w->vscroll2.cap = 6; w->resize.step_height = PLY_WND_PRC__SIZE_OF_ROW_SMALL; break; case VEH_SHIP: case VEH_AIRCRAFT: - w->vscroll.cap = 9; + w->vscroll.cap = 7; w->vscroll2.cap = 4; w->resize.step_height = PLY_WND_PRC__SIZE_OF_ROW_BIG2; break; @@ -294,6 +296,7 @@ const Player *p = GetPlayer(owner); groupveh_d *gv = &WP(w, groupveh_d); grouplist_d *gl = &WP(w, groupveh_d).gl; + Money this_year = 0, last_year = 0; gv->vehicle_type = (VehicleType)GB(w->window_number, 11, 5); @@ -474,6 +477,21 @@ y2 += w->resize.step_height; } + // Draw group stats + DrawGroupProfitButton(gv, 1, w->height - 48); + + for (i = 0, max = gv->l.list_length; i < max; ++i) { + this_year += gv->sort_list[i]->profit_this_year; + last_year += gv->sort_list[i]->profit_last_year; + } + + DrawString(10, w->height - 48, GROUP_PROFIT_THIS_YEAR, 16); + DrawString(10, w->height - 37, GROUP_PROFIT_LAST_YEAR, 16); + SetDParam(0, this_year); + DrawStringRightAligned(190, w->height - 48, GROUP_CURRENCY, 0); + SetDParam(0, last_year); + DrawStringRightAligned(190, w->height - 37, GROUP_CURRENCY, 0); + break; } Index: src/lang/english.txt =================================================================== --- src/lang/english.txt (revision 11039) +++ src/lang/english.txt (working copy) @@ -3374,3 +3374,7 @@ STR_PROSPECT_NEW_INDUSTRY :{BLACK}Prospect STR_BUILD_NEW_INDUSTRY :{BLACK}Build STR_INDUSTRY_SELECTION_HINT :{BLACK}Choose the appropriate industry from this list + +GROUP_PROFIT_LAST_YEAR :Profit last year: +GROUP_PROFIT_THIS_YEAR :Profit this year: +GROUP_CURRENCY :{BLACK}{CURRENCY} Index: src/vehicle_gui.cpp =================================================================== --- src/vehicle_gui.cpp (revision 11039) +++ src/vehicle_gui.cpp (working copy) @@ -173,7 +173,35 @@ } DrawSprite(SPR_BLOT, pal, x, y); } +/** draw the group profit button in the group list window. */ +void DrawGroupProfitButton(const groupveh_d *gv, int x, int y) +{ + SpriteID pal; + Money this_year = 0; + Money last_year = 0; + int count = 0; + /* draw profit-based colored icons */ + for (int i = 0, cpt = gv->l.list_length; i < cpt; ++i) { + if (gv->sort_list[i]->age <= 365 * 2) continue; + + ++count; + last_year += gv->sort_list[i]->profit_last_year; + this_year += gv->sort_list[i]->profit_this_year; + } + + if (count == 0) { + pal = PALETTE_TO_GREY; + } else if (last_year < 0) { + pal = PALETTE_TO_RED; + } else if (last_year < 10000 * count) { + pal = PALETTE_TO_YELLOW; + } else { + pal = PALETTE_TO_GREEN; + } + DrawSprite(SPR_BLOT, pal, x, y); +} + struct RefitOption { CargoID cargo; byte subtype; Index: src/vehicle_gui.h =================================================================== --- src/vehicle_gui.h (revision 11039) +++ src/vehicle_gui.h (working copy) @@ -9,6 +9,7 @@ #include "vehicle.h" void DrawVehicleProfitButton(const Vehicle *v, int x, int y); +void DrawGroupProfitButton(const groupveh_d *gv, int x, int y); void ShowVehicleRefitWindow(const Vehicle *v, VehicleOrderID order); void InitializeVehiclesGuiList();