Пример #1
0
unsigned short mapindex_name2id(const char* name) {
	int i;
	char map_name[MAP_NAME_LENGTH];
	
	mapindex_getmapname(name, map_name);

	if( (i = strdb_iget(mapindex_db, map_name)) )
		return i;
	
	ShowDebug("mapindex_name2id: Map \"%s\" not found in index list!\n", map_name);
	return 0;
}
Пример #2
0
unsigned short mapindex_name2id(const char* name)
{
	//TODO: Perhaps use a db to speed this up? [Skotlex]
	int i;

	char map_name[MAP_NAME_LENGTH];
	mapindex_getmapname(name, map_name);

	for (i = 1; i < max_index; i++)
	{
		if (strcmpi(indexes[i].name,map_name)==0)
			return i;
	}
	ShowDebug("mapindex_name2id: Map \"%s\" not found in index list!\n", map_name);
	return 0;
}
Пример #3
0
/// Adds a map to the specified index
/// Returns 1 if successful, 0 oherwise
int mapindex_addmap (int index, const char *name)
{
	char map_name[MAP_NAME_LENGTH];

	if (index == -1)
	{
		for (index = 1; index < max_index; index++)
		{
			//if (strcmp(indexes[index].name,"#CLEARED#")==0)
			if (indexes[index].name[0] == '\0')
				break;
		}
	}

	if (index < 0 || index >= MAX_MAPINDEX)
	{
		ShowError ("(mapindex_add) Map index (%d) for \"%s\" out of range (max is %d)\n", index, name, MAX_MAPINDEX);
		return 0;
	}

	mapindex_getmapname (name, map_name);

	if (map_name[0] == '\0')
	{
		ShowError ("(mapindex_add) Cannot add maps with no name.\n");
		return 0;
	}

	if (strlen (map_name) >= MAP_NAME_LENGTH)
	{
		ShowError ("(mapindex_add) Map name %s is too long. Maps are limited to %d characters.\n", map_name, MAP_NAME_LENGTH);
		return 0;
	}

	if (mapindex_exists (index))
		ShowWarning ("(mapindex_add) Overriding index %d: map \"%s\" -> \"%s\"\n", index, indexes[index].name, map_name);

	safestrncpy (indexes[index].name, map_name, MAP_NAME_LENGTH);

	if (max_index <= index)
		max_index = index + 1;

	return index;
}
Пример #4
0
/**
 * Check default map (only triggered once by char-server)
 * @param mapname
 **/
void mapindex_check_mapdefault(const char *mapname) {
	mapname = mapindex_getmapname(mapname, NULL);
	if( !strdb_iget(mapindex_db, mapname) ) {
		ShowError("mapindex_init: Default map '%s' not found in cache! Please change in (by default in) char_athena.conf!\n", mapname);
	}
}