Files
@ r17167:68f47a8db1b5
Branch filter:
Location: cpp/openttd-patchpack/source/src/strings_func.h - annotation
r17167:68f47a8db1b5
3.7 KiB
text/x-c
(svn r21916) -Fix [FS#4442]: the minimum speed needed for (realistic) acceleration to work properly can sometimes be more than the (temporary) maximum speed causing Clamp to "fail". Make sure that the minimum speed always overrules the maximum speed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | r8114:866ed489ed98 r8114:866ed489ed98 r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r8114:866ed489ed98 r8114:866ed489ed98 r8114:866ed489ed98 r8114:866ed489ed98 r8114:866ed489ed98 r8114:866ed489ed98 r16701:b670a606abe0 r8114:866ed489ed98 r8114:866ed489ed98 r8114:866ed489ed98 r16701:b670a606abe0 r8445:07810e0b20bf r8114:866ed489ed98 r10197:a65cfa37d4ad r8114:866ed489ed98 r12499:2e177e6e0453 r12499:2e177e6e0453 r12499:2e177e6e0453 r12499:2e177e6e0453 r12499:2e177e6e0453 r12499:2e177e6e0453 r8114:866ed489ed98 r8114:866ed489ed98 r8114:866ed489ed98 r8114:866ed489ed98 r8114:866ed489ed98 r12499:2e177e6e0453 r12499:2e177e6e0453 r12499:2e177e6e0453 r12499:2e177e6e0453 r12499:2e177e6e0453 r8114:866ed489ed98 r8114:866ed489ed98 r8114:866ed489ed98 r8114:866ed489ed98 r8114:866ed489ed98 r8114:866ed489ed98 r8114:866ed489ed98 r8114:866ed489ed98 r8114:866ed489ed98 r8114:866ed489ed98 r12499:2e177e6e0453 r12499:2e177e6e0453 r12499:2e177e6e0453 r12499:2e177e6e0453 r12499:2e177e6e0453 r12499:2e177e6e0453 r8114:866ed489ed98 r8114:866ed489ed98 r8114:866ed489ed98 r8114:866ed489ed98 r8114:866ed489ed98 r12499:2e177e6e0453 r12499:2e177e6e0453 r12499:2e177e6e0453 r12499:2e177e6e0453 r12499:2e177e6e0453 r8114:866ed489ed98 r8114:866ed489ed98 r8114:866ed489ed98 r8114:866ed489ed98 r8114:866ed489ed98 r8114:866ed489ed98 r8114:866ed489ed98 r8114:866ed489ed98 r12499:2e177e6e0453 r12499:2e177e6e0453 r12499:2e177e6e0453 r12499:2e177e6e0453 r12499:2e177e6e0453 r12499:2e177e6e0453 r8114:866ed489ed98 r8114:866ed489ed98 r8114:866ed489ed98 r8114:866ed489ed98 r8114:866ed489ed98 r8114:866ed489ed98 r12499:2e177e6e0453 r12499:2e177e6e0453 r12499:2e177e6e0453 r12499:2e177e6e0453 r12499:2e177e6e0453 r12499:2e177e6e0453 r8114:866ed489ed98 r8114:866ed489ed98 r8114:866ed489ed98 r8114:866ed489ed98 r8114:866ed489ed98 r8114:866ed489ed98 r16431:ec558deca9d7 r8114:866ed489ed98 r8114:866ed489ed98 r13271:4bcd60b30aeb r8114:866ed489ed98 r13018:7caa31b19a80 r8114:866ed489ed98 r8321:b008a9407302 r8321:b008a9407302 r8321:b008a9407302 r8330:b2f77e5f39e7 r8321:b008a9407302 r8321:b008a9407302 r8114:866ed489ed98 r8114:866ed489ed98 r16603:771c410131a7 r16603:771c410131a7 r16849:d593358b4346 | /* $Id$ */
/*
* This file is part of OpenTTD.
* 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.
* 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.
* 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/>.
*/
/** @file strings_func.h Functions related to OTTD's strings. */
#ifndef STRINGS_FUNC_H
#define STRINGS_FUNC_H
#include "strings_type.h"
#include "string_type.h"
char *InlineString(char *buf, StringID string);
char *GetString(char *buffr, StringID string, const char *last);
char *GetStringWithArgs(char *buffr, uint string, int64 *argv, const int64 *argve, const char *last, WChar *argt = NULL);
const char *GetStringPtr(StringID string);
void InjectDParam(uint amount);
/**
* Set a string parameter \a v at index \a n in a given array \a s.
* @param s Array of string parameters.
* @param n Index of the string parameter.
* @param v Value of the string parameter.
*/
static inline void SetDParamX(uint64 *s, uint n, uint64 v)
{
s[n] = v;
}
/**
* Set a string parameter \a v at index \a n in the global string parameter array.
* @param n Index of the string parameter.
* @param v Value of the string parameter.
*/
static inline void SetDParam(uint n, uint64 v)
{
extern uint64 _decode_parameters[20];
assert(n < lengthof(_decode_parameters));
_decode_parameters[n] = v;
}
void SetDParamStr(uint n, const char *str);
/**
* Get the current string parameter at index \a n from parameter array \a s.
* @param s Array of string parameters.
* @param n Index of the string parameter.
* @return Value of the requested string parameter.
*/
static inline uint64 GetDParamX(const uint64 *s, uint n)
{
return s[n];
}
/**
* Get the current string parameter at index \a n from the global string parameter array.
* @param n Index of the string parameter.
* @return Value of the requested string parameter.
*/
static inline uint64 GetDParam(uint n)
{
extern uint64 _decode_parameters[20];
assert(n < lengthof(_decode_parameters));
return _decode_parameters[n];
}
/**
* Copy \a num string parameters from array \a src into the global string parameter array.
* @param offs Index in the global array to copy the first string parameter to.
* @param src Source array of string parameters.
* @param num Number of string parameters to copy.
*/
static inline void CopyInDParam(int offs, const uint64 *src, int num)
{
extern uint64 _decode_parameters[20];
memcpy(_decode_parameters + offs, src, sizeof(uint64) * (num));
}
/**
* Copy \a num string parameters from the global string parameter array to the \a dst array.
* @param dst Destination array of string parameters.
* @param offs Index in the global array to copy the first string parameter from.
* @param num Number of string parameters to copy.
*/
static inline void CopyOutDParam(uint64 *dst, int offs, int num)
{
extern uint64 _decode_parameters[20];
memcpy(dst, _decode_parameters + offs, sizeof(uint64) * (num));
}
extern TextDirection _current_text_dir; ///< Text direction of the currently selected language
void InitializeLanguagePacks();
const char *GetCurrentLanguageIsoCode();
int CDECL StringIDSorter(const StringID *a, const StringID *b);
/** Key comparison function for std::map */
struct StringIDCompare
{
bool operator()(StringID s1, StringID s2) const { return StringIDSorter(&s1, &s2) < 0; }
};
void CheckForMissingGlyphsInLoadedLanguagePack();
int strnatcmp(const char *s1, const char *s2);
#endif /* STRINGS_FUNC_H */
|