void CharSelectDialog::setCharacters(const Net::Characters &characters) { // Reset previous characters for (std::vector<CharacterDisplay*>::const_iterator iter = mCharacterEntries.begin(), iter_end = mCharacterEntries.end(); iter != iter_end; ++iter) { (*iter)->setCharacter(nullptr); } for (Net::Characters::const_iterator i = characters.begin(), i_end = characters.end(); i != i_end; ++i) { if (!*i) continue; Net::Character *character = *i; // Slots Number start at 1 for Manaserv, so we offset them by one. int characterSlot = character->slot; #ifdef MANASERV_SUPPORT if (Net::getNetworkType() == ServerInfo::MANASERV && characterSlot > 0) --characterSlot; #endif if (characterSlot >= static_cast<int>(mCharacterEntries.size())) { logger->log("Warning: slot out of range: %d", character->slot); continue; } mCharacterEntries[characterSlot]->setCharacter(character); } }
void CharSelectDialog::setCharacters(const Net::Characters &characters) { // Reset previous characters std::vector<CharacterDisplay*>::iterator iter, iter_end; for (iter = mCharacterEntries.begin(), iter_end = mCharacterEntries.end(); iter != iter_end; ++iter) (*iter)->setCharacter(0); Net::Characters::const_iterator i, i_end = characters.end(); for (i = characters.begin(); i != i_end; ++i) { Net::Character *character = *i; // Slots Number start at 1 for Manaserv, so we offset them by one. int characterSlot = character->slot; if (Net::getNetworkType() == ServerInfo::MANASERV && characterSlot > 0) --characterSlot; if (characterSlot >= (int)mCharacterEntries.size()) { logger->log("Warning: slot out of range: %d", character->slot); continue; } mCharacterEntries[characterSlot]->setCharacter(character); } }