Dawn/src/file/loaders/item.h

49 lines
1.3 KiB
C

/**
* Copyright (c) 2021 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#pragma once
#include "../types/common.h"
/**
* Retreive an exisitng asset manager item by its key.
*
* @param man Manager to get from
* @param key Key to search for.
* @return The matching asset manager item, or NULL if not found.
*/
assetmanageritem_t * assetManagerItemGet(assetmanager_t *man, char *key);
/**
* Private method, simply adds an item to the manager and resets the state.
*
* @param manager Manager to add to.
* @param key Key to use when adding.
* @return The added and reset item.
*/
assetmanageritem_t * assetManagerItemAdd(assetmanager_t *manager, char *key);
/**
* Add or get the index that a given holder has as a manager item.
*
* @param i Asset Item to check.
* @param o Owner to get/add.
* @return The index within the item that the owner is at.
*/
uint8_t assetManagerItemGetOrAddHolder(
assetmanageritem_t *i, assetmanagerowner_t o
);
/**
* Checks if a given asset item is finished or not.
*
* @param item Item to check.
* @param def Item type definition used for loading.
* @return True if finished, otherwise false.
*/
bool assetManagerItemIsFinished(
assetmanageritem_t *item, assetmanagerloaderdefinition_t *def
);