Exemplo n.º 1
0
	virtual void Init()
	{
		OptionRowHandler::Init();
		ListEntries.clear();
		Default.Init();
		m_bUseModNameForIcon = false;
		m_vsBroadcastOnExport.clear();
	}
Exemplo n.º 2
0
void ScreenBranch::HandleScreenMessage( const ScreenMessage SM )
{
	switch( SM )
	{
	case SM_GoToNextScreen:
		{
			CString sNextScreen = NEXT_SCREEN(m_sChoice);
			LOG->Trace( "Branching to '%s'", sNextScreen.c_str() );

			GameCommand mc;
			mc.Load( 0, ParseCommands(sNextScreen) );
			if( mc.m_sScreen == "" )
				RageException::Throw("Metric %s::%s must set \"screen\"",
					m_sName.c_str(), ("NextScreen"+m_sChoice).c_str() );
			mc.ApplyToAllPlayers();
		}
		break;
	}
}
Exemplo n.º 3
0
void ScreenSelect::Init()
{
	IDLE_COMMENT_SECONDS.Load( m_sName, "IdleCommentSeconds" );
	IDLE_TIMEOUT_SECONDS.Load( m_sName, "IdleTimeoutSeconds" );
	ALLOW_DISABLED_PLAYER_INPUT.Load( m_sName, "AllowDisabledPlayerInput" );

	ScreenWithMenuElements::Init();

	// Load messages to update on
	split( UPDATE_ON_MESSAGE, ",", m_asSubscribedMessages );
	for( unsigned i = 0; i < m_asSubscribedMessages.size(); ++i )
		MESSAGEMAN->Subscribe( this, m_asSubscribedMessages[i] );
	// Subscribe to PlayerJoined, if not already.
	if( !MESSAGEMAN->IsSubscribedToMessage(this, Message_PlayerJoined) )
		this->SubscribeToMessage( Message_PlayerJoined );

	// Load choices
	{
		// Instead of using NUM_CHOICES, use a comma-separated list of choices.
		// Each element in the list is a choice name. This level of indirection 
		// makes it easier to add or remove items without having to change a
		// bunch of indices.
		vector<RString> asChoiceNames;
		split( CHOICE_NAMES, ",", asChoiceNames, true );

		for( unsigned c=0; c<asChoiceNames.size(); c++ )
		{
			RString sChoiceName = asChoiceNames[c];

			GameCommand mc;
			mc.ApplyCommitsScreens( false );
			mc.m_sName = sChoiceName;
			Commands cmd = ParseCommands( CHOICE(sChoiceName) );
			mc.Load( c, cmd );
			m_aGameCommands.push_back( mc );
		}
	}

	if(m_aGameCommands.empty())
	{
		LuaHelpers::ReportScriptErrorFmt("Screen \"%s\" does not set any choices.", m_sName.c_str());
	}
}
Exemplo n.º 4
0
void	ClientRun()
{
	timer t;
	float32 now = 0;
	float32 last = 0;

	float delay = 0.0;
	while (true)
	{
		if(bExist)
			break;
		SSleep(10);
		now		= (float32)t.elapsed();
		delay	= now - last;
		gGameCommond.Command(delay);
		GameUpdate(delay);
		ClientPlayerMgr::Instance()->Update();
		last = now;
	}

}
Exemplo n.º 5
0
void AGOL_MainWindow::OnLaunch(AG_Event *event)
{
	GameCommand cmd;
	string      sAddr;
	string      waddirs;
	string      extraParams;
	int         ndx = GetSelectedServerArrayIndex();

	// No selection
	if(ndx < 0)
		return;

	if(GuiConfig::Read("WadDirs", waddirs))
	{
		char cwd[AG_PATHNAME_MAX];

		if(!AG_GetCWD(cwd, AG_PATHNAME_MAX))
			cmd.AddParameter("-waddir", cwd);
	}
	else
		cmd.AddParameter("-waddir", waddirs);

	if(!GuiConfig::Read("ExtraParams", extraParams))
		cmd.AddParameter(extraParams);


	QServer[ndx].GetLock();
	sAddr = QServer[ndx].GetAddress();
	QServer[ndx].Unlock();

	if(!sAddr.size())
		return;

	cmd.AddParameter("-connect", sAddr);

	cmd.Launch();
}
Exemplo n.º 6
0
void ScreenSelect::Init()
{
	IDLE_COMMENT_SECONDS.Load( m_sName, "IdleCommentSeconds" );
	IDLE_TIMEOUT_SECONDS.Load( m_sName, "IdleTimeoutSeconds" );
	ALLOW_DISABLED_PLAYER_INPUT.Load( m_sName, "AllowDisabledPlayerInput" );

	ScreenWithMenuElements::Init();

	// Load messages to update on
	split( UPDATE_ON_MESSAGE, ",", m_asSubscribedMessages );
	for( unsigned i = 0; i < m_asSubscribedMessages.size(); ++i )
		MESSAGEMAN->Subscribe( this, m_asSubscribedMessages[i] );
	// Subscribe to PlayerJoined, if not already.
	if( !MESSAGEMAN->IsSubscribedToMessage(this, Message_PlayerJoined) )
		this->SubscribeToMessage( Message_PlayerJoined );

	// Load choices
	// Allow lua as an alternative to metrics.
	RString choice_names= CHOICE_NAMES;
	if(choice_names.Left(4) == "lua,")
	{
		RString command= choice_names.Right(choice_names.size()-4);
		Lua* L= LUA->Get();
		if(LuaHelpers::RunExpression(L, command, m_sName + "::ChoiceNames"))
		{
			if(!lua_istable(L, 1))
			{
				LuaHelpers::ReportScriptError(m_sName + "::ChoiceNames expression did not return a table of gamecommands.");
			}
			else
			{
				size_t len= lua_objlen(L, 1);
				for(size_t i= 1; i <= len; ++i)
				{
					lua_rawgeti(L, 1, i);
					if(!lua_isstring(L, -1))
					{
						LuaHelpers::ReportScriptErrorFmt(m_sName + "::ChoiceNames element %zu is not a string.", i);
					}
					else
					{
						RString com= SArg(-1);
						GameCommand mc;
						mc.ApplyCommitsScreens(false);
						mc.m_sName = ssprintf("%zu", i);
						Commands cmd= ParseCommands(com);
						mc.Load(i, cmd);
						m_aGameCommands.push_back(mc);
					}
					lua_pop(L, 1);
				}
			}
		}
		lua_settop(L, 0);
		LUA->Release(L);
	}
	else
	{
		// Instead of using NUM_CHOICES, use a comma-separated list of choices.
		// Each element in the list is a choice name. This level of indirection 
		// makes it easier to add or remove items without having to change a
		// bunch of indices.
		vector<RString> asChoiceNames;
		split( CHOICE_NAMES, ",", asChoiceNames, true );

		for( unsigned c=0; c<asChoiceNames.size(); c++ )
		{
			RString sChoiceName = asChoiceNames[c];

			GameCommand mc;
			mc.ApplyCommitsScreens( false );
			mc.m_sName = sChoiceName;
			Commands cmd = ParseCommands( CHOICE(sChoiceName) );
			mc.Load( c, cmd );
			m_aGameCommands.push_back( mc );
		}
	}

	if(m_aGameCommands.empty())
	{
		LuaHelpers::ReportScriptErrorFmt("Screen \"%s\" does not set any choices.", m_sName.c_str());
	}
}
Exemplo n.º 7
0
	virtual void Load( OptionRowDefinition &defOut, CString sParam )
	{
		ASSERT( sParam.size() );

		if( sParam.CompareNoCase("NoteSkins")==0 )		{ FillNoteSkins( defOut, sParam );		return; }
		else if( sParam.CompareNoCase("Steps")==0 )		{ FillSteps( defOut, sParam, false );	return; }
		else if( sParam.CompareNoCase("StepsLocked")==0 )	{ FillSteps( defOut, sParam, true );	return; }
		else if( sParam.CompareNoCase("Characters")==0 )	{ FillCharacters( defOut, sParam );		return; }
		else if( sParam.CompareNoCase("Styles")==0 )		{ FillStyles( defOut, sParam );			return; }
		else if( sParam.CompareNoCase("Groups")==0 )		{ FillGroups( defOut, sParam );			return; }
		else if( sParam.CompareNoCase("Difficulties")==0 )	{ FillDifficulties( defOut, sParam );	return; }
		else if( sParam.CompareNoCase("SongsInCurrentSongGroup")==0 )	{ FillSongsInCurrentSongGroup( defOut, sParam );	return; }

		Init();
		defOut.Init();

		m_bUseModNameForIcon = true;
			
		defOut.name = sParam;

		Default.Load( -1, ParseCommands(ENTRY_DEFAULT(sParam)) );

		/* Parse the basic configuration metric. */
		Commands cmds = ParseCommands( ENTRY(sParam) );
		if( cmds.v.size() < 1 )
			RageException::Throw( "Parse error in ScreenOptionsMaster::%s", sParam.c_str() );

		defOut.bOneChoiceForAllPlayers = false;
		const int NumCols = atoi( cmds.v[0].m_vsArgs[0] );
		for( unsigned i=1; i<cmds.v.size(); i++ )
		{
			const Command &cmd = cmds.v[i];
			CString sName = cmd.GetName();

			if(		 sName == "together" )			defOut.bOneChoiceForAllPlayers = true;
			else if( sName == "selectmultiple" )	defOut.selectType = SELECT_MULTIPLE;
			else if( sName == "selectone" )			defOut.selectType = SELECT_ONE;
			else if( sName == "selectnone" )		defOut.selectType = SELECT_NONE;
			else if( sName == "showoneinrow" )		defOut.layoutType = LAYOUT_SHOW_ONE_IN_ROW;
			else if( sName == "reloadrowmessages" )
			{
				for( unsigned a=1; a<cmd.m_vsArgs.size(); a++ )
					m_vsReloadRowMessages.push_back( cmd.m_vsArgs[a] );
			}
			else if( sName == "enabledforplayers" )
			{
				defOut.m_vEnabledForPlayers.clear();
				for( unsigned a=1; a<cmd.m_vsArgs.size(); a++ )
				{
					CString sArg = cmd.m_vsArgs[a];
					PlayerNumber pn = (PlayerNumber)(atoi(sArg)-1);
					ASSERT( pn >= 0 && pn < NUM_PLAYERS );
					defOut.m_vEnabledForPlayers.insert( pn );
				}
			}
			else if( sName == "exportonchange" )	defOut.m_bExportOnChange = true;
			else if( sName == "broadcastonexport" )
			{
				for( unsigned i=1; i<cmd.m_vsArgs.size(); i++ )
					m_vsBroadcastOnExport.push_back( cmd.m_vsArgs[i] );
			}
			else		RageException::Throw( "Unkown row flag \"%s\"", sName.c_str() );
		}

		for( int col = 0; col < NumCols; ++col )
		{
			GameCommand mc;
			mc.Load( 0, ParseCommands(ENTRY_MODE(sParam, col)) );
			/* If the row has just one entry, use the name of the row as the name of the
			 * entry.  If it has more than one, each one must be specified explicitly. */
			if( mc.m_sName == "" && NumCols == 1 )
				mc.m_sName = sParam;
			if( mc.m_sName == "" )
				RageException::Throw( "List \"%s\", col %i has no name", sParam.c_str(), col );

			if( !mc.IsPlayable() )
			{
				LOG->Trace( "\"%s\" is not playable.", sParam.c_str() );
				continue;
			}

			ListEntries.push_back( mc );

			CString sName = mc.m_sName;
			CString sChoice = mc.m_sName;
			defOut.choices.push_back( sChoice );
		}

		// OpenITG hack: load player-defined speed mods
		if (sParam == "Speed")
		{
			set<CString> additionalSet;
			
			// load anything from the machine profile first
			Profile *pMProf = PROFILEMAN->GetMachineProfile();
			if (pMProf != NULL)
			{
				FOREACH_CONST(CString, pMProf->m_sPlayerAdditionalModifiers, mod)
					additionalSet.insert(*mod);
			}

			// then load anything from the players' profiles
			FOREACH_EnabledPlayer( pn )
			{
				Profile *pProf = PROFILEMAN->GetProfile(pn);
				if (pProf == NULL) continue;
				FOREACH_CONST(CString, pProf->m_sPlayerAdditionalModifiers, mod)
					additionalSet.insert(*mod);
			}
			FOREACHS_CONST( CString, additionalSet, addit_mod )
			{
				Regex mult("^[0-9]{1,2}(\\.[0-9]{1,2})?x$");
				Regex constmod("^C[0-9]{1,4}$");
				Regex mmod("^M[0-9]{1,4}$");
				CString sAdditModName;
				if (mult.Compare(*addit_mod))
				{
					float factor = 1.0f;
					sscanf(*addit_mod, "%fx", &factor);
					sAdditModName = ssprintf("x%.1f", factor);
				}
				else if (constmod.Compare(*addit_mod))
				{
					unsigned bpm = 300;
					sscanf(*addit_mod, "C%u", &bpm);
					sAdditModName = ssprintf("c%u", bpm);
				}
				else if (mmod.Compare(*addit_mod))
				{
					unsigned bpm = 600;
					sscanf(*addit_mod, "M%u", &bpm);
					sAdditModName = ssprintf("m%u", bpm);
				}
				else ASSERT(0); // how'd it get in here in the first place...

				GameCommand mc;
				mc.Load( 0, ParseCommands(CString("mod,")+*addit_mod+";name,"+sAdditModName) );
				if ( !mc.IsPlayable() )
				{
					LOG->Trace( "Additional mod \"%s\" is not playable.", addit_mod->c_str() );
					continue;
				}
				ListEntries.push_back(mc);
				defOut.choices.push_back(mc.m_sName);
			}
Exemplo n.º 8
0
void OptionRowHandler::GetIconTextAndGameCommand( int iFirstSelection, RString &sIconTextOut, GameCommand &gcOut ) const
{
	sIconTextOut = "";
	gcOut.Init();
}
Exemplo n.º 9
0
	virtual void LoadInternal( const Commands &cmds )
	{
		ASSERT( cmds.v.size() == 1 );
		const Command &command = cmds.v[0];
		RString sParam = command.GetArg(1).s;
		ASSERT( command.m_vsArgs.size() == 2 );
		ASSERT( sParam.size() != 0 );

		m_bUseModNameForIcon = true;

		m_Def.m_sName = sParam;

		m_Default.Load( -1, ParseCommands(ENTRY_DEFAULT(sParam)) );

		{
			// Parse the basic configuration metric.
			Commands lCmds = ParseCommands( ENTRY(sParam) );
			if( lCmds.v.size() < 1 )
				RageException::Throw( "Parse error in \"ScreenOptionsMaster::%s\".", sParam.c_str() );

			m_Def.m_bOneChoiceForAllPlayers = false;
			const int NumCols = StringToInt( lCmds.v[0].m_vsArgs[0] );
			for( unsigned i=1; i<lCmds.v.size(); i++ )
			{
				const Command &cmd = lCmds.v[i];
				RString sName = cmd.GetName();

				if(	 sName == "together" )		m_Def.m_bOneChoiceForAllPlayers = true;
				else if( sName == "selectmultiple" )	m_Def.m_selectType = SELECT_MULTIPLE;
				else if( sName == "selectone" )		m_Def.m_selectType = SELECT_ONE;
				else if( sName == "selectnone" )	m_Def.m_selectType = SELECT_NONE;
				else if( sName == "showoneinrow" )	m_Def.m_layoutType = LAYOUT_SHOW_ONE_IN_ROW;
				else if( sName == "default" )		m_Def.m_iDefault = StringToInt( cmd.GetArg(1).s ) - 1; // match ENTRY_MODE
				else if( sName == "reloadrowmessages" )
				{
					for( unsigned a=1; a<cmd.m_vsArgs.size(); a++ )
						m_vsReloadRowMessages.push_back( cmd.m_vsArgs[a] );
				}
				else if( sName == "enabledforplayers" )
				{
					m_Def.m_vEnabledForPlayers.clear();
					for( unsigned a=1; a<cmd.m_vsArgs.size(); a++ )
					{
						RString sArg = cmd.m_vsArgs[a];
						PlayerNumber pn = (PlayerNumber)(StringToInt(sArg)-1);
						ASSERT( pn >= 0 && pn < NUM_PLAYERS );
						m_Def.m_vEnabledForPlayers.insert( pn );
					}
				}
				else if( sName == "exportonchange" )
				{
					m_Def.m_bExportOnChange = true;
				}
				else if( sName == "broadcastonexport" )
				{
					for( unsigned j=1; j<cmd.m_vsArgs.size(); j++ )
						m_vsBroadcastOnExport.push_back( cmd.m_vsArgs[j] );
				}
				else
				{
					RageException::Throw( "Unkown row flag \"%s\".", sName.c_str() );
				}
			}

			for( int col = 0; col < NumCols; ++col )
			{
				GameCommand mc;
				mc.ApplyCommitsScreens( false );
				mc.Load( 0, ParseCommands(ENTRY_MODE(sParam, col)) );
				/* If the row has just one entry, use the name of the row as the name of the
				 * entry. If it has more than one, each one must be specified explicitly. */
				if( mc.m_sName == "" && NumCols == 1 )
					mc.m_sName = sParam;
				if( mc.m_sName == "" )
					RageException::Throw( "List \"%s\", col %i has no name.", sParam.c_str(), col );

				if( !mc.IsPlayable() )
				{
					LOG->Trace( "\"%s\" is not playable.", sParam.c_str() );
					continue;
				}

				m_aListEntries.push_back( mc );

				RString sName = mc.m_sName;
				RString sChoice = mc.m_sName;
				m_Def.m_vsChoices.push_back( sChoice );
			}
		}

		if( m_Def.m_selectType != SELECT_MULTIPLE && m_Def.m_iDefault == -1 )
		{
			for( unsigned e = 0; e < m_aListEntries.size(); ++e )
			{
				const GameCommand &mc = m_aListEntries[e];
				if( mc.IsZero() )
					m_Def.m_iDefault = e;
			}
		}
	}
Exemplo n.º 10
0
void AGOL_Solo::OnLaunch(AG_Event *event)
{
	AG_TlistItem *selitem;
	GameCommand   cmd;
	string        wad;
	string        waddirs;
	string        extraParams;

	// Add the iwad parameter
	if(((selitem = AG_TlistSelectedItem(IwadList)) != NULL) && (strlen(selitem->text) > 0))
		cmd.AddParameter("-iwad", selitem->text);
	else // We can't continue if no iwad is selected
	{
		AG_TextErrorS("You must choose an IWAD!");
		return;
	}

	// Get the waddir option
	if(GuiConfig::Read("WadDirs", waddirs))
	{
		char cwd[AG_PATHNAME_MAX];

		// No waddirs are set so use CWD
		if(!AG_GetCWD(cwd, AG_PATHNAME_MAX))
			cmd.AddParameter("-waddir", cwd);
	}
	else
		cmd.AddParameter("-waddir", waddirs);

	// If there are selected items traverse the wad list
	if(AG_TlistSelectedItem(PwadList))
	{
		// WAD files
		if(PWadListContainsFileType("WAD"))
		{
			cmd.AddParameter("-file");

			// Find any selected pwads
			for(int i = 1; i <= PwadList->nitems; i++)
			{
				selitem = AG_TlistFindByIndex(PwadList, i);

				if(selitem && selitem->selected && strlen(selitem->text) > 0)
				{
					if(PwadIsFileType(selitem->text, "WAD"))
						cmd.AddParameter(selitem->text);
				}
			}
		}
		// Dehacked patches
		if(PWadListContainsFileType("DEH"))
		{
			cmd.AddParameter("-deh");

			// Find any selected pwads
			for(int i = 1; i <= PwadList->nitems; i++)
			{
				selitem = AG_TlistFindByIndex(PwadList, i);

				if(selitem && selitem->selected && strlen(selitem->text) > 0)
				{
					if(PwadIsFileType(selitem->text, "DEH"))
						cmd.AddParameter(selitem->text);
				}
			}
		}
		// BEX patches
		if(PWadListContainsFileType("BEX"))
		{
			cmd.AddParameter("-bex");

			// Find any selected pwads
			for(int i = 1; i <= PwadList->nitems; i++)
			{
				selitem = AG_TlistFindByIndex(PwadList, i);

				if(selitem && selitem->selected && strlen(selitem->text) > 0)
				{
					if(PwadIsFileType(selitem->text, "BEX"))
						cmd.AddParameter(selitem->text);
				}
			}
		}
	}

	// Add the extra parameters
	if(!GuiConfig::Read("ExtraParams", extraParams))
		cmd.AddParameter(extraParams);

	// Launch the game
	cmd.Launch();

	// Detach and destroy the window + contents
	AG_ObjectDetach(SoloGameDialog);

	// Call the close handler if one was set
	if(CloseEventHandler)
		CloseEventHandler->Trigger(event);
}
Exemplo n.º 11
0
ResponseCode Server_ProtocolHandler::processCommandHelper(Command *command, CommandContainer *cont)
{
	lastCommandTime = QDateTime::currentDateTime();

	RoomCommand *roomCommand = qobject_cast<RoomCommand *>(command);
	if (roomCommand) {
		qDebug() << "received RoomCommand: roomId =" << roomCommand->getRoomId();
		if (authState == PasswordWrong)
			return RespLoginNeeded;
	
		Server_Room *room = rooms.value(roomCommand->getRoomId(), 0);
		if (!room)
			return RespNameNotFound;
		
		switch (command->getItemId()) {
			case ItemId_Command_LeaveRoom: return cmdLeaveRoom(static_cast<Command_LeaveRoom *>(command), cont, room);
			case ItemId_Command_RoomSay: return cmdRoomSay(static_cast<Command_RoomSay *>(command), cont, room);
			case ItemId_Command_CreateGame: return cmdCreateGame(static_cast<Command_CreateGame *>(command), cont, room);
			case ItemId_Command_JoinGame: return cmdJoinGame(static_cast<Command_JoinGame *>(command), cont, room);
			default: return RespInvalidCommand;
		}
	}
	GameCommand *gameCommand = qobject_cast<GameCommand *>(command);
	if (gameCommand) {
		qDebug() << "received GameCommand: game =" << gameCommand->getGameId();
		if (authState == PasswordWrong)
			return RespLoginNeeded;
	
		if (!games.contains(gameCommand->getGameId())) {
			qDebug() << "invalid game";
			return RespNameNotFound;
		}
		QPair<Server_Game *, Server_Player *> gamePair = games.value(gameCommand->getGameId());
		Server_Game *game = gamePair.first;
		Server_Player *player = gamePair.second;
		
		switch (command->getItemId()) {
			case ItemId_Command_DeckSelect: return cmdDeckSelect(static_cast<Command_DeckSelect *>(command), cont, game, player);
			case ItemId_Command_SetSideboardPlan: return cmdSetSideboardPlan(static_cast<Command_SetSideboardPlan *>(command), cont, game, player);
			case ItemId_Command_LeaveGame: return cmdLeaveGame(static_cast<Command_LeaveGame *>(command), cont, game, player);
			case ItemId_Command_ReadyStart: return cmdReadyStart(static_cast<Command_ReadyStart *>(command), cont, game, player);
			case ItemId_Command_Concede: return cmdConcede(static_cast<Command_Concede *>(command), cont, game, player);
			case ItemId_Command_Say: return cmdSay(static_cast<Command_Say *>(command), cont, game, player);
			case ItemId_Command_Shuffle: return cmdShuffle(static_cast<Command_Shuffle *>(command), cont, game, player);
			case ItemId_Command_Mulligan: return cmdMulligan(static_cast<Command_Mulligan *>(command), cont, game, player);
			case ItemId_Command_RollDie: return cmdRollDie(static_cast<Command_RollDie *>(command), cont, game, player);
			case ItemId_Command_DrawCards: return cmdDrawCards(static_cast<Command_DrawCards *>(command), cont, game, player);
			case ItemId_Command_MoveCard: return cmdMoveCard(static_cast<Command_MoveCard *>(command), cont, game, player);
			case ItemId_Command_FlipCard: return cmdFlipCard(static_cast<Command_FlipCard *>(command), cont, game, player);
			case ItemId_Command_AttachCard: return cmdAttachCard(static_cast<Command_AttachCard *>(command), cont, game, player);
			case ItemId_Command_CreateToken: return cmdCreateToken(static_cast<Command_CreateToken *>(command), cont, game, player);
			case ItemId_Command_CreateArrow: return cmdCreateArrow(static_cast<Command_CreateArrow *>(command), cont, game, player);
			case ItemId_Command_DeleteArrow: return cmdDeleteArrow(static_cast<Command_DeleteArrow *>(command), cont, game, player);
			case ItemId_Command_SetCardAttr: return cmdSetCardAttr(static_cast<Command_SetCardAttr *>(command), cont, game, player);
			case ItemId_Command_SetCardCounter: return cmdSetCardCounter(static_cast<Command_SetCardCounter *>(command), cont, game, player);
			case ItemId_Command_IncCardCounter: return cmdIncCardCounter(static_cast<Command_IncCardCounter *>(command), cont, game, player);
			case ItemId_Command_IncCounter: return cmdIncCounter(static_cast<Command_IncCounter *>(command), cont, game, player);
			case ItemId_Command_CreateCounter: return cmdCreateCounter(static_cast<Command_CreateCounter *>(command), cont, game, player);
			case ItemId_Command_SetCounter: return cmdSetCounter(static_cast<Command_SetCounter *>(command), cont, game, player);
			case ItemId_Command_DelCounter: return cmdDelCounter(static_cast<Command_DelCounter *>(command), cont, game, player);
			case ItemId_Command_NextTurn: return cmdNextTurn(static_cast<Command_NextTurn *>(command), cont, game, player);
			case ItemId_Command_SetActivePhase: return cmdSetActivePhase(static_cast<Command_SetActivePhase *>(command), cont, game, player);
			case ItemId_Command_DumpZone: return cmdDumpZone(static_cast<Command_DumpZone *>(command), cont, game, player);
			case ItemId_Command_StopDumpZone: return cmdStopDumpZone(static_cast<Command_StopDumpZone *>(command), cont, game, player);
			case ItemId_Command_RevealCards: return cmdRevealCards(static_cast<Command_RevealCards *>(command), cont, game, player);
			default: return RespInvalidCommand;
		}
	}
	AdminCommand *adminCommand = qobject_cast<AdminCommand *>(command);
	if (adminCommand) {
		qDebug() << "received AdminCommand";
		if (!(userInfo->getUserLevel() & ServerInfo_User::IsAdmin))
			return RespLoginNeeded;
		
		switch (command->getItemId()) {
			case ItemId_Command_UpdateServerMessage: return cmdUpdateServerMessage(static_cast<Command_UpdateServerMessage *>(command), cont);
			default: return RespInvalidCommand;
		}
	}
	qDebug() << "received generic Command";
	switch (command->getItemId()) {
		case ItemId_Command_Ping: return cmdPing(static_cast<Command_Ping *>(command), cont);
		case ItemId_Command_Login: return cmdLogin(static_cast<Command_Login *>(command), cont);
		case ItemId_Command_Message: return cmdMessage(static_cast<Command_Message *>(command), cont);
		case ItemId_Command_DeckList: return cmdDeckList(static_cast<Command_DeckList *>(command), cont);
		case ItemId_Command_DeckNewDir: return cmdDeckNewDir(static_cast<Command_DeckNewDir *>(command), cont);
		case ItemId_Command_DeckDelDir: return cmdDeckDelDir(static_cast<Command_DeckDelDir *>(command), cont);
		case ItemId_Command_DeckDel: return cmdDeckDel(static_cast<Command_DeckDel *>(command), cont);
		case ItemId_Command_DeckUpload: return cmdDeckUpload(static_cast<Command_DeckUpload *>(command), cont);
		case ItemId_Command_DeckDownload: return cmdDeckDownload(static_cast<Command_DeckDownload *>(command), cont);
		case ItemId_Command_GetUserInfo: return cmdGetUserInfo(static_cast<Command_GetUserInfo *>(command), cont);
		case ItemId_Command_ListRooms: return cmdListRooms(static_cast<Command_ListRooms *>(command), cont);
		case ItemId_Command_JoinRoom: return cmdJoinRoom(static_cast<Command_JoinRoom *>(command), cont);
		case ItemId_Command_ListUsers: return cmdListUsers(static_cast<Command_ListUsers *>(command), cont);
		default: return RespInvalidCommand;
	}
}