Index: C:/Code/OpenTTD/player_gui.c =================================================================== --- C:/Code/OpenTTD/player_gui.c (revision 4303) +++ C:/Code/OpenTTD/player_gui.c (working copy) @@ -29,15 +29,24 @@ { int x,y,i,j,year; const int64 (*tbl)[13]; - int64 sum, cost; + int64 sum, cost, tally; StringID str; if (!(mode & 1)) { // normal sized economics window (mode&1) is minimized status /* draw categories */ DrawStringCenterUnderline(61, 15, STR_700F_EXPENDITURE_INCOME, 0); - for (i = 0; i != 13; i++) - DrawString(2, 27 + i*10, STR_7011_CONSTRUCTION + i, 0); - DrawStringRightAligned(111, 27 + 10*13 + 2, STR_7020_TOTAL, 0); + for (i = 0; i != 2; i++) + DrawString(2, 27 + i*10 + 150, STR_7011_CONSTRUCTION + i, 0); + for (i = 2; i != 7; i++) + DrawString(2, 27 + i*10 - 20, STR_7011_CONSTRUCTION + i, 0); + for (i = 7; i != 11; i++) + DrawString(2, 27 + i*10 + 20, STR_7011_CONSTRUCTION + i, 0); + for (i = 11; i != 13; i++) + DrawString(2, 27 + i*10 - 60, STR_7011_CONSTRUCTION + i, 0); + DrawStringRightAligned(111, 27 + 7*10 + 2, STR_7020_TOTAL, 0); + DrawStringRightAligned(111, 27 + 13*10 + 2, STR_7020_TOTAL, 0); + DrawStringRightAligned(111, 27 + 17*10 + 2, STR_7020_TOTAL, 0); + DrawStringRightAligned(111, 27 + 19*10 + 2, STR_7020_TOTAL, 0); /* draw the price columns */ year = _cur_year - 2; @@ -49,7 +58,8 @@ SetDParam(0, year + 1920); DrawStringCenterUnderline(x-17, 15, STR_7010, 0); sum = 0; - for (i = 0; i != 13; i++) { + tally = 0; + for (i = 2; i != 7; i++) { /* draw one row in the price column */ cost = (*tbl)[i]; if (cost != 0) { @@ -58,23 +68,81 @@ str = STR_701E; if (cost < 0) { cost = -cost; str++; } SetDParam64(0, cost); - DrawStringRightAligned(x, 27+i*10, str, 0); + DrawStringRightAligned(x, 27 + i*10 - 20, str, 0); } } + for (i = 11; i != 13; i++) { + cost = (*tbl)[i]; + if (cost != 0) { + sum += cost; + str = STR_701E; + if (cost < 0) { cost = -cost; str++; } + SetDParam64(0, cost); + DrawStringRightAligned(x, 27 + i*10 - 60, str, 0); + } + } + str = STR_701E; + tally += sum; if (sum < 0) { sum = -sum; str++; } SetDParam64(0, sum); + DrawStringRightAligned(x, 27 + 7*10 + 2, str, 0); + + sum = 0; + for (i = 7; i != 11; i++) { + cost = (*tbl)[i]; + if (cost != 0) { + sum += cost; + + str = STR_701E; + if (cost < 0) { cost = -cost; str++; } + SetDParam64(0, cost); + DrawStringRightAligned(x, 27 + i*10 + 20, str, 0); + } + } + + str = STR_701E; + tally += sum; + if (sum < 0) { sum = -sum; str++; } + SetDParam64(0, sum); DrawStringRightAligned(x, 27 + 13*10 + 2, str, 0); + sum = 0; + for (i = 0; i != 2; i++) { + cost = (*tbl)[i]; + if (cost != 0) { + sum += cost; + + str = STR_701E; + if (cost < 0) { cost = -cost; str++; } + SetDParam64(0, cost); + DrawStringRightAligned(x, 27 + i*10 + 150, str, 0); + } + } + + str = STR_701E; + tally += sum; + if (sum < 0) { sum = -sum; str++; } + SetDParam64(0, sum); + DrawStringRightAligned(x, 27 + 17*10 + 2, str, 0); + + str = STR_701E; + if (tally < 0) { tally = -tally; str++; } + SetDParam64(0, tally); + DrawStringRightAligned(x, 27 + 19*10 + 2, str, 0); + + GfxFillRect(x - 75, 27 + 10*7, x, 27 + 10*7, 215); GfxFillRect(x - 75, 27 + 10*13, x, 27 + 10*13, 215); + GfxFillRect(x - 75, 27 + 10*17, x, 27 + 10*17, 215); + GfxFillRect(x - 75, 27 + 10*19, x, 27 + 10*19, 215); x += 95; } year++; tbl--; } while (--j != 0); - y = 171; + y = 231; // draw max loan aligned to loan below (y += 10) SetDParam64(0, (uint64)_economy.max_loan); @@ -106,10 +174,10 @@ { WWT_CAPTION, RESIZE_NONE, 14, 11, 379, 0, 13, STR_700E_FINANCES, STR_018C_WINDOW_TITLE_DRAG_THIS}, { WWT_IMGBTN, RESIZE_NONE, 14, 380, 394, 0, 13, 0x2AA, STR_7075_TOGGLE_LARGE_SMALL_WINDOW}, { WWT_STICKYBOX, RESIZE_NONE, 14, 395, 406, 0, 13, 0x0, STR_STICKY_BUTTON}, -{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 406, 14, 169, 0x0, STR_NULL}, -{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 406, 170, 203, 0x0, STR_NULL}, -{ WWT_PUSHTXTBTN, RESIZE_NONE, 14, 0, 202, 204, 215, STR_7029_BORROW, STR_7035_INCREASE_SIZE_OF_LOAN}, -{ WWT_PUSHTXTBTN, RESIZE_NONE, 14, 203, 406, 204, 215, STR_702A_REPAY, STR_7036_REPAY_PART_OF_LOAN}, +{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 406, 14, 229, 0x0, STR_NULL}, +{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 406, 230, 263, 0x0, STR_NULL}, +{ WWT_PUSHTXTBTN, RESIZE_NONE, 14, 0, 202, 264, 275, STR_7029_BORROW, STR_7035_INCREASE_SIZE_OF_LOAN}, +{ WWT_PUSHTXTBTN, RESIZE_NONE, 14, 203, 406, 264, 275, STR_702A_REPAY, STR_7036_REPAY_PART_OF_LOAN}, { WIDGETS_END}, }; @@ -118,8 +186,8 @@ { WWT_CAPTION, RESIZE_NONE, 14, 11, 379, 0, 13, STR_700E_FINANCES, STR_018C_WINDOW_TITLE_DRAG_THIS}, { WWT_IMGBTN, RESIZE_NONE, 14, 380, 394, 0, 13, 0x2AA, STR_7075_TOGGLE_LARGE_SMALL_WINDOW}, { WWT_STICKYBOX, RESIZE_NONE, 14, 395, 406, 0, 13, 0x0, STR_STICKY_BUTTON}, -{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 406, 14, 169, 0x0, STR_NULL}, -{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 406, 170, 203, 0x0, STR_NULL}, +{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 406, 14, 229, 0x0, STR_NULL}, +{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 406, 230, 263, 0x0, STR_NULL}, { WIDGETS_END}, }; @@ -187,7 +255,7 @@ } static const WindowDesc _player_finances_desc = { - -1,-1, 407, 216, + -1,-1, 407, 276, WC_FINANCES,0, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON, _player_finances_widgets, @@ -203,7 +271,7 @@ }; static const WindowDesc _other_player_finances_desc = { - -1,-1, 407, 204, + -1,-1, 407, 264, WC_FINANCES,0, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON, _other_player_finances_widgets,