コード例 #1
0
void SwgSnapshot::decodeBattlefieldParticipants(const NetworkId &objectId, Archive::ReadIterator &data, bool isBaseline)
{
	typedef Archive::AutoDeltaMap<NetworkId, uint32> MapType;
	typedef std::vector<MapType::Command> CommandList;
	CommandList commands;
	if (isBaseline)
		MapType::unpack(data, commands);
	else
		MapType::unpackDelta(data, commands);
	for (CommandList::const_iterator i = commands.begin(); i != commands.end(); ++i)
	{
		switch ((*i).cmd)
		{
			case MapType::Command::ERASE:
				m_battlefieldParticipantBuffer.removeParticipantForRegion(objectId, (*i).key);
				break;

			case MapType::Command::ADD:
			case MapType::Command::SET:
				m_battlefieldParticipantBuffer.setParticipantForRegion(objectId, (*i).key, (*i).value);
				break;

			default:
				FATAL(true,("Unknown AutoDeltaMap command.\n"));
		}
	}
}
コード例 #2
0
void SwgSnapshot::decodeExperience(const NetworkId &objectId, Archive::ReadIterator &data, bool isBaseline)
{
	typedef Archive::AutoDeltaMap<std::string, int> MapType;
	typedef std::vector<MapType::Command> CommandList;
	CommandList commands;
	if (isBaseline)
		MapType::unpack(data, commands);
	else
		MapType::unpackDelta(data, commands);
	for (CommandList::const_iterator i = commands.begin(); i != commands.end(); ++i)
	{
		switch ((*i).cmd)
		{
			case MapType::Command::ERASE:
				m_experienceBuffer.removeExperience(objectId, (*i).key);
				break;

			case MapType::Command::ADD:
			case MapType::Command::SET:
				m_experienceBuffer.setExperience(objectId, (*i).key, (*i).value);
				break;

			default:
				FATAL(true,("Unknown AutoDeltaMap command.\n"));
		}
	}
}
コード例 #3
0
void SwgSnapshot::decodeManufactureSchematicAttributes(const NetworkId &objectId, Archive::ReadIterator &data, bool isBaseline)
{
	typedef Archive::AutoDeltaMap<StringId, float> MapType;
	typedef std::vector<MapType::Command> CommandList;
	CommandList commands;
	if (isBaseline)
		MapType::unpack(data, commands);
	else
		MapType::unpackDelta(data, commands);
	for (CommandList::const_iterator i = commands.begin(); i != commands.end(); ++i)
	{
		switch ((*i).cmd)
		{
			case MapType::Command::ERASE:
				m_manufactureSchematicAttributeBuffer.removeManufactureSchematicAttribute(objectId,(*i).key.getCanonicalRepresentation());
				break;

			case MapType::Command::ADD:
			case MapType::Command::SET:
				m_manufactureSchematicAttributeBuffer.setManufactureSchematicAttribute(objectId,(*i).key.getCanonicalRepresentation(),(*i).value);
				break;

			default:
				FATAL(true,("Unknown AutoDeltaMap command.\n"));
		}
	}
}
コード例 #4
0
void SwgSnapshot::decodePropertyList(const NetworkId &objectId, int listId, Archive::ReadIterator &data, bool isBaseline)
{
	typedef Archive::AutoDeltaSet<std::string> SetType;
	typedef std::vector<SetType::Command> CommandList;
	CommandList commands;
	if (isBaseline)
		SetType::unpack(data, commands);
	else
		SetType::unpackDelta(data, commands);
	for (CommandList::const_iterator i = commands.begin(); i != commands.end(); ++i)
	{
		switch (i->cmd)
		{
			case SetType::Command::ERASE:
				m_propertyListBuffer.deleteProperty(objectId, listId, i->value);
				break;
			case SetType::Command::INSERT:
				m_propertyListBuffer.insertProperty(objectId, listId, i->value);
				break;
			case SetType::Command::CLEAR:
				m_propertyListBuffer.clearProperties(objectId, listId);
				break;
			default:
				FATAL(true,("Unknown AutoDeltaSet command.\n"));
		}
	}
}
コード例 #5
0
ファイル: natives.cpp プロジェクト: hqy/tsconnector
//native TSC_SendClientMessage(uid[], msg[]);
cell AMX_NATIVE_CALL native_TSC_SendClientMessage(AMX* amx, cell* params) {
	char *TmpParam = NULL;

	amx_StrParam(amx, params[1], TmpParam);
	string UID(TmpParam);
	TSServer.EscapeString(UID);

	amx_StrParam(amx, params[2], TmpParam);
	string Msg(TmpParam);
	TSServer.EscapeString(Msg);


	CommandList *cmds = new CommandList;

	CCommand *cmd1 = new CCommand("clientlist -uid", "clid");
	cmd1->MFind = "client_unique_identifier=";
	cmd1->MFind.append(UID);
	cmds->push(cmd1);

	char FormatTmp[256];
	sprintf(FormatTmp, "sendtextmessage targetmode=1 target=<1> msg=%s", Msg.c_str());
	cmds->push(new CCommand(FormatTmp, "cid"));

	TSServer.AddCommandListToQueue(cmds);
	return 1;
}
コード例 #6
0
void ScaleInteraction::snapMouseReleaseEvent(QMouseEvent * anEvent, Feature* /*Closer*/)
{
    Q_UNUSED(anEvent);

    if (Radius != 1.0 && Scaling.size() && !panning())
    {
        CommandList* theList;
        theList = new CommandList(MainWindow::tr("Scale Feature").arg(Scaling[0]->id().numId), Scaling[0]);
        for (int i=0; i<Scaling.size(); ++i)
        {
            if (NodeOrigin && Scaling[i] == OriginNode)
                continue;
            Scaling[i]->setPosition(OriginalPosition[i]);
            if (Scaling[i]->layer()->isTrack())
                theList->add(new MoveNodeCommand(Scaling[i],scalePosition(OriginalPosition[i], Radius), Scaling[i]->layer()));
            else
                theList->add(new MoveNodeCommand(Scaling[i],scalePosition(OriginalPosition[i], Radius), document()->getDirtyOrOriginLayer(Scaling[i]->layer())));
        }


        document()->addHistory(theList);
        view()->invalidate(true, true, false);
    }
    view()->setInteracting(false);
    Radius = 1.0;
    Scaling.clear();
    OriginalPosition.clear();
    clearNoSnap();
}
コード例 #7
0
ファイル: natives.cpp プロジェクト: hqy/tsconnector
//native TSC_MoveChannelBelowChannel(channelname[], parentchannelname[]);
cell AMX_NATIVE_CALL native_TSC_MoveChannelBelowChannel(AMX* amx, cell* params) {
	char *TmpParam = NULL;

	amx_StrParam(amx, params[1], TmpParam);
	string ChannelName(TmpParam);
	TSServer.EscapeString(ChannelName);

	amx_StrParam(amx, params[2], TmpParam);
	string ParentChannelName(TmpParam);
	TSServer.EscapeString(ParentChannelName);

	
	CommandList *cmds = new CommandList;

	string CmdStr("channelfind pattern=");
	CmdStr.append(ChannelName);
	cmds->push(new CCommand(CmdStr, "cid"));

	CmdStr.assign("channelfind pattern=");
	CmdStr.append(ParentChannelName);
	cmds->push(new CCommand(CmdStr, "cid"));

	cmds->push(new CCommand("channeledit cid=<1> channel_order=<2>"));

	TSServer.AddCommandListToQueue(cmds);
	return 1;
}
コード例 #8
0
ファイル: natives.cpp プロジェクト: hqy/tsconnector
//native TSC_MoveClient(uid[], channelname[]);
cell AMX_NATIVE_CALL native_TSC_MoveClient(AMX* amx, cell* params) {
	char *TmpParam = NULL;

	amx_StrParam(amx, params[1], TmpParam);
	string UID(TmpParam);
	TSServer.EscapeString(UID);

	amx_StrParam(amx, params[2], TmpParam);
	string ChannelName(TmpParam);
	TSServer.EscapeString(ChannelName);
	

	CommandList *cmds = new CommandList;
	
	CCommand *cmd1 = new CCommand("clientlist -uid", "clid");
	cmd1->MFind = "client_unique_identifier=";
	cmd1->MFind.append(UID);
	cmds->push(cmd1);

	char FormatTmp[128];
	sprintf(FormatTmp, "channelfind pattern=%s", ChannelName.c_str());
	cmds->push(new CCommand(FormatTmp, "cid"));

	cmds->push(new CCommand("clientmove clid=<1> cid=<2>"));

	TSServer.AddCommandListToQueue(cmds);
	return 1;
}
コード例 #9
0
ファイル: natives.cpp プロジェクト: hqy/tsconnector
//native TSC_SetClientChannelGroup(uid[], groupid, channelname[]);
cell AMX_NATIVE_CALL native_TSC_SetClientChannelGroup(AMX* amx, cell* params) {
	char *TmpParam = NULL;

	amx_StrParam(amx, params[1], TmpParam);
	string UID(TmpParam);
	TSServer.EscapeString(UID);

	amx_StrParam(amx, params[3], TmpParam);
	string ChannelName(TmpParam);
	TSServer.EscapeString(ChannelName);
	
	
	CommandList *cmds = new CommandList;

	string CmdStr("channelfind pattern=");
	CmdStr.append(ChannelName);
	cmds->push(new CCommand(CmdStr, "cid"));

	char FormatTmp[256];
	sprintf(FormatTmp, "clientdbfind pattern=%s -uid", UID.c_str());
	cmds->push(new CCommand(FormatTmp, "cldbid"));

	sprintf(FormatTmp, "setclientchannelgroup cgid=%d cid=<1> cldbid=<2>", (int)params[2]);
	cmds->push(new CCommand(FormatTmp));

	TSServer.AddCommandListToQueue(cmds);
	return 1;
}
コード例 #10
0
ファイル: natives.cpp プロジェクト: hqy/tsconnector
//native TSC_SetChannelDescription(channelname[], desc[]);
cell AMX_NATIVE_CALL native_TSC_SetChannelDescription(AMX* amx, cell* params) {
	char *TmpParam = NULL;

	amx_StrParam(amx, params[1], TmpParam);
	string ChannelName(TmpParam);
	TSServer.EscapeString(ChannelName);

	amx_StrParam(amx, params[2], TmpParam);
	string Desc(TmpParam);
	TSServer.EscapeString(Desc);


	CommandList *cmds = new CommandList;

	string CmdStr("channelfind pattern=");
	CmdStr.append(ChannelName);
	cmds->push(new CCommand(CmdStr, "cid"));

	CmdStr.assign("channeledit cid=<1> channel_description=");
	CmdStr.append(Desc);
	cmds->push(new CCommand(CmdStr));

	TSServer.AddCommandListToQueue(cmds);
	return 1;
}
コード例 #11
0
void PropertiesDock::on_RemoveMemberButton_clicked()
{
    if (CurrentMembersView)
    {
        Relation* R = dynamic_cast<Relation*>(Selection[0]);
        if (R) {
            QModelIndexList indexes = CurrentMembersView->selectionModel()->selectedIndexes();
            QModelIndex index;

            foreach(index, indexes)
            {
                QModelIndex idx = index.sibling(index.row(),0);
                QVariant Content(R->referenceMemberModel(Main)->data(idx,Qt::UserRole));
                if (Content.isValid())
                {
                    Feature* F = Content.value<Feature*>();
                    if (F) {
                        CommandList* L = new CommandList(MainWindow::tr("Remove member '%1' on %2").arg(F->description()).arg(R->description()), R);
                        if (R->find(F) < R->size())
                            L->add(new RelationRemoveFeatureCommand(R,F,Main->document()->getDirtyOrOriginLayer(R->layer())));
                        if (L->empty())
                            delete L;
                        else
                        {
                            Main->document()->addHistory(L);
                            Main->invalidateView();
                            return;
                        }
                    }
                }
            }
        }
    }
コード例 #12
0
ファイル: natives.cpp プロジェクト: hqy/tsconnector
//native TSC_SendChannelMessage(channelname[], msg[]);
cell AMX_NATIVE_CALL native_TSC_SendChannelMessage(AMX* amx, cell* params) {
	char *TmpParam = NULL;

	amx_StrParam(amx, params[1], TmpParam);
	string ChannelName(TmpParam);
	TSServer.EscapeString(ChannelName);

	amx_StrParam(amx, params[2], TmpParam);
	string Msg(TmpParam);
	TSServer.EscapeString(Msg);


	CommandList *cmds = new CommandList;

	string CmdStr("channelfind pattern=");
	CmdStr.append(ChannelName);
	cmds->push(new CCommand(CmdStr, "cid"));

	char FormatTmp[256];
	sprintf(FormatTmp, "sendtextmessage targetmode=2 target=<1> msg=%s", Msg.c_str());
	cmds->push(new CCommand(FormatTmp));

	TSServer.AddCommandListToQueue(cmds);
	return 1;
}
コード例 #13
0
void RotateInteraction::snapMouseReleaseEvent(QMouseEvent * anEvent, Feature* /*Closer*/)
{
    Q_UNUSED(anEvent);

    if (Angle != 0.0 && Rotating.size() && !panning())
    {
        CommandList* theList;
        theList = new CommandList(MainWindow::tr("Rotate Feature").arg(Rotating[0]->id().numId), Rotating[0]);
        for (int i=0; i<Rotating.size(); ++i)
        {
            if (NodeOrigin && Rotating[i] == OriginNode)
                continue;
            Rotating[i]->setPosition(OriginalPosition[i]);
            if (Rotating[i]->layer()->isTrack())
                theList->add(new MoveNodeCommand(Rotating[i],rotatePosition(OriginalPosition[i], Angle), Rotating[i]->layer()));
            else
                theList->add(new MoveNodeCommand(Rotating[i],rotatePosition(OriginalPosition[i], Angle), document()->getDirtyOrOriginLayer(Rotating[i]->layer())));
        }


        document()->addHistory(theList);
        view()->invalidate(true, false);
    }
    Angle = 0.0;
    Rotating.clear();
    OriginalPosition.clear();
    clearNoSnap();
}
コード例 #14
0
void PropertiesDock::on_RemoveTagButton_clicked()
{
    QTableView* TagTable = 0;
    switch (NowShowing)
    {
    case TrackPointUiShowing:
        TagTable = TrackPointUi.TagView; break;
    case RoadUiShowing:
        TagTable = RoadUi.TagView; break;
    case MultiShowing:
        TagTable = MultiUi.TagView; break;
    case RelationUiShowing:
        TagTable = RelationUi.TagView; break;
    default: break;
    }
    if (!TagTable) return;

    QModelIndexList indexes = TagTable->selectionModel()->selectedIndexes();
    if (indexes.isEmpty()) return;

    CommandList *L = 0;
    if (indexes.count()==1)
    {
        QModelIndex index = indexes.at(0);
        QModelIndex idx = index.sibling(index.row(),0);
        QVariant Content(theModel->data(idx,Qt::DisplayRole));
        if (Content.isValid())
        {
            QString KeyName = Content.toString();
            L = new CommandList(MainWindow::tr("Clear Tag '%1' on %2").arg(KeyName).arg(Selection[0]->id().numId), Selection[0]);
            for (int i=0; i<Selection.size(); ++i)
                if (Selection[i]->findKey(KeyName) != -1)
                    L->add(new ClearTagCommand(Selection[i],KeyName,Main->document()->getDirtyOrOriginLayer(Selection[i]->layer())));
        }
    }
    else
    {
        L = new CommandList(MainWindow::tr("Clear %1 tags on %2").arg(indexes.count()).arg(Selection[0]->id().numId), Selection[0]);
        while (!indexes.isEmpty()) {
            QModelIndex index = indexes.takeLast();
            QModelIndex idx = index.sibling(index.row(),0);
            QVariant Content(theModel->data(idx,Qt::DisplayRole));
            if (Content.isValid())
            {
                QString KeyName = Content.toString();
                for (int i=0; i<Selection.size(); ++i)
                    if (Selection[i]->findKey(KeyName) != -1)
                        L->add(new ClearTagCommand(Selection[i],KeyName,Main->document()->getDirtyOrOriginLayer(Selection[i]->layer())));
            }
        }
    }
    if (!L) return;
    if (L->empty()) {
        delete L;
    } else {
        Main->document()->addHistory(L);
        Main->invalidateView();
    }
}
コード例 #15
0
ファイル: CommandList.cpp プロジェクト: calamares/calamares
static inline bool
findInCommands( const CommandList& l, const QString& needle )
{
    for ( CommandList::const_iterator i = l.cbegin(); i != l.cend(); ++i )
        if ( i->command().contains( needle ) )
            return true;
    return false;
}
コード例 #16
0
ファイル: ai_strategy.cpp プロジェクト: jcemelanda/wormux
AICommand * SkipTurnStrategy::CreateCommand() const
{
    CommandList * commands = new CommandList();
    commands->Add(new SelectWeaponCommand(Weapon::WEAPON_SKIP_TURN));
    commands->Add(new StartShootingCommand());
    commands->Add(new StopShootingCommand());
    return commands;
}
コード例 #17
0
ファイル: rulecommands.cpp プロジェクト: BumblingCoder/qbs
bool operator==(const CommandList &l1, const CommandList &l2)
{
    if (l1.size() != l2.size())
        return false;
    for (int i = 0; i < l1.size(); ++i)
        if (!l1.commandAt(i)->equals(l2.commandAt(i).get()))
            return false;
    return true;
}
コード例 #18
0
ファイル: ai_strategy.cpp プロジェクト: jcemelanda/wormux
AICommand * LoadAndFireStrategy::CreateCommand() const
{
    CommandList * commands = CreateSelectCommandList(shooter, weapon, direction, angle, timeout);
    commands->Add(new StartShootingCommand());
    commands->Add(new WaitForStrengthCommand(strength));
    commands->Add(new StopShootingCommand());
    commands->Add(new DoNothingForeverCommand());
    return commands;
}
コード例 #19
0
ファイル: ai_strategy.cpp プロジェクト: jcemelanda/wormux
AICommand * ShootWithGunStrategy::CreateCommand() const
{
    CommandList * commands = CreateSelectCommandList(shooter, weapon, direction, angle);
    for (int i = 0; i < bullets; i++) {
        if (i != 0)
            commands->Add(new DoNothingCommand(1000));
        commands->Add(new StartShootingCommand());
        commands->Add(new StopShootingCommand());
    }
    commands->Add(new DoNothingCommand(WATCH_MISSILE_TIME_IN_MS));
    return commands;
}
コード例 #20
0
ファイル: exec.cpp プロジェクト: AlbanBedel/scummvm
void CommandExec::run(CommandList& list, ZonePtr z) {
	if (list.size() == 0) {
		debugC(3, kDebugExec, "runCommands: nothing to do");
		return;
	}

	_execZone = z;

	debugC(3, kDebugExec, "runCommands starting");
	runList(list.begin(), list.end());
	debugC(3, kDebugExec, "runCommands completed");
}
コード例 #21
0
void CreateRoundaboutInteraction::mousePressEvent(QMouseEvent * event)
{
    if (event->buttons() & Qt::LeftButton)
    {
        if (!HaveCenter)
        {
            HaveCenter = true;
            view()->setInteracting(true);
            Center = XY_TO_COORD(event->pos());
        }
        else
        {
            calculatePoints();
            if (Points.size() == 0) return;

            QPointF Prev = Points[0];
            Node* First = g_backend.allocNode(theMain->document()->getDirtyOrOriginLayer(), XY_TO_COORD(Prev.toPoint()));
            Way* R = g_backend.allocWay(theMain->document()->getDirtyOrOriginLayer());
            CommandList* L  = new CommandList(MainWindow::tr("Create Roundabout %1").arg(R->id().numId), R);
            L->add(new AddFeatureCommand(theMain->document()->getDirtyOrOriginLayer(),R,true));
            R->add(First);
            L->add(new AddFeatureCommand(theMain->document()->getDirtyOrOriginLayer(),First,true));
            if (M_PREFS->getAutoSourceTag()) {
                QStringList sl = theMain->document()->getCurrentSourceTags();
                if (sl.size())
                    R->setTag("source", sl.join(";"));
            }
            // "oneway" is implied on roundabouts
            //R->setTag("oneway","yes");
            if (DockData.type->currentIndex() == 0)
                R->setTag("junction","roundabout");
            for (int i = 1; i < Points.size(); i++ ) {
                QPointF Next = Points[i];
                Node* New = g_backend.allocNode(theMain->document()->getDirtyOrOriginLayer(), XY_TO_COORD(Next.toPoint()));
                L->add(new AddFeatureCommand(theMain->document()->getDirtyOrOriginLayer(),New,true));
                R->add(New);
            }
            R->add(First);
            for (FeatureIterator it(document()); !it.isEnd(); ++it) {
                Way* W1 = CAST_WAY(it.get());
                if (W1 && (W1 != R))
                    Way::createJunction(theMain->document(), L, R, W1, true);
            }
            theMain->properties()->setSelection(R);
            document()->addHistory(L);
            view()->setInteracting(false);
            view()->invalidate(true, true, false);
            theMain->launchInteraction(0);
        }
    }
    else
        Interaction::mousePressEvent(event);
}
コード例 #22
0
void Client::SendCommand(ClientConn* conn, CommandList& commands)
{
//	Log_Message("Sending command");

	Command**	it;
	
	it = commands.Head();
	if (it != NULL)
	{
		conn->Send(**it);
		commands.Remove(it);
	}
}
コード例 #23
0
ファイル: chat.cpp プロジェクト: bakkdoor/mineserver
void Chat::sendHelp(User* user, std::deque<std::string> args)
{
  // TODO: Add paging support, since not all commands will fit into
  // the screen at once.

  CommandList* commandList = &m_guestCommands; // defaults
  std::string commandColor = MC_COLOR_BLUE;

  if(IS_ADMIN(user->permissions))
  {
    commandList = &m_adminCommands;
    commandColor = MC_COLOR_RED; // different color for admin commands
  }
  else if(IS_OP(user->permissions))
  {
    commandList = &m_opCommands;
    commandColor = MC_COLOR_GREEN;
  }
  else if(IS_MEMBER(user->permissions))
  {
    commandList = &m_memberCommands;
  }

  if(args.size() == 0)
  {
    for(CommandList::iterator it = commandList->begin();
        it != commandList->end();
        it++)
    {
      std::string args = it->second->arguments;
      std::string description = it->second->description;
      sendMsg(user, commandColor + CHATCMDPREFIX + it->first + " " + args + " : " + MC_COLOR_YELLOW + description, Chat::USER);
    }
  }
  else
  {
    CommandList::iterator iter;
    if((iter = commandList->find(args.front())) != commandList->end())
    {
      std::string args = iter->second->arguments;
      std::string description = iter->second->description;
      sendMsg(user, commandColor + CHATCMDPREFIX + iter->first + " " + args, Chat::USER);
      sendMsg(user, MC_COLOR_YELLOW + CHATCMDPREFIX + description, Chat::USER);
    }
    else
    {
      sendMsg(user, MC_COLOR_RED + "Unknown Command: " + args.front(), Chat::USER);
    }
  }
}
コード例 #24
0
void PropertiesDock::on_SourceTagButton_clicked()
{
    QStringList sl = Main->document()->getCurrentSourceTags();
    if (!sl.size())
        return;

    QString src = Selection[0]->tagValue("source", "");
    if (!src.isEmpty())
        sl.prepend(src);

    CommandList* L = new CommandList(MainWindow::tr("Set \"source\" tag on %1").arg(Selection[0]->id().numId), Selection[0]);
    L->add(new SetTagCommand(Selection[0], "source", sl.join(";")));
    Main->document()->addHistory(L);
    Main->invalidateView();
}
コード例 #25
0
void RTCommandEngine::evaluateCommands( TimeStamp timeStamp ) 
{
    mergeIncomingCommands();

    CommandList* commandList = getDueCommands( timeStamp );

    if( commandList ) 
    {
        // XXX: evaluate commands that came in first first, basically what a queue should do,
        //      but the queue used here is actually a LIFO ringbuffer, so we have to reverse
        //      the list of commands -> ugly
        commandList->reverse();
        std::for_each( commandList->begin(), commandList->end(), processCommand );
        scheduleCommandListForDeletion( commandList );
    }
}
コード例 #26
0
ファイル: ai_strategy.cpp プロジェクト: jcemelanda/wormux
static CommandList * CreateSelectCommandList(const Character & character, Weapon::Weapon_type weapon,
        LRDirection  direction, float angle, int timeout = -1)
{
    CommandList * commands = new CommandList();
    commands->Add(new SelectCharacterCommand(&character));
    commands->Add(new DoNothingCommand(1000));
    commands->Add(new SelectWeaponCommand(weapon));
    commands->Add(new DoNothingCommand(100));
    if (timeout > 0) {
        commands->Add(new SetTimeoutCommand(timeout));
    }
    commands->Add(new DoNothingCommand(100));
    commands->Add(new SetDirectionCommand(direction));
    commands->Add(new SetWeaponAngleCommand(angle));
    commands->Add(new DoNothingCommand(200));
    return commands;
}
コード例 #27
0
ファイル: natives.cpp プロジェクト: hqy/tsconnector
//native TSC_CreateChannel(channelname[]);
cell AMX_NATIVE_CALL native_TSC_CreateChannel(AMX* amx, cell* params) {
	char *ChannelNameTmp = NULL;
	amx_StrParam(amx, params[1], ChannelNameTmp);

	string ChannelName(ChannelNameTmp);
	TSServer.EscapeString(ChannelName);


	CommandList *cmds = new CommandList;

	string CmdStr("channelcreate channel_name=");
	CmdStr.append(ChannelName);
	cmds->push(new CCommand(CmdStr));

	TSServer.AddCommandListToQueue(cmds);
	return 1;
}
コード例 #28
0
ファイル: gameApp.cpp プロジェクト: ElectricJack/ofGame0
// -------------------------------------------------------------- //
void GameApp::setup()
{
  ofSetWindowTitle      ( "Game Editor Test" );
  ofSetDataPathRoot     ( "data/" );

  // Setup the console and make sure the systemTests have access to it for output
  console.setup();
  systemTests->setConsole( console );

  // Register all commandable commands
  //  ( This should be automated in the future )
  console.registerCommands      ( cp );
  gfxCommands.registerCommands  ( cp );
  systemTests->registerCommands ( cp );

  // Let's output the command list to the console
  cp.printCommandList( console );

  // Register all unregistered input targets up to this point
  processUnregisteredInputTargets( cp );


  CommandList startupCmds;
  startupCmds.ExecuteFile( "data/startup.cmds", cp );

  hmd.setup( console );
  hmd.enableTracking();


  Environment*          env = new MainMenu();
  registerEnvironment ( env );
  pushEnvironment     ( env );
  env->setup();


//  Environment*          env2 = new Asset_Viewer();
//  registerEnvironment ( env2 );
//  pushEnvironment     ( env2 );
//  env2->setup();



  gameAppInputHandler.activate();
}
コード例 #29
0
void AliasManager::expand(const QString &alias, const BufferInfo &bufferInfo, const QString &msg, CommandList &list) {
  const Network *net = network(bufferInfo.networkId());
  if(!net) {
    // FIXME send error as soon as we have a method for that!
    return;
  }

  QRegExp paramRangeR("\\$(\\d+)\\.\\.(\\d*)");
  QStringList commands = alias.split(QRegExp("; ?"));
  QStringList params = msg.split(' ');
  QStringList expandedCommands;
  for(int i = 0; i < commands.count(); i++) {
    QString command = commands[i];

    // replace ranges like $1..3
    if(!params.isEmpty()) {
      int pos;
      while((pos = paramRangeR.indexIn(command)) != -1) {
        int start = paramRangeR.cap(1).toInt();
        bool ok;
        int end = paramRangeR.cap(2).toInt(&ok);
        if(!ok) {
          end = params.count();
        }
        if(end < start)
          command = command.replace(pos, paramRangeR.matchedLength(), QString());
        else {
          command = command.replace(pos, paramRangeR.matchedLength(), QStringList(params.mid(start - 1, end - start + 1)).join(" "));
        }
      }
    }

    for(int j = params.count(); j > 0; j--) {
      IrcUser *ircUser = net->ircUser(params[j - 1]);
      command = command.replace(QString("$%1:hostname").arg(j), ircUser ? ircUser->host() : QString("*"));
      command = command.replace(QString("$%1").arg(j), params[j - 1]);
    }
    command = command.replace("$0", msg);
    command = command.replace("$channelname", bufferInfo.bufferName()); // legacy
    command = command.replace("$channel", bufferInfo.bufferName());
    command = command.replace("$currentnick", net->myNick()); // legacy
    command = command.replace("$nick", net->myNick());
    expandedCommands << command;
  }

  while(!expandedCommands.isEmpty()) {
    QString command;
    if(expandedCommands[0].trimmed().toLower().startsWith("/wait")) {
      command = expandedCommands.join("; ");
      expandedCommands.clear();
    } else {
      command = expandedCommands.takeFirst();
    }
    list.append(qMakePair(bufferInfo, command));
  }
}
コード例 #30
0
ファイル: natives.cpp プロジェクト: hqy/tsconnector
//native TSC_DeleteChannel(channelname[]);
cell AMX_NATIVE_CALL native_TSC_DeleteChannel(AMX* amx, cell* params) {
	char *ChannelNameTmp = NULL;
	amx_StrParam(amx, params[1], ChannelNameTmp);

	string ChannelName(ChannelNameTmp);
	TSServer.EscapeString(ChannelName);
	

	CommandList *cmds = new CommandList;

	string CmdStr("channelfind pattern=");
	CmdStr.append(ChannelName);
	cmds->push(new CCommand(CmdStr, "cid"));

	cmds->push(new CCommand("channeldelete cid=<1> force=1"));

	TSServer.AddCommandListToQueue(cmds);
	return 1;
}