OpenTTD Source: src/league_base.h Source File

OpenTTD Source 15.0-beta1

league_base.h
Go to the documentation of this file.
1/*
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/>.
6 */
7
10#ifndef LEAGUE_BASE_H
11#define LEAGUE_BASE_H
12
13#include "company_type.h"
14#include "goal_type.h"
15#include "league_type.h"
16#include "core/pool_type.hpp"
17
18bool IsValidLink(Link link);
19
20typedef Pool<LeagueTableElement, LeagueTableElementID, 64, 64000> LeagueTableElementPool;
21extern LeagueTableElementPool _league_table_element_pool;
22
23typedef Pool<LeagueTable, LeagueTableID, 4, 255> LeagueTablePool;
24extern LeagueTablePool _league_table_pool;
25
26
31 struct LeagueTableElement : LeagueTableElementPool::PoolItem<&_league_table_element_pool> {
32 LeagueTableID table;
33 int64_t rating;
34 CompanyID company;
35 std::string text;
36 std::string score;
37 Link link;
38
42 LeagueTableElement() { }
43
47 ~LeagueTableElement() { }
48};
49
50
52 struct LeagueTable : LeagueTablePool::PoolItem<&_league_table_pool> {
53 std::string title;
54 std::string header;
55 std::string footer;
56
60 LeagueTable() { }
61
65 ~LeagueTable() { }
66};
67
68#endif /* LEAGUE_BASE_H */
company_type.h
Types related to companies.
Owner
Owner
Enum for all companies/owners.
Definition company_type.h:18
goal_type.h
basic types related to goals
IsValidLink
bool IsValidLink(Link link)
Checks whether a link is valid, i.e.
Definition league_cmd.cpp:34
league_type.h
basic types related to league tables
LeagueTableID
uint8_t LeagueTableID
ID of a league table.
Definition league_type.h:32
pool_type.hpp
Definition of Pool, structure used to access PoolItems, and PoolItem, base structure for Vehicle,...
LeagueTableElement
Struct about league table elements.
Definition league_base.h:31
LeagueTableElement::score
std::string score
String representation of the score associated with the element.
Definition league_base.h:36
LeagueTableElement::text
std::string text
Text of the element.
Definition league_base.h:35
LeagueTableElement::rating
int64_t rating
Value that determines ordering of elements in the table (higher=better)
Definition league_base.h:33
LeagueTableElement::~LeagueTableElement
~LeagueTableElement()
(Empty) destructor has to be defined else operator delete might be called with nullptr parameter
Definition league_base.h:47
LeagueTableElement::LeagueTableElement
LeagueTableElement()
We need an (empty) constructor so struct isn't zeroed (as C++ standard states)
Definition league_base.h:42
LeagueTableElement::link
Link link
What opens when element is clicked.
Definition league_base.h:37
LeagueTableElement::table
LeagueTableID table
Id of the table which this element belongs to.
Definition league_base.h:32
LeagueTableElement::company
CompanyID company
Company Id to show the color blob for or INVALID_COMPANY.
Definition league_base.h:34
LeagueTable
Struct about custom league tables.
Definition league_base.h:52
LeagueTable::LeagueTable
LeagueTable()
We need an (empty) constructor so struct isn't zeroed (as C++ standard states)
Definition league_base.h:60
LeagueTable::header
std::string header
Text to show above the table.
Definition league_base.h:54
LeagueTable::title
std::string title
Title of the table.
Definition league_base.h:53
LeagueTable::~LeagueTable
~LeagueTable()
(Empty) destructor has to be defined else operator delete might be called with nullptr parameter
Definition league_base.h:65
LeagueTable::footer
std::string footer
Text to show below the table.
Definition league_base.h:55
Link
Definition league_type.h:25
Pool::PoolItem
Base class for all PoolItems.
Definition pool_type.hpp:237
Pool
Base class for all pools.
Definition pool_type.hpp:80