Index: src/lang/english.txt =================================================================== --- src/lang/english.txt (revision 14569) +++ src/lang/english.txt (working copy) @@ -175,6 +175,8 @@ STR_00CE_4 :{BLACK}4 STR_00CF_5 :{BLACK}5 STR_00D0_NOTHING :Nothing +STR_00D0_NOTHING_BL :{BLACK}Nothing +STR_00D0_NOTHING_WHITE :{WHITE}Nothing STR_00D1_DARK_BLUE :Dark Blue STR_00D2_PALE_GREEN :Pale Green STR_00D3_PINK :Pink @@ -195,6 +197,8 @@ STR_00E2 :{BLACK}{COMMA} STR_00E3 :{RED}{COMMA} STR_00E4_LOCATION :{BLACK}Location +STR_00E4_STATS :{BLACK}Stats +STR_00E4_WAITING :{BLACK}Waiting STR_00E5_CONTOURS :Contours STR_00E6_VEHICLES :Vehicles STR_00E7_INDUSTRIES :Industries @@ -1911,8 +1915,13 @@ STR_3031_CAN_T_RENAME_STATION :{WHITE}Can't rename station... STR_3032_RATINGS :{BLACK}Ratings STR_3033_ACCEPTS :{BLACK}Accepts +STR_3033_CARGOS :{BLACK}Cargos STR_3034_LOCAL_RATING_OF_TRANSPORT :{BLACK}Local rating of transport service: +STR_3034_GENERATED_CARGO :{BLACK}Generated cargo: +STR_3034_TRANSFERRED_CARGO :{BLACK}Transferred cargo: +STR_3034_ARRIVING_CARGO :{BLACK}Incoming cargo: + ############ range for rating starts STR_3035_APPALLING :Appalling STR_3036_VERY_POOR :Very Poor @@ -1925,6 +1934,7 @@ ############ range for rating ends STR_303D :{WHITE}{STRING}: {YELLOW}{STRING} ({COMMA}%) +STR_303D_NO_RATING :{WHITE}{STRING}: {YELLOW}(No rating yet) STR_303E_NO_LONGER_ACCEPTS :{WHITE}{STATION} no longer accepts {STRING} STR_303F_NO_LONGER_ACCEPTS_OR :{WHITE}{STATION} no longer accepts {STRING} or {STRING} STR_3040_NOW_ACCEPTS :{WHITE}{STATION} now accepts {STRING} @@ -3460,6 +3470,10 @@ STR_SMALLMAP_CENTER :{BLACK}Center the smallmap on the current position STR_SMALLMAP_INDUSTRY :{TINYFONT}{STRING} ({NUM}) +STR_STATIONS_CURRENTMONTH :{TINYFONT}{BLACK}this month +STR_STATIONS_LASTMONTH :{TINYFONT}{BLACK}last month +STR_STATIONS_LASTYEAR :{TINYFONT}{BLACK}last year + ########### String for new airports STR_SMALL_AIRPORT :{BLACK}Small STR_CITY_AIRPORT :{BLACK}City Index: src/station_gui.h =================================================================== --- src/station_gui.h (revision 14569) +++ src/station_gui.h (working copy) @@ -34,18 +34,22 @@ enum StationViewWidgets { SVW_CLOSEBOX = 0, ///< Close 'X' button SVW_CAPTION = 1, ///< Caption of the window - SVW_WAITING = 3, ///< List of waiting cargo - SVW_ACCEPTLIST = 5, ///< List of accepted cargos - SVW_RATINGLIST = 5, ///< Ratings of cargos - SVW_LOCATION = 6, ///< 'Location' button - SVW_RATINGS = 7, ///< 'Ratings' button - SVW_ACCEPTS = 7, ///< 'Accepts' button - SVW_RENAME = 8, ///< 'Rename' button - SVW_TRAINS = 9, ///< List of scheduled trains button + // 2 = stickybox + SVW_WAITINGBTN = 3, ///< Button for waiting list + SVW_CARGOSBTN = 4, ///< Button for cargo list + SVW_STATSBTN = 5, ///< Button for statistics + SVW_LIST = 6, ///< general List + // 8 = scrollbar + SVW_LOCATION = 8, ///< 'Location' button + SVW_RENAME = 9, ///< 'Rename' button + SVW_TRAINS = 10, ///< List of scheduled trains button SVW_ROADVEHS, ///< List of scheduled road vehs button SVW_PLANES, ///< List of scheduled planes button SVW_SHIPS, ///< List of scheduled ships button SVW_RESIZE, ///< Resize button + SVW_CMONTH, ///< Current Month Button + SVW_LMONTH, ///< Last Month Button + SVW_LYEAR, ///< Last Year Button }; enum StationCoverageType { @@ -54,6 +58,17 @@ SCT_ALL }; +enum StationViewMode { + SVM_WAITING, ///< Waiting list + SVM_CARGOS, ///< Accept list + SVM_STATS ///< Stats mode +}; + +enum StationTimeViewMode { + SVT_CURRENT_MONTH, ///< current month + SVT_LAST_MONTH, ///< last month + SVM_LAST_YEAR ///< last year +}; int DrawStationCoverageAreaText(int sx, int sy, StationCoverageType sct, int rad, bool supplies); void CheckRedrawStationCoverage(const Window *w); Index: src/station_cmd.cpp =================================================================== --- src/station_cmd.cpp (revision 14569) +++ src/station_cmd.cpp (working copy) @@ -621,7 +621,7 @@ } /* redraw the station view since acceptance changed */ - InvalidateWindowWidget(WC_STATION_VIEW, st->index, SVW_ACCEPTLIST); + InvalidateWindowWidget(WC_STATION_VIEW, st->index, SVW_LIST); } static void UpdateStationSignCoord(Station *st) @@ -2724,7 +2724,7 @@ if (waiting_changed) { InvalidateWindow(WC_STATION_VIEW, index); // update whole window } else { - InvalidateWindowWidget(WC_STATION_VIEW, index, SVW_RATINGLIST); // update only ratings list + InvalidateWindowWidget(WC_STATION_VIEW, index, SVW_LIST); // update only ratings list } } @@ -2764,9 +2764,41 @@ void StationMonthlyLoop() { - /* not used */ + // update goods counters + Station *st; + FOR_ALL_STATIONS(st) { + st->months_gone_by++; + if(st->months_gone_by>=13) { + st->months_gone_by=0; + for(uint8 j=0;jlast_year_goods_counter[j][i] += st->current_year_goods_counter[j][i]; + st->current_year_goods_counter[j][i] = 0; + } + } + } + + for(uint8 j=0;jlast_month_goods_counter[j][i] = st->goods_counter[j][i]; + st->current_year_goods_counter[j][i] += st->goods_counter[j][i]; + st->goods_counter[j][i] = 0; + } + } + } } +void StationYearlyLoop() +{ + // update goods counters + Station *st; + FOR_ALL_STATIONS(st) { + for(uint8 j=0;jowner; if (owner != OWNER_NONE) this->caption_color = owner; - this->vscroll.cap = 5; this->resize.step_height = 10; + this->vscroll.cap =(this->height/(int)this->resize.step_height)-4; // -4 = substract title bar, top and bottom bar + this->row_counter=0; + // set view type + this->view_type=SVM_WAITING; + this->SetWidgetLoweredState(SVW_WAITINGBTN, true); + this->SetWidgetLoweredState(SVW_CARGOSBTN, false); + this->SetWidgetLoweredState(SVW_STATSBTN, false); + + // time widgets + this->stats_time_mode=SVT_CURRENT_MONTH; + this->SetWidgetLoweredState(SVW_CMONTH, true); + this->SetWidgetsHiddenState(true, SVW_CMONTH, SVW_LMONTH, SVW_LYEAR, WIDGET_LIST_END); + this->FindWindowPlacementAndResize(desc); } @@ -713,6 +745,9 @@ CargoDataList cargolist; uint32 transfers = 0; + int old_row_counter=this->row_counter; + this->row_counter=0; + /* count types of cargos waiting in station */ for (CargoID i = 0; i < NUM_CARGO; i++) { if (st->goods[i].cargo.Empty()) { @@ -752,7 +787,6 @@ } } } - SetVScrollCount(this, (int)cargolist.size() + 1); // update scrollbar /* disable some buttons */ this->SetWidgetDisabledState(SVW_RENAME, st->owner != _local_company); @@ -766,102 +800,249 @@ this->DrawWidgets(); int x = 2; ///< coordinates used for printing waiting/accepted/rating of cargo - int y = 15; + int y = 27; int pos = this->vscroll.pos; ///< = this->vscroll.pos - uint width = this->widget[SVW_WAITING].right - this->widget[SVW_WAITING].left - 4; + uint width = this->widget[SVW_LIST].right - this->widget[SVW_LIST].left - 4; int maxrows = this->vscroll.cap; + uint8 bottomheight = 20; // size of the bottom button row (to determine if we overflow or not) - StringID str; - - if (--pos < 0) { - str = STR_00D0_NOTHING; - for (CargoID i = 0; i < NUM_CARGO; i++) { - if (!st->goods[i].cargo.Empty()) str = STR_EMPTY; + if (this->view_type == SVM_WAITING) { // small window with list of waiting cargo + SetVScrollCount(this, (int)cargolist.size() + 1); // update scrollbar + // check if nothing is waiting + bool nothing_waiting = true; + if (--pos < 0) { + for (CargoID i = 0; i < NUM_CARGO; i++) { + if (!st->goods[i].cargo.Empty()) + nothing_waiting = false; + } } - SetDParam(0, str); - DrawString(x, y, STR_0008_WAITING, TC_FROMSTRING); - y += 10; - } + if(nothing_waiting) { + DrawString(x, y, STR_00D0_NOTHING_WHITE, TC_FROMSTRING); + row_counter++; + y += 10; + } - for (CargoDataList::const_iterator it = cargolist.begin(); it != cargolist.end() && pos > -maxrows; ++it) { - if (--pos < 0) { - const CargoData *cd = &(*it); - if (cd->source == INVALID_STATION) { - /* Heading */ - DrawCargoIcons(cd->cargo, cd->count, x, y, width); - SetDParam(0, cd->cargo); - SetDParam(1, cd->count); - if (HasBit(transfers, cd->cargo)) { - /* This cargo has transfers waiting so show the expand or shrink 'button' */ - const char *sym = HasBit(this->cargo, cd->cargo) ? "-" : "+"; - DrawStringRightAligned(x + width - 8, y, STR_0009, TC_FROMSTRING); - DoDrawString(sym, x + width - 6, y, TC_YELLOW); + for (CargoDataList::const_iterator it = cargolist.begin(); it != cargolist.end() && pos > -maxrows; ++it) { + if (--pos < 0) { + const CargoData *cd = &(*it); + if (cd->source == INVALID_STATION) { + /* Heading */ + DrawCargoIcons(cd->cargo, cd->count, x, y, width); + SetDParam(0, cd->cargo); + SetDParam(1, cd->count); + if (HasBit(transfers, cd->cargo)) { + /* This cargo has transfers waiting so show the expand or shrink 'button' */ + const char *sym = HasBit(this->cargo, cd->cargo) ? "-" : "+"; + DrawStringRightAligned(x + width - 8, y, STR_0009, TC_FROMSTRING); + DoDrawString(sym, x + width - 6, y, TC_YELLOW); + } else { + DrawStringRightAligned(x + width, y, STR_0009, TC_FROMSTRING); + } } else { - DrawStringRightAligned(x + width, y, STR_0009, TC_FROMSTRING); + SetDParam(0, cd->cargo); + SetDParam(1, cd->count); + SetDParam(2, cd->source); + DrawStringRightAlignedTruncated(x + width, y, STR_EN_ROUTE_FROM, TC_FROMSTRING, width); } - } else { - SetDParam(0, cd->cargo); - SetDParam(1, cd->count); - SetDParam(2, cd->source); - DrawStringRightAlignedTruncated(x + width, y, STR_EN_ROUTE_FROM, TC_FROMSTRING, width); + y += 10; + row_counter++; + if(y>this->height-bottomheight) break; // no overflowing content } - - y += 10; } } - - if (this->widget[SVW_ACCEPTS].data == STR_3032_RATINGS) { // small window with list of accepted cargo - char string[512]; - char *b = string; + else if (this->view_type == SVM_CARGOS) { // small window with list of accepted cargo bool first = true; - b = InlineString(b, STR_000C_ACCEPTS); - + // accepted cargo + if(row_counter++>=pos) { + DrawString(2, y, STR_000D_ACCEPTS, TC_FROMSTRING); + y+=10; + } + if(yheight-bottomheight) // no overflowing content for (CargoID i = 0; i < NUM_CARGO; i++) { - if (b >= lastof(string) - (1 + 2 * 4)) break; // ',' or ' ' and two calls to Utf8Encode() if (HasBit(st->goods[i].acceptance_pickup, GoodsEntry::ACCEPTANCE)) { - if (first) { - first = false; - } else { - /* Add a comma if this is not the first item */ - *b++ = ','; - *b++ = ' '; + first=false; + if(row_counter++>=pos) { + // draw cargo icon + SpriteID sprite = GetCargoSprite(i); + DrawSprite(sprite, PAL_NONE, 2, y); + + // draw cargo text + const CargoSpec *cs = GetCargo(i); + if (!cs->IsValid()) continue; + DrawString(16, y, cs->name, TC_WHITE); + y+=10; + if(y>this->height-bottomheight) break; // no overflowing content } - b = InlineString(b, GetCargo(i)->name); } } /* If first is still true then no cargo is accepted */ - if (first) b = InlineString(b, STR_00D0_NOTHING); + if (first && row_counter++>=pos && yheight-bottomheight) { + DrawString(2, y, STR_00D0_NOTHING_WHITE, TC_FROMSTRING); + y+=10; + } + + if(row_counter++>=pos && yheight-bottomheight) { + y+=10; //space between accepted and supplied + } - *b = '\0'; + // provided cargo + if(row_counter++>=pos && yheight-bottomheight) { + DrawString(2, y, STR_SUPPLIES, TC_FROMSTRING); + y+=10; + } + first=true; - /* Make sure we detect any buffer overflow */ - assert(b < endof(string)); + // get supplied cargos + for (CargoID i = 0; i < NUM_CARGO; i++) { + const CargoSpec *cs = GetCargo(i); + if (!cs->IsValid()) continue; + + const GoodsEntry *ge = &st->goods[i]; + bool rating_available = HasBit(ge->acceptance_pickup, GoodsEntry::PICKUP); + if(!rating_available) continue; // <- possibly fix that, otherwise produced cargo that is not picked up is not shown + first=false; + if(row_counter++>=pos) { + // draw cargo icon + SpriteID sprite = GetCargoSprite(i); + DrawSprite(sprite, PAL_NONE, 2, y); - SetDParamStr(0, string); - DrawStringMultiLine(2, this->widget[SVW_ACCEPTLIST].top + 1, STR_JUST_RAW_STRING, this->widget[SVW_ACCEPTLIST].right - this->widget[SVW_ACCEPTLIST].left); - } else { // extended window with list of cargo ratings - y = this->widget[SVW_RATINGLIST].top + 1; + // draw cargo text + SetDParam(0, cs->name); + SetDParam(2, ge->rating * 101 >> 8); + SetDParam(1, STR_3035_APPALLING + (ge->rating >> 5)); - DrawString(2, y, STR_3034_LOCAL_RATING_OF_TRANSPORT, TC_FROMSTRING); - y += 10; + if (rating_available) // < that needs fixing + DrawString(16, y, STR_303D, TC_FROMSTRING); + // else + // DrawString(16, y, STR_303D_NO_RATING, TC_FROMSTRING); + y+=10; + if(y>this->height-bottomheight) break; // no overflowing content + } + } + if (first && row_counter++>=pos && yheight-bottomheight) { + DrawString(2, y, STR_00D0_NOTHING_WHITE, TC_FROMSTRING); + y+=10; + } + SetVScrollCount(this, row_counter + 1); // update scrollbar + } + else if (this->view_type == SVM_STATS) { // extended window with some statistics about the station + y = this->widget[SVW_LIST].top + 1; + + // generated goods + if(row_counter++>=pos) { + DrawString(2, y, STR_3034_GENERATED_CARGO, TC_FROMSTRING); + y += 10; + } + bool nothing=true; + if(yheight-bottomheight) // no overflowing content for (CargoID i = 0; i < NUM_CARGO; i++) { - const CargoSpec *cs = GetCargo(i); - if (!cs->IsValid()) continue; + uint32 value = 0; + if (this->stats_time_mode == SVT_CURRENT_MONTH) + value = st->goods_counter[CARCAT_OUTGOING][i]; + else if (this->stats_time_mode == SVT_LAST_MONTH) + value = st->last_month_goods_counter[CARCAT_OUTGOING][i]; + else if (this->stats_time_mode == SVM_LAST_YEAR) + value = st->last_year_goods_counter[CARCAT_OUTGOING][i]; - const GoodsEntry *ge = &st->goods[i]; - if (!HasBit(ge->acceptance_pickup, GoodsEntry::PICKUP)) continue; + if(value > 0) { + nothing=false; + if(row_counter++>=pos) { + // draw cargo icon + SpriteID sprite = GetCargoSprite(i); + DrawSprite(sprite, PAL_NONE, 2, y); + + // draw cargo text + SetDParam(0, i); + SetDParam(1, value); + DrawString(16, y, STR_0009, TC_FROMSTRING); + y += 10; + if(y>this->height-bottomheight) break; // no overflowing content + } + } + } + if(nothing && row_counter++>=pos && yheight-bottomheight) { + DrawString(2, y, STR_00D0_NOTHING_WHITE, TC_FROMSTRING); + y+=10; + } + + // incoming goods + if(row_counter++>=pos && yheight-bottomheight) { + DrawString(2, y, STR_3034_ARRIVING_CARGO, TC_FROMSTRING); + y += 10; + } + nothing=true; + for (CargoID i = 0; i < NUM_CARGO; i++) { + uint32 value = 0; + if (this->stats_time_mode == SVT_CURRENT_MONTH) + value = st->goods_counter[CARCAT_INCOMING][i]; + else if (this->stats_time_mode == SVT_LAST_MONTH) + value = st->last_month_goods_counter[CARCAT_INCOMING][i]; + else if (this->stats_time_mode == SVM_LAST_YEAR) + value = st->last_year_goods_counter[CARCAT_INCOMING][i]; - SetDParam(0, cs->name); - SetDParam(2, ge->rating * 101 >> 8); - SetDParam(1, STR_3035_APPALLING + (ge->rating >> 5)); - DrawString(8, y, STR_303D, TC_FROMSTRING); + if(value > 0) { + nothing=false; + if(row_counter++>=pos) { + // draw cargo icon + SpriteID sprite = GetCargoSprite(i); + DrawSprite(sprite, PAL_NONE, 2, y); + + // draw cargo text + SetDParam(0, i); + SetDParam(1, value); + DrawString(16, y, STR_0009, TC_FROMSTRING); + y += 10; + if(y>this->height-bottomheight) break; // no overflowing content + } + } + } + if(nothing && row_counter++>=pos && yheight-bottomheight) { + DrawString(2, y, STR_00D0_NOTHING_WHITE, TC_FROMSTRING); + y+=10; + } + + if(row_counter++>=pos && yheight-bottomheight) { + DrawString(2, y, STR_3034_TRANSFERRED_CARGO, TC_FROMSTRING); y += 10; } + + nothing=true; + for (CargoID i = 0; i < NUM_CARGO; i++) { + uint32 value = 0; + if (this->stats_time_mode == SVT_CURRENT_MONTH) + value = st->goods_counter[CARCAT_TRANSFERRD][i]; + else if (this->stats_time_mode == SVT_LAST_MONTH) + value = st->last_month_goods_counter[CARCAT_TRANSFERRD][i]; + else if (this->stats_time_mode == SVM_LAST_YEAR) + value = st->last_year_goods_counter[CARCAT_TRANSFERRD][i]; + + if(value > 0) { + nothing=false; + if(row_counter++>=pos) { + // draw cargo icon + SpriteID sprite = GetCargoSprite(i); + DrawSprite(sprite, PAL_NONE, 2, y); + + // draw cargo text + SetDParam(0, i); + SetDParam(1, value); + DrawString(16, y, STR_0009, TC_FROMSTRING); + y += 10; + if(y>this->height-bottomheight) break; // no overflowing content + } + } + } + if(nothing && row_counter++>=pos && yheight-bottomheight) { + DrawString(2, y, STR_00D0_NOTHING_WHITE, TC_FROMSTRING); + y+=10; + } + SetVScrollCount(this, row_counter + 1); // update scrollbar } + if(old_row_counter!=this->row_counter) this->SetDirty(); // redraw scroll bar! } void HandleCargoWaitingClick(int row) @@ -871,7 +1052,7 @@ for (CargoID c = 0; c < NUM_CARGO; c++) { if (this->cargo_rows[c] == row) { ToggleBit(this->cargo, c); - this->InvalidateWidget(SVW_WAITING); + this->InvalidateWidget(SVW_LIST); break; } } @@ -880,8 +1061,8 @@ virtual void OnClick(Point pt, int widget) { switch (widget) { - case SVW_WAITING: - this->HandleCargoWaitingClick((pt.y - this->widget[SVW_WAITING].top) / 10 + this->vscroll.pos); + case SVW_LIST: + this->HandleCargoWaitingClick((pt.y - this->widget[SVW_LIST].top) / 10 + this->vscroll.pos); break; case SVW_LOCATION: @@ -892,21 +1073,57 @@ } break; - case SVW_RATINGS: + case SVW_WAITINGBTN: + this->view_type = SVM_WAITING; + this->SetWidgetLoweredState(SVW_WAITINGBTN, true); + this->SetWidgetLoweredState(SVW_CARGOSBTN, false); + this->SetWidgetLoweredState(SVW_STATSBTN, false); + this->SetWidgetsHiddenState(true, SVW_CMONTH, SVW_LMONTH, SVW_LYEAR, WIDGET_LIST_END); + this->vscroll.pos=0; this->SetDirty(); + break; + + case SVW_CARGOSBTN: + this->view_type = SVM_CARGOS; + this->SetWidgetLoweredState(SVW_WAITINGBTN, false); + this->SetWidgetLoweredState(SVW_CARGOSBTN, true); + this->SetWidgetLoweredState(SVW_STATSBTN, false); + this->SetWidgetsHiddenState(true, SVW_CMONTH, SVW_LMONTH, SVW_LYEAR, WIDGET_LIST_END); + this->vscroll.pos=0; + this->SetDirty(); + break; + + case SVW_STATSBTN: + this->view_type = SVM_STATS; + this->SetWidgetLoweredState(SVW_WAITINGBTN, false); + this->SetWidgetLoweredState(SVW_CARGOSBTN, false); + this->SetWidgetLoweredState(SVW_STATSBTN, true); + this->SetWidgetsHiddenState(false, SVW_CMONTH, SVW_LMONTH, SVW_LYEAR, WIDGET_LIST_END); + this->vscroll.pos=0; + this->SetDirty(); + break; + + case SVW_CMONTH: + this->stats_time_mode=SVT_CURRENT_MONTH; + this->SetWidgetLoweredState(SVW_CMONTH, true); + this->SetWidgetLoweredState(SVW_LMONTH, false); + this->SetWidgetLoweredState(SVW_LYEAR, false); + this->SetDirty(); + break; + + case SVW_LMONTH: + this->stats_time_mode=SVT_LAST_MONTH; + this->SetWidgetLoweredState(SVW_CMONTH, false); + this->SetWidgetLoweredState(SVW_LMONTH, true); + this->SetWidgetLoweredState(SVW_LYEAR, false); + this->SetDirty(); + break; - if (this->widget[SVW_RATINGS].data == STR_3032_RATINGS) { - /* Switch to ratings view */ - this->widget[SVW_RATINGS].data = STR_3033_ACCEPTS; - this->widget[SVW_RATINGS].tooltips = STR_3056_SHOW_LIST_OF_ACCEPTED_CARGO; - ResizeWindowForWidget(this, SVW_ACCEPTLIST, 0, 100); - } else { - /* Switch to accepts view */ - this->widget[SVW_RATINGS].data = STR_3032_RATINGS; - this->widget[SVW_RATINGS].tooltips = STR_3054_SHOW_STATION_RATINGS; - ResizeWindowForWidget(this, SVW_ACCEPTLIST, 0, -100); - } - + case SVW_LYEAR: + this->stats_time_mode=SVM_LAST_YEAR; + this->SetWidgetLoweredState(SVW_CMONTH, false); + this->SetWidgetLoweredState(SVW_LMONTH, false); + this->SetWidgetLoweredState(SVW_LYEAR, true); this->SetDirty(); break; @@ -955,7 +1172,10 @@ virtual void OnResize(Point new_size, Point delta) { - if (delta.x != 0) ResizeButtons(this, SVW_LOCATION, SVW_RENAME); + if (delta.x != 0) { + ResizeButtons(this, SVW_LOCATION, SVW_RENAME); + ResizeButtons(this, SVW_WAITINGBTN, SVW_STATSBTN); + } this->vscroll.cap += delta.y / (int)this->resize.step_height; } }; Index: src/economy.cpp =================================================================== --- src/economy.cpp (revision 14569) +++ src/economy.cpp (working copy) @@ -1626,7 +1626,6 @@ if (HasBit(ge->acceptance_pickup, GoodsEntry::ACCEPTANCE) && !(u->current_order.GetUnloadType() & OUFB_TRANSFER)) { /* The cargo has reached it's final destination, the packets may now be destroyed */ remaining = v->cargo.MoveTo(NULL, amount_unloaded, CargoList::MTA_FINAL_DELIVERY, last_visited); - result |= 1; } else if (u->current_order.GetUnloadType() & (OUFB_UNLOAD | OUFB_TRANSFER)) { remaining = v->cargo.MoveTo(&ge->cargo, amount_unloaded); @@ -1645,6 +1644,12 @@ unloading_time += amount_unloaded; + // totally unloaded, increase counters + if(u->current_order.GetUnloadType() & (OUFB_UNLOAD | OUFB_TRANSFER)) + st->goods_counter[CARCAT_TRANSFERRD][v->cargo_type] += amount_unloaded; + else + st->goods_counter[CARCAT_INCOMING][v->cargo_type] += amount_unloaded; + anything_unloaded = true; if (_settings_game.order.gradual_loading && remaining) { completely_emptied = false; @@ -1705,6 +1710,9 @@ completely_emptied = false; anything_loaded = true; + // totally loaded, increase counters + st->goods_counter[CARCAT_OUTGOING][v->cargo_type] += cap; + ge->cargo.MoveTo(&v->cargo, cap, CargoList::MTA_CARGO_LOAD, st->xy); st->time_since_load = 0; Index: src/station_base.h =================================================================== --- src/station_base.h (revision 14569) +++ src/station_base.h (working copy) @@ -46,6 +46,13 @@ CargoList cargo; ///< The cargo packets of cargo waiting in this station }; +enum CargoCategories { + CARCAT_OUTGOING=0, ///< generated at the station + CARCAT_INCOMING, ///< shipped to the station, unloaded and processed + CARCAT_TRANSFERRD ///< transferred at the station +}; +#define CARCAT_NUM 3 + /** A Stop for a Road Vehicle */ struct RoadStop : PoolItem { static const int cDebugCtorLevel = 5; ///< Debug level on which Contructor / Destructor messages are printed @@ -159,6 +166,12 @@ std::list loading_vehicles; GoodsEntry goods[NUM_CARGO]; ///< Goods at this station + uint32 goods_counter[CARCAT_NUM][NUM_CARGO]; ///< this month's goods counter + uint32 last_month_goods_counter[CARCAT_NUM][NUM_CARGO]; ///< last month goods counter + uint32 current_year_goods_counter[CARCAT_NUM][NUM_CARGO]; ///< last month goods counter + uint32 last_year_goods_counter[CARCAT_NUM][NUM_CARGO]; ///< last month goods counter + uint8 months_gone_by; ///< how many months gone by since the last reset + uint16 random_bits; byte waiting_triggers; uint8 cached_anim_triggers; ///< Combined animation trigger bitmask, used to determine if trigger processing should happen.