Index: graph_gui.c =================================================================== --- graph_gui.c (revision 3585) +++ graph_gui.c (working copy) @@ -15,7 +15,7 @@ #include "debug.h" #include "variables.h" -static uint _legend_excludebits; +static uint64 _legend_excludebits; static uint _legend_cargobits; /************************/ @@ -25,7 +25,7 @@ enum {GRAPH_NUM = 16}; typedef struct GraphDrawer { - uint sel; // bitmask of the players *excluded* (e.g. 11111111 means that no players are shown) + uint64 sel; // bitmask of the players *excluded* (e.g. 11111111 means that no players are shown) byte num_dataset; byte num_on_x_axis; byte month; @@ -58,7 +58,7 @@ uint64 y_scaling, tmp; int64 value; int64 cur_val; - uint sel; + uint64 sel; /* the colors and cost array of GraphDrawer must accomodate * both values for cargo and players. So if any are higher, quit */ @@ -242,7 +242,7 @@ break; case WE_CLICK: - if (IS_INT_INSIDE(e->click.widget, 3, 11)) { + if (IS_INT_INSIDE(e->click.widget, 3, 19)) { _legend_excludebits ^= (1 << (e->click.widget - 3)); SetWindowDirty(w); InvalidateWindow(WC_INCOME_GRAPH, 0); @@ -258,7 +258,7 @@ static const Widget _graph_legend_widgets[] = { { WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, { WWT_CAPTION, RESIZE_NONE, 14, 11, 249, 0, 13, STR_704E_KEY_TO_COMPANY_GRAPHS, STR_018C_WINDOW_TITLE_DRAG_THIS}, -{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 249, 14, 113, 0x0,STR_NULL}, +{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 249, 14, 209, 0x0,STR_NULL}, { WWT_IMGBTN, RESIZE_NONE, 14, 2, 247, 16, 27, 0x0,STR_704F_CLICK_HERE_TO_TOGGLE_COMPANY}, { WWT_IMGBTN, RESIZE_NONE, 14, 2, 247, 28, 39, 0x0,STR_704F_CLICK_HERE_TO_TOGGLE_COMPANY}, { WWT_IMGBTN, RESIZE_NONE, 14, 2, 247, 40, 51, 0x0,STR_704F_CLICK_HERE_TO_TOGGLE_COMPANY}, @@ -267,11 +267,19 @@ { WWT_IMGBTN, RESIZE_NONE, 14, 2, 247, 76, 87, 0x0,STR_704F_CLICK_HERE_TO_TOGGLE_COMPANY}, { WWT_IMGBTN, RESIZE_NONE, 14, 2, 247, 88, 99, 0x0,STR_704F_CLICK_HERE_TO_TOGGLE_COMPANY}, { WWT_IMGBTN, RESIZE_NONE, 14, 2, 247, 100, 111, 0x0,STR_704F_CLICK_HERE_TO_TOGGLE_COMPANY}, +{ WWT_IMGBTN, RESIZE_NONE, 14, 2, 247, 112, 123, 0x0,STR_704F_CLICK_HERE_TO_TOGGLE_COMPANY}, +{ WWT_IMGBTN, RESIZE_NONE, 14, 2, 247, 124, 135, 0x0,STR_704F_CLICK_HERE_TO_TOGGLE_COMPANY}, +{ WWT_IMGBTN, RESIZE_NONE, 14, 2, 247, 136, 147, 0x0,STR_704F_CLICK_HERE_TO_TOGGLE_COMPANY}, +{ WWT_IMGBTN, RESIZE_NONE, 14, 2, 247, 148, 159, 0x0,STR_704F_CLICK_HERE_TO_TOGGLE_COMPANY}, +{ WWT_IMGBTN, RESIZE_NONE, 14, 2, 247, 160, 171, 0x0,STR_704F_CLICK_HERE_TO_TOGGLE_COMPANY}, +{ WWT_IMGBTN, RESIZE_NONE, 14, 2, 247, 172, 183, 0x0,STR_704F_CLICK_HERE_TO_TOGGLE_COMPANY}, +{ WWT_IMGBTN, RESIZE_NONE, 14, 2, 247, 184, 195, 0x0,STR_704F_CLICK_HERE_TO_TOGGLE_COMPANY}, +{ WWT_IMGBTN, RESIZE_NONE, 14, 2, 247, 196, 207, 0x0,STR_704F_CLICK_HERE_TO_TOGGLE_COMPANY}, { WIDGETS_END}, }; static const WindowDesc _graph_legend_desc = { - -1, -1, 250, 114, + -1, -1, 250, 210, WC_GRAPH_LEGEND,0, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, _graph_legend_widgets, @@ -290,7 +298,7 @@ static void SetupGraphDrawerForPlayers(GraphDrawer *gd) { const Player* p; - uint excludebits = _legend_excludebits; + uint64 excludebits = _legend_excludebits; int nums; int mo,yr; @@ -837,7 +845,9 @@ qsort((void*)plist, pl_num, sizeof(*plist), PerfHistComp); - for (i = 0; i != pl_num; i++) { + SetVScrollCount(w, pl_num); + + for (i = w->vscroll.pos; i < w->vscroll.cap + w->vscroll.pos && i < w->vscroll.count; i++) { p = plist[i]; SetDParam(0, i + STR_01AC_1ST); SetDParam(1, p->name_1); @@ -845,246 +855,257 @@ SetDParam(3, GetPlayerNameString(p->index, 4)); SetDParam(5, GetPerformanceTitleFromValue(p->old_economy[1].performance_history)); - DrawString(2, 15 + i * 10, i == 0 ? STR_7054 : STR_7055, 0); - DrawPlayerIcon(p->index, 27, 16 + i * 10); + DrawString(2, 15 + (i - w->vscroll.pos) * 10, i == 0 ? STR_7054 : STR_7055, 0); + DrawPlayerIcon(p->index, 27, 16 + (i - w->vscroll.pos) * 10); } break; } + + case WE_RESIZE: { + w->vscroll.cap += e->sizing.diff.y / 10; + break; + } } } static const Widget _company_league_widgets[] = { -{ WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, -{ WWT_CAPTION, RESIZE_NONE, 14, 11, 387, 0, 13, STR_7053_COMPANY_LEAGUE_TABLE, STR_018C_WINDOW_TITLE_DRAG_THIS}, -{ WWT_STICKYBOX, RESIZE_NONE, 14, 388, 399, 0, 13, STR_NULL, STR_STICKY_BUTTON}, -{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 399, 14, 96, 0x0, STR_NULL}, +{ WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, +{ WWT_CAPTION, RESIZE_RIGHT, 14, 11, 387, 0, 13, STR_7053_COMPANY_LEAGUE_TABLE, STR_018C_WINDOW_TITLE_DRAG_THIS}, +{ WWT_STICKYBOX, RESIZE_LR, 14, 388, 399, 0, 13, STR_NULL, STR_STICKY_BUTTON}, +{ WWT_IMGBTN, RESIZE_RB, 14, 0, 399, 14, 176, 0x0, STR_NULL}, +{ WWT_SCROLLBAR, RESIZE_LRB, 14, 388, 399, 14, 164, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST}, +{ WWT_RESIZEBOX, RESIZE_LRTB, 14, 388, 399, 165, 176, 0x0, STR_RESIZE_BUTTON}, { WIDGETS_END}, }; static const WindowDesc _company_league_desc = { - -1, -1, 400, 97, + -1, -1, 400, 177, WC_COMPANY_LEAGUE,0, - WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON, + WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON | WDF_RESIZABLE, _company_league_widgets, CompanyLeagueWndProc }; void ShowCompanyLeagueTable(void) { - AllocateWindowDescFront(&_company_league_desc,0); + Window *w; + + w = AllocateWindowDescFront(&_company_league_desc,0); + + if (w != NULL) { + w->vscroll.cap = 16; + w->resize.step_height = 10; + w->resize.height = w->height - 10 * 11; // minimum if 5 in the list + } + } /*****************************/ /* PERFORMANCE RATING DETAIL */ /*****************************/ +static int _selected_player; + static void PerformanceRatingDetailWndProc(Window *w, WindowEvent *e) { switch (e->event) { - case WE_PAINT: { - int val, needed, score, i; - byte owner, x; - uint16 y=14; - int total_score = 0; - int color_done, color_notdone; + case WE_PAINT: { + int val, needed, score, i; + byte x; + uint16 y=25; + int total_score = 0; + int color_done, color_notdone; + int num_players = 0; + + int active_players[MAX_PLAYERS]; - // Draw standard stuff - DrawWindowWidgets(w); + // Make sure we have a clean start for the buttons. + w->disabled_state = 0; + + // Find the active players. + for (i=0;iis_active) + active_players[++num_players] = i; - // The player of which we check the detail performance rating - owner = FindFirstBit(w->click_state) - 13; + // Disable any buttons that don't have players. + for (i = num_players; i < 8; i++) + w->disabled_state |= 1 << (13 + i); + + if (!(_selected_player - w->hscroll.pos < 0) && !(_selected_player - w->hscroll.pos > 7)) + w->click_state = 1 << (_selected_player - w->hscroll.pos + 13); + else + w->click_state = 0; - // Paint the player icons - for (i=0;iis_active) { - // Check if we have the player as an active player - if (!(w->disabled_state & (1 << (i+13)))) { - // Bah, player gone :( - w->disabled_state += 1 << (i+13); - // Is this player selected? If so, select first player (always save? :s) - if (w->click_state == 1U << (i + 13)) - w->click_state = 1 << 13; - // We need a repaint - SetWindowDirty(w); - } - continue; - } + DrawWindowWidgets(w); + + // For each player, draw an icon. + for (i=w->hscroll.pos; i < num_players && (i - w->hscroll.pos) < 8; i++) { + if (i == _selected_player) + x = 1; + else + x = 0; + + DrawPlayerIcon(i, (i - w->hscroll.pos) * 37 + 13 + x, 28 + x); + } + + SetHScrollCount(w, num_players); - // Check if we have the player marked as inactive - if ((w->disabled_state & (1 << (i+13)))) { - // New player! Yippie :p - w->disabled_state -= 1 << (i+13); - // We need a repaint - SetWindowDirty(w); - } + // The colors used to show how the progress is going + color_done = _color_list[6].window_color_1b; + color_notdone = _color_list[4].window_color_1b; - if (i == owner) x = 1; else x = 0; - DrawPlayerIcon(i, i * 37 + 13 + x, 16 + x); - } + // Draw all the score parts + for (i=0;i needed) x = 50; + else if (val == 0) x = 0; + else x = ((val * 50) / needed); - // Draw the score - SetDParam(0, score); - DrawStringRightAligned(107, y, SET_PERFORMANCE_DETAIL_INT, 0); + // SCORE_LOAN is inversed + if (val < 0 && i == SCORE_LOAN) + x = 0; - // Calculate the %-bar - if (val > needed) x = 50; - else if (val == 0) x = 0; - else x = ((val * 50) / needed); + // Draw the bar + if (x != 0) + GfxFillRect(112, y-2, x + 112, y+10, color_done); + if (x != 50) + GfxFillRect(x + 112, y-2, 50 + 112, y+10, color_notdone); - // SCORE_LOAN is inversed - if (val < 0 && i == SCORE_LOAN) - x = 0; + // Calculate the % + if (val > needed) + x = 100; + else + x = ((val * 100) / needed); - // Draw the bar - if (x != 0) - GfxFillRect(112, y-2, x + 112, y+10, color_done); - if (x != 50) - GfxFillRect(x + 112, y-2, 50 + 112, y+10, color_notdone); + // SCORE_LOAN is inversed + if (val < 0 && i == SCORE_LOAN) + x = 0; - // Calculate the % - if (val > needed) x = 100; - else x = ((val * 100) / needed); + // Draw it + SetDParam(0, x); + DrawStringCentered(137, y, STR_PERFORMANCE_DETAIL_PERCENT, 0); - // SCORE_LOAN is inversed - if (val < 0 && i == SCORE_LOAN) - x = 0; + // SCORE_LOAN is inversed + if (i == SCORE_LOAN) + val = needed - val; - // Draw it - SetDParam(0, x); - DrawStringCentered(137, y, STR_PERFORMANCE_DETAIL_PERCENT, 0); + // Draw the amount we have against what is needed + // For some of them it is in currency format + SetDParam(0, val); + SetDParam(1, needed); + switch (i) { + case SCORE_MIN_PROFIT: + case SCORE_MIN_INCOME: + case SCORE_MAX_INCOME: + case SCORE_MONEY: + case SCORE_LOAN: + DrawString(167, y, STR_PERFORMANCE_DETAIL_AMOUNT_CURRENCY, 0); + break; + default: + DrawString(167, y, STR_PERFORMANCE_DETAIL_AMOUNT_INT, 0); + } + } + break; + } - // SCORE_LOAN is inversed - if (i == SCORE_LOAN) - val = needed - val; - - // Draw the amount we have against what is needed - // For some of them it is in currency format - SetDParam(0, val); - SetDParam(1, needed); - switch (i) { - case SCORE_MIN_PROFIT: - case SCORE_MIN_INCOME: - case SCORE_MAX_INCOME: - case SCORE_MONEY: - case SCORE_LOAN: - DrawString(167, y, STR_PERFORMANCE_DETAIL_AMOUNT_CURRENCY, 0); - break; - default: - DrawString(167, y, STR_PERFORMANCE_DETAIL_AMOUNT_INT, 0); + case WE_CLICK: + // Check which button is clicked + if (IS_INT_INSIDE(e->click.widget, 13, 21)) { + // Is it disabled? If not, set the click state. + if ((w->disabled_state & (1 << (e->click.widget + w->hscroll.pos))) == 0) { + _selected_player = e->click.widget + w->hscroll.pos - 13; + SetWindowDirty(w); + } } - } + break; - break; - } + case WE_CREATE: + { + Player *p2; + w->hidden_state = 0; + w->disabled_state = 0; + + // Update all player stats with the current data + // (this is because _score_info is not saved to a savegame) + FOR_ALL_PLAYERS(p2) + if (p2->is_active) + UpdateCompanyRatingAndValue(p2, false); - case WE_CLICK: - // Check which button is clicked - if (IS_INT_INSIDE(e->click.widget, 13, 21)) { - // Is it no on disable? - if ((w->disabled_state & (1 << e->click.widget)) == 0) { - w->click_state = 1 << e->click.widget; - SetWindowDirty(w); - } - } - break; + w->custom[0] = DAY_TICKS; + w->custom[1] = 5; - case WE_CREATE: + _selected_player = 0; + SetWindowDirty(w); + } + break; + + case WE_TICK: { - int i; - Player *p2; - w->hidden_state = 0; - w->disabled_state = 0; - - // Hide the player who are not active - for (i=0;iis_active) { - w->disabled_state += 1 << (i+13); - } + // Update the player score every 5 days + if (--w->custom[0] == 0) { + w->custom[0] = DAY_TICKS; + if (--w->custom[1] == 0) { + Player *p2; + w->custom[1] = 5; + FOR_ALL_PLAYERS(p2) + // Skip if player is not active + if (p2->is_active) + UpdateCompanyRatingAndValue(p2, false); + SetWindowDirty(w); + } + } } - // Update all player stats with the current data - // (this is because _score_info is not saved to a savegame) - FOR_ALL_PLAYERS(p2) - if (p2->is_active) - UpdateCompanyRatingAndValue(p2, false); - - w->custom[0] = DAY_TICKS; - w->custom[1] = 5; - - w->click_state = 1 << 13; - - SetWindowDirty(w); - } - break; - case WE_TICK: - { - // Update the player score every 5 days - if (--w->custom[0] == 0) { - w->custom[0] = DAY_TICKS; - if (--w->custom[1] == 0) { - Player *p2; - w->custom[1] = 5; - FOR_ALL_PLAYERS(p2) - // Skip if player is not active - if (p2->is_active) - UpdateCompanyRatingAndValue(p2, false); - SetWindowDirty(w); - } - } - } - break; + break; } } static const Widget _performance_rating_detail_widgets[] = { -{ WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, +{ WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, { WWT_CAPTION, RESIZE_NONE, 14, 11, 298, 0, 13, STR_PERFORMANCE_DETAIL, STR_018C_WINDOW_TITLE_DRAG_THIS}, -{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 298, 14, 27, 0x0, STR_NULL}, - -{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 298, 28, 47, 0x0,STR_PERFORMANCE_DETAIL_VEHICLES_TIP}, -{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 298, 48, 67, 0x0,STR_PERFORMANCE_DETAIL_STATIONS_TIP}, -{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 298, 68, 87, 0x0,STR_PERFORMANCE_DETAIL_MIN_PROFIT_TIP}, -{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 298, 88, 107, 0x0,STR_PERFORMANCE_DETAIL_MIN_INCOME_TIP}, -{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 298, 108, 127, 0x0,STR_PERFORMANCE_DETAIL_MAX_INCOME_TIP}, -{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 298, 128, 147, 0x0,STR_PERFORMANCE_DETAIL_DELIVERED_TIP}, -{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 298, 148, 167, 0x0,STR_PERFORMANCE_DETAIL_CARGO_TIP}, -{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 298, 168, 187, 0x0,STR_PERFORMANCE_DETAIL_MONEY_TIP}, -{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 298, 188, 207, 0x0,STR_PERFORMANCE_DETAIL_LOAN_TIP}, -{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 298, 208, 227, 0x0,STR_PERFORMANCE_DETAIL_TOTAL_TIP}, - -{ WWT_IMGBTN, RESIZE_NONE, 14, 2, 38, 14, 26, 0x0,STR_704F_CLICK_HERE_TO_TOGGLE_COMPANY}, -{ WWT_IMGBTN, RESIZE_NONE, 14, 39, 75, 14, 26, 0x0,STR_704F_CLICK_HERE_TO_TOGGLE_COMPANY}, -{ WWT_IMGBTN, RESIZE_NONE, 14, 76, 112, 14, 26, 0x0,STR_704F_CLICK_HERE_TO_TOGGLE_COMPANY}, -{ WWT_IMGBTN, RESIZE_NONE, 14, 113, 149, 14, 26, 0x0,STR_704F_CLICK_HERE_TO_TOGGLE_COMPANY}, -{ WWT_IMGBTN, RESIZE_NONE, 14, 150, 186, 14, 26, 0x0,STR_704F_CLICK_HERE_TO_TOGGLE_COMPANY}, -{ WWT_IMGBTN, RESIZE_NONE, 14, 187, 223, 14, 26, 0x0,STR_704F_CLICK_HERE_TO_TOGGLE_COMPANY}, -{ WWT_IMGBTN, RESIZE_NONE, 14, 224, 260, 14, 26, 0x0,STR_704F_CLICK_HERE_TO_TOGGLE_COMPANY}, -{ WWT_IMGBTN, RESIZE_NONE, 14, 261, 297, 14, 26, 0x0,STR_704F_CLICK_HERE_TO_TOGGLE_COMPANY}, +{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 298, 26, 38, 0x0, STR_NULL}, +{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 298, 39, 58, 0x0, STR_PERFORMANCE_DETAIL_VEHICLES_TIP}, +{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 298, 59, 78, 0x0, STR_PERFORMANCE_DETAIL_STATIONS_TIP}, +{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 298, 79, 98, 0x0, STR_PERFORMANCE_DETAIL_MIN_PROFIT_TIP}, +{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 298, 99, 118, 0x0, STR_PERFORMANCE_DETAIL_MIN_INCOME_TIP}, +{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 298, 119, 138, 0x0, STR_PERFORMANCE_DETAIL_MAX_INCOME_TIP}, +{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 298, 139, 158, 0x0, STR_PERFORMANCE_DETAIL_DELIVERED_TIP}, +{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 298, 159, 178, 0x0, STR_PERFORMANCE_DETAIL_CARGO_TIP}, +{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 298, 179, 198, 0x0, STR_PERFORMANCE_DETAIL_MONEY_TIP}, +{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 298, 199, 218, 0x0, STR_PERFORMANCE_DETAIL_LOAN_TIP}, +{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 298, 219, 238, 0x0, STR_PERFORMANCE_DETAIL_TOTAL_TIP}, +{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 38, 26, 38, 0x0, STR_704F_CLICK_HERE_TO_TOGGLE_COMPANY}, +{ WWT_IMGBTN, RESIZE_NONE, 14, 39, 75, 26, 38, 0x0, STR_704F_CLICK_HERE_TO_TOGGLE_COMPANY}, +{ WWT_IMGBTN, RESIZE_NONE, 14, 76, 112, 26, 38, 0x0, STR_704F_CLICK_HERE_TO_TOGGLE_COMPANY}, +{ WWT_IMGBTN, RESIZE_NONE, 14, 113, 149, 26, 38, 0x0, STR_704F_CLICK_HERE_TO_TOGGLE_COMPANY}, +{ WWT_IMGBTN, RESIZE_NONE, 14, 150, 186, 26, 38, 0x0, STR_704F_CLICK_HERE_TO_TOGGLE_COMPANY}, +{ WWT_IMGBTN, RESIZE_NONE, 14, 187, 223, 26, 38, 0x0, STR_704F_CLICK_HERE_TO_TOGGLE_COMPANY}, +{ WWT_IMGBTN, RESIZE_NONE, 14, 224, 260, 26, 38, 0x0, STR_704F_CLICK_HERE_TO_TOGGLE_COMPANY}, +{ WWT_IMGBTN, RESIZE_NONE, 14, 261, 297, 26, 38, 0x0, STR_704F_CLICK_HERE_TO_TOGGLE_COMPANY}, +{ WWT_HSCROLLBAR, RESIZE_NONE, 14, 0, 298, 14, 25, 0x0, STR_NULL}, { WIDGETS_END}, }; static const WindowDesc _performance_rating_detail_desc = { - -1, -1, 299, 228, + -1, -1, 299, 239, WC_PERFORMANCE_DETAIL,0, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, _performance_rating_detail_widgets, @@ -1093,7 +1114,13 @@ void ShowPerformanceRatingDetail(void) { - AllocateWindowDescFront(&_performance_rating_detail_desc, 0); + Window *w; + w = AllocateWindowDescFront(&_performance_rating_detail_desc, 0); + + if (w != NULL) { + w->hscroll.cap = 8; + SetHScrollCount(w, 8); + } } Index: engine.c =================================================================== --- engine.c (revision 3585) +++ engine.c (working copy) @@ -215,7 +215,7 @@ e->intro_date = ei->base_intro <= 729 ? ei->base_intro : GB(r, 0, 9) + ei->base_intro; if (e->intro_date <= _date) { e->age = (_date - e->intro_date) >> 5; - e->player_avail = (byte)-1; + e->player_avail = (uint16)-1; e->flags |= ENGINE_AVAILABLE; } Index: engine.h =================================================================== --- engine.h (revision 3585) +++ engine.h (working copy) @@ -86,10 +86,10 @@ uint16 duration_phase_1, duration_phase_2, duration_phase_3; byte lifelength; byte flags; - byte preview_player; + uint16 preview_player; byte preview_wait; byte railtype; - byte player_avail; + uint16 player_avail; byte type; // type, ie VEH_Road, VEH_Train, etc. Same as in vehicle.h } Engine; Index: network.c =================================================================== --- network.c (revision 3585) +++ network.c (working copy) @@ -1353,8 +1353,8 @@ if (_network_unique_id[0] == '\0') NetworkGenerateUniqueId(); memset(&_network_game_info, 0, sizeof(_network_game_info)); - _network_game_info.clients_max = 10; // XXX - hardcoded, string limiation -- TrueLight - _network_game_info.companies_max = MAX_PLAYERS; // 8 + _network_game_info.clients_max = 16; + _network_game_info.companies_max = MAX_PLAYERS; // 16 _network_game_info.spectators_max = _network_game_info.clients_max; // Let's load the network in windows Index: lang/english.txt =================================================================== --- lang/english.txt (revision 3585) +++ lang/english.txt (working copy) @@ -1250,6 +1250,12 @@ STR_NETWORK_8_PLAYERS :8 players STR_NETWORK_9_PLAYERS :9 players STR_NETWORK_10_PLAYERS :10 players +STR_NETWORK_11_PLAYERS :11 players +STR_NETWORK_12_PLAYERS :12 players +STR_NETWORK_13_PLAYERS :13 players +STR_NETWORK_14_PLAYERS :14 players +STR_NETWORK_15_PLAYERS :15 players +STR_NETWORK_16_PLAYERS :16 players STR_NETWORK_NUMBER_OF_COMPANIES :{BLACK}Max companies: STR_NETWORK_NUMBER_OF_COMPANIES_TIP :{BLACK}Limit the server to a certain amount of companies STR_NETWORK_COMBO3 :{BLACK}{SKIP}{SKIP}{SKIP}{SKIP}{SKIP}{SKIP}{SKIP}{SKIP}{SKIP}{SKIP}{SKIP}{STRING} Index: openttd.c =================================================================== --- openttd.c (revision 3585) +++ openttd.c (working copy) @@ -1118,6 +1118,25 @@ END_TILE_LOOP(tile_cur, w, h, tile) } + if (CheckSavegameVersionOldStyle(23, 1)) { + TileIndex tile = TileXY(0, 0); + uint w = MapSizeX(); + uint h = MapSizeY(); + + BEGIN_TILE_LOOP(tile_cur, w, h, tile) + if (_m[tile_cur].m1 == 0xf) + _m[tile_cur].m1 = OWNER_TOWN; + if (_m[tile_cur].m1 == 0x10) + _m[tile_cur].m1 = OWNER_NONE; + if (_m[tile_cur].m1 == 0x11) + _m[tile_cur].m1 = OWNER_WATER; + if (_m[tile_cur].m1 == 0xff) + _m[tile_cur].m1 = OWNER_SPECTATOR; + END_TILE_LOOP(tile_cur, w, h, tile) + +} + + // convert road side to my format. if (_opt.road_side) _opt.road_side = 1; Index: saveload.c =================================================================== --- saveload.c (revision 3585) +++ saveload.c (working copy) @@ -29,7 +29,7 @@ #include enum { - SAVEGAME_VERSION = 21, + SAVEGAME_VERSION = 22, }; Index: player.h =================================================================== --- player.h (revision 3585) +++ player.h (working copy) @@ -206,7 +206,7 @@ VARDEF PlayerID _local_player; VARDEF PlayerID _current_player; -#define MAX_PLAYERS 8 +#define MAX_PLAYERS 16 VARDEF Player _players[MAX_PLAYERS]; // NOSAVE: can be determined from player structs VARDEF byte _player_colors[MAX_PLAYERS]; Index: map.h =================================================================== --- map.h (revision 3585) +++ map.h (working copy) @@ -68,10 +68,10 @@ } typedef enum { - OWNER_TOWN = 0xf, // a town owns the tile - OWNER_NONE = 0x10, // nobody owns the tile - OWNER_WATER = 0x11, // "water" owns the tile - OWNER_SPECTATOR = 0xff, // spectator in MP or in scenario editor + OWNER_TOWN = 0x81, // a town owns the tile + OWNER_NONE = 0x82, // nobody owns the tile + OWNER_WATER = 0x83, // "water" owns the tile + OWNER_SPECTATOR = 0x84, // spectator in MP or in scenario editor } Owner; enum { Index: network_gui.c =================================================================== --- network_gui.c (revision 3585) +++ network_gui.c (working copy) @@ -79,6 +79,12 @@ STR_NETWORK_8_PLAYERS, STR_NETWORK_9_PLAYERS, STR_NETWORK_10_PLAYERS, + STR_NETWORK_11_PLAYERS, + STR_NETWORK_12_PLAYERS, + STR_NETWORK_13_PLAYERS, + STR_NETWORK_14_PLAYERS, + STR_NETWORK_15_PLAYERS, + STR_NETWORK_16_PLAYERS, INVALID_STRING_ID }; @@ -612,7 +618,7 @@ DrawString(10, 43, STR_NETWORK_SELECT_MAP, 2); DrawString(280, 63, STR_NETWORK_CONNECTION, 2); - DrawString(280, 95, STR_NETWORK_NUMBER_OF_CLIENTS, 2); + DrawString(280, 98, STR_NETWORK_NUMBER_OF_CLIENTS, 2); DrawString(280, 127, STR_NETWORK_NUMBER_OF_COMPANIES, 2); DrawString(280, 159, STR_NETWORK_NUMBER_OF_SPECTATORS, 2); DrawString(280, 191, STR_NETWORK_LANGUAGE_SPOKEN, 2); Index: settings_gui.c =================================================================== --- settings_gui.c (revision 3585) +++ settings_gui.c (working copy) @@ -298,7 +298,7 @@ } GameSettingData; static const GameSettingData _game_setting_info[] = { - { 0, 7, 1, STR_NULL}, + { 0, 15, 1, STR_NULL}, //Number of competitors { 0, 3, 1, STR_6830_IMMEDIATE}, { 0, 2, 1, STR_6816_LOW}, { 0, 3, 1, STR_26816_NONE},