remove String_StripCols from public API

This commit is contained in:
UnknownShadow200 2020-04-29 11:44:33 +10:00
parent 556134290b
commit 3c6d837088
4 changed files with 11 additions and 13 deletions

View File

@ -723,7 +723,7 @@ void Font_Free(struct FontDesc* desc) {
void SysFonts_Register(const String* path) { }
static int Font_SysTextWidth(struct DrawTextArgs* args) { return 0; }
static void Font_SysTextDraw(struct DrawTextArgs* args, Bitmap* bmp, int x, int y, cc_bool shadow) { return 0; }
static void Font_SysTextDraw(struct DrawTextArgs* args, Bitmap* bmp, int x, int y, cc_bool shadow) { }
#else
#include "freetype/ft2build.h"
#include "freetype/freetype.h"

View File

@ -134,6 +134,15 @@ static void AddTablistEntry(EntityID id, const String* playerName, const String*
TabList_Set(id, &rawName, listName, groupName, groupRank);
}
static void StripCols(String* str) {
int i;
for (i = str->length - 1; i >= 0; i--) {
if (str->buffer[i] != '&') continue;
/* Remove the & and the colour code following it */
String_DeleteAt(str, i); String_DeleteAt(str, i);
}
}
static void CheckName(EntityID id, String* name, String* skin) {
String colorlessName; char colorlessBuffer[STRING_SIZE];
@ -147,7 +156,7 @@ static void CheckName(EntityID id, String* name, String* skin) {
if (!skin->length) String_Copy(skin, name);
RemoveEndPlus(skin);
String_StripCols(skin);
StripCols(skin);
}
static void Classic_ReadAbsoluteLocation(cc_uint8* data, EntityID id, cc_bool interpolate);

View File

@ -27,15 +27,6 @@ String String_FromReadonly(STRING_REF const char* buffer) {
}
void String_StripCols(String* str) {
int i;
for (i = str->length - 1; i >= 0; i--) {
if (str->buffer[i] != '&') continue;
/* Remove the & and the colour code following it */
String_DeleteAt(str, i); String_DeleteAt(str, i);
}
}
void String_Copy(String* dst, const String* src) {
dst->length = 0;
String_AppendString(dst, src);

View File

@ -49,8 +49,6 @@ CC_NOINLINE String String_FromReadonly(STRING_REF const char* buffer);
/* Initialises a string from a compile time array. (leaving 1 byte of room for null terminator) */
#define String_InitArray_NT(str, buffr) str.buffer = buffr; str.length = 0; str.capacity = sizeof(buffr) - 1;
/* Removes all colour codes from the given string. */
CC_API void String_StripCols(String* str);
/* Sets length of dst to 0, then appends all characters in src. */
CC_API void String_Copy(String* dst, const String* src);
/* Copies up to capacity characters from src into dst. Appends \0 after if src->length is < capacity. */