Files
@ r20199:eddc8307a7f1
Branch filter:
Location: cpp/openttd-patchpack/source/src/script/api/script_window.cpp - annotation
r20199:eddc8307a7f1
1.9 KiB
text/x-c
(svn r25196) -Update from WebTranslator v3.0:
croatian - 2 changes by VoyagerOne
brazilian_portuguese - 9 changes by and_opttd
gaelic - 372 changes by GunChleoc
croatian - 2 changes by VoyagerOne
brazilian_portuguese - 9 changes by and_opttd
gaelic - 372 changes by GunChleoc
r18773:1df705d87864 r18773:1df705d87864 r18773:1df705d87864 r18773:1df705d87864 r18773:1df705d87864 r18773:1df705d87864 r18773:1df705d87864 r18773:1df705d87864 r18773:1df705d87864 r18773:1df705d87864 r18773:1df705d87864 r18773:1df705d87864 r18773:1df705d87864 r18773:1df705d87864 r18773:1df705d87864 r18773:1df705d87864 r18773:1df705d87864 r18773:1df705d87864 r18773:1df705d87864 r18773:1df705d87864 r18773:1df705d87864 r18773:1df705d87864 r18773:1df705d87864 r18773:1df705d87864 r18773:1df705d87864 r18773:1df705d87864 r18773:1df705d87864 r18773:1df705d87864 r18773:1df705d87864 r18773:1df705d87864 r18773:1df705d87864 r18773:1df705d87864 r18773:1df705d87864 r18773:1df705d87864 r18773:1df705d87864 r18773:1df705d87864 r18773:1df705d87864 r18773:1df705d87864 r18773:1df705d87864 r18773:1df705d87864 r18773:1df705d87864 r18773:1df705d87864 r18773:1df705d87864 r18773:1df705d87864 r18773:1df705d87864 r18773:1df705d87864 r18773:1df705d87864 r18773:1df705d87864 r18773:1df705d87864 r18773:1df705d87864 r18773:1df705d87864 r18773:1df705d87864 r18773:1df705d87864 r18773:1df705d87864 r18773:1df705d87864 r18773:1df705d87864 r18773:1df705d87864 r18773:1df705d87864 r18773:1df705d87864 | /* $Id$ */
/*
* 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 script_window.cpp Implementation of ScriptWindow. */
#include "../../stdafx.h"
#include "script_window.hpp"
#include "script_game.hpp"
#include "../../window_func.h"
#include "../../window_gui.h"
/* static */ void ScriptWindow::Close(WindowClass window, uint32 number)
{
if (ScriptGame::IsMultiplayer()) return;
if (number == NUMBER_ALL) {
DeleteWindowByClass((::WindowClass)window);
return;
}
DeleteWindowById((::WindowClass)window, number);
}
/* static */ bool ScriptWindow::IsOpen(WindowClass window, uint32 number)
{
if (ScriptGame::IsMultiplayer()) return false;
if (number == NUMBER_ALL) {
return (FindWindowByClass((::WindowClass)window) != NULL);
}
return FindWindowById((::WindowClass)window, number) != NULL;
}
/* static */ void ScriptWindow::Highlight(WindowClass window, uint32 number, uint8 widget, TextColour colour)
{
if (ScriptGame::IsMultiplayer()) return;
if (number == NUMBER_ALL) return;
if (!IsOpen(window, number)) return;
if (colour != TC_INVALID && (::TextColour)colour >= ::TC_END) return;
Window *w = FindWindowById((::WindowClass)window, number);
if (widget == WIDGET_ALL) {
if (colour != TC_INVALID) return;
w->DisableAllWidgetHighlight();
return;
}
const NWidgetBase *wid = w->GetWidget<NWidgetBase>(widget);
if (wid == NULL) return;
w->SetWidgetHighlight(widget, (::TextColour)colour);
}
|