OpenTTD Source  20241120-master-g6d3adc6169
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 NOACCESS(args)
 
#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. More...
 
#define cpp_sizeof(base, variable)   (sizeof(std::declval<base>().variable))
 Gets the size of a variable within a class. More...
 
#define GNU_TARGET(x)
 
#define FMT_HEADER_ONLY
 
#define JSON_ASSERT(x)   assert(x)
 
#define MAX_PATH   260
 
#define MAX_UVALUE(type)   (static_cast<type>(~static_cast<type>(0)))
 The largest value that can be entered in a variable. More...
 
#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())
 
void free (const void *ptr)
 Version of the standard free that accepts const pointers. More...
 

Detailed Description

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

Definition in file stdafx.h.

Macro Definition Documentation

◆ 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 288 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 280 of file stdafx.h.

◆ MAX_UVALUE

#define MAX_UVALUE (   type)    (static_cast<type>(~static_cast<type>(0)))

The largest value that can be entered in a variable.

Parameters
typethe type of the variable

Definition at line 343 of file stdafx.h.

Function Documentation

◆ free()