AW CELL SIZE

From ActiveWiki
Revision as of 14:34, 31 October 2008 by Macavity (talk | contribs) (More elaborate example)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search


Minimum requirements
Added in version 2.1
SDKbuild 13


AW_CELL_SIZE

Type

Integer (read only)

Description

Size in bytes of the entire cell update packet.

Notes

This attribute is provided for informational purposes only; it is not required for querying or changing property. A possible use of AW_CELL_SIZE could be for printing a status message to the user describing the amount of data received from the server. It is not the same as cell data size which relates to the world's current cell data limit.

For a complete description of examining and manipulating property, see Property.

Usage

List the amount of network traffic for some nearby cells.

int cell_data;

void handle_cell_begin (void)
{
  printf ("%d bytes received for cell (%d, %d)\n", 
          aw_int (AW_CELL_SIZE),
          aw_int (AW_CELL_X),
          aw_int (AW_CELL_Z));
  
  cell_data = 0;
}

void handle_cell_object (void)
{
  int v4data_len = 0;
  
  if (aw_int (AW_OBJECT_TYPE) != AW_OBJECT_TYPE_V3)
    aw_data (AW_OBJECT_DATA, &v4data_len);
  
  cell_data = cell_data
              + 32
              + strlen (aw_string (AW_OBJECT_MODEL))
              + strlen (aw_string (AW_OBJECT_DESCRIPTION))
              + strlen (aw_string (AW_OBJECT_ACTION))
              + v4data_len;
}

void handle_cell_end (void)
{
  printf ("%d bytes of data in cell (%d, %d)\n", 
          cell_data,
          aw_int (AW_CELL_X),
          aw_int (AW_CELL_Z));
}

aw_event_set (AW_EVENT_CELL_BEGIN, handle_cell_begin);
aw_event_set (AW_EVENT_CELL_OBJECT, handle_cell_object);
aw_event_set (AW_EVENT_CELL_END, handle_cell_end);
aw_query (0, 0, sequence);

Used by

See also