2 * This file is part of OpenTTD.
3 * 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.
4 * 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.
5 * 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/>.
8 /** @file league_base.h %LeagueTable base class. */
13 #include "company_type.h"
14 #include "goal_type.h"
15 #include "league_type.h"
16 #include "core/pool_type.hpp"
18 bool IsValidLink(Link link
);
20 typedef Pool
<LeagueTableElement
, LeagueTableElementID
, 64, 64000> LeagueTableElementPool
;
21 extern LeagueTableElementPool _league_table_element_pool
;
23 typedef Pool
<LeagueTable
, LeagueTableID
, 4, 255> LeagueTablePool
;
24 extern LeagueTablePool _league_table_pool
;
28 * Struct about league table elements.
29 * Each LeagueTable is composed of one or more elements. Elements are sorted by their rating (higher=better).
31 struct LeagueTableElement
: LeagueTableElementPool::PoolItem
<&_league_table_element_pool
> {
32 LeagueTableID table
; ///< Id of the table which this element belongs to
33 int64_t rating
; ///< Value that determines ordering of elements in the table (higher=better)
34 CompanyID company
; ///< Company Id to show the color blob for or INVALID_COMPANY
35 std::string text
; ///< Text of the element
36 std::string score
; ///< String representation of the score associated with the element
37 Link link
; ///< What opens when element is clicked
40 * We need an (empty) constructor so struct isn't zeroed (as C++ standard states)
42 LeagueTableElement() { }
45 * (Empty) destructor has to be defined else operator delete might be called with nullptr parameter
47 ~LeagueTableElement() { }
51 /** Struct about custom league tables */
52 struct LeagueTable
: LeagueTablePool::PoolItem
<&_league_table_pool
> {
53 std::string title
; ///< Title of the table
54 std::string header
; ///< Text to show above the table
55 std::string footer
; ///< Text to show below the table
58 * We need an (empty) constructor so struct isn't zeroed (as C++ standard states)
63 * (Empty) destructor has to be defined else operator delete might be called with nullptr parameter
68 #endif /* LEAGUE_BASE_H */