Esempio n. 1
0
static RESULT cmd_load(const char** argv, int argc, GameContext* pContext, GameEventContext* pEvent)
{
	GameEventContext    event;
	//RESULT ret;
	if(pContext->status != Status_None)
	{
		MSG_OUT("已经在游戏中,不能加载一个游戏进度!\n");
		return R_E_STATUS;
	}

	if(argc != 2)
	{
		param_error(argv[0]);
		return R_E_PARAM;
	}
	
	// load game

	INIT_EVENT(&event, GameEvent_LoadGame, INVALID_PLAYER , INVALID_PLAYER, pEvent);
	event.file_name = argv[1];

	//ret = game_load(pContext, argv[1]);
	
	//if(R_SUCC != ret)
	//{
	//	return ret;
	//}

	// game main
	return game_main(pContext, &event);
}
Esempio n. 2
0
CANUSE game_card_can_use(GameContext* pGame, GameEventContext* pEvent, int player, PosCard* pPosCard)
{
	GameEventContext   event;
	CardCanUse   stCanUse;
	Player* pPlayer;

	pPlayer = get_game_player(pGame, player);

	if(pPlayer == NULL)
		return USE_CANNOT;

	if(CardFlag_None != get_player_card_flag(pPlayer, pPosCard->where, pPosCard->pos) )
		return USE_CANNOT;


	INIT_EVENT(&event, GameEvent_CheckCardCanUse, player, INVALID_PLAYER, pEvent);
	stCanUse.pos_card = *pPosCard;
	stCanUse.can_use = USE_CANNOT;
	event.card_canuse = &stCanUse;

	call_game_event(pGame, &event);

	if(event.result == R_BACK)
		return stCanUse.can_use;
	return call_card_can_use(stCanUse.pos_card.card.id, pGame, pEvent, player, pPosCard);
}
Esempio n. 3
0
void FrameworkEventInfo::initializeEvents()
{
    // DPTF Events
    INIT_EVENT_WITH_GUID(DptfConnectedStandbyEntry, 0, CONNECTED_STANDBY_ENTRY);
    INIT_EVENT_WITH_GUID(DptfConnectedStandbyExit, 0, CONNECTED_STANDBY_EXIT);
    INIT_EVENT(DptfGetStatus, 0);

    // Participant and Domain events
    INIT_EVENT(ParticipantAllocate, 31);
    INIT_EVENT(ParticipantCreate, 31);
    INIT_EVENT(ParticipantDestroy, 31);
    INIT_EVENT_WITH_GUID(ParticipantSpecificInfoChanged, 0, SPEC_INFO_CHANGED);
    INIT_EVENT(DomainAllocate, 31);
    INIT_EVENT(DomainCreate, 31);
    INIT_EVENT(DomainDestroy, 31);
    INIT_EVENT_WITH_GUID(DomainConfigTdpCapabilityChanged, 0, CTDP_CAPABILITY_CHANGED);
    INIT_EVENT_WITH_GUID(DomainCoreControlCapabilityChanged, 0, CORE_CAPABILITY_CHANGED);
    INIT_EVENT_WITH_GUID(DomainDisplayControlCapabilityChanged, 0, DISPLAY_CAPABILITY_CHANGED);
    INIT_EVENT_WITH_GUID(DomainDisplayStatusChanged, 0, DISPLAY_STATUS_CHANGED);
    INIT_EVENT_WITH_GUID(DomainPerformanceControlCapabilityChanged, 0, PERF_CAPABILITY_CHANGED);
    INIT_EVENT_WITH_GUID(DomainPerformanceControlsChanged, 0, PERF_CONTROL_CHANGED);
    INIT_EVENT_WITH_GUID(DomainPowerControlCapabilityChanged, 0, POWER_CAPABILITY_CHANGED);
    INIT_EVENT_WITH_GUID(DomainPriorityChanged, 0, PRIORITY_CHANGED);
    INIT_EVENT_WITH_GUID(DomainTemperatureThresholdCrossed, 0, TEMP_THRESHOLD_CROSSED);

    // Policy events
    INIT_EVENT(PolicyCreate, 31);
    INIT_EVENT(PolicyDestroy, 31);
    INIT_EVENT_WITH_GUID(PolicyActiveRelationshipTableChanged, 0, ACTIVE_RELATIONSHIP_CHANGED);
    INIT_EVENT_WITH_GUID(PolicyThermalRelationshipTableChanged, 0, THERMAL_RELATIONSHIP_CHANGED);
    INIT_EVENT(PolicyInitiatedCallback, 0);
    INIT_EVENT_WITH_GUID(PolicyForegroundApplicationChanged, 0, FOREGROUND_CHANGED);
    INIT_EVENT_WITH_GUID(PolicyOperatingSystemLpmModeChanged, 0, OS_LPM_MODE_CHANGED);
    INIT_EVENT_WITH_GUID(PolicyPlatformLpmModeChanged, 0, LPM_MODE_CHANGED);
    INIT_EVENT_WITH_GUID(PolicyOperatingSystemConfigTdpLevelChanged, 0, OS_CTDP_CAPABILITY_CHANGED);
    INIT_EVENT_WITH_GUID(PolicyCoolingModePowerLimitChanged, 0, COOLING_MODE_POWER_LIMIT_CHANGED);
    INIT_EVENT_WITH_GUID(PolicyCoolingModeAcousticLimitChanged, 0, COOLING_MODE_ACOUSTIC_LIMIT_CHANGED);
    INIT_EVENT_WITH_GUID(PolicyCoolingModePolicyChanged, 0, SYSTEM_COOLING_POLICY_CHANGED);
    INIT_EVENT_WITH_GUID(PolicyPassiveTableChanged, 0, PASSIVE_TABLE_CHANGED);
    INIT_EVENT_WITH_GUID(PolicySensorOrientationChanged, 0, SENSOR_ORIENTATION_CHANGED);
    INIT_EVENT_WITH_GUID(PolicySensorSpatialOrientationChanged, 0, SENSOR_SPATIAL_ORIENTATION_CHANGED);
    INIT_EVENT_WITH_GUID(PolicySensorProximityChanged, 0, SENSOR_PROXIMITY_CHANGED);
}
Esempio n. 4
0
static RESULT cmd_start(const char** argv, int argc, GameContext* pContext, GameEventContext* pEvent)
{

	//RESULT  ret;
	int cfg;
	const NewGameConfig*  pConfig;
	GameEventContext    event;

	if(pContext->status != Status_None)
	{
		MSG_OUT("你正在游戏中,不能开始一个新的游戏!");
		return R_E_STATUS;
	}

	if(argc < 2 || 0 != to_int(argv[1], &cfg))
	{
		param_error(argv[0]);
		return R_E_PARAM;
	}

	// get config struct 
	pConfig = select_config(cfg);

	if(pConfig == NULL )
	{
		param_error(argv[0]);
		return R_E_PARAM;
	}

	// new game
	INIT_EVENT(&event, GameEvent_NewGame, INVALID_PLAYER, INVALID_PLAYER, pEvent);
	event.new_game_config = pConfig;


	//ret = init_game_context(pContext, pConfig->ministers, pConfig->spies, pConfig->mutineers);

	//if(ret != R_SUCC)
	//{
	//	MSG_OUT("start init new game failed!");
	//	return ret;
	//}

	// game main
	return game_main(pContext, &event);
}
Esempio n. 5
0
CANUSE game_skill_can_use(GameContext* pGame, GameEventContext* pEvent, int player, HeroID heroid, int skillindex)
{
	GameEventContext   event;
	SkillCanUse     stCanUse;
	Player* pPlayer;

	pPlayer = get_game_player(pGame, player);

	if(pPlayer == NULL)
		return USE_CANNOT;

	INIT_EVENT(&event, GameEvent_CheckSkillCanUse, player, INVALID_PLAYER, pEvent);
	stCanUse.hero_id = heroid;
	stCanUse.skill_index = skillindex;
	stCanUse.can_use = USE_CANNOT;
	event.skill_canuse = &stCanUse;

	call_game_event(pGame, &event);

	if(event.result == R_BACK)
		return stCanUse.can_use;

	return call_hero_skill_can_use(stCanUse.hero_id, stCanUse.skill_index, pGame, pEvent, player);
}