Files @ r28370:d448a5422ad5
Branch filter:

Location: cpp/openttd-patchpack/source/src/window_func.h - annotation

Peter Nelson
Fix: Calculation of initial engine age was inaccurate. (#11660)

Engine age in months was calculated as the difference in days / 32, instead of the actually difference in months. This would result in engines being artificially younger if a game was started at a later date.
r12768:980ae0491352
r12768:980ae0491352
r12768:980ae0491352
r12768:980ae0491352
r12768:980ae0491352
r12768:980ae0491352
r12768:980ae0491352
r18845:66bf168f1100
r8106:01dbd10fde05
r8106:01dbd10fde05
r8106:01dbd10fde05
r8106:01dbd10fde05
r8106:01dbd10fde05
r10208:ef8fcc3dc4ca
r20643:19ed64eb09ff
r27799:ab7d36d10264
r8106:01dbd10fde05
r8106:01dbd10fde05
r13795:7af2272ab313
r26752:adf33386687c
r10207:a1fc2f2a33db
r8106:01dbd10fde05
r27799:ab7d36d10264
r27799:ab7d36d10264
r27799:ab7d36d10264
r28112:bca7556a6bb6
r27799:ab7d36d10264
r27799:ab7d36d10264
r19195:a195b2c5b358
r8107:82461791b7a2
r16453:a6fa65e29fdb
r16508:4ece159f9ad1
r17309:6de76b3d28ae
r8106:01dbd10fde05
r13468:aea5e361cd84
r13468:aea5e361cd84
r13468:aea5e361cd84
r8106:01dbd10fde05
r8106:01dbd10fde05
r8106:01dbd10fde05
r11085:c87a330fb4c2
r8106:01dbd10fde05
r9165:ce5457160835
r17477:761eed726354
r17477:761eed726354
r8106:01dbd10fde05
r27799:ab7d36d10264
r27799:ab7d36d10264
r27799:ab7d36d10264
r28112:bca7556a6bb6
r27799:ab7d36d10264
r27799:ab7d36d10264
r25565:6a5de7df7ea1
r25565:6a5de7df7ea1
r23324:11315ee6c365
r25565:6a5de7df7ea1
r8106:01dbd10fde05
r8106:01dbd10fde05
r8106:01dbd10fde05
r25324:71e56110ba9f
r25324:71e56110ba9f
r25324:71e56110ba9f
r25324:71e56110ba9f
r25324:71e56110ba9f
r12262:8e175bd7b32c
r28353:bfc4ab63f376
r13024:48c81d0b078a
r13024:48c81d0b078a
r9165:ce5457160835
r27799:ab7d36d10264
r27799:ab7d36d10264
r27799:ab7d36d10264
r28112:bca7556a6bb6
r27799:ab7d36d10264
r27799:ab7d36d10264
r27991:0d8a4a945cd0
r27991:0d8a4a945cd0
r8131:7a50db7be0ff
r27799:ab7d36d10264
r27991:0d8a4a945cd0
r27799:ab7d36d10264
r28112:bca7556a6bb6
r27799:ab7d36d10264
r27799:ab7d36d10264
r20629:5b2e9e84b75a
r23915:2c04880cede9
r20643:19ed64eb09ff
r20629:5b2e9e84b75a
r8106:01dbd10fde05
/*
 * This file is part of OpenTTD.
 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
 */

/** @file window_func.h %Window functions not directly related to making/drawing windows. */

#ifndef WINDOW_FUNC_H
#define WINDOW_FUNC_H

#include "window_type.h"
#include "company_type.h"
#include "core/geometry_type.hpp"
#include "core/strong_typedef_type.hpp"

Window *FindWindowById(WindowClass cls, WindowNumber number);
Window *FindWindowByClass(WindowClass cls);
Window *GetMainWindow();
void ChangeWindowOwner(Owner old_owner, Owner new_owner);

template<typename T, std::enable_if_t<std::is_base_of<StrongTypedefBase, T>::value, int> = 0>
Window *FindWindowById(WindowClass cls, T number)
{
	return FindWindowById(cls, number.base());
}

void ResizeWindow(Window *w, int x, int y, bool clamp_to_screen = true);
int PositionMainToolbar(Window *w);
int PositionStatusbar(Window *w);
int PositionNewsMessage(Window *w);
int PositionNetworkChatWindow(Window *w);

int GetMainViewTop();
int GetMainViewBottom();

void InitWindowSystem();
void UnInitWindowSystem();
void ResetWindowSystem();
void SetupColoursAndInitialWindow();
void InputLoop();

void InvalidateWindowData(WindowClass cls, WindowNumber number, int data = 0, bool gui_scope = false);
void InvalidateWindowClassesData(WindowClass cls, int data = 0, bool gui_scope = false);

template<typename T, std::enable_if_t<std::is_base_of<StrongTypedefBase, T>::value, int> = 0>
void InvalidateWindowData(WindowClass cls, T number, int data = 0, bool gui_scope = false)
{
	InvalidateWindowData(cls, number.base(), data, gui_scope);
}

void CloseNonVitalWindows();
void CloseAllNonVitalWindows();
void DeleteAllMessages();
void CloseConstructionWindows();
void HideVitalWindows();
void ShowVitalWindows();

/**
 * Re-initialize all windows.
 * @param zoom_changed Set if windows are being re-initialized due to a zoom level changed.
 */
void ReInitAllWindows(bool zoom_changed);

void SetWindowWidgetDirty(WindowClass cls, WindowNumber number, WidgetID widget_index);
void SetWindowDirty(WindowClass cls, WindowNumber number);
void SetWindowClassesDirty(WindowClass cls);

template<typename T, std::enable_if_t<std::is_base_of<StrongTypedefBase, T>::value, int> = 0>
void SetWindowDirty(WindowClass cls, T number)
{
	SetWindowDirty(cls, number.base());
}

void CloseWindowById(WindowClass cls, WindowNumber number, bool force = true, int data = 0);
void CloseWindowByClass(WindowClass cls, int data = 0);

template<typename T, std::enable_if_t<std::is_base_of<StrongTypedefBase, T>::value, int> = 0>
void CloseWindowById(WindowClass cls, T number, bool force = true, int data = 0)
{
	CloseWindowById(cls, number.base(), force, data);
}

bool EditBoxInGlobalFocus();
bool FocusedWindowIsConsole();
Point GetCaretPosition();

#endif /* WINDOW_FUNC_H */