[Crossfire-wiki] [Crossfire DokuWiki] page changed: server_plugin

no-reply_wiki at metalforge.org no-reply_wiki at metalforge.org
Sat Mar 31 11:03:49 CDT 2007


A page in your DokuWiki was added or changed. Here are the details:

Date        : 2007/03/31 11:03
User        : ryo
Edit Summary: fix list

@@ -278,13 +278,10 @@
  }
  </code>
  
  where ''cfapiObject_get_key'' is the matching hook.
- 
  
  ===== Linked list handling =====
- FIXME correct when changed for other types
- 
  In some cases, objects are linked through the use of a ''next'' field, with a ''first_'' pointer somewhere (includes objects, friendly list, maps, archetypes). Since the ''next'' field will certainly be a property for the object, a convention for getting the ''first_'' item is to call this property getter with a NULL value for the object.
  
  Thus, for the ''partylist'' linked list, the server-side functions looks like (parts edited out):
  <code>
@@ -292,26 +289,34 @@
  {
  [snipped]
  
      case CFAPI_PARTY_PROP_NEXT:
+         rparty = va_arg(args, partylist**);
+         *rparty = (party ? party->next : get_firstparty());
          *type = CFAPI_PPARTY;
-         rv = (party ? party->next : get_firstparty());
          break;
  </code>
  
- and the common library's function is:
+ The common library's function for first party is:
  <code>
  partylist* cf_party_get_first(void)
  {
      int type;
-     return cfapiParty_get_property(&type, NULL, CFAPI_PARTY_PROP_NEXT);
+     partylist* value;
+     cfapiParty_get_property(&type, NULL, CFAPI_PARTY_PROP_NEXT, &value);
+     assert(type == CFAPI_PPARTY);
+     return value;
  }
  </code>
  
- whereas access to the next party is done through: FIXME fix when updated for wrapping syntax
+ whereas access to the next party is done through:
  <code>
  partylist* cf_party_get_next(partylist* party)
  {
      int type;
-     return cfapiParty_get_property(&type, party, CFAPI_PARTY_PROP_NEXT);
+     partylist* value;
+     cfapiParty_get_property(&type, party, CFAPI_PARTY_PROP_NEXT, &value);
+     assert(type == CFAPI_PPARTY);
+     return value;
  }
  </code>
+ 


IP-Address  : 82.236.87.204
Old Revision: http://wiki.metalforge.net/doku.php/server_plugin?rev=1174840411
New Revision: http://wiki.metalforge.net/doku.php/server_plugin

-- 
This mail was generated by DokuWiki at
http://wiki.metalforge.net/




More information about the crossfire-wiki mailing list