Aw object delete
Minimum requirements | ||
---|---|---|
Added in version 2.1 | ||
SDK | build 13 |
int aw_object_delete (void)
Description
Deletes an object.
Callback
Notes
The object to be deleted can be specified in two ways. This is the old method for doing it:
- AW_OBJECT_X is set to x coordinate of object (in cm's).
- AW_OBJECT_Z is set to z coordinate of object (in cm's).
- AW_OBJECT_NUMBER is set to object number (which is only unique to all objects within the same cell).
- AW_OBJECT_ID is set to 0.
There is also new method which was introduced in version 4.1:
- AW_OBJECT_X is not used.
- AW_OBJECT_Z is not used.
- AW_OBJECT_NUMBER is set to 0.
- AW_OBJECT_ID is set to the object id (which is unique to all objects within the world).
If the callback AW_CALLBACK_OBJECT_RESULT is installed then AW_OBJECT_NUMBER and AW_OBJECT_ID will be set during the callback to indicate which object the callback is for. This can be useful in applications that issue multiple asynchronous building requests.
It is possible to tell which call to a method an AW_CALLBACK_OBJECT_RESULT is for. This is done by setting AW_OBJECT_CALLBACK_REFERENCE before calling it. The attribute will be set to the specified value when the call completes (only useful within the callback).
Arguments
None
Argument attributes
Return values
- RC_SUCCESS (1) (2)
- RC_NOT_INITIALIZED (1)
- RC_NO_INSTANCE (1)
- RC_NO_CONNECTION (1)
- The connection to the world is down.
- RC_UNAUTHORIZED (2)
- Only world server administration instances or those with build capability (i.e. aw_bool (AW_WORLD_BUILD_CAPABILITY) returns 1) may use this method.
- RC_RESTRICTED_AREA (2)
- RC_NO_SUCH_OBJECT (2)
- RC_ENCROACHES (2)
- RC_NOT_DELETE_OWNER (2)
- Only world server administration instances or those with eminent domain capability (i.e. aw_bool (AW_WORLD_EMINENT_DOMAIN_CAPABILITY) returns 1) may delete an object owned by someone else.
- RC_RESTRICTED_OBJECT (2)
- RC_UNABLE_TO_SET_SEQUENCE (2)
- Unable to increment sequence number of the sector.
(1) Possible return values when a callback is installed.
(2) Returned by the world server.
Returned attributes
(1) Added in SDK build 70.
Usage
/* reference by cell coordinates and object number */ void delete_object (int x, int z, int number) { int rc; aw_int_set (AW_OBJECT_ID, 0); aw_int_set (AW_OBJECT_NUMBER, number); aw_int_set (AW_OBJECT_X, x); aw_int_set (AW_OBJECT_Z, z); rc = aw_object_delete (); if (rc != RC_SUCCESS) printf ("Unable to delete object (reason %d)\n", rc); else puts ("Object deleted"); } /* reference by object id */ void delete_object (int id) { int rc; aw_int_set (AW_OBJECT_ID, id); aw_int_set (AW_OBJECT_NUMBER, 0); aw_int_set (AW_OBJECT_X, 0); aw_int_set (AW_OBJECT_Z, 0); rc = aw_object_delete (); if (rc != RC_SUCCESS) printf ("Unable to delete object (reason %d)\n", rc); else puts ("Object deleted"); }