truelight@0: #include "stdafx.h" truelight@0: #include "ttd.h" tron@507: #include "table/strings.h" truelight@0: #include "town.h" truelight@0: #include "window.h" truelight@0: #include "gfx.h" truelight@0: #include "viewport.h" truelight@0: #include "gui.h" truelight@0: #include "command.h" truelight@0: #include "player.h" darkvater@891: #include "network.h" truelight@0: truelight@0: static const Widget _town_authority_widgets[] = { truelight@867: { WWT_TEXTBTN, RESIZE_NONE, 13, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, truelight@867: { WWT_CAPTION, RESIZE_NONE, 13, 11, 316, 0, 13, STR_2022_LOCAL_AUTHORITY, STR_018C_WINDOW_TITLE_DRAG_THIS}, truelight@867: { WWT_IMGBTN, RESIZE_NONE, 13, 0, 316, 14, 105, 0x0, STR_NULL}, darkvater@893: { WWT_IMGBTN, RESIZE_NONE, 13, 0, 306, 106, 157, 0x0, STR_2043_LIST_OF_THINGS_TO_DO_AT}, darkvater@893: { WWT_SCROLLBAR, RESIZE_NONE, 13, 305, 316, 106, 157, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST}, truelight@867: { WWT_IMGBTN, RESIZE_NONE, 13, 0, 316, 158, 209, 0x0, STR_NULL}, truelight@867: { WWT_PUSHTXTBTN, RESIZE_NONE, 13, 0, 316, 210, 221, STR_2042_DO_IT, STR_2044_CARRY_OUT_THE_HIGHLIGHTED}, darkvater@176: { WIDGETS_END}, truelight@0: }; truelight@0: truelight@0: extern const byte _town_action_costs[8]; truelight@0: extern void DrawPlayerIcon(int p, int x, int y); truelight@0: truelight@0: static uint GetMaskOfTownActions(int *nump, Town *t) truelight@0: { truelight@0: int32 avail, ref; truelight@0: int i, num; truelight@0: uint avail_buttons = 0x7F; // by default all buttons except bribe are enabled. truelight@0: uint buttons; truelight@0: darkvater@1: if (_local_player != OWNER_SPECTATOR) { truelight@0: // bribe option enabled? truelight@0: if (_patches.bribe) { truelight@0: // if unwanted, disable everything. truelight@0: if (t->unwanted[_local_player]) { truelight@0: avail_buttons = 0; truelight@0: } else if (t->ratings[_local_player] < 600) truelight@0: avail_buttons |= (1 << 7); // only bribe if less than excellent truelight@0: } truelight@0: truelight@0: // Things worth more than this are not shown truelight@0: avail = DEREF_PLAYER(_local_player)->player_money + _price.station_value * 200; truelight@0: ref = _price.build_industry >> 8; truelight@0: truelight@0: for(i=0,buttons=0,num=0; i != lengthof(_town_action_costs); i++,avail_buttons>>=1) { truelight@0: if (avail_buttons&1 && avail >= _town_action_costs[i] * ref) { truelight@0: SETBIT(buttons, i); truelight@0: num++; truelight@0: } truelight@0: } truelight@0: truelight@0: // Disable build statue if already built truelight@0: if(HASBIT(t->statues, _local_player)) truelight@0: { truelight@0: CLRBIT(buttons, 4); truelight@0: num--; truelight@0: } truelight@0: truelight@0: } else { truelight@0: // no actions available for spectator truelight@0: buttons = 0; truelight@0: num = 0; truelight@0: } truelight@0: truelight@0: if (nump) *nump = num; truelight@0: return buttons; truelight@0: } truelight@0: truelight@0: static int GetNthSetBit(uint32 bits, int n) truelight@0: { truelight@0: int i = 0; truelight@0: if (n >= 0) { truelight@0: do { truelight@0: if (bits&1 && --n < 0) return i; truelight@0: i++; truelight@0: } while (bits>>=1); truelight@0: } truelight@0: return -1; truelight@0: } truelight@0: truelight@0: static void TownAuthorityWndProc(Window *w, WindowEvent *e) truelight@0: { truelight@0: uint buttons; truelight@0: int numact; truelight@919: Town *t = GetTown(w->window_number); truelight@193: truelight@0: switch(e->event) { truelight@0: case WE_PAINT: truelight@0: buttons = GetMaskOfTownActions(&numact, t); truelight@0: SetVScrollCount(w, numact + 1); truelight@0: truelight@0: if (WP(w,def_d).data_1 != -1 && !HASBIT(buttons, WP(w,def_d).data_1)) truelight@0: WP(w,def_d).data_1 = -1; truelight@0: truelight@0: w->disabled_state = (WP(w,def_d).data_1 == -1) ? (1 << 6) : 0; truelight@0: truelight@0: { truelight@0: int y; truelight@0: Player *p; truelight@0: int r; truelight@0: StringID str; truelight@0: tron@534: SetDParam(0, w->window_number); truelight@0: DrawWindowWidgets(w); truelight@0: truelight@0: DrawString(2, 15, STR_2023_TRANSPORT_COMPANY_RATINGS, 0); dominik@122: truelight@0: // Draw list of players truelight@0: y = 25; truelight@0: FOR_ALL_PLAYERS(p) { dominik@121: if (p->is_active && (HASBIT(t->have_ratings, p->index) || t->exclusivity==p->index)) { dominik@125: DrawPlayerIcon(p->index, 2, y); dominik@121: tron@534: SetDParam(0, p->name_1); tron@534: SetDParam(1, p->name_2); tron@534: SetDParam(2, GetPlayerNameString(p->index, 3)); truelight@0: truelight@0: r = t->ratings[p->index]; truelight@0: (str = STR_3035_APPALLING, r <= -400) || // Apalling truelight@0: (str++, r <= -200) || // Very Poor truelight@0: (str++, r <= 0) || // Poor truelight@0: (str++, r <= 200) || // Mediocore truelight@0: (str++, r <= 400) || // Good truelight@0: (str++, r <= 600) || // Very Good truelight@0: (str++, r <= 800) || // Excellent truelight@0: (str++, true); // Outstanding truelight@0: darkvater@16: /* WARNING ugly hack! darkvater@16: GetPlayerNameString sets up (Player #) if the player is human in an extra DPARAM16 darkvater@16: It seems that if player is non-human, nothing is set up, so param is 0. GetString doesn't like truelight@193: that because there is another param after it. darkvater@16: So we'll just shift the rating one back if player is AI and all is fine darkvater@16: */ tron@534: SetDParam((IS_HUMAN_PLAYER(p->index) ? 4 : 3), str); darkvater@246: if (t->exclusivity == p->index) // red icon for player with exclusive rights dominik@579: DrawSprite((SPR_BLOT) | 0x30b8000, 18, y); darkvater@246: darkvater@246: DrawString(28, y, STR_2024, 0); truelight@0: y+=10; truelight@0: } truelight@0: } truelight@0: } truelight@0: truelight@0: // Draw actions list truelight@0: { truelight@0: int y = 107, i; truelight@0: int pos = w->vscroll.pos; truelight@0: truelight@0: if (--pos < 0) { truelight@0: DrawString(2, y, STR_2045_ACTIONS_AVAILABLE, 0); truelight@0: y+=10; truelight@0: } truelight@0: for(i=0; buttons; i++,buttons>>=1) { truelight@0: if (pos <= -5) truelight@0: break; truelight@0: truelight@0: if (buttons&1 && --pos < 0) { truelight@0: DrawString(3, y, STR_2046_SMALL_ADVERTISING_CAMPAIGN + i, 6); truelight@0: y += 10; truelight@0: } truelight@0: } truelight@0: } dominik@122: truelight@0: { truelight@0: int i; truelight@0: if ((i=WP(w,def_d).data_1) != -1) { tron@534: SetDParam(1, (_price.build_industry >> 8) * _town_action_costs[i]); tron@534: SetDParam(0, STR_2046_SMALL_ADVERTISING_CAMPAIGN + i); truelight@0: DrawStringMultiLine(2, 159, STR_204D_INITIATE_A_SMALL_LOCAL + i, 313); truelight@0: } truelight@0: } truelight@193: truelight@0: break; truelight@0: truelight@0: case WE_CLICK: truelight@0: switch(e->click.widget) { truelight@0: case 3: { /* listbox */ truelight@0: int y = (e->click.pt.y - 0x6B) / 10; truelight@0: if (!IS_INT_INSIDE(y, 0, 5)) truelight@0: return; truelight@0: truelight@0: y = GetNthSetBit(GetMaskOfTownActions(NULL, t), y + w->vscroll.pos - 1); truelight@0: if (y >= 0) { truelight@0: WP(w,def_d).data_1 = y; truelight@0: SetWindowDirty(w); truelight@0: } truelight@0: break; truelight@0: } truelight@0: truelight@0: case 6: { /* carry out the action */ truelight@0: DoCommandP(t->xy, w->window_number, WP(w,def_d).data_1, NULL, CMD_DO_TOWN_ACTION | CMD_MSG(STR_2054_CAN_T_DO_THIS)); truelight@0: break; truelight@0: } truelight@0: } truelight@0: break; truelight@0: truelight@0: case WE_4: truelight@0: SetWindowDirty(w); truelight@0: break; truelight@0: } truelight@0: } truelight@0: truelight@0: static const WindowDesc _town_authority_desc = { truelight@0: -1, -1, 317, 222, truelight@0: WC_TOWN_AUTHORITY,0, truelight@0: WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, truelight@0: _town_authority_widgets, truelight@0: TownAuthorityWndProc truelight@0: }; truelight@0: tron@410: static void ShowTownAuthorityWindow(uint town) truelight@0: { truelight@0: Window *w; truelight@0: truelight@0: w = AllocateWindowDescFront(&_town_authority_desc, town); truelight@0: if (w) { truelight@0: w->vscroll.cap = 5; truelight@0: WP(w,def_d).data_1 = -1; truelight@0: } truelight@0: } truelight@0: truelight@0: static void TownViewWndProc(Window *w, WindowEvent *e) truelight@0: { truelight@919: Town *t = GetTown(w->window_number); truelight@0: truelight@0: switch(e->event) { truelight@0: case WE_PAINT: darkvater@891: // disable renaming town in network games if you are not the server darkvater@891: if (_networking && !_network_server) SETBIT(w->disabled_state, 8); darkvater@891: tron@534: SetDParam(0, t->index); truelight@0: DrawWindowWidgets(w); truelight@193: tron@534: SetDParam(0, t->population); tron@534: SetDParam(1, t->num_houses); truelight@0: DrawString(2,107,STR_2006_POPULATION,0); truelight@193: tron@534: SetDParam(0, t->act_pass); tron@534: SetDParam(1, t->max_pass); truelight@0: DrawString(2,117,STR_200D_PASSENGERS_LAST_MONTH_MAX,0); truelight@0: tron@534: SetDParam(0, t->act_mail); tron@534: SetDParam(1, t->max_mail); truelight@0: DrawString(2,127,STR_200E_MAIL_LAST_MONTH_MAX,0); truelight@193: truelight@0: DrawWindowViewport(w); truelight@0: break; truelight@0: truelight@0: case WE_CLICK: truelight@0: switch(e->click.widget) { darkvater@758: case 6: /* scroll to location */ truelight@0: ScrollMainWindowToTile(t->xy); truelight@0: break; darkvater@758: case 7: /* town authority */ truelight@0: ShowTownAuthorityWindow(w->window_number); truelight@0: break; darkvater@758: case 8: /* rename */ tron@534: SetDParam(0, t->townnameparts); truelight@0: ShowQueryString(t->townnametype, STR_2007_RENAME_TOWN, 31, 130, w->window_class, w->window_number); truelight@0: break; darkvater@758: case 9: /* expand town */ truelight@0: ExpandTown(t); truelight@0: break; darkvater@758: case 10: /* delete town */ truelight@0: DeleteTown(t); truelight@0: break; truelight@0: } truelight@0: break; truelight@0: truelight@0: case WE_ON_EDIT_TEXT: { truelight@0: byte *b = e->edittext.str; truelight@0: if (*b == 0) truelight@0: return; truelight@0: memcpy(_decode_parameters, b, 32); truelight@0: DoCommandP(0, w->window_number, 0, NULL, CMD_RENAME_TOWN | CMD_MSG(STR_2008_CAN_T_RENAME_TOWN)); truelight@0: } break; truelight@0: } truelight@0: } truelight@0: truelight@0: truelight@0: static const Widget _town_view_widgets[] = { truelight@867: { WWT_TEXTBTN, RESIZE_NONE, 13, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, truelight@867: { WWT_CAPTION, RESIZE_NONE, 13, 11, 247, 0, 13, STR_2005, STR_018C_WINDOW_TITLE_DRAG_THIS}, truelight@867: { WWT_STICKYBOX, RESIZE_NONE, 13, 248, 259, 0, 13, 0x0, STR_STICKY_BUTTON}, truelight@867: { WWT_IMGBTN, RESIZE_NONE, 13, 0, 259, 14, 105, 0x0, STR_NULL}, truelight@867: { WWT_6, RESIZE_NONE, 13, 2, 257, 16, 103, 0x0, STR_NULL}, truelight@867: { WWT_IMGBTN, RESIZE_NONE, 13, 0, 259, 106, 137, 0x0, STR_NULL}, truelight@867: { WWT_PUSHTXTBTN, RESIZE_NONE, 13, 0, 85, 138, 149, STR_00E4_LOCATION, STR_200B_CENTER_THE_MAIN_VIEW_ON}, truelight@867: { WWT_PUSHTXTBTN, RESIZE_NONE, 13, 86, 171, 138, 149, STR_2020_LOCAL_AUTHORITY,STR_2021_SHOW_INFORMATION_ON_LOCAL}, truelight@867: { WWT_PUSHTXTBTN, RESIZE_NONE, 13, 172, 259, 138, 149, STR_0130_RENAME, STR_200C_CHANGE_TOWN_NAME}, darkvater@176: { WIDGETS_END}, truelight@0: }; truelight@0: truelight@0: static const WindowDesc _town_view_desc = { truelight@0: -1, -1, 260, 150, truelight@0: WC_TOWN_VIEW,0, darkvater@758: WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON, truelight@0: _town_view_widgets, truelight@0: TownViewWndProc truelight@0: }; truelight@0: truelight@0: static const Widget _town_view_scen_widgets[] = { truelight@867: { WWT_TEXTBTN, RESIZE_NONE, 13, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, truelight@867: { WWT_CAPTION, RESIZE_NONE, 13, 11, 172, 0, 13, STR_2005, STR_018C_WINDOW_TITLE_DRAG_THIS}, truelight@867: { WWT_STICKYBOX, RESIZE_NONE, 13, 248, 259, 0, 13, 0x0, STR_STICKY_BUTTON}, truelight@867: { WWT_IMGBTN, RESIZE_NONE, 13, 0, 259, 14, 105, 0x0, STR_NULL}, truelight@867: { WWT_6, RESIZE_NONE, 13, 2, 257, 16, 103, 0x0, STR_NULL}, truelight@867: { WWT_IMGBTN, RESIZE_NONE, 13, 0, 259, 106, 137, 0x0, STR_NULL}, truelight@867: { WWT_PUSHTXTBTN, RESIZE_NONE, 13, 0, 85, 138, 149, STR_00E4_LOCATION, STR_200B_CENTER_THE_MAIN_VIEW_ON}, truelight@867: { WWT_EMPTY, RESIZE_NONE, 0, 0, 0, 0, 0, 0x0, STR_NULL}, truelight@867: { WWT_PUSHTXTBTN, RESIZE_NONE, 13, 173, 247, 0, 13, STR_0130_RENAME, STR_200C_CHANGE_TOWN_NAME}, truelight@867: { WWT_PUSHTXTBTN, RESIZE_NONE, 13, 86, 171, 138, 149, STR_023C_EXPAND, STR_023B_INCREASE_SIZE_OF_TOWN}, truelight@867: { WWT_PUSHTXTBTN, RESIZE_NONE, 13, 172, 259, 138, 149, STR_0290_DELETE, STR_0291_DELETE_THIS_TOWN_COMPLETELY}, darkvater@176: { WIDGETS_END}, truelight@0: }; truelight@0: truelight@0: static const WindowDesc _town_view_scen_desc = { truelight@0: -1, -1, 260, 150, truelight@0: WC_TOWN_VIEW,0, darkvater@758: WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON, truelight@0: _town_view_scen_widgets, truelight@0: TownViewWndProc truelight@0: }; truelight@0: truelight@0: void ShowTownViewWindow(uint town) truelight@0: { truelight@0: Window *w; truelight@0: Town *t; truelight@0: truelight@0: if (_game_mode != GM_EDITOR) { truelight@0: w = AllocateWindowDescFront(&_town_view_desc, town); truelight@0: } else { truelight@0: w = AllocateWindowDescFront(&_town_view_scen_desc, town); truelight@0: } truelight@0: truelight@0: if (w) { truelight@0: w->flags4 |= WF_DISABLE_VP_SCROLL; truelight@919: t = GetTown(w->window_number); truelight@0: AssignWindowViewport(w, 3, 17, 0xFE, 0x56, t->xy, 1); truelight@0: } truelight@0: } truelight@0: truelight@0: static const Widget _town_directory_widgets[] = { truelight@867: { WWT_TEXTBTN, RESIZE_NONE, 13, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, truelight@867: { WWT_CAPTION, RESIZE_NONE, 13, 11, 195, 0, 13, STR_2000_TOWNS, STR_018C_WINDOW_TITLE_DRAG_THIS}, truelight@867: { WWT_STICKYBOX, RESIZE_NONE, 13, 196, 207, 0, 13, 0x0, STR_STICKY_BUTTON}, truelight@867: { WWT_PUSHTXTBTN, RESIZE_NONE, 13, 0, 98, 14, 25, STR_SORT_BY_NAME, STR_SORT_ORDER_TIP}, darkvater@893: { WWT_PUSHTXTBTN, RESIZE_NONE, 13, 99, 195, 14, 25, STR_SORT_BY_POPULATION, STR_SORT_ORDER_TIP}, darkvater@893: { WWT_IMGBTN, RESIZE_BOTTOM, 13, 0, 195, 26, 189, 0x0, STR_200A_TOWN_NAMES_CLICK_ON_NAME}, darkvater@893: { WWT_SCROLLBAR, RESIZE_BOTTOM, 13, 196, 207, 14, 177, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST}, darkvater@893: { WWT_RESIZEBOX, RESIZE_TB, 13, 196, 207, 178, 189, 0x0, STR_RESIZE_BUTTON}, darkvater@176: { WIDGETS_END}, truelight@0: }; truelight@0: truelight@0: truelight@0: // used to get a sorted list of the towns truelight@0: static uint _num_town_sort; truelight@0: truelight@0: static char _bufcache[64]; truelight@821: static uint16 _last_town_idx; truelight@0: darkvater@164: static int CDECL TownNameSorter(const void *a, const void *b) truelight@0: { truelight@0: char buf1[64]; darkvater@222: const Town *t; truelight@0: byte val; truelight@0: int r; truelight@0: truelight@919: t = GetTown(*(const uint16*)a); tron@534: SetDParam(0, t->townnameparts); truelight@0: GetString(buf1, t->townnametype); truelight@0: truelight@821: if ( (val=*(const uint16*)b) != _last_town_idx) { truelight@0: _last_town_idx = val; truelight@919: t = GetTown(val); tron@534: SetDParam(0, t->townnameparts); truelight@0: GetString(_bufcache, t->townnametype); truelight@0: } truelight@0: truelight@0: r = strcmp(buf1, _bufcache); truelight@0: if (_town_sort_order & 1) r = -r; truelight@0: return r; truelight@0: } truelight@0: darkvater@164: static int CDECL TownPopSorter(const void *a, const void *b) truelight@0: { truelight@919: const Town *ta = GetTown(*(const uint16*)a); truelight@919: const Town *tb = GetTown(*(const uint16*)b); darkvater@164: int r = ta->population - tb->population; truelight@0: if (_town_sort_order & 1) r = -r; truelight@0: return r; truelight@0: } truelight@0: truelight@0: static void MakeSortedTownList() truelight@0: { truelight@0: Town *t; truelight@0: int n = 0; truelight@919: truelight@919: /* Create array for sorting */ truelight@919: _town_sort = realloc(_town_sort, _towns_size * sizeof(_town_sort[0])); truelight@919: if (_town_sort == NULL) truelight@919: error("Could not allocate memory for the town-sorting-list"); truelight@919: truelight@821: FOR_ALL_TOWNS(t) truelight@821: if(t->xy) truelight@821: _town_sort[n++] = t->index; truelight@821: truelight@0: _num_town_sort = n; truelight@0: darkvater@174: _last_town_idx = 0; // used for "cache" darkvater@164: qsort(_town_sort, n, sizeof(_town_sort[0]), _town_sort_order & 2 ? TownPopSorter : TownNameSorter); darkvater@65: darkvater@69: DEBUG(misc, 1) ("Resorting Towns list..."); truelight@0: } truelight@0: truelight@0: truelight@0: static void TownDirectoryWndProc(Window *w, WindowEvent *e) truelight@0: { truelight@0: switch(e->event) { truelight@0: case WE_PAINT: { truelight@0: truelight@0: if (_town_sort_dirty) { truelight@0: _town_sort_dirty = false; truelight@0: MakeSortedTownList(); truelight@0: } truelight@0: darkvater@174: SetVScrollCount(w, _num_town_sort); truelight@0: truelight@0: DrawWindowWidgets(w); darkvater@174: DoDrawString(_town_sort_order & 1 ? "\xAA" : "\xA0", (_town_sort_order <= 1) ? 88 : 187, 15, 0x10); truelight@193: darkvater@174: { darkvater@174: Town *t; darkvater@174: int n = 0; darkvater@174: uint16 i = w->vscroll.pos; darkvater@174: int y = 28; truelight@0: darkvater@174: while (i < _num_town_sort) { truelight@919: t = GetTown(_town_sort[i]); darkvater@174: darkvater@174: assert(t->xy); darkvater@174: tron@534: SetDParam(0, t->index); tron@534: SetDParam(1, t->population); darkvater@174: DrawString(2, y, STR_2057, 0); darkvater@174: darkvater@174: y += 10; darkvater@174: i++; darkvater@174: if (++n == w->vscroll.cap) { break;} // max number of towns in 1 window darkvater@174: } truelight@0: } truelight@0: } break; truelight@0: truelight@0: case WE_CLICK: truelight@0: switch(e->click.widget) { darkvater@758: case 3: { /* Sort by Name ascending/descending */ darkvater@174: _town_sort_order = (_town_sort_order == 0) ? 1 : 0; truelight@0: _town_sort_dirty = true; truelight@0: SetWindowDirty(w); truelight@0: } break; truelight@0: darkvater@758: case 4: { /* Sort by Population ascending/descending */ darkvater@174: _town_sort_order = (_town_sort_order == 2) ? 3 : 2; truelight@0: _town_sort_dirty = true; truelight@0: SetWindowDirty(w); truelight@0: } break; truelight@193: darkvater@758: case 5: { /* Click on Town Matrix */ darkvater@174: uint16 id_v = (e->click.pt.y - 28) / 10; truelight@0: darkvater@174: if (id_v >= w->vscroll.cap) { return;} // click out of bounds darkvater@174: darkvater@174: id_v += w->vscroll.pos; darkvater@174: darkvater@174: if (id_v >= _num_town_sort) { return;} // click out of town bounds darkvater@174: darkvater@174: { truelight@919: Town *t = GetTown(_town_sort[id_v]); darkvater@174: assert(t->xy); truelight@193: truelight@0: ScrollMainWindowToTile(t->xy); truelight@0: } darkvater@174: } break; truelight@0: } truelight@0: break; truelight@193: truelight@0: case WE_4: truelight@0: SetWindowDirty(w); truelight@0: break; truelight@867: truelight@867: case WE_RESIZE: truelight@867: w->vscroll.cap += e->sizing.diff.y / 10; truelight@867: break; truelight@193: } truelight@0: } truelight@0: truelight@0: static const WindowDesc _town_directory_desc = { truelight@0: -1, -1, 208, 190, truelight@0: WC_TOWN_DIRECTORY,0, truelight@867: WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE, truelight@0: _town_directory_widgets, truelight@0: TownDirectoryWndProc truelight@0: }; truelight@0: truelight@0: truelight@0: void ShowTownDirectory() truelight@0: { truelight@0: Window *w; truelight@0: truelight@0: w = AllocateWindowDescFront(&_town_directory_desc, 0); truelight@0: if (w) { truelight@0: w->vscroll.cap = 16; truelight@867: w->resize.step_height = 10; truelight@867: w->resize.height = w->height - 10 * 6; // minimum of 10 items in the list truelight@0: } truelight@0: } truelight@0: truelight@0: