Coder Social home page Coder Social logo

Comments (1)

assertivist avatar assertivist commented on July 23, 2024

This is fixed but that code still lives on. I think it is needed to divide lines up for the chat tab.

I also don't really like the stuff that goes all the way back out to GUI code to make chat lines, but actually thats how the original did it too:

void CPlayerManagerImpl::FlushMessageText(
Boolean forceAll)
{
Str255 fullLine;
short maxLen;
short baseLen;
GrafPtr savedPort;
TextSettings savedTexs;
OSErr err;
GetPort(&savedPort);
SetPort(theRoster->itsWindow);
GetSetTextSettings(&savedTexs, geneva, 0, 9, srcOr);
do
{
BlockMoveData(playerName, fullLine, playerName[0] + 1);
#if 0
while(fullLine[0] && fullLine[fullLine[0]] == 32)
{ fullLine[0]--;
}
#endif
TruncString(kChatMessageWidth/3, fullLine, smTruncEnd);
fullLine[++fullLine[0]] = ':';
fullLine[++fullLine[0]] = ' ';
baseLen = fullLine[0];
maxLen = lineBuffer[0];
if(maxLen + baseLen > 250)
{ maxLen = 250 - baseLen;
}
BlockMoveData(lineBuffer+1, fullLine + 1 + baseLen, maxLen);
fullLine[0] += maxLen;
#if 1
err = WordWrapString(fullLine);
#else
err = TruncString(kChatMessageWidth, fullLine, smTruncEnd);
#endif
if(err == 1 || forceAll)
{ short outLen;
if(err == 1)
{ outLen = fullLine[0] - baseLen - 1;
}
else
{ outLen = maxLen;
}
if(outLen != 0) theRoster->NewChatLine(fullLine);
BlockMoveData(lineBuffer + outLen + 1, lineBuffer + 1, lineBuffer[0] - outLen);
lineBuffer[0] -= outLen;
if(err == 0) forceAll = false;
}
} while(err == 1 || forceAll);
isLocalPlayer = (theNetManager->itsCommManager->myId == slot);
if(isLocalPlayer)
{ theRoster->SetChatLine(fullLine);
}
RestoreTextSettings(&savedTexs);
SetPort(savedPort);
}

additionally, i was gonna say something about making it match by renaming the function to FlushMessage but then i realized that I ALSO ignored an old function RosterKeyPress when i was making special characters show up in the roster chat! so i have no room to talk! And i'm closing this!

from avara.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.