/* resource.c */
/* Locates and manages resources loaded up into the current engine */

#include "gameinc.h"

/* Just a name list so the resource dump can name each section */
static char *resource_namelist[]={
"System",
"World",
"Template",
"Object",
"Handler",
"MiscItem"
};

p_LinkListHead resource_type_list[RESOURCE_NUM_TYPES];


void Init_ResourceList(void)
{
	int i;

	for (i=0;i<RESOURCE_NUM_TYPES;i++)
	{
		resource_type_list[i] = LinkList_Create();
	}
}

void Resource_Free(void)
{
}

void Resource_Dump(void)
{
}

/* FIXME to cope with the more generic case of not just finding handlers */
/* this means parsing the linklist of the resource header. */
void *Resource_Find(int number,char *identifier)
{
	void *found = NULL;
	t_Strat_Item *cstrat;
	int i=0;

	if (number == RESOURCE_TYPE_HANDLER)
	{
		do {
			cstrat = &strat_code_strats[i++];
			if (!strcmp(identifier,cstrat->identifier))
			{
				found = cstrat->callback;
			}
		} while (found == NULL && cstrat != NULL);

	}

	return found;
}
