virtual void OnClick(Point pt, int widget, int click_count) { switch (widget) { case WID_S_MIDDLE: ShowLastNewsMessage(); break; case WID_S_RIGHT: if (_local_company != COMPANY_SPECTATOR) ShowCompanyFinances(_local_company); break; default: ResetObjectToPlace(); } }
/** * A year has passed, update the economic data of all companies, and perhaps show the * financial overview window of the local company. */ void CompaniesYearlyLoop() { Company *c; /* Copy statistics */ FOR_ALL_COMPANIES(c) { memmove(&c->yearly_expenses[1], &c->yearly_expenses[0], sizeof(c->yearly_expenses) - sizeof(c->yearly_expenses[0])); memset(&c->yearly_expenses[0], 0, sizeof(c->yearly_expenses[0])); SetWindowDirty(WC_FINANCES, c->index); } if (_settings_client.gui.show_finances && _local_company != COMPANY_SPECTATOR) { ShowCompanyFinances(_local_company); c = Company::Get(_local_company); if (c->num_valid_stat_ent > 5 && c->old_economy[0].performance_history < c->old_economy[4].performance_history) { SndPlayFx(SND_01_BAD_YEAR); } else { SndPlayFx(SND_00_GOOD_YEAR); } } }