Crossfire Server, Trunk
image.cpp File Reference
#include "global.h"
#include <assert.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "image.h"
#include "assets.h"
#include "AssetsManager.h"
+ Include dependency graph for image.cpp:

Go to the source code of this file.

Functions

void dump_faces (void)
 
uint8_t find_color (const char *name)
 
int find_smooth (const Face *face, const Face **smoothed)
 
const char * get_colorname (uint8_t index)
 
int get_face_fallback (int faceset, uint16_t imageno)
 
int is_valid_faceset (int fsn)
 

Variables

const Faceblank_face
 
static const char *const colorname []
 
const Faceempty_face
 
const Facesmooth_face
 

Detailed Description

Handles face-related stuff, including the actual face data.

Definition in file image.cpp.

Function Documentation

◆ dump_faces()

void dump_faces ( void  )

Dump all faces to stderr, for debugging purposes.

Definition at line 159 of file image.cpp.

References AssetsCollection< T, Key >::each(), AssetsManager::faces(), getManager(), Face::name, Face::number, and Face::smoothface.

Referenced by server_dump_faces().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ find_color()

uint8_t find_color ( const char *  name)

Finds a color by name.

Parameters
namecolor name, case-sensitive.
Returns
the matching color in the coloralias if found, 0 otherwise.
Note
0 will actually be black, so there is no way the calling function can tell if an error occurred or not

Definition at line 75 of file image.cpp.

References colorname, llevError, LOG(), and give::name.

Referenced by FaceLoader::load().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ find_smooth()

int find_smooth ( const Face face,
const Face **  smoothed 
)

Find the smooth face for a given face.

Parameters
facethe face to find the smoothing face for
smoothedreturn value: set to smooth face
Returns
1=smooth face found, 0=no smooth face found

Definition at line 102 of file image.cpp.

References Face::smoothface.

Referenced by send_smooth().

+ Here is the caller graph for this function:

◆ get_colorname()

const char* get_colorname ( uint8_t  index)

Definition at line 86 of file image.cpp.

References colorname, and npc_dialog::index.

Referenced by CREFacePanel::CREFacePanel(), and FaceWriter::write().

+ Here is the caller graph for this function:

◆ get_face_fallback()

int get_face_fallback ( int  faceset,
uint16_t  imageno 
)

This returns the set we will actually use when sending a face. This is used because the image files may be sparse. This function is recursive. imageno is the face number we are trying to send

If face is not found in specified faceset, tries with 'fallback' faceset.

Parameters
facesetfaceset to check
imagenoimage number

Definition at line 133 of file image.cpp.

References face_info::data, face_sets::faces, face_sets::fallback, find_faceset(), get_face_fallback(), face_sets::id, llevError, LOG(), and face_sets::prefix.

Referenced by esrv_send_face(), get_face_fallback(), process_map(), send_image_sums(), and test_faceset().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ is_valid_faceset()

int is_valid_faceset ( int  fsn)

Checks specified faceset is valid

Parameters
fsnfaceset number

Definition at line 117 of file image.cpp.

References find_faceset().

Referenced by main(), and set_up_cmd().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ blank_face

const Face* blank_face

◆ colorname

const char* const colorname[]
static
Initial value:
= {
"black",
"white",
"blue",
"red",
"orange",
"light_blue",
"dark_orange",
"green",
"light_green",
"grey",
"brown",
"yellow",
"khaki"
}

The only thing this table is used for now is to translate the colorname in the magicmap field of the face into a numeric index that is then sent to the client for magic map commands. The order of this table must match that of the NDI colors in include/newclient.h.

Definition at line 46 of file image.cpp.

Referenced by find_color(), and get_colorname().

◆ empty_face

const Face * empty_face

Definition at line 36 of file image.cpp.

Referenced by esrv_draw_look(), esrv_send_inventory(), and Faces::Faces().

◆ smooth_face

const Face * smooth_face

Definition at line 36 of file image.cpp.

Referenced by Faces::Faces(), and send_smooth().