MCPcopy Create free account
hub / github.com/Meridian59/Meridian59 / ExtractObjectList

Function ExtractObjectList

clientd3d/server.c:414–437  ·  view source on GitHub ↗

/ * ExtractObjectList: Get a list of objects from ptr, allocate space * for the objects, and return the list. * Len should be the remaining bytes at the beginning of the list, * and the list should be the last component of the message. * Return LIST_ERROR on error. */

Source from the content-addressed store, hash-verified

412 * Return LIST_ERROR on error.
413 */
414list_type ExtractObjectList(char **ptr, long len)
415{
416 WORD list_len, i;
417 char *start;
418 list_type list = NULL;
419
420 if (len < SIZE_LIST_LEN)
421 return LIST_ERROR;
422 len -= SIZE_LIST_LEN;
423
424 Extract(ptr, &list_len, SIZE_LIST_LEN);
425
426 start = *ptr;
427
428 for (i=0; i < list_len; i++)
429 list = list_add_item(list, ExtractNewObject(ptr));
430 len -= (*ptr - start);
431 if (len != 0)
432 {
433 ObjectListDestroy(list);
434 return LIST_ERROR;
435 }
436 return list;
437}
438/********************************************************************/
439/*
440 * ExtractNewBackgroundOverlay: Allocate a new background overlay,

Callers 6

HandleObjectContentsFunction · 0.85
HandleInventoryFunction · 0.85
HandleOfferFunction · 0.85
HandleOfferedFunction · 0.85
HandleCounterofferedFunction · 0.85
HandleCounterofferFunction · 0.85

Calls 4

ExtractFunction · 0.85
ExtractNewObjectFunction · 0.85
ObjectListDestroyFunction · 0.85
list_add_itemFunction · 0.70

Tested by

no test coverage detected