diff --git a/src/company_gui.cpp b/src/company_gui.cpp --- a/src/company_gui.cpp +++ b/src/company_gui.cpp @@ -227,7 +227,7 @@ static void DrawPrice(Money amount, int * Draw a category of expenses/revenues in the year column. * @return The income sum of the category. */ -static Money DrawYearCategory (const Rect &r, int start_y, ExpensesList list, const Money(*tbl)[EXPENSES_END]) +static Money DrawYearCategory (const Rect &r, int start_y, ExpensesList list, const Money(&tbl)[EXPENSES_END]) { int y = start_y; ExpensesType et; @@ -235,7 +235,7 @@ static Money DrawYearCategory (const Rec for (uint i = 0; i < list.length; i++) { et = list.et[i]; - Money cost = (*tbl)[et]; + Money cost = tbl[et]; sum += cost; if (cost != 0) DrawPrice(cost, r.left, r.right, y, TC_BLACK); y += FONT_HEIGHT_NORMAL; @@ -255,10 +255,10 @@ static Money DrawYearCategory (const Rec * Draw a column with prices. * @param r Available space for drawing. * @param year Year being drawn. - * @param tbl Pointer to table of amounts for \a year. + * @param tbl Reference to table of amounts for \a year. * @note The environment must provide padding at the left and right of \a r. */ -static void DrawYearColumn(const Rect &r, int year, const Money (*tbl)[EXPENSES_END]) +static void DrawYearColumn(const Rect &r, int year, const Money (&tbl)[EXPENSES_END]) { int y = r.top; Money sum; @@ -435,7 +435,7 @@ struct CompanyFinancesWindow : Window { int age = std::min(_cur_year - c->inaugurated_year, 2); int wid_offset = widget - WID_CF_EXPS_PRICE1; if (wid_offset <= age) { - DrawYearColumn(r, _cur_year - (age - wid_offset), c->yearly_expenses + (age - wid_offset)); + DrawYearColumn(r, _cur_year - (age - wid_offset), c->yearly_expenses[age - wid_offset]); } break; }