Beispiel #1
0
void GAME_SetMode (const cgame_export_t *gametype)
{
	const cgame_export_t *list;

	if (cls.gametype == gametype)
		return;

	list = GAME_GetCurrentType();
	if (list) {
		Com_Printf("Shutdown gametype '%s'\n", list->name);
		list->Shutdown();

		/* we dont need to go back to "main" stack if we are already on this stack */
		if (!UI_IsWindowOnStack("main"))
			UI_InitStack("main", "", qtrue, qtrue);
	}

	cls.gametype = gametype;

	CL_Disconnect();

	list = GAME_GetCurrentType();
	if (list) {
		Com_Printf("Change gametype to '%s'\n", list->name);
		/* inventory structure switched/initialized */
		INV_DestroyInventory(&cls.i);
		INV_InitInventory(list->name, &cls.i, &csi, &inventoryImport);
		/** @todo this should be in GetCGameAPI */
		list->Init(NULL);
	}
}
Beispiel #2
0
static qboolean GAME_Spawn (void)
{
	const size_t size = GAME_GetCharacterArraySize();
	int i;

	/* If there is no active gametype we create a team with default values.
	 * This is e.g. the case when someone starts a map with the map command */
	if (GAME_GetCurrentType() == NULL || chrDisplayList.num == 0) {
		const char *teamDefID = GAME_GetTeamDef();
		const equipDef_t *ed = INV_GetEquipmentDefinitionByID("multiplayer_initial");

		/* inventory structure switched/initialized */
		INV_DestroyInventory(&cls.i);
		INV_InitInventory("client", &cls.i, &csi, &inventoryImport);
		GAME_GenerateTeam(teamDefID, ed, size);
	}

	for (i = 0; i < size; i++)
		cl.chrList.chr[i] = chrDisplayList.chr[i];
	cl.chrList.num = chrDisplayList.num;

	return qtrue;
}
Beispiel #3
0
static inline void ResetInventoryList (void)
{
	INV_DestroyInventory(&i);
	INV_InitInventory("test", &i, &csi, &inventoryImport);
}
Beispiel #4
0
static inline void ResetInventoryList (void)
{
	INV_DestroyInventory(&cls.i);
	INV_InitInventory("testCampaign", &cls.i, &csi, &inventoryImport);
}