本文整理汇总了C++中AbstractCommand::apply方法的典型用法代码示例。如果您正苦于以下问题:C++ AbstractCommand::apply方法的具体用法?C++ AbstractCommand::apply怎么用?C++ AbstractCommand::apply使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AbstractCommand
的用法示例。
在下文中一共展示了AbstractCommand::apply方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: receiveData
void BattleInput::receiveData(QByteArray inf)
{
if (inf.isEmpty()) {
if (paused()) {
delayedCommands.push_back(inf);
return;
}
/* An empty array means raw Command */
if (commands.size() > 0) {
AbstractCommand *command = *commands.begin();
commands.pop_front();
command->apply();
delete command;
return;
}
}
if (paused() && inf[0] != char(BC::BattleChat) && inf[0] != char(BC::SpectatorChat) && inf[0] != char(BC::ClockStart)
&& inf[0] != char(BC::ClockStop)
&& inf[0] != char(BC::Spectating)) {
delayedCommands.push_back(inf);
return;
}
DataStream in (&inf, QIODevice::ReadOnly);
uchar command;
qint8 player;
in >> command >> player;
dealWithCommandInfo(in, command, player);
}
示例2: unpause
void RegularBattleScene::unpause()
{
pauseCount -= 1;
if (pauseCount == 0 && !unpausing) {
unpausing = true;
while (commands.size() > 0) {
AbstractCommand *command = *commands.begin();
commands.pop_front();
command->apply();
delete command;
}
unpausing = false;
}
baseClass::unpause();
}
示例3: useCommand
void BattleScene::useCommand()
{
if (commands.size() > 0) {
AbstractCommand *command = *commands.begin();
int val = command->val();
if (!onPeek(val)) {
return;
}
commands.pop_front();
command->apply();
delete command;
if (replayCount > 0 && misReplayingCommands) {
replayCount --;
if (replayCount == 0) {
misReplayingCommands = false;
}
}
}
}