MCPcopy Create free account
hub / github.com/ClassiCube/ClassiCube / SPConnection_AddPart

Function SPConnection_AddPart

src/Server.c:158–180  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

156
157static char sp_lastCol;
158static void SPConnection_AddPart(const cc_string* text) {
159 cc_string tmp; char tmpBuffer[STRING_SIZE * 2];
160 char col;
161 int i;
162 String_InitArray(tmp, tmpBuffer);
163
164 /* Prepend color codes for subsequent lines of multi-line chat */
165 if (!Drawer2D_IsWhiteColor(sp_lastCol)) {
166 String_Append(&tmp, '&');
167 String_Append(&tmp, sp_lastCol);
168 }
169 String_AppendString(&tmp, text);
170
171 /* Replace all % with & */
172 for (i = 0; i < tmp.length; i++) {
173 if (tmp.buffer[i] == '%') tmp.buffer[i] = '&';
174 }
175 String_UNSAFE_TrimEnd(&tmp);
176
177 col = Drawer2D_LastColor(&tmp, tmp.length);
178 if (col) sp_lastCol = col;
179 Chat_Add(&tmp);
180}
181
182static void SPConnection_SendChat(const cc_string* text) {
183 cc_string left, part;

Callers 1

SPConnection_SendChatFunction · 0.85

Calls 6

Drawer2D_IsWhiteColorFunction · 0.85
String_AppendFunction · 0.85
String_AppendStringFunction · 0.85
String_UNSAFE_TrimEndFunction · 0.85
Drawer2D_LastColorFunction · 0.85
Chat_AddFunction · 0.85

Tested by

no test coverage detected