Fixed bug 561203: Who is speaking in 3 player game.

Text wraps if it is too wide.
This commit is contained in:
jsalmon3 2002-05-28 00:18:50 +00:00
parent 5478400061
commit 5f0a109568
2 changed files with 23 additions and 4 deletions

View file

@ -69,7 +69,7 @@ local int SavedMapPositionX[4]; /// Saved map position X
local int SavedMapPositionY[4]; /// Saved map position Y
local char Input[80]; /// line input for messages/long commands
local int InputIndex; /// current index into input
local char InputStatusLine[80]; /// Last input status line
local char InputStatusLine[99]; /// Last input status line
global char GameRunning; /// Current running state
global char GamePaused; /// Current pause state
global char OrdersDuringPause; /// Allow giving orders in pause mode.
@ -864,6 +864,8 @@ local int CommandKey(int key)
*/
local int InputKey(int key)
{
char ChatMessage[sizeof(Input)+40];
switch (key) {
case '\r':
if (Input[0] == '(') {
@ -953,7 +955,8 @@ local int InputKey(int key)
// FIXME: only to selected players ...
}
}
NetworkChatMessage(Input);
sprintf(ChatMessage, "<%s> %s", ThisPlayer->Name, Input);
NetworkChatMessage(ChatMessage);
case '\033':
ClearStatusLine();

View file

@ -708,12 +708,28 @@ global void DrawMessage(void)
*/
local void AddMessage(const char *msg)
{
char *ptr;
char *message;
if (MessagesCount == MESSAGES_MAX) {
ShiftMessages();
}
DebugCheck(strlen(msg) >= sizeof(Messages[0]));
strcpy(Messages[MessagesCount], msg);
message = Messages[MessagesCount];
strncpy(message, msg, sizeof(Messages[0])-1);
message[sizeof(Messages[0])-1] = '\0';
ptr = message + strlen(message);
while (VideoTextLength(GameFont, message) >= 440+(VideoWidth-640)/2 ) {
*--ptr = '\0';
}
MessagesCount++;
if (strlen(msg) != ptr-message) {
AddMessage(msg+(ptr-message));
}
}
/**