Aw world attribute set
Minimum requirements | ||
---|---|---|
Added in version 3.1 | ||
SDK | build 18 |
int aw_world_attribute_set (int attribute, char *value)
Description
Sets the value of an individual world attribute.
Callback
None (returns immediately)
Notes
This method was added to make the implementation of a "remote atload" utility easier and is of limited use to the general SDK programmer. In particular, meaningful values for the attribute argument correspond only to entries in a world server attribute dump file and are not otherwise documented; they do not correspond to the various AW_WORLD_ attributes defined within the SDK.
SDK applications that wish to change specific world attributes should continue to do so by using the aw_int_set, aw_bool_set, aw_float_set, and aw_string_set routines followed by a call to aw_world_attributes_change.
This method only changes the local value of the world attribute (i.e. within the SDK.) To change the value for everyone, aw_world_attributes_change must be called.
Arguments
- attribute
- Attribute id.
- value
- Attribute value. If set to NULL then the attribute will be set to 0, 0.0, false, or "" depending on its type.
Attribute arguments
None
Return values
Returned attributes
None
Usage
Simplistic remote atload utility.
FILE *fp; int rc; int id; char string[4096]; aw_world_attributes_reset (); fp = fopen ("atdump.txt", "r"); if (fp == NULL) { printf ("Unable to open atdump.txt\n"); return; } for (;;) { rc = fscanf (fp, "%d%[^\n]", &id, string); if (rc == EOF) break; if (rc != 2) { printf ("Unable to load attributes: invalid format"); fclose (fp); return; } /* string + 1 skips the space delimiter */ rc = aw_world_attribute_set (id, string + 1); if (rc != RC_SUCCESS) { printf ("Unable to set attribute (reason %d)", rc); fclose (fp); return; } } fclose (fp); rc = aw_world_attributes_change (); if (rc != RC_SUCCESS)) printf ("Unable to load attributes (reason %d)", rc); else printf ("Attribute load complete");