summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorludde <ludde@openttd.org>2005-07-14 09:53:52 +0000
committerludde <ludde@openttd.org>2005-07-14 09:53:52 +0000
commit20b7c66f7fe06a17920accbce995d2d2448f4f52 (patch)
tree38011285ce74ce89fc7b048e0ff6e6d88adcd0a7
parent80860170973d57edbf48c864a642cb5874f18c48 (diff)
downloadopenttd-20b7c66f7fe06a17920accbce995d2d2448f4f52.tar.xz
(svn r2565) Fix: Remove GetParamInt8, GetParamInt16, GetParamUint16.. they are just confusing and just do the same thing as GetParamInt32
-rw-r--r--misc.c2
-rw-r--r--strings.c46
-rw-r--r--strings.h6
3 files changed, 13 insertions, 41 deletions
diff --git a/misc.c b/misc.c
index 9e87baf97..bf78f9b98 100644
--- a/misc.c
+++ b/misc.c
@@ -320,7 +320,7 @@ void DeleteName(StringID id)
char *GetName(int id, char *buff)
{
if (id & 0x400) GetParamInt32();
- if (id & 0x200) GetParamUint16();
+ if (id & 0x200) GetParamInt32();
return strecpy(buff, _name_array[id & ~0x600], NULL);
}
diff --git a/strings.c b/strings.c
index f91d17e1a..74ca3c9cf 100644
--- a/strings.c
+++ b/strings.c
@@ -208,7 +208,6 @@ void InjectDParam(int amount)
memmove(_decode_parameters + amount, _decode_parameters, sizeof(_decode_parameters) - amount * sizeof(uint32));
}
-
int32 GetParamInt32(void)
{
int32 result = GetDParam(0);
@@ -224,27 +223,6 @@ static int64 GetParamInt64(void)
}
-int GetParamInt16(void)
-{
- int result = (int16)GetDParam(0);
- memmove(&_decode_parameters[0], &_decode_parameters[1], sizeof(uint32) * (lengthof(_decode_parameters)-1));
- return result;
-}
-
-int GetParamInt8(void)
-{
- int result = (int8)GetDParam(0);
- memmove(&_decode_parameters[0], &_decode_parameters[1], sizeof(uint32) * (lengthof(_decode_parameters)-1));
- return result;
-}
-
-int GetParamUint16(void)
-{
- int result = GetDParam(0);
- memmove(&_decode_parameters[0], &_decode_parameters[1], sizeof(uint32) * (lengthof(_decode_parameters)-1));
- return result;
-}
-
static const uint32 _divisor_table[] = {
1000000000,
100000000,
@@ -456,13 +434,13 @@ static char *DecodeString(char *buff, const char *str)
buff = GetString(buff, READ_LE_UINT16(str-2));
break;
case 0x82: // {DATE_LONG}
- buff = FormatYmdString(buff, GetParamUint16());
+ buff = FormatYmdString(buff, GetParamInt32());
break;
case 0x83: // {DATE_SHORT}
- buff = FormatMonthAndYear(buff, GetParamUint16());
+ buff = FormatMonthAndYear(buff, GetParamInt32());
break;
case 0x84: {// {VELOCITY}
- int value = GetParamInt16();
+ int value = GetParamInt32();
if (_opt_ptr->kilometers) value = value * 1648 >> 10;
buff = FormatCommaNumber(buff, value);
if (_opt_ptr->kilometers) {
@@ -488,10 +466,10 @@ static char *DecodeString(char *buff, const char *str)
// Short description of cargotypes. Layout:
// 8-bit = cargo type
// 16-bit = cargo count
- StringID cargo_str = _cargo_string_list[_opt_ptr->landscape][(byte)GetParamInt8()];
+ StringID cargo_str = _cargo_string_list[_opt_ptr->landscape][GetParamInt32()];
uint16 multiplier = (cargo_str == STR_LITERS) ? 1000 : 1;
// liquid type of cargo is multiplied by 100 to get correct amount
- buff = FormatCommaNumber(buff, GetParamInt16() * multiplier);
+ buff = FormatCommaNumber(buff, GetParamInt32() * multiplier);
buff = strecpy(buff, " ", NULL);
buff = strecpy(buff, GetStringPtr(cargo_str), NULL);
} break;
@@ -506,24 +484,24 @@ static char *DecodeString(char *buff, const char *str)
break;
case 0x86: // {SKIP}
- GetParamInt16();
+ GetParamInt32();
//assert(0);
break;
case 0x87: // {VOLUME}
- buff = FormatCommaNumber(buff, GetParamInt16() * 1000);
+ buff = FormatCommaNumber(buff, GetParamInt32() * 1000);
buff = strecpy(buff, " ", NULL);
buff = strecpy(buff, GetStringPtr(STR_LITERS), NULL);
break;
case 0x88: // {STRING}
- buff = GetString(buff, (uint16)GetParamUint16());
+ buff = GetString(buff, GetParamInt32());
break;
case 0x99: { // {CARGO}
// Layout now is:
// 8bit - cargo type
// 16-bit - cargo count
- int cargo_str = _cargoc.names_long_s[GetParamInt8()];
+ int cargo_str = _cargoc.names_long_s[GetParamInt32()];
// Now check if the cargo count is 1, if it is, increase string by 32.
if (GetDParam(0) != 1) cargo_str += 32;
buff = GetString(buff, cargo_str);
@@ -580,7 +558,7 @@ static char *DecodeString(char *buff, const char *str)
} break;
case 0x9E: { // {DATE_TINY}
- buff = FormatTinyDate(buff, GetParamUint16());
+ buff = FormatTinyDate(buff, GetParamInt32());
break;
}
@@ -599,7 +577,7 @@ static char *DecodeString(char *buff, const char *str)
static char *StationGetSpecialString(char *buff)
{
- int x = GetParamInt8();
+ int x = GetParamInt32();
if (x & 0x01) *buff++ = '\xB4';
if (x & 0x02) *buff++ = '\xB5';
if (x & 0x04) *buff++ = '\xB6';
@@ -770,7 +748,7 @@ static char *GetSpecialPlayerNameString(char *buff, int ind)
return GenPlayerName_4(buff);
case 4: // song names
- return strecpy(buff, _song_names[GetParamUint16() - 1], NULL);
+ return strecpy(buff, _song_names[GetParamInt32() - 1], NULL);
}
// town name?
diff --git a/strings.h b/strings.h
index f3cd34d1d..2114a1062 100644
--- a/strings.h
+++ b/strings.h
@@ -10,14 +10,8 @@ static inline char* InlineString(char* buf, uint16 string)
}
char *GetString(char *buffr, uint16 string);
-
void InjectDParam(int amount);
-
int32 GetParamInt32(void);
-int GetParamInt16(void);
-int GetParamInt8(void);
-int GetParamUint16(void);
-
uint GetCurrentCurrencyRate(void);
#endif