void StageBuilder::visit(PlayerSet &players, Visitor &visitor, bool isPlaying) { std::vector<int> masks; int m = players.size(); int h = 0; for (; h < m; h++) { Player &player = players[h]; unsigned int i = 0; // vale solo per TAB pro for (; i < masks.size() && i < player.m_masks.size(); i++) if (masks[i] != player.m_masks[i]) break; // vale solo per TAB pro if (i < masks.size() || i < player.m_masks.size()) { while (i < masks.size()) { masks.pop_back(); visitor.disableMask(); } while (i < player.m_masks.size()) { int maskIndex = player.m_masks[i]; visitor.beginMask(); visit(*m_maskPool[maskIndex], visitor, isPlaying); visitor.endMask(); masks.push_back(maskIndex); visitor.enableMask(); i++; } } player.m_isPlaying = isPlaying; visitor.onImage(player); } // vale solo per TAB pro for (h = 0; h < (int)masks.size(); h++) visitor.disableMask(); }
void StageBuilder::dumpPlayerSet(PlayerSet &players, std::ostream &out) { out << "["; int m = players.size(); for (int i = 0; i < m; i++) { if (i > 0) out << " "; const Player &player = players[i]; out << "img"; if (!player.m_masks.empty()) { out << "(" << player.m_masks[0]; for (unsigned int j = 1; j < player.m_masks.size(); j++) out << "," << player.m_masks[j]; out << ")"; } } out << "]"; }