Engine Interface

Summary
Engine Interface
SNAP_ITEM
CLIENT_INFO
Map
Functions
map_is_loadedChecks if a map is loaded.
map_num_itemsChecks the number of items in the loaded map.
map_find_itemSearches the map for an item.
map_get_itemGets an item from the loaded map from index.
map_get_typeGets the index range of an item type.
map_get_dataFetches a pointer to a raw data chunk in the map.
map_get_data_swappedTODO
Network (Server)
Functions
snap_new_itemCreates a new item that should be sent.
snap_num_itemsCheck the number of items in a snapshot.
snap_get_itemGets an item from a snapshot.
snap_find_itemSearches a snapshot for an item.
snap_invalidate_itemMarks an item as invalid byt setting type and id to 0xffffffff.
snap_inputSets the input data to send to the server.
snap_set_staticsizeTells the engine how big a specific item always will be.
server_send_msgTODO
client_send_msgTODO
snap_new_idTODO
snap_free_idTODO
map_unload_dataTODO

SNAP_ITEM

CLIENT_INFO

Map

Summary
Functions
map_is_loadedChecks if a map is loaded.
map_num_itemsChecks the number of items in the loaded map.
map_find_itemSearches the map for an item.
map_get_itemGets an item from the loaded map from index.
map_get_typeGets the index range of an item type.
map_get_dataFetches a pointer to a raw data chunk in the map.
map_get_data_swappedTODO

Functions

map_is_loaded

int map_is_loaded()

Checks if a map is loaded.

Returns

Returns 1 if the button is pressed, otherwise 0.

map_num_items

int map_num_items()

Checks the number of items in the loaded map.

Returns

Returns the number of items.  0 if no map is loaded.

map_find_item

void *map_find_item(int type,
int id)

Searches the map for an item.

Arguments

typeItem type.
idItem ID.

Returns

Returns a pointer to the item if it exists, otherwise it returns NULL.

map_get_item

void *map_get_item(int index,
int *type,
int *id)

Gets an item from the loaded map from index.

Arguments

indexItem index.
typePointer that recives the item type (can be NULL).
idPointer that recives the item id (can be NULL).

Returns

Returns a pointer to the item if it exists, otherwise it returns NULL.

map_get_type

void map_get_type(int type,
int *start,
int *num)

Gets the index range of an item type.

Arguments

typeItem type to search for.
startPointer that recives the starting index.
numPointer that recives the number of items.

Returns

If the item type is not in the map, start and num will be set to 0.

map_get_data

void *map_get_data(int index)

Fetches a pointer to a raw data chunk in the map.

Arguments

indexIndex to the data to fetch.

Returns

A pointer to the raw data, otherwise 0.

map_get_data_swapped

void *map_get_data_swapped(int index)

TODO

Arguments

arg1desc

Returns

See Also

<other_func>

Network (Server)

Summary
Functions
snap_new_itemCreates a new item that should be sent.
snap_num_itemsCheck the number of items in a snapshot.
snap_get_itemGets an item from a snapshot.
snap_find_itemSearches a snapshot for an item.
snap_invalidate_itemMarks an item as invalid byt setting type and id to 0xffffffff.
snap_inputSets the input data to send to the server.
snap_set_staticsizeTells the engine how big a specific item always will be.
server_send_msgTODO
client_send_msgTODO
snap_new_idTODO
snap_free_idTODO
map_unload_dataTODO

Functions

snap_new_item

void *snap_new_item(int type,
int id,
int size)

Creates a new item that should be sent.

Arguments

typeType of the item.
idID of the item.
sizeSize of the item.

Returns

A pointer to the item data, otherwise 0.

Remarks

The item data should only consist pf 4 byte integers as they are subject to byte swapping.  This means that the size argument should be dividable by 4.

snap_num_items

int snap_num_items(int snapid)

Check the number of items in a snapshot.

Arguments

snapidSnapshot ID to the data to fetch.
  • SNAP_PREV for previous snapshot.
  • SNAP_CUR for current snapshot.

Returns

The number of items in the snapshot.

snap_get_item

void *snap_get_item(int snapid,
int index,
SNAP_ITEM *item)

Gets an item from a snapshot.

Arguments

snapidSnapshot ID to the data to fetch.
  • SNAP_PREV for previous snapshot.
  • SNAP_CUR for current snapshot.
indexIndex of the item.
itemPointer that recives the item info.

Returns

Returns a pointer to the item if it exists, otherwise NULL.

snap_find_item

void *snap_find_item(int snapid,
int type,
int id)

Searches a snapshot for an item.

Arguments

snapidSnapshot ID to the data to fetch.
  • SNAP_PREV for previous snapshot.
  • SNAP_CUR for current snapshot.
typeType of the item.
idID of the item.

Returns

Returns a pointer to the item if it exists, otherwise NULL.

snap_invalidate_item

void snap_invalidate_item(int snapid,
int index)

Marks an item as invalid byt setting type and id to 0xffffffff.

Arguments

snapidSnapshot ID to the data to fetch.
  • SNAP_PREV for previous snapshot.
  • SNAP_CUR for current snapshot.
indexIndex of the item.

snap_input

void snap_input(void *data,
int size)

Sets the input data to send to the server.

Arguments

dataPointer to the data.
sizeSize of the data.

Remarks

The data should only consist of 4 bytes integer as they are subject to byte swapping.

snap_set_staticsize

void snap_set_staticsize(int type,
int size)

Tells the engine how big a specific item always will be.  This helps the engine to compress snapshots better.

Arguments

typeItem type
sizeSize of the data.

Remarks

Size must be in a multiple of 4.

server_send_msg

int server_send_msg(int client_id)

TODO

Arguments

arg1desc

Returns

See Also

<other_func>

client_send_msg

int client_send_msg()

TODO

Arguments

arg1desc

Returns

See Also

<other_func>

snap_new_id

int snap_new_id()

TODO

Arguments

arg1desc

Returns

See Also

<other_func>

snap_free_id

void snap_free_id(int id)

TODO

Arguments

arg1desc

Returns

See Also

<other_func>

map_unload_data

void map_unload_data(int index)

TODO

Arguments

arg1desc

Returns

See Also

<other_func>

int map_is_loaded()
Checks if a map is loaded.
int map_num_items()
Checks the number of items in the loaded map.
void *map_find_item(int type,
int id)
Searches the map for an item.
void *map_get_item(int index,
int *type,
int *id)
Gets an item from the loaded map from index.
void map_get_type(int type,
int *start,
int *num)
Gets the index range of an item type.
void *map_get_data(int index)
Fetches a pointer to a raw data chunk in the map.
void *map_get_data_swapped(int index)
TODO
void *snap_new_item(int type,
int id,
int size)
Creates a new item that should be sent.
int snap_num_items(int snapid)
Check the number of items in a snapshot.
void *snap_get_item(int snapid,
int index,
SNAP_ITEM *item)
Gets an item from a snapshot.
void *snap_find_item(int snapid,
int type,
int id)
Searches a snapshot for an item.
void snap_invalidate_item(int snapid,
int index)
Marks an item as invalid byt setting type and id to 0xffffffff.
void snap_input(void *data,
int size)
Sets the input data to send to the server.
void snap_set_staticsize(int type,
int size)
Tells the engine how big a specific item always will be.
int server_send_msg(int client_id)
TODO
int client_send_msg()
TODO
int snap_new_id()
TODO
void snap_free_id(int id)
TODO
void map_unload_data(int index)
TODO
Close