Crossfire Server, Trunk
image.cpp File Reference
#include "global.h"
#include <stdlib.h>
#include <string.h>
#include "image.h"
#include "newserver.h"
#include "shared/newclient.h"
#include "sproto.h"
#include "assets.h"
#include "AssetsManager.h"
+ Include dependency graph for image.cpp:

Go to the source code of this file.

Functions

void esrv_send_face (socket_struct *ns, const Face *face, int nocache)
 
void send_face_cmd (char *buff, int len, socket_struct *ns)
 
void send_image_info (socket_struct *ns)
 
void send_image_sums (socket_struct *ns, char *params)
 

Detailed Description

Image related communication

Date
2006-03-18

This file deals with the image related communication to the client. I've located all the functions in this file - this localizes it more, and means that we don't need to declare things like all the structures as globals.

Definition in file image.cpp.

Function Documentation

◆ esrv_send_face()

void esrv_send_face ( socket_struct ns,
const Face face,
int  nocache 
)

Sends a face to a client if they are in pixmap mode, nothing gets sent in bitmap mode. If nocache is true (nonzero), ignore the cache setting from the client - this is needed for the askface, in which we really do want to send the face (and askface is the only place that should be setting it). Otherwise, we look at the facecache, and if set, send the image name.

Parameters
nssocket to send the date to.
faceface to send.
nocacheif 1 then send a 'image2', else depending on client cache setting.

Definition at line 72 of file image.cpp.

References face_info::checksum, face_info::data, face_info::datalen, socket_struct::facecache, face_sets::faces, socket_struct::faces_sent, socket_struct::faceset, find_faceset(), get_face_fallback(), face_sets::id, llevError, LOG(), Face::name, NS_FACESENT_FACE, Face::number, Send_With_Handling(), SockList_AddChar(), SockList_AddData(), SockList_AddInt(), SockList_AddShort(), SockList_AddString(), SockList_Init(), and SockList_Term().

Referenced by add_object_to_socklist(), append_spell(), esrv_draw_look(), esrv_new_player(), esrv_send_animation(), esrv_update_item(), knowledge_process_incremental(), knowledge_send_info(), map2_add_ob(), quest_send_initial_states(), quest_set_state(), send_account_players(), send_face_cmd(), send_skill_info(), and send_smooth().

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

◆ send_face_cmd()

void send_face_cmd ( char *  buff,
int  len,
socket_struct ns 
)

Client has requested pixmap that it somehow missed getting. This will be called often if the client is caching images.

Parameters
buffdata received from the client.
lenlength of buff, ignored.
nssocket to send data to.

Definition at line 45 of file image.cpp.

References esrv_send_face(), get_face_by_id(), socket_struct::host, llevDebug, and LOG().

+ Here is the call graph for this function:

◆ send_image_info()

void send_image_info ( socket_struct ns)

Sends the number of images, checksum of the face file, and the image_info file information. See the doc/Developers/protocol if you want further detail.

Parameters
nssocket to send data to.

Definition at line 113 of file image.cpp.

References checksum(), face_sets::comment, AssetsCollection< T, Key >::each(), face_sets::extension, dragon_attune::faces, AssetsManager::facesets(), face_sets::fallback, face_sets::fullname, get_faces_count(), getManager(), face_sets::id, face_sets::prefix, Send_With_Handling(), face_sets::size, SockList_AddPrintf(), SockList_Init(), and SockList_Term().

Referenced by request_info_cmd().

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

◆ send_image_sums()

void send_image_sums ( socket_struct ns,
char *  params 
)

Sends requested face information.

Parameters
nssocket to send to
paramscontains first and last index of face

For each image in [start..stop] sends

  • checksum
  • name

Definition at line 138 of file image.cpp.

References face_info::checksum, face_sets::faces, socket_struct::faces_sent, socket_struct::faceset, find_faceset(), get_face_by_id(), get_face_fallback(), get_faces_count(), face_sets::id, llevError, LOG(), Face::name, NS_FACESENT_FACE, Face::number, roll-o-matic::params, Send_With_Handling(), SockList_AddChar(), SockList_AddInt(), SockList_AddLen8Data(), SockList_AddPrintf(), SockList_AddShort(), SockList_Avail(), SockList_Init(), SockList_Reset(), SockList_Term(), and roll-o-matic::stop().

Referenced by request_info_cmd().

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