OpenTTD Source 20250426-master-gbb1d561369
stdafx.h File Reference

Definition of base types and functions in a cross-platform compatible way. More...

#include <stdint.h>
#include <algorithm>
#include <array>
#include <bit>
#include <cassert>
#include <cctype>
#include <cerrno>
#include <climits>
#include <cmath>
#include <cstddef>
#include <cstdint>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cwchar>
#include <deque>
#include <exception>
#include <functional>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <numeric>
#include <optional>
#include <set>
#include <source_location>
#include <span>
#include <stdexcept>
#include <string>
#include <type_traits>
#include <variant>
#include <vector>

Go to the source code of this file.

Macros

#define __STDC_LIMIT_MACROS
 
#define EMPTY_BASES
 
#define PATHSEP   "/"
 
#define PATHSEPCHAR   '/'
 
#define PACK_N(type_dec, n)   type_dec __attribute__((__packed__, aligned(n)))
 
#define PACK(type_dec)   PACK_N(type_dec, 1)
 
#define debug_inline   inline
 
#define PERSONAL_DIR   ""
 
#define M_PI_2   1.57079632679489661923
 
#define M_PI   3.14159265358979323846
 
#define lengthof(array)   (sizeof(ArraySizeHelper(array)))
 Return the length of an fixed size array.
 
#define cpp_sizeof(base, variable)   (sizeof(std::declval<base>().variable))
 Gets the size of a variable within a class.
 
#define GNU_TARGET(x)
 
#define JSON_ASSERT(x)   assert(x)
 
#define MAX_PATH   260
 
#define IGNORE_UNINITIALIZED_WARNING_START
 
#define IGNORE_UNINITIALIZED_WARNING_STOP
 

Typedefs

typedef unsigned int uint
 

Functions

template<typename T >
std::string FS2OTTD (T name)
 
template<typename T >
std::string OTTD2FS (T name)
 
template<typename T , size_t N>
char(& ArraySizeHelper (T(&array)[N]))[N]
 
void NOT_REACHED (const std::source_location location=std::source_location::current())
 
void AssertFailedError (const char *expression, const std::source_location location=std::source_location::current())
 

Detailed Description

Definition of base types and functions in a cross-platform compatible way.

Definition in file stdafx.h.

Macro Definition Documentation

◆ __STDC_LIMIT_MACROS

#define __STDC_LIMIT_MACROS

Definition at line 32 of file stdafx.h.

◆ cpp_sizeof

#define cpp_sizeof (   base,
  variable 
)    (sizeof(std::declval<base>().variable))

Gets the size of a variable within a class.

Parameters
baseThe class the variable is in.
variableThe variable to get the size of.
Returns
the size of the variable

Definition at line 279 of file stdafx.h.

◆ debug_inline

#define debug_inline   inline

Definition at line 222 of file stdafx.h.

◆ EMPTY_BASES

#define EMPTY_BASES

Definition at line 93 of file stdafx.h.

◆ GNU_TARGET

#define GNU_TARGET (   x)

Definition at line 292 of file stdafx.h.

◆ IGNORE_UNINITIALIZED_WARNING_START

#define IGNORE_UNINITIALIZED_WARNING_START

Definition at line 335 of file stdafx.h.

◆ IGNORE_UNINITIALIZED_WARNING_STOP

#define IGNORE_UNINITIALIZED_WARNING_STOP

Definition at line 336 of file stdafx.h.

◆ JSON_ASSERT

#define JSON_ASSERT (   x)    assert(x)

Definition at line 306 of file stdafx.h.

◆ lengthof

#define lengthof (   array)    (sizeof(ArraySizeHelper(array)))

Return the length of an fixed size array.

Unlike sizeof this function returns the number of elements of the given type.

Parameters
xThe pointer to the first element of the array
Returns
The number of elements

Definition at line 271 of file stdafx.h.

◆ M_PI

#define M_PI   3.14159265358979323846

Definition at line 257 of file stdafx.h.

◆ M_PI_2

#define M_PI_2   1.57079632679489661923

Definition at line 256 of file stdafx.h.

◆ MAX_PATH

#define MAX_PATH   260

Definition at line 315 of file stdafx.h.

◆ PACK

#define PACK (   type_dec)    PACK_N(type_dec, 1)

Definition at line 187 of file stdafx.h.

◆ PACK_N

#define PACK_N (   type_dec,
 
)    type_dec __attribute__((__packed__, aligned(n)))

Definition at line 185 of file stdafx.h.

◆ PATHSEP

#define PATHSEP   "/"

Definition at line 175 of file stdafx.h.

◆ PATHSEPCHAR

#define PATHSEPCHAR   '/'

Definition at line 176 of file stdafx.h.

◆ PERSONAL_DIR

#define PERSONAL_DIR   ""

Definition at line 240 of file stdafx.h.

Typedef Documentation

◆ uint

typedef unsigned int uint

Definition at line 236 of file stdafx.h.

Function Documentation

◆ AssertFailedError()

void AssertFailedError ( const char *  expression,
const std::source_location  location = std::source_location::current() 
)

Definition at line 19 of file error.cpp.

◆ FS2OTTD()

template<typename T >
std::string FS2OTTD ( name)

Definition at line 166 of file stdafx.h.

◆ NOT_REACHED()

void NOT_REACHED ( const std::source_location  location = std::source_location::current())

Definition at line 14 of file error.cpp.

◆ OTTD2FS()

template<typename T >
std::string OTTD2FS ( name)

Definition at line 167 of file stdafx.h.