git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@1472 e016b1c5-ed68-44aa-a2f7-31cac88cffde
31 lines
850 B
C
31 lines
850 B
C
struct cline { char *cref; int millis; };
|
|
|
|
struct consolebuffer
|
|
{
|
|
vector<cline> conlines;
|
|
|
|
void addline(const char *sf, bool highlight, int millis) // add a line to the console buffer
|
|
{
|
|
cline cl;
|
|
cl.cref = conlines.length()>100 ? conlines.pop().cref : newstringbuf(""); // constrain the buffer size
|
|
cl.millis = millis; // for how long to keep line on screen
|
|
conlines.insert(0,cl);
|
|
if(highlight) // show line in a different colour, for chat etc.
|
|
{
|
|
cl.cref[0] = '\f';
|
|
cl.cref[1] = '0';
|
|
cl.cref[2] = 0;
|
|
s_strcat(cl.cref, sf);
|
|
}
|
|
else
|
|
{
|
|
s_strcpy(cl.cref, sf);
|
|
}
|
|
}
|
|
|
|
virtual ~consolebuffer() {}
|
|
|
|
virtual void render() = 0;
|
|
};
|
|
|