예제 #1
0
size_t Buffer::peek(void *buf)
{
	size_t rc;

	enterMutex();
	if(!_used)
	{
		leaveMutex();
		return 0;
	}
	rc = onPeek(buf);
	leaveMutex();
	return rc;
}
예제 #2
0
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;
            }
        }
    }
}