mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-08-19 12:39:11 +00:00
(svn r15425) -Codechange: some color->colour changes and type safety.
This commit is contained in:
@@ -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
|
||||
|
@@ -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 */
|
||||
|
@@ -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();
|
||||
|
||||
|
Reference in New Issue
Block a user