summaryrefslogtreecommitdiff
path: root/src/network
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-02-09 02:09:47 +0000
committerrubidium <rubidium@openttd.org>2009-02-09 02:09:47 +0000
commit8dae160d0f1065ff40ecddc518b3905820f77f7a (patch)
tree36a060def733fe274859ec2afcbf3478faf2e63c /src/network
parent861e9cefb3c31f1cab46ddb068af7a3648f45b4a (diff)
downloadopenttd-8dae160d0f1065ff40ecddc518b3905820f77f7a.tar.xz
(svn r15425) -Codechange: some color->colour changes and type safety.
Diffstat (limited to 'src/network')
-rw-r--r--src/network/network.cpp14
-rw-r--r--src/network/network_chat_gui.cpp8
-rw-r--r--src/network/network_func.h3
3 files changed, 13 insertions, 12 deletions
diff --git a/src/network/network.cpp b/src/network/network.cpp
index 99b63cf4a..02121b347 100644
--- a/src/network/network.cpp
+++ b/src/network/network.cpp
@@ -189,7 +189,7 @@ bool NetworkCompanyIsPassworded(CompanyID company_id)
// This puts a text-message to the console, or in the future, the chat-box,
// (to keep it all a bit more general)
// If 'self_send' is true, this is the client who is sending the message
-void NetworkTextMessage(NetworkAction action, ConsoleColour color, bool self_send, const char *name, const char *str, int64 data)
+void NetworkTextMessage(NetworkAction action, ConsoleColour colour, bool self_send, const char *name, const char *str, int64 data)
{
const int duration = 10; // Game days the messages stay visible
@@ -200,19 +200,19 @@ void NetworkTextMessage(NetworkAction action, ConsoleColour color, bool self_sen
if (data >= NETWORK_SERVER_MESSAGE_END) return;
strid = STR_NETWORK_SERVER_MESSAGE;
- color = CC_DEFAULT;
+ colour = CC_DEFAULT;
data = STR_NETWORK_SERVER_MESSAGE_GAME_PAUSED_PLAYERS + data;
break;
case NETWORK_ACTION_COMPANY_SPECTATOR:
- color = CC_DEFAULT;
+ colour = CC_DEFAULT;
strid = STR_NETWORK_CLIENT_COMPANY_SPECTATE;
break;
case NETWORK_ACTION_COMPANY_JOIN:
- color = CC_DEFAULT;
+ colour = CC_DEFAULT;
strid = STR_NETWORK_CLIENT_COMPANY_JOIN;
break;
case NETWORK_ACTION_COMPANY_NEW:
- color = CC_DEFAULT;
+ colour = CC_DEFAULT;
strid = STR_NETWORK_CLIENT_COMPANY_NEW;
break;
case NETWORK_ACTION_JOIN: strid = STR_NETWORK_CLIENT_JOINED; break;
@@ -231,8 +231,8 @@ void NetworkTextMessage(NetworkAction action, ConsoleColour color, bool self_sen
GetString(message, strid, lastof(message));
DEBUG(desync, 1, "msg: %d; %d; %s\n", _date, _date_fract, message);
- IConsolePrintF(color, "%s", message);
- NetworkAddChatMessage(color, duration, "%s", message);
+ IConsolePrintF(colour, "%s", message);
+ NetworkAddChatMessage((TextColour)colour, duration, "%s", message);
}
// Calculate the frame-lag of a client
diff --git a/src/network/network_chat_gui.cpp b/src/network/network_chat_gui.cpp
index a5336c126..948aa5942 100644
--- a/src/network/network_chat_gui.cpp
+++ b/src/network/network_chat_gui.cpp
@@ -32,7 +32,7 @@ enum {
struct ChatMessage {
char message[DRAW_STRING_BUFFER];
- uint16 color;
+ TextColour colour;
Date end_date;
};
@@ -64,7 +64,7 @@ static inline uint GetChatMessageCount()
* @param duration The duration of the chat message in game-days
* @param message message itself in printf() style
*/
-void CDECL NetworkAddChatMessage(uint16 color, uint8 duration, const char *message, ...)
+void CDECL NetworkAddChatMessage(TextColour colour, uint8 duration, const char *message, ...)
{
char buf[DRAW_STRING_BUFFER];
const char *bufp;
@@ -96,7 +96,7 @@ void CDECL NetworkAddChatMessage(uint16 color, uint8 duration, const char *messa
/* The default colour for a message is company colour. Replace this with
* white for any additional lines */
- cmsg->color = (bufp == buf && color & IS_PALETTE_COLOR) ? color : (0x1D - 15) | IS_PALETTE_COLOR;
+ cmsg->colour = (bufp == buf && colour & IS_PALETTE_COLOR) ? colour : (TextColour)(0x1D - 15) | IS_PALETTE_COLOR;
cmsg->end_date = _date + duration;
bufp += strlen(bufp) + 1; // jump to 'next line' in the formatted string
@@ -237,7 +237,7 @@ void NetworkDrawChatMessage()
/* Paint the chat messages starting with the lowest at the bottom */
for (uint y = NETWORK_CHAT_LINE_HEIGHT; count-- != 0; y += NETWORK_CHAT_LINE_HEIGHT) {
- DoDrawString(_chatmsg_list[count].message, _chatmsg_box.x + 3, _screen.height - _chatmsg_box.y - y + 1, _chatmsg_list[count].color);
+ DoDrawString(_chatmsg_list[count].message, _chatmsg_box.x + 3, _screen.height - _chatmsg_box.y - y + 1, _chatmsg_list[count].colour);
}
/* Make sure the data is updated next flush */
diff --git a/src/network/network_func.h b/src/network/network_func.h
index 70bc96ff0..af8f4cbd6 100644
--- a/src/network/network_func.h
+++ b/src/network/network_func.h
@@ -10,6 +10,7 @@
#include "core/address.h"
#include "network_type.h"
#include "../console_type.h"
+#include "../gfx_type.h"
extern NetworkServerGameInfo _network_game_info;
extern NetworkCompanyState *_network_company_states;
@@ -69,7 +70,7 @@ void NetworkServerSendError(ClientID client_id, NetworkErrorCode error);
void NetworkServerSendChat(NetworkAction action, DestType type, int dest, const char *msg, ClientID from_id, int64 data = 0);
void NetworkInitChatMessage();
-void CDECL NetworkAddChatMessage(uint16 color, uint8 duration, const char *message, ...);
+void CDECL NetworkAddChatMessage(TextColour colour, uint8 duration, const char *message, ...);
void NetworkUndrawChatMessage();
void NetworkChatMessageDailyLoop();