summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortron <tron@openttd.org>2005-02-06 20:53:31 +0000
committertron <tron@openttd.org>2005-02-06 20:53:31 +0000
commit27dc506a0313993c8e7dc4acf77da9649d362a58 (patch)
tree4d728c3b9f36fe992992338e2532a9f937559204
parentcc8fc19d4a1caab042a1b545f37eead2ff62f5ff (diff)
downloadopenttd-27dc506a0313993c8e7dc4acf77da9649d362a58.tar.xz
(svn r1832) Next byte -> char iteration: custom names
-rw-r--r--engine.c2
-rw-r--r--functions.h4
-rw-r--r--misc.c14
-rw-r--r--misc_cmd.c4
-rw-r--r--network_gui.c10
-rw-r--r--oldloader.c2
-rw-r--r--rail_cmd.c2
-rw-r--r--signs.c2
-rw-r--r--station_cmd.c2
-rw-r--r--town_cmd.c2
-rw-r--r--vehicle.c2
11 files changed, 23 insertions, 23 deletions
diff --git a/engine.c b/engine.c
index 2e8d3130e..8b5980bf7 100644
--- a/engine.c
+++ b/engine.c
@@ -816,7 +816,7 @@ int32 CmdRenameEngine(int x, int y, uint32 flags, uint32 p1, uint32 p2)
{
StringID str;
- str = AllocateNameUnique((byte*)_decode_parameters, 0);
+ str = AllocateNameUnique((const char*)_decode_parameters, 0);
if (str == 0)
return CMD_ERROR;
diff --git a/functions.h b/functions.h
index 164c5f634..44be4f8c4 100644
--- a/functions.h
+++ b/functions.h
@@ -159,13 +159,13 @@ void InitializeLandscapeVariables(bool only_constants);
/* misc.c */
void DeleteName(StringID id);
-byte *GetName(int id, byte *buff);
+char *GetName(int id, char *buff);
// AllocateNameUnique also tests if the name used is not used anywere else
// and if it is used, it returns an error.
#define AllocateNameUnique(name, skip) RealAllocateName(name, skip, true)
#define AllocateName(name, skip) RealAllocateName(name, skip, false)
-StringID RealAllocateName(const byte *name, byte skip, bool check_double);
+StringID RealAllocateName(const char *name, byte skip, bool check_double);
void ConvertDayToYMD(YearMonthDay *ymd, uint16 date);
uint ConvertYMDToDay(uint year, uint month, uint day);
uint ConvertIntDate(uint date);
diff --git a/misc.c b/misc.c
index c01122833..df9436549 100644
--- a/misc.c
+++ b/misc.c
@@ -15,7 +15,7 @@
extern void StartupEconomy(void);
extern void InitNewsItemStructs(void);
-byte _name_array[512][32];
+char _name_array[512][32];
static inline uint32 ROR(uint32 x, int n)
{
@@ -306,9 +306,9 @@ void DeleteName(StringID id)
}
}
-byte *GetName(int id, byte *buff)
+char *GetName(int id, char *buff)
{
- byte *b;
+ const char *b;
if (id & 0x600) {
if (id & 0x200) {
@@ -341,11 +341,11 @@ static void InitializeNameMgr(void)
memset(_name_array, 0, sizeof(_name_array));
}
-StringID RealAllocateName(const byte *name, byte skip, bool check_double)
+StringID RealAllocateName(const char *name, byte skip, bool check_double)
{
int free_item = -1;
- const byte *names;
- byte *dst;
+ const char *names;
+ char *dst;
int i;
names = &_name_array[0][0];
@@ -744,7 +744,7 @@ void bubblesort(void *base, size_t nmemb, size_t size, int(*compar)(const void *
static void Save_NAME(void)
{
int i;
- byte *b = _name_array[0];
+ char *b = _name_array[0];
for(i=0; i!=lengthof(_name_array); i++,b+=sizeof(_name_array[0])) {
if (*b) {
diff --git a/misc_cmd.c b/misc_cmd.c
index 2c83d1f70..d45a6978c 100644
--- a/misc_cmd.c
+++ b/misc_cmd.c
@@ -126,7 +126,7 @@ int32 CmdChangeCompanyName(int x, int y, uint32 flags, uint32 p1, uint32 p2)
StringID str,old_str;
Player *p;
- str = AllocateNameUnique((byte*)_decode_parameters, 4);
+ str = AllocateNameUnique((const char*)_decode_parameters, 4);
if (str == 0)
return CMD_ERROR;
@@ -148,7 +148,7 @@ int32 CmdChangePresidentName(int x, int y, uint32 flags, uint32 p1, uint32 p2)
StringID str,old_str;
Player *p;
- str = AllocateNameUnique((byte*)_decode_parameters, 4);
+ str = AllocateNameUnique((const char*)_decode_parameters, 4);
if (str == 0)
return CMD_ERROR;
diff --git a/network_gui.c b/network_gui.c
index d12088d7a..3cf00a1ea 100644
--- a/network_gui.c
+++ b/network_gui.c
@@ -275,22 +275,22 @@ static void NetworkGameWindowWndProc(Window *w, WindowEvent *e)
DeleteName(_str_server_version);
DeleteName(_str_server_address);
if (_selected_item->info.server_name[0] != '\0')
- _str_game_name = AllocateName((byte*) _selected_item->info.server_name, 0);
+ _str_game_name = AllocateName(_selected_item->info.server_name, 0);
else
_str_game_name = STR_EMPTY;
if (_selected_item->info.map_name[0] != '\0')
- _str_map_name = AllocateName((byte*) _selected_item->info.map_name, 0);
+ _str_map_name = AllocateName(_selected_item->info.map_name, 0);
else
_str_map_name = STR_EMPTY;
if (_selected_item->info.server_revision[0] != '\0')
- _str_server_version = AllocateName((byte*) _selected_item->info.server_revision, 0);
+ _str_server_version = AllocateName(_selected_item->info.server_revision, 0);
else
_str_server_version = STR_EMPTY;
if (_selected_item->info.hostname[0] != '\0')
- _str_server_address = AllocateName((byte*) _selected_item->info.hostname, 0);
+ _str_server_address = AllocateName(_selected_item->info.hostname, 0);
else
_str_server_address = STR_EMPTY;
}
@@ -303,7 +303,7 @@ static void NetworkGameWindowWndProc(Window *w, WindowEvent *e)
}
break;
case 12: { // Add a server
- StringID str = AllocateName((byte*)_network_default_ip, 0);
+ StringID str = AllocateName(_network_default_ip, 0);
ShowQueryString(
str,
diff --git a/oldloader.c b/oldloader.c
index 0a32cd2af..c0d23b5a8 100644
--- a/oldloader.c
+++ b/oldloader.c
@@ -462,7 +462,7 @@ static void FixOldVehicles(void)
#define REMAP_ORDER_IDX(x) ((x) - (0x045AB08 - 0x0458EF0)) / 2
extern TileIndex _animated_tile_list[256];
-extern byte _name_array[512][32];
+extern char _name_array[512][32];
extern uint16 _custom_sprites_base;
static byte _old_vehicle_multipler;
diff --git a/rail_cmd.c b/rail_cmd.c
index 7de16d0fb..c4d8a2e37 100644
--- a/rail_cmd.c
+++ b/rail_cmd.c
@@ -840,7 +840,7 @@ int32 CmdRenameWaypoint(int x, int y, uint32 flags, uint32 p1, uint32 p2)
StringID str;
if (_decode_parameters[0] != 0) {
- str = AllocateNameUnique((byte*)_decode_parameters, 0);
+ str = AllocateNameUnique((const char*)_decode_parameters, 0);
if (str == 0) return CMD_ERROR;
if (flags & DC_EXEC) {
diff --git a/signs.c b/signs.c
index 267a254f5..355351621 100644
--- a/signs.c
+++ b/signs.c
@@ -132,7 +132,7 @@ int32 CmdRenameSign(int x, int y, uint32 flags, uint32 sign_id, uint32 owner)
/* If GetDParam(0) == nothing, we delete the sign */
if (GetDParam(0) != 0 && owner != OWNER_NONE) {
/* Create the name */
- str = AllocateName((byte*)_decode_parameters, 0);
+ str = AllocateName((const char*)_decode_parameters, 0);
if (str == 0)
return CMD_ERROR;
diff --git a/station_cmd.c b/station_cmd.c
index 67457728d..f31634d78 100644
--- a/station_cmd.c
+++ b/station_cmd.c
@@ -2652,7 +2652,7 @@ int32 CmdRenameStation(int x, int y, uint32 flags, uint32 p1, uint32 p2)
StringID str,old_str;
Station *st;
- str = AllocateNameUnique((byte*)_decode_parameters, 6);
+ str = AllocateNameUnique((const char*)_decode_parameters, 6);
if (str == 0)
return CMD_ERROR;
diff --git a/town_cmd.c b/town_cmd.c
index 0c7a16756..b0c05b629 100644
--- a/town_cmd.c
+++ b/town_cmd.c
@@ -1395,7 +1395,7 @@ int32 CmdRenameTown(int x, int y, uint32 flags, uint32 p1, uint32 p2)
StringID str;
Town *t = GetTown(p1);
- str = AllocateNameUnique((byte*)_decode_parameters, 4);
+ str = AllocateNameUnique((const char*)_decode_parameters, 4);
if (str == 0)
return CMD_ERROR;
diff --git a/vehicle.c b/vehicle.c
index 991f6e6dd..f0f875b79 100644
--- a/vehicle.c
+++ b/vehicle.c
@@ -1612,7 +1612,7 @@ int32 CmdNameVehicle(int x, int y, uint32 flags, uint32 p1, uint32 p2)
if (!CheckOwnership(v->owner))
return CMD_ERROR;
- str = AllocateNameUnique((byte*)_decode_parameters, 2);
+ str = AllocateNameUnique((const char*)_decode_parameters, 2);
if (str == 0)
return CMD_ERROR;