engine/EngineServerEntity.c
/*	The entities are directly placed in the array, rather than allocated with
	ED_Alloc, because otherwise an error loading the map would have entity
	number references out of order.

	Creates a server's entity / program execution context by
	parsing textual entity definitions out of an ent file.

	Used for both fresh maps and savegame loads.  A fresh map would also need
	to call ED_CallSpawnFunctions () to let the objects initialize themselves.
*/
The entities are directly placed in the array, rather than allocated with
ED_Alloc, because otherwise an error loading the map would have entity
number references out of order.

Creates a server's entity / program execution context by
parsing textual entity definitions out of an ent file.

Used for both fresh maps and savegame loads.  A fresh map would also need
to call ED_CallSpawnFunctions () to let the objects initialize themselves.
The entities are directly placed in the array rather than allocated with ED_Alloc because otherwise an error loading the map would have entity number references out of order . Creates a server ' s entity / program execution context by parsing textual entity definitions out of an ent file . Used for both fresh maps and savegame loads . A fresh map would also need to call ED_CallSpawnFunctions () to let the objects initialize themselves .
void ED_LoadFromFile(char *data)
{
	ServerEntity_t	*eEntity = NULL;
	for(;;)
	{
		data = COM_Parse(data);
		if(!data)
			break;
		if(com_token[0] != '{')
			Sys_Error ("ED_LoadFromFile: found %s when expecting {",com_token);
		if(!eEntity)
			eEntity = EDICT_NUM(0);
		else
			eEntity = ED_Alloc();
		data = ED_ParseEdict(data,eEntity);
		if(!Game->Server_SpawnEntity(eEntity))
		{
			if(developer.value)
				Edict_Print(eEntity);
			ED_Free(eEntity);
			continue;
		}
	}
}
void ED_LoadFromFile ( char * data ) { ServerEntity_t * eEntity = NULL ; for ( ; ; ) { data = COM_Parse ( data ) ; if ( ! data ) break ; if ( com_token [ 0 ] != ' ' ) Sys_Error ( " " , com_token ) ; if ( ! eEntity ) eEntity = EDICT_NUM ( 0 ) ; else eEntity = ED_Alloc ( ) ; data = ED_ParseEdict ( data , eEntity ) ; if ( ! Game -> Server_SpawnEntity ( eEntity ) ) { if ( developer . value ) Edict_Print ( eEntity ) ; ED_Free ( eEntity ) ; continue ; } } }
The entities are directly placed in the array, rather than allocated with
ED_Alloc, because otherwise an error loading the map would have entity
number references out of order.
The entities are directly placed in the array rather than allocated with ED_Alloc because otherwise an error loading the map would have entity number references out of order .
// parse the opening brace // Immediately call spawn function