Esempio n. 1
0
void ScreenStart(void)
{
	// Reset player datas
	PlayerDataTerminate(&gPlayerDatas);
	PlayerDataInit(&gPlayerDatas);

	debug(D_NORMAL, ">> Entering campaign\n");
	if (IsIntroNeeded(gCampaign.Entry.Mode))
	{
		if (!ScreenCampaignIntro(&gCampaign.Setting))
		{
			gCampaign.IsLoaded = false;
			return;
		}
	}

	if (gCampaign.IsClient)
	{
		debug(D_NORMAL, ">> Waiting for number of players from server\n");
		if (!ScreenWaitForRemotePlayers())
		{
			gCampaign.IsLoaded = false;
			return;
		}
	}

	debug(D_NORMAL, ">> Select number of players\n");
	if (!NumPlayersSelection(
		gCampaign.Entry.Mode, &gGraphicsDevice, &gEventHandlers))
	{
		gCampaign.IsLoaded = false;
		return;
	}

	if (gCampaign.IsClient)
	{
		debug(D_NORMAL, ">> Registering new players\n");
		if (!ScreenWaitForNewPlayers())
		{
			gCampaign.IsLoaded = false;
			return;
		}
	}

	debug(D_NORMAL, ">> Entering selection\n");
	if (!PlayerSelection())
	{
		gCampaign.IsLoaded = false;
		return;
	}

	debug(D_NORMAL, ">> Starting campaign\n");
	Campaign(&gGraphicsDevice, &gCampaign);
	CampaignUnload(&gCampaign);
}
Esempio n. 2
0
void ScreenStart(void)
{
	// Reset player datas
	PlayerDataTerminate(&gPlayerDatas);
	PlayerDataInit(&gPlayerDatas);

	// Initialise game events; we need this for init as well as the game
	GameEventsInit(&gGameEvents);

	debug(D_NORMAL, ">> Entering campaign\n");
	if (IsIntroNeeded(gCampaign.Entry.Mode))
	{
		if (!ScreenCampaignIntro(&gCampaign.Setting))
		{
			gCampaign.IsLoaded = false;
			goto bail;
		}
	}

	debug(D_NORMAL, ">> Select number of players\n");
	if (!NumPlayersSelection(
		gCampaign.Entry.Mode, &gGraphicsDevice, &gEventHandlers))
	{
		gCampaign.IsLoaded = false;
		goto bail;
	}

	debug(D_NORMAL, ">> Entering selection\n");
	if (!PlayerSelection())
	{
		gCampaign.IsLoaded = false;
		goto bail;
	}

	debug(D_NORMAL, ">> Starting campaign\n");
	Campaign(&gGraphicsDevice, &gCampaign);
	CampaignUnload(&gCampaign);
	
bail:
	NetClientDisconnect(&gNetClient);
	GameEventsTerminate(&gGameEvents);
}
Esempio n. 3
0
/** Количество действительных предложений по кампании campaign */
int count_valid_offers_by_campaign(const std::string &campaign_id)
{
    list<Offer> offers = Offers::x()->offers_by_campaign(Campaign(campaign_id));
    return count_if(offers.begin(), offers.end(), is_valid_offer);
}