OpenTTD Source: src/stdafx.h File Reference

OpenTTD Source 14.0-beta1

Macros | Typedefs | Functions
stdafx.h File Reference
`#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 <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(x) (sizeof(x) / sizeof(x[0]))
| Return the length of an fixed size array. More...
#define | endof(x) (&x[lengthof(x)])
| Get the end element of an fixed size array. More...
#define | lastof(x) (&x[lengthof(x) - 1])
| Get the last element 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 | cpp_lengthof(base, variable) (cpp_sizeof(base, variable) / cpp_sizeof(base, variable[0]))
| Gets the length of an array variable within a class. More...
#define | GNU_TARGET(x)
#define | FMT_HEADER_ONLY
#define | NOT_REACHED() NotReachedError(__LINE__, __FILE__)
#define | JSON_ASSERT(x) assert(x)
#define | MAX_PATH 260
#define | MAX_UVALUE(type) ((type)~(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 uint8_t | byte
typedef unsigned int | uint

## Functions
template<typename T >
std::string | FS2OTTD (T name)
template<typename T >
std::string | OTTD2FS (T name)
void | NotReachedError (int line, const char *file)
void | AssertFailedError (int line, const char *file, const char *expression)
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_lengthof

#define cpp_lengthof | ( |  | base,
|  |  | variable
| ) |  | (cpp_sizeof(base, variable) / cpp_sizeof(base, variable[0]))

Gets the length of an array variable within a class.

Parameters

  base | The class the variable is in.
  variable | The array variable to get the size of.

Returns
  the length of the array

Definition at line 332 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

  base | The class the variable is in.
  variable | The variable to get the size of.

Returns
  the size of the variable

Definition at line 324 of file stdafx.h.

## ◆ endof

#define endof | ( |  | x | ) | (&x[lengthof(x)])

Get the end element of an fixed size array.

Parameters

  x | The pointer to the first element of the array

Returns
  The pointer past to the last element of the array

Definition at line 308 of file stdafx.h.

## ◆ lastof

#define lastof | ( |  | x | ) | (&x[lengthof(x) - 1])

Get the last element of an fixed size array.

Parameters

  x | The pointer to the first element of the array

Returns
  The pointer to the last element of the array

Definition at line 316 of file stdafx.h.

## ◆ lengthof

#define lengthof | ( |  | x | ) | (sizeof(x) / sizeof(x[0]))

Return the length of an fixed size array.

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

Parameters

  x | The pointer to the first element of the array

Returns
  The number of elements

Definition at line 300 of file stdafx.h.

## ◆ MAX_UVALUE

#define MAX_UVALUE | ( |  | type | ) | ((type)~(type)0)

The largest value that can be entered in a variable.

Parameters

  type | the type of the variable

Definition at line 388 of file stdafx.h.

## Function Documentation

## ◆ free()

void free | ( | const void * | ptr | ) |
| inline

Version of the standard free that accepts const pointers.

Parameters

  ptr | The data to free.

Definition at line 379 of file stdafx.h.

Referenced by ScriptAllocator::CheckAllocation(), BinaryHeap::Clear(), Hash::Clear(), TrueTypeFontCache::ClearFontCache(), SpriteFontCache::ClearGlyphToSpriteMap(), ClearSnowLine(), DEFINE_POOL_METHOD(), Hash::Delete(), BinaryHeap::Free(), FreeEngine(), Path::GetCapacityRatio(), GetLayouter(), Gunzip(), HeightMapAdjustWaterLevel(), InitializeOldNames(), OpenGLBackend::InternalClearCursorCache(), IniLoadFile::LoadFromDisk(), TextfileWindow::LoadTextfile(), ZeroedMemoryAllocator::operator delete(), ZeroedMemoryAllocator::operator delete[](), ResetCustomAirports(), ResetOldNames(), StringFilter::SetFilterTerm(), VideoDriver_Dedicated::Stop(), CrashLogOSX::SurveyStacktrace(), Xunzip(), FixedSizeArray< SubArray, 1024 >::~FixedSizeArray(), FreeUnitIDGenerator::~FreeUnitIDGenerator(), ReusableBuffer< SpriteLoader::CommonPixel >::~ReusableBuffer(), and TrueTypeFontCache::~TrueTypeFontCache().