project_files/frontlib/model/weapon.h
changeset 7320 e704706008d4
parent 7314 6171f0bad318
child 7482 d70a5b0d1190
equal deleted inserted replaced
7318:a446eafcddeb 7320:e704706008d4
    36 	char delay[WEAPONS_COUNT+1];
    36 	char delay[WEAPONS_COUNT+1];
    37 	char *name;
    37 	char *name;
    38 } flib_weaponset;
    38 } flib_weaponset;
    39 
    39 
    40 typedef struct {
    40 typedef struct {
    41 	int _referenceCount;
       
    42 	int weaponsetCount;
    41 	int weaponsetCount;
    43 	flib_weaponset **weaponsets;
    42 	flib_weaponset **weaponsets;
    44 } flib_weaponsetlist;
    43 } flib_weaponsetlist;
    45 
    44 
    46 /**
    45 /**
    87  * Create an empty weaponset list. Returns NULL on error.
    86  * Create an empty weaponset list. Returns NULL on error.
    88  */
    87  */
    89 flib_weaponsetlist *flib_weaponsetlist_create();
    88 flib_weaponsetlist *flib_weaponsetlist_create();
    90 
    89 
    91 /**
    90 /**
       
    91  * Release all memory associated with the weaponsetlist and release all contained weaponsets
       
    92  */
       
    93 void flib_weaponsetlist_destroy(flib_weaponsetlist *list);
       
    94 
       
    95 /**
    92  * Insert a new weaponset into the list at position pos, moving all higher weaponsets to make place.
    96  * Insert a new weaponset into the list at position pos, moving all higher weaponsets to make place.
    93  * pos must be at least 0 (insert at the start) and at most list->weaponsetCount (insert at the end).
    97  * pos must be at least 0 (insert at the start) and at most list->weaponsetCount (insert at the end).
    94  * The weaponset is retained automatically.
    98  * The weaponset is retained automatically.
    95  * Returns 0 on success.
    99  * Returns 0 on success.
    96  */
   100  */
   101  * The weaponset is released automatically.
   105  * The weaponset is released automatically.
   102  * Returns 0 on success.
   106  * Returns 0 on success.
   103  */
   107  */
   104 int flib_weaponsetlist_delete(flib_weaponsetlist *list, int pos);
   108 int flib_weaponsetlist_delete(flib_weaponsetlist *list, int pos);
   105 
   109 
   106 /**
       
   107  * Increase the reference count of the object. Call this if you store a pointer to it somewhere.
       
   108  * Returns the parameter.
       
   109  */
       
   110 flib_weaponsetlist *flib_weaponsetlist_retain(flib_weaponsetlist *list);
       
   111 
       
   112 /**
       
   113  * Decrease the reference count of the object and free it if this was the last reference.
       
   114  */
       
   115 void flib_weaponsetlist_release(flib_weaponsetlist *list);
       
   116 
       
   117 #endif
   110 #endif