26 auto slash = strrchr(filename.c_str(),
'/');
27 char *dup = slash ?
strdup_local(strrchr(filename.c_str(),
'/') + 1) : strdup(filename.c_str());
39 for (
size_t p = 0; p < count - 1; p++) {
44 strcat(buf, split[p]);
51 if (face->
number >= set->allocated) {
53 for (
int i = set->allocated; i <= face->number; i++) {
54 set->faces[i].
data = NULL;
55 set->faces[i].datalen = 0;
56 set->faces[i].checksum = 0;
58 set->allocated = face->
number + 1;
61 if (set->faces[face->
number].data) {
62 LOG(
llevDebug,
"replacing facedata %s by %s\n", face->
name, filename.c_str());
63 free(set->faces[face->
number].data);
67 set->faces[face->
number].data =
static_cast<uint8_t *
>(malloc(set->faces[face->
number].datalen));
68 if (!set->faces[face->
number].data) {
72 set->faces[face->
number].checksum = 0;
73 for (
size_t i = 0; i <
set->faces[face->
number].datalen; i++) {
75 set->faces[face->
number].checksum +=
set->faces[face->
number].data[i];
76 set->faces[face->
number].checksum &= 0xffffffff;
Actual image data the client will display.
T * get(const Key &name)
Get a named asset.
void LOG(LogLevel logLevel, const char *format,...)
Logs a message to stderr, or to file.
static std::vector< std::string > split(const std::string &field, const std::string &by)
New face structure - this enforces the notion that data is face by face only - you can not change the...
char * bufferreader_data(BufferReader *br)
Get the whole buffer, independently of the calls to bufferreader_next_line().
Global type definitions and header inclusions.
size_t bufferreader_data_length(BufferReader *br)
Return the length of the buffer data.
size_t split_string(char *str, char *array[], size_t array_size, char sep)
Splits a string delimited by passed in sep value into characters into an array of strings...
Image-related structures.
uint8_t * data
Image data.
uint16_t number
This is the image unique identifier.
void fatal(enum fatal_error err)
fatal() is meant to be called whenever a fatal signal is intercepted.
Compatibility implementations of useful nonstandard types and functions.
Available facesets for clients.
Only for debugging purposes.
PngLoader(Faces *faces, Facesets *facesets)
virtual void load(BufferReader *reader, const std::string &filename) override
Load assets from the specified reader.
Information about one face set.
sstring name
Face name, as used by archetypes and such.