| 70 | //========================================================================== |
| 71 | |
| 72 | void FConsoleBuffer::AddText(int printlevel, const char *text) |
| 73 | { |
| 74 | FString build = TEXTCOLOR_TAN; |
| 75 | |
| 76 | if (mAddType == REPLACELINE) |
| 77 | { |
| 78 | // Just wondering: Do we actually need this case? If so, it may need some work. |
| 79 | mConsoleText.Pop(); // remove the line to be replaced |
| 80 | mLastLineNeedsUpdate = true; |
| 81 | } |
| 82 | else if (mAddType == APPENDLINE) |
| 83 | { |
| 84 | mConsoleText.Pop(build); |
| 85 | printlevel = -1; |
| 86 | mLastLineNeedsUpdate = true; |
| 87 | } |
| 88 | |
| 89 | if (printlevel >= 0 && printlevel != PRINT_HIGH) |
| 90 | { |
| 91 | if (printlevel == 200) build = TEXTCOLOR_GREEN; |
| 92 | else if (printlevel < PRINTLEVELS) build.Format("%c%c", TEXTCOLOR_ESCAPE, PrintColors[printlevel]+'A'); |
| 93 | } |
| 94 | |
| 95 | size_t textsize = strlen(text); |
| 96 | |
| 97 | if (text[textsize-1] == '\r') |
| 98 | { |
| 99 | textsize--; |
| 100 | mAddType = REPLACELINE; |
| 101 | } |
| 102 | else if (text[textsize-1] == '\n') |
| 103 | { |
| 104 | textsize--; |
| 105 | mAddType = NEWLINE; |
| 106 | } |
| 107 | else |
| 108 | { |
| 109 | mAddType = APPENDLINE; |
| 110 | } |
| 111 | |
| 112 | // don't bother with linefeeds etc. inside the text, we'll let the formatter sort this out later. |
| 113 | build.AppendCStrPart(text, textsize); |
| 114 | mConsoleText.Push(build); |
| 115 | } |
| 116 | |
| 117 | //========================================================================== |
| 118 | // |
no test coverage detected