Update openttd to 1.7.0-RC1
--HG-- branch : openttd
This commit is contained in:
+44
-1
@@ -1,4 +1,4 @@
|
||||
/* $Id: strings_func.h 26238 2014-01-12 17:59:43Z frosch $ */
|
||||
/* $Id: strings_func.h 27758 2017-02-26 19:41:30Z frosch $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -15,6 +15,49 @@
|
||||
#include "strings_type.h"
|
||||
#include "string_type.h"
|
||||
#include "gfx_type.h"
|
||||
#include "core/bitmath_func.hpp"
|
||||
|
||||
/**
|
||||
* Extract the StringTab from a StringID.
|
||||
* @param str String identifier
|
||||
* @return StringTab from \a str
|
||||
*/
|
||||
static inline StringTab GetStringTab(StringID str)
|
||||
{
|
||||
StringTab result = (StringTab)(str >> TAB_SIZE_BITS);
|
||||
if (result >= TEXT_TAB_NEWGRF_START) return TEXT_TAB_NEWGRF_START;
|
||||
if (result >= TEXT_TAB_GAMESCRIPT_START) return TEXT_TAB_GAMESCRIPT_START;
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract the StringIndex from a StringID.
|
||||
* @param str String identifier
|
||||
* @return StringIndex from \a str
|
||||
*/
|
||||
static inline uint GetStringIndex(StringID str)
|
||||
{
|
||||
return str - (GetStringTab(str) << TAB_SIZE_BITS);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a StringID
|
||||
* @param tab StringTab
|
||||
* @param index StringIndex
|
||||
* @return StringID composed from \a tab and \a index
|
||||
*/
|
||||
static inline StringID MakeStringID(StringTab tab, uint index)
|
||||
{
|
||||
if (tab == TEXT_TAB_NEWGRF_START) {
|
||||
assert(index < TAB_SIZE_NEWGRF);
|
||||
} else if (tab == TEXT_TAB_GAMESCRIPT_START) {
|
||||
assert(index < TAB_SIZE_GAMESCRIPT);
|
||||
} else {
|
||||
assert(tab < TEXT_TAB_END);
|
||||
assert(index < TAB_SIZE);
|
||||
}
|
||||
return (tab << TAB_SIZE_BITS) + index;
|
||||
}
|
||||
|
||||
class StringParameters {
|
||||
StringParameters *parent; ///< If not NULL, this instance references data from this parent instance.
|
||||
|
||||
Reference in New Issue
Block a user