equal
deleted
inserted
replaced
21 #include "sound_func.h" |
21 #include "sound_func.h" |
22 #include "economy_func.h" |
22 #include "economy_func.h" |
23 #include "core/alloc_func.hpp" |
23 #include "core/alloc_func.hpp" |
24 #include "settings_type.h" |
24 #include "settings_type.h" |
25 #include "tilehighlight_func.h" |
25 #include "tilehighlight_func.h" |
|
26 #include "string_func.h" |
26 |
27 |
27 #include "table/sprites.h" |
28 #include "table/sprites.h" |
28 #include "table/strings.h" |
29 #include "table/strings.h" |
29 |
30 |
30 extern bool GenerateTowns(); |
31 extern bool GenerateTowns(); |
250 DoCommandP(GetTown(w->window_number)->xy, w->window_number, WP(w, def_d).data_1, NULL, CMD_DO_TOWN_ACTION | CMD_MSG(STR_00B4_CAN_T_DO_THIS)); |
251 DoCommandP(GetTown(w->window_number)->xy, w->window_number, WP(w, def_d).data_1, NULL, CMD_DO_TOWN_ACTION | CMD_MSG(STR_00B4_CAN_T_DO_THIS)); |
251 break; |
252 break; |
252 } |
253 } |
253 break; |
254 break; |
254 |
255 |
255 case WE_4: |
256 case WE_100_TICKS: |
256 w->SetDirty(); |
257 w->SetDirty(); |
257 break; |
258 break; |
258 } |
259 } |
259 } |
260 } |
260 |
261 |
266 TownAuthorityWndProc |
267 TownAuthorityWndProc |
267 }; |
268 }; |
268 |
269 |
269 static void ShowTownAuthorityWindow(uint town) |
270 static void ShowTownAuthorityWindow(uint town) |
270 { |
271 { |
271 Window *w = AllocateWindowDescFront(&_town_authority_desc, town); |
272 Window *w = AllocateWindowDescFront<Window>(&_town_authority_desc, town); |
272 |
273 |
273 if (w != NULL) { |
274 if (w != NULL) { |
274 w->vscroll.cap = 5; |
275 w->vscroll.cap = 5; |
275 WP(w, def_d).data_1 = -1; |
276 WP(w, def_d).data_1 = -1; |
276 } |
277 } |
358 delete t; |
359 delete t; |
359 break; |
360 break; |
360 } break; |
361 } break; |
361 |
362 |
362 case WE_ON_EDIT_TEXT: |
363 case WE_ON_EDIT_TEXT: |
363 if (e->we.edittext.str[0] != '\0') { |
364 if (!StrEmpty(e->we.edittext.str)) { |
364 _cmd_text = e->we.edittext.str; |
365 _cmd_text = e->we.edittext.str; |
365 DoCommandP(0, w->window_number, 0, NULL, |
366 DoCommandP(0, w->window_number, 0, NULL, |
366 CMD_RENAME_TOWN | CMD_MSG(STR_2008_CAN_T_RENAME_TOWN)); |
367 CMD_RENAME_TOWN | CMD_MSG(STR_2008_CAN_T_RENAME_TOWN)); |
367 } |
368 } |
368 break; |
369 break; |
395 |
396 |
396 void ShowTownViewWindow(TownID town) |
397 void ShowTownViewWindow(TownID town) |
397 { |
398 { |
398 Window *w; |
399 Window *w; |
399 |
400 |
400 w = AllocateWindowDescFront(&_town_view_desc, town); |
401 w = AllocateWindowDescFront<Window>(&_town_view_desc, town); |
401 |
402 |
402 if (w != NULL) { |
403 if (w != NULL) { |
403 w->flags4 |= WF_DISABLE_VP_SCROLL; |
404 w->flags4 |= WF_DISABLE_VP_SCROLL; |
404 InitializeWindowViewport(w, 3, 17, 254, 86, GetTown(town)->xy, ZOOM_LVL_TOWN); |
405 InitializeWindowViewport(w, 3, 17, 254, 86, GetTown(town)->xy, ZOOM_LVL_TOWN); |
405 } |
406 } |
553 } |
554 } |
554 } break; |
555 } break; |
555 } |
556 } |
556 break; |
557 break; |
557 |
558 |
558 case WE_4: |
559 case WE_100_TICKS: |
559 w->SetDirty(); |
560 w->SetDirty(); |
560 break; |
561 break; |
561 |
562 |
562 case WE_RESIZE: |
563 case WE_RESIZE: |
563 w->vscroll.cap += e->we.sizing.diff.y / 10; |
564 w->vscroll.cap += e->we.sizing.diff.y / 10; |
574 }; |
575 }; |
575 |
576 |
576 |
577 |
577 void ShowTownDirectory() |
578 void ShowTownDirectory() |
578 { |
579 { |
579 Window *w = AllocateWindowDescFront(&_town_directory_desc, 0); |
580 Window *w = AllocateWindowDescFront<Window>(&_town_directory_desc, 0); |
580 |
581 |
581 if (w != NULL) { |
582 if (w != NULL) { |
582 w->vscroll.cap = 16; |
583 w->vscroll.cap = 16; |
583 w->resize.step_height = 10; |
584 w->resize.step_height = 10; |
584 w->resize.height = w->height - 10 * 6; // minimum of 10 items in the list, each item 10 high |
585 w->resize.height = w->height - 10 * 6; // minimum of 10 items in the list, each item 10 high |
703 }; |
704 }; |
704 |
705 |
705 void ShowBuildTownWindow() |
706 void ShowBuildTownWindow() |
706 { |
707 { |
707 if (_game_mode != GM_EDITOR && !IsValidPlayer(_current_player)) return; |
708 if (_game_mode != GM_EDITOR && !IsValidPlayer(_current_player)) return; |
708 AllocateWindowDescFront(&_scen_edit_town_gen_desc, 0); |
709 AllocateWindowDescFront<Window>(&_scen_edit_town_gen_desc, 0); |
709 } |
710 } |
710 |
711 |