diff options
Diffstat (limited to 'src')
55 files changed, 286 insertions, 298 deletions
diff --git a/src/account-server/account.cpp b/src/account-server/account.cpp index 0878c760..ed7c5df4 100644 --- a/src/account-server/account.cpp +++ b/src/account-server/account.cpp @@ -43,13 +43,13 @@ void Account::setCharacters(const Characters &characters) void Account::addCharacter(Character *character) { - unsigned int slot = (unsigned int) character->getCharacterSlot(); + unsigned slot = (unsigned) character->getCharacterSlot(); assert(isSlotEmpty(slot)); mCharacters[slot] = character; } -void Account::delCharacter(unsigned int slot) +void Account::delCharacter(unsigned slot) { for (Characters::iterator iter = mCharacters.begin(), iter_end = mCharacters.end(); iter != iter_end; ++iter) diff --git a/src/account-server/account.h b/src/account-server/account.h index 98794fbf..46693e80 100644 --- a/src/account-server/account.h +++ b/src/account-server/account.h @@ -158,7 +158,7 @@ class Account * * @param slot slot index of the character. */ - void delCharacter(unsigned int slot); + void delCharacter(unsigned slot); /** * Get all the characters. diff --git a/src/account-server/accounthandler.cpp b/src/account-server/accounthandler.cpp index 3590dbeb..9901300e 100644 --- a/src/account-server/accounthandler.cpp +++ b/src/account-server/accounthandler.cpp @@ -740,7 +740,7 @@ void AccountHandler::handleCharacterCreateMessage(AccountClient &client, // than <account_maxCharacters> characters. Characters &chars = acc->getCharacters(); if (slot < 1 || slot > mMaxCharacters - || !acc->isSlotEmpty((unsigned int) slot)) + || !acc->isSlotEmpty((unsigned) slot)) { reply.writeInt8(CREATE_INVALID_SLOT); client.send(reply); @@ -758,11 +758,11 @@ void AccountHandler::handleCharacterCreateMessage(AccountClient &client, // Customization of character's attributes... std::vector<int> attributes = std::vector<int>(mModifiableAttributes.size(), 0); - for (unsigned int i = 0; i < mModifiableAttributes.size(); ++i) + for (unsigned i = 0; i < mModifiableAttributes.size(); ++i) attributes[i] = msg.readInt16(); int totalAttributes = 0; - for (unsigned int i = 0; i < mModifiableAttributes.size(); ++i) + for (unsigned i = 0; i < mModifiableAttributes.size(); ++i) { // For good total attributes check. totalAttributes += attributes.at(i); @@ -790,7 +790,7 @@ void AccountHandler::handleCharacterCreateMessage(AccountClient &client, Character *newCharacter = new Character(name); // Set the initial attributes provided by the client - for (unsigned int i = 0; i < mModifiableAttributes.size(); ++i) + for (unsigned i = 0; i < mModifiableAttributes.size(); ++i) { newCharacter->mAttributes.insert( std::make_pair(mModifiableAttributes.at(i), attributes[i])); diff --git a/src/account-server/character.h b/src/account-server/character.h index 5e6bd3b3..0b697392 100644 --- a/src/account-server/character.h +++ b/src/account-server/character.h @@ -55,22 +55,22 @@ struct SpecialValue : currentMana(0) {} - SpecialValue(unsigned int currentMana) + SpecialValue(unsigned currentMana) : currentMana(currentMana) {} - unsigned int currentMana; + unsigned currentMana; }; /** * Stores attributes by their id. */ -typedef std::map<unsigned int, AttributeValue> AttributeMap; +typedef std::map<unsigned, AttributeValue> AttributeMap; /** * Stores specials by their id. */ -typedef std::map<unsigned int, SpecialValue> SpecialMap; +typedef std::map<unsigned, SpecialValue> SpecialMap; class Character { @@ -87,10 +87,10 @@ class Character /** * Gets the slot of the character. */ - unsigned int getCharacterSlot() const + unsigned getCharacterSlot() const { return mCharacterSlot; } - void setCharacterSlot(unsigned int slot) + void setCharacterSlot(unsigned slot) { mCharacterSlot = slot; } /** Gets the account the character belongs to. */ @@ -148,10 +148,10 @@ class Character void setLevel(int level) { mLevel = level; } /** Sets the value of a base attribute of the character. */ - void setAttribute(unsigned int id, double value) + void setAttribute(unsigned id, double value) { mAttributes[id].base = value; } - void setModAttribute(unsigned int id, double value) + void setModAttribute(unsigned id, double value) { mAttributes[id].modified = value; } int getSkillSize() const @@ -277,7 +277,7 @@ class Character Possessions mPossessions; //!< All the possesions of the character. std::string mName; //!< Name of the character. int mDatabaseID; //!< Character database ID. - unsigned int mCharacterSlot; //!< Character slot. + unsigned mCharacterSlot; //!< Character slot. int mAccountID; //!< Account ID of the owner. Account *mAccount; //!< Account owning the character. Point mPos; //!< Position the being is at. @@ -307,6 +307,6 @@ class Character /** * Type definition for a list of Characters. */ -typedef std::map<unsigned int, Character* > Characters; +typedef std::map<unsigned, Character* > Characters; #endif diff --git a/src/account-server/serverhandler.cpp b/src/account-server/serverhandler.cpp index c938324f..abdb5756 100644 --- a/src/account-server/serverhandler.cpp +++ b/src/account-server/serverhandler.cpp @@ -185,7 +185,7 @@ void ServerHandler::processMessage(NetComputer *comp, MessageIn &msg) const std::string password = msg.readString(); // checks the version of the remote item database with our local copy - unsigned int dbversion = msg.readInt32(); + unsigned dbversion = msg.readInt32(); LOG_INFO("Game server uses itemsdatabase with version " << dbversion); LOG_DEBUG("AGMSG_REGISTER_RESPONSE"); @@ -487,7 +487,7 @@ void ServerHandler::processMessage(NetComputer *comp, MessageIn &msg) // send the post if valid if (post) { - for (unsigned int i = 0; i < post->getNumberOfLetters(); ++i) + for (unsigned i = 0; i < post->getNumberOfLetters(); ++i) { // get each letter, send the sender's name, // the contents and any attachments @@ -495,7 +495,7 @@ void ServerHandler::processMessage(NetComputer *comp, MessageIn &msg) result.writeString(letter->getSender()->getName()); result.writeString(letter->getContents()); std::vector<InventoryItem> items = letter->getAttachments(); - for (unsigned int j = 0; j < items.size(); ++j) + for (unsigned j = 0; j < items.size(); ++j) { result.writeInt16(items[j].itemId); result.writeInt16(items[j].amount); @@ -546,7 +546,7 @@ void ServerHandler::processMessage(NetComputer *comp, MessageIn &msg) LOG_DEBUG("Creating letter"); Letter *letter = new Letter(0, sender, receiver); letter->addText(contents); - for (unsigned int i = 0; i < items.size(); ++i) + for (unsigned i = 0; i < items.size(); ++i) { InventoryItem item; item.itemId = items[i].first; diff --git a/src/account-server/storage.cpp b/src/account-server/storage.cpp index 9426c885..f75e3edb 100644 --- a/src/account-server/storage.cpp +++ b/src/account-server/storage.cpp @@ -174,8 +174,6 @@ Account *Storage::getAccountBySQL() if (accountInfo.isEmpty()) return 0; - // Specialize the string_to functor to convert - // a string to an unsigned int. string_to< unsigned > toUint; unsigned id = toUint(accountInfo(0, 0)); @@ -265,8 +263,6 @@ void Storage::fixCharactersSlot(int accountId) if (charInfo.isEmpty()) return; - // Specialize the string_to functor to convert - // a string to an unsigned int. string_to< unsigned > toUint; std::map<unsigned, unsigned> slotsToUpdate; @@ -347,8 +343,6 @@ Character *Storage::getCharacterBySQL(Account *owner) { Character *character = 0; - // Specialize the string_to functor to convert - // a string to an unsigned int. string_to< unsigned > toUint; string_to< int > toInt; @@ -361,8 +355,6 @@ Character *Storage::getCharacterBySQL(Account *owner) if (charInfo.isEmpty()) return 0; - // Specialize the string_to functor to convert - // a string to an unsigned short. string_to< unsigned short > toUshort; string_to< double > toDouble; @@ -417,10 +409,10 @@ Character *Storage::getCharacterBySQL(Account *owner) const dal::RecordSet &attrInfo = mDb->execSql(s.str()); if (!attrInfo.isEmpty()) { - const unsigned int nRows = attrInfo.rows(); - for (unsigned int row = 0; row < nRows; ++row) + const unsigned nRows = attrInfo.rows(); + for (unsigned row = 0; row < nRows; ++row) { - unsigned int id = toUint(attrInfo(row, 0)); + unsigned id = toUint(attrInfo(row, 0)); character->setAttribute(id, toDouble(attrInfo(row, 1))); character->setModAttribute(id, toDouble(attrInfo(row, 2))); } @@ -437,10 +429,10 @@ Character *Storage::getCharacterBySQL(Account *owner) const dal::RecordSet &skillInfo = mDb->execSql(s.str()); if (!skillInfo.isEmpty()) { - const unsigned int nRows = skillInfo.rows(); - for (unsigned int row = 0; row < nRows; ++row) + const unsigned nRows = skillInfo.rows(); + for (unsigned row = 0; row < nRows; ++row) { - unsigned int id = toUint(skillInfo(row, 0)); + unsigned id = toUint(skillInfo(row, 0)); character->setExperience(id, toInt(skillInfo(row, 1))); } } @@ -455,8 +447,8 @@ Character *Storage::getCharacterBySQL(Account *owner) const dal::RecordSet &statusInfo = mDb->execSql(s.str()); if (!statusInfo.isEmpty()) { - const unsigned int nRows = statusInfo.rows(); - for (unsigned int row = 0; row < nRows; row++) + const unsigned nRows = statusInfo.rows(); + for (unsigned row = 0; row < nRows; row++) { character->applyStatusEffect( toUint(statusInfo(row, 0)), // Status Id @@ -472,8 +464,8 @@ Character *Storage::getCharacterBySQL(Account *owner) const dal::RecordSet &killsInfo = mDb->execSql(s.str()); if (!killsInfo.isEmpty()) { - const unsigned int nRows = killsInfo.rows(); - for (unsigned int row = 0; row < nRows; row++) + const unsigned nRows = killsInfo.rows(); + for (unsigned row = 0; row < nRows; row++) { character->setKillCount( toUint(killsInfo(row, 0)), // MonsterID @@ -490,8 +482,8 @@ Character *Storage::getCharacterBySQL(Account *owner) const dal::RecordSet &specialsInfo = mDb->execSql(s.str()); if (!specialsInfo.isEmpty()) { - const unsigned int nRows = specialsInfo.rows(); - for (unsigned int row = 0; row < nRows; row++) + const unsigned nRows = specialsInfo.rows(); + for (unsigned row = 0; row < nRows; row++) { character->giveSpecial(toUint(specialsInfo(row, 0)), toUint(specialsInfo(row, 1))); @@ -523,7 +515,7 @@ Character *Storage::getCharacterBySQL(Account *owner) { equipItem.itemId = toUint(equipInfo(k, 1)); equipItem.itemInstance = toUint(equipInfo(k, 2)); - equipData.insert(std::pair<unsigned int, EquipmentItem>( + equipData.insert(std::pair<unsigned, EquipmentItem>( toUint(equipInfo(k, 0)), equipItem)); } @@ -591,7 +583,7 @@ Character *Storage::getCharacter(const std::string &name) return 0; } -unsigned int Storage::getCharacterId(const std::string &name) +unsigned Storage::getCharacterId(const std::string &name) { std::ostringstream sql; sql << "SELECT id FROM " << CHARACTERS_TBL_NAME << " WHERE name = ?"; @@ -629,7 +621,7 @@ bool Storage::doesUserNameExist(const std::string &name) const dal::RecordSet &accountInfo = mDb->processSql(); std::istringstream ssStream(accountInfo(0, 0)); - unsigned int iReturn = 1; + unsigned iReturn = 1; ssStream >> iReturn; return iReturn != 0; } @@ -662,7 +654,7 @@ bool Storage::doesEmailAddressExist(const std::string &email) const dal::RecordSet &accountInfo = mDb->processSql(); std::istringstream ssStream(accountInfo(0, 0)); - unsigned int iReturn = 1; + unsigned iReturn = 1; ssStream >> iReturn; return iReturn != 0; } @@ -884,8 +876,8 @@ bool Storage::updateCharacter(Character *character) { sql.str(""); unsigned short slot = j->first; - unsigned int itemId = j->second.itemId; - unsigned int amount = j->second.amount; + unsigned itemId = j->second.itemId; + unsigned amount = j->second.amount; assert(itemId); sql << base << slot << ", " << itemId << ", " << amount << ");"; mDb->execSql(sql.str()); @@ -1084,8 +1076,6 @@ void Storage::flush(Account *account) // or updated in database. // Now, let's remove those who are no more in memory from database. - // Specialize the string_to functor to convert - // a string to an unsigned int. string_to<unsigned short> toUint; std::ostringstream sqlSelectNameIdCharactersTable; @@ -1099,7 +1089,7 @@ void Storage::flush(Account *account) // We compare chars from memory and those existing in db, // and delete those not in mem but existing in db. bool charFound; - for (unsigned int i = 0; i < charInMemInfo.rows(); ++i) // In database + for (unsigned i = 0; i < charInMemInfo.rows(); ++i) // In database { charFound = false; for (Characters::const_iterator it = characters.begin(), @@ -1118,7 +1108,7 @@ void Storage::flush(Account *account) // We store the id of the char to delete, // because as deleted, the RecordSet is also emptied, // and that creates an error. - unsigned int charId = toUint(charInMemInfo(i, 1)); + unsigned charId = toUint(charInMemInfo(i, 1)); delCharacter(charId); } } @@ -1235,7 +1225,7 @@ void Storage::updateExperience(int charId, int skillId, int skillValue) } } -void Storage::updateAttribute(int charId, unsigned int attrId, +void Storage::updateAttribute(int charId, unsigned attrId, double base, double mod) { try @@ -1349,7 +1339,7 @@ void Storage::addGuild(Guild *guild) mDb->bindValue(1, guild->getName()); const dal::RecordSet& guildInfo = mDb->processSql(); - string_to<unsigned int> toUint; + string_to<unsigned> toUint; unsigned id = toUint(guildInfo(0, 0)); guild->setId(id); } @@ -1531,7 +1521,7 @@ std::map<int, Guild*> Storage::getGuildList() return guilds; // Loop through every row in the table and assign it to a guild - for (unsigned int i = 0; i < guildInfo.rows(); ++i) + for (unsigned i = 0; i < guildInfo.rows(); ++i) { Guild* guild = new Guild(guildInfo(i,1)); guild->setId(toShort(guildInfo(i,0))); @@ -1550,7 +1540,7 @@ std::map<int, Guild*> Storage::getGuildList() const dal::RecordSet& memberInfo = mDb->execSql(memberSql.str()); std::list<std::pair<int, int> > members; - for (unsigned int j = 0; j < memberInfo.rows(); ++j) + for (unsigned j = 0; j < memberInfo.rows(); ++j) { members.push_back(std::pair<int, int>(toUint(memberInfo(j, 0)), toUint(memberInfo(j, 1)))); @@ -1677,7 +1667,7 @@ std::map<std::string, std::string> Storage::getAllWorldStateVars(int mapId) mDb->bindValue(1, mapId); const dal::RecordSet &results = mDb->processSql(); - for (unsigned int i = 0; i < results.rows(); ++i) + for (unsigned i = 0; i < results.rows(); ++i) { variables[results(i, 0)] = results(i, 1); } @@ -1998,8 +1988,6 @@ Post *Storage::getStoredPost(int playerId) { Post *p = new Post(); - // Specialize the string_to functor to convert - // a string to an unsigned int. string_to< unsigned > toUint; try @@ -2016,7 +2004,7 @@ Post *Storage::getStoredPost(int playerId) return p; } - for (unsigned int i = 0; i < post.rows(); i++ ) + for (unsigned i = 0; i < post.rows(); i++ ) { // Load sender and receiver Character *sender = getCharacter(toUint(post(i, 1)), 0); @@ -2248,10 +2236,10 @@ void Storage::addTransaction(const Transaction &trans) } } -std::vector<Transaction> Storage::getTransactions(unsigned int num) +std::vector<Transaction> Storage::getTransactions(unsigned num) { std::vector<Transaction> transactions; - string_to<unsigned int> toUint; + string_to<unsigned> toUint; try { @@ -2283,7 +2271,7 @@ std::vector<Transaction> Storage::getTransactions(unsigned int num) std::vector<Transaction> Storage::getTransactions(time_t date) { std::vector<Transaction> transactions; - string_to<unsigned int> toUint; + string_to<unsigned> toUint; try { @@ -2292,7 +2280,7 @@ std::vector<Transaction> Storage::getTransactions(time_t date) << date; const dal::RecordSet &rec = mDb->execSql(sql.str()); - for (unsigned int i = 0; i < rec.rows(); ++i) + for (unsigned i = 0; i < rec.rows(); ++i) { Transaction trans; trans.mCharacterId = toUint(rec(i, 1)); diff --git a/src/account-server/storage.h b/src/account-server/storage.h index b71be22f..f58738f5 100644 --- a/src/account-server/storage.h +++ b/src/account-server/storage.h @@ -101,7 +101,7 @@ class Storage * * @return the id of the character */ - unsigned int getCharacterId(const std::string &name); + unsigned getCharacterId(const std::string &name); /** * Add an account to the database. @@ -152,7 +152,7 @@ class Storage * @param base The base value of the attribute for this character * @param mod The cached modified value for this character. */ - void updateAttribute(int charId, unsigned int attrId, + void updateAttribute(int charId, unsigned attrId, double base, double mod); /** @@ -427,7 +427,7 @@ class Storage * * @return the database version number. */ - unsigned int getItemDatabaseVersion() const + unsigned getItemDatabaseVersion() const { return mItemDbVersion; } /** @@ -450,7 +450,7 @@ class Storage * * @return a vector of transactions. */ - std::vector<Transaction> getTransactions(unsigned int num); + std::vector<Transaction> getTransactions(unsigned num); /** * Retrieve all transactions since the given \a date. @@ -508,7 +508,7 @@ class Storage void syncDatabase(); dal::DataProvider *mDb; /**< the data provider */ - unsigned int mItemDbVersion; /**< Version of the item database. */ + unsigned mItemDbVersion; /**< Version of the item database. */ }; extern Storage *storage; diff --git a/src/chat-server/chatclient.h b/src/chat-server/chatclient.h index a0812a30..7e8c4e2e 100644 --- a/src/chat-server/chatclient.h +++ b/src/chat-server/chatclient.h @@ -46,7 +46,7 @@ class ChatClient : public NetComputer } std::string characterName; - unsigned int characterId; + unsigned characterId; std::vector<ChatChannel *> channels; std::vector<Guild *> guilds; Party *party; diff --git a/src/chat-server/chathandler.h b/src/chat-server/chathandler.h index 06d72513..1a96cfbc 100644 --- a/src/chat-server/chathandler.h +++ b/src/chat-server/chathandler.h @@ -214,7 +214,7 @@ class ChatHandler : public ConnectionHandler * Finds out the name of a character by its id. Either searches it * in the list of online characters or otherwise gets it from the db. */ - unsigned int getIdOfChar(const std::string &name); + unsigned getIdOfChar(const std::string &name); /** * Sends a message to every client in a registered channel. diff --git a/src/chat-server/guildhandler.cpp b/src/chat-server/guildhandler.cpp index 949728c2..1bbe3671 100644 --- a/src/chat-server/guildhandler.cpp +++ b/src/chat-server/guildhandler.cpp @@ -350,7 +350,7 @@ void ChatHandler::handleGuildKickMember(ChatClient &client, MessageIn &msg) return; } ChatClient *otherClient = getClient(otherCharName); - unsigned int otherCharId; + unsigned otherCharId; if (otherClient) otherCharId = otherClient->characterId; else diff --git a/src/chat-server/party.h b/src/chat-server/party.h index da8755b3..18bec58d 100644 --- a/src/chat-server/party.h +++ b/src/chat-server/party.h @@ -48,19 +48,19 @@ public: /** * Return number of users in party */ - unsigned int userCount() const { return mUsers.size(); } + unsigned userCount() const { return mUsers.size(); } /** * Return the party id */ - unsigned int getId() const { return mId; } + unsigned getId() const { return mId; } const PartyUsers &getUsers() const { return mUsers; } private: PartyUsers mUsers; - unsigned int mId; + unsigned mId; }; #endif diff --git a/src/chat-server/post.cpp b/src/chat-server/post.cpp index eff5ddb3..dc1e0d1e 100644 --- a/src/chat-server/post.cpp +++ b/src/chat-server/post.cpp @@ -23,7 +23,7 @@ #include "../account-server/character.h" #include "../common/configuration.h" -Letter::Letter(unsigned int type, Character *sender, Character *receiver) +Letter::Letter(unsigned type, Character *sender, Character *receiver) : mId(0), mType(type), mSender(sender), mReceiver(receiver) { } @@ -59,7 +59,7 @@ std::string Letter::getContents() const bool Letter::addAttachment(InventoryItem item) { - unsigned int max = Configuration::getValue("mail_maxAttachments", 3); + unsigned max = Configuration::getValue("mail_maxAttachments", 3); if (mAttachments.size() > max) { return false; @@ -100,7 +100,7 @@ Post::~Post() bool Post::addLetter(Letter *letter) { - unsigned int max = Configuration::getValue("mail_maxLetters", 10); + unsigned max = Configuration::getValue("mail_maxLetters", 10); if (mLetters.size() > max) { return false; @@ -120,7 +120,7 @@ Letter* Post::getLetter(int letter) const return mLetters[letter]; } -unsigned int Post::getNumberOfLetters() const +unsigned Post::getNumberOfLetters() const { return mLetters.size(); } diff --git a/src/chat-server/post.h b/src/chat-server/post.h index c8006faa..2d0b2ae0 100644 --- a/src/chat-server/post.h +++ b/src/chat-server/post.h @@ -42,7 +42,7 @@ public: * @param sender Pointer to character that sent the letter * @param receiver Pointer to character that will receive the letter */ - Letter(unsigned int type, Character *sender, Character *receiver); + Letter(unsigned type, Character *sender, Character *receiver); ~Letter(); @@ -62,7 +62,7 @@ public: /** * Gets the type of the letter. (unused) */ - unsigned int getType() const + unsigned getType() const { return mType; } /** @@ -113,8 +113,8 @@ public: std::vector<InventoryItem> getAttachments() const; private: - unsigned int mId; - unsigned int mType; + unsigned mId; + unsigned mType; unsigned long mExpiry; std::string mContents; std::vector<InventoryItem> mAttachments; @@ -143,7 +143,7 @@ public: * Return number of letters in post * @return Returns the size of mLetters */ - unsigned int getNumberOfLetters() const; + unsigned getNumberOfLetters() const; private: std::vector<Letter*> mLetters; diff --git a/src/common/inventorydata.h b/src/common/inventorydata.h index 490abff2..b410b3fb 100644 --- a/src/common/inventorydata.h +++ b/src/common/inventorydata.h @@ -39,8 +39,8 @@ struct InventoryItem itemId(0), amount(0) {} - unsigned int itemId; - unsigned int amount; + unsigned itemId; + unsigned amount; }; struct EquipmentItem @@ -49,25 +49,25 @@ struct EquipmentItem itemId(0), itemInstance(0) {} - EquipmentItem(unsigned int itemId, unsigned int itemInstance) + EquipmentItem(unsigned itemId, unsigned itemInstance) { this->itemId = itemId; this->itemInstance = itemInstance; } // The item id taken from the item db. - unsigned int itemId; + unsigned itemId; // A unique instance number used to separate items when equipping the same // item id multiple times on possible multiple slots. - unsigned int itemInstance; + unsigned itemInstance; }; // inventory slot id -> { item } -typedef std::map< unsigned int, InventoryItem > InventoryData; +typedef std::map< unsigned, InventoryItem > InventoryData; // equip slot id -> { item id, item instance } // Equipment taking up multiple equip slot ids will be referenced multiple times -typedef std::multimap< unsigned int, EquipmentItem > EquipData; +typedef std::multimap< unsigned, EquipmentItem > EquipData; /** * Structure storing the equipment and inventory of a Player. diff --git a/src/common/transaction.h b/src/common/transaction.h index fdd0b8f7..51c373eb 100644 --- a/src/common/transaction.h +++ b/src/common/transaction.h @@ -23,8 +23,8 @@ struct Transaction { - unsigned int mAction; - unsigned int mCharacterId; + unsigned mAction; + unsigned mCharacterId; std::string mMessage; }; diff --git a/src/dal/mysqldataprovider.cpp b/src/dal/mysqldataprovider.cpp index 13036461..9f9c4a93 100644 --- a/src/dal/mysqldataprovider.cpp +++ b/src/dal/mysqldataprovider.cpp @@ -32,7 +32,7 @@ const std::string MySqlDataProvider::CFGPARAM_MYSQL_USER ="mysql_username"; const std::string MySqlDataProvider::CFGPARAM_MYSQL_PWD ="mysql_password"; const std::string MySqlDataProvider::CFGPARAM_MYSQL_HOST_DEF = "localhost"; -const unsigned int MySqlDataProvider::CFGPARAM_MYSQL_PORT_DEF = 3306; +const unsigned MySqlDataProvider::CFGPARAM_MYSQL_PORT_DEF = 3306; const std::string MySqlDataProvider::CFGPARAM_MYSQL_DB_DEF = "mana"; const std::string MySqlDataProvider::CFGPARAM_MYSQL_USER_DEF = "mana"; const std::string MySqlDataProvider::CFGPARAM_MYSQL_PWD_DEF = "mana"; @@ -84,7 +84,7 @@ void MySqlDataProvider::connect() = Configuration::getValue(CFGPARAM_MYSQL_USER, CFGPARAM_MYSQL_USER_DEF); const std::string password = Configuration::getValue(CFGPARAM_MYSQL_PWD, CFGPARAM_MYSQL_PWD_DEF); - const unsigned int tcpPort + const unsigned tcpPort = Configuration::getValue(CFGPARAM_MYSQL_PORT, CFGPARAM_MYSQL_PORT_DEF); // allocate and initialize a new MySQL object suitable @@ -158,10 +158,10 @@ const RecordSet &MySqlDataProvider::execSql(const std::string& sql, throw DbSqlQueryExecFailure(mysql_error(mDb)); // set the field names. - unsigned int nFields = mysql_num_fields(res); + unsigned nFields = mysql_num_fields(res); MYSQL_FIELD* fields = mysql_fetch_fields(res); Row fieldNames; - for (unsigned int i = 0; i < nFields; ++i) + for (unsigned i = 0; i < nFields; ++i) fieldNames.push_back(fields[i].name); mRecordSet.setColumnHeaders(fieldNames); @@ -172,7 +172,7 @@ const RecordSet &MySqlDataProvider::execSql(const std::string& sql, { Row r; - for (unsigned int i = 0; i < nFields; ++i) + for (unsigned i = 0; i < nFields; ++i) r.push_back(static_cast<char *>(row[i])); mRecordSet.add(r); @@ -411,13 +411,13 @@ const RecordSet &MySqlDataProvider::processSql() res = mysql_stmt_result_metadata(mStmt); // set the field names. - unsigned int nFields = mysql_num_fields(res); + unsigned nFields = mysql_num_fields(res); MYSQL_FIELD* fields = mysql_fetch_fields(res); Row fieldNames; resultBind = new MYSQL_BIND[mysql_num_fields(res)]; - unsigned int i = 0; + unsigned i = 0; for (i = 0; i < mysql_num_fields(res); ++i) { resultBind[i].buffer_type = MYSQL_TYPE_STRING; diff --git a/src/dal/mysqldataprovider.h b/src/dal/mysqldataprovider.h index 945b284f..6f8de3a8 100644 --- a/src/dal/mysqldataprovider.h +++ b/src/dal/mysqldataprovider.h @@ -192,7 +192,7 @@ class MySqlDataProvider: public DataProvider /** defines the default value of the CFGPARAM_MYSQL_HOST parameter */ static const std::string CFGPARAM_MYSQL_HOST_DEF; /** defines the default value of the CFGPARAM_MYSQL_PORT parameter */ - static const unsigned int CFGPARAM_MYSQL_PORT_DEF; + static const unsigned CFGPARAM_MYSQL_PORT_DEF; /** defines the default value of the CFGPARAM_MYSQL_DB parameter */ static const std::string CFGPARAM_MYSQL_DB_DEF; /** defines the default value of the CFGPARAM_MYSQL_USER parameter */ diff --git a/src/dal/pqdataprovider.cpp b/src/dal/pqdataprovider.cpp index 58959129..34dd5486 100644 --- a/src/dal/pqdataprovider.cpp +++ b/src/dal/pqdataprovider.cpp @@ -100,22 +100,22 @@ const RecordSet &PqDataProvider::execSql(const std::string& sql, } // get field count - unsigned int nFields = PQnfields(res); + unsigned nFields = PQnfields(res); // fill column names Row fieldNames; - for (unsigned int i = 0; i < nFields; i++) + for (unsigned i = 0; i < nFields; i++) { fieldNames.push_back(PQfname(res, i)); } mRecordSet.setColumnHeaders(fieldNames); // fill rows - for (unsigned int r = 0; r < PQntuples(res); r++) + for (unsigned r = 0; r < PQntuples(res); r++) { Row row; - for (unsigned int i = 0; i < nFields; i++) + for (unsigned i = 0; i < nFields; i++) row.push_back(PQgetvalue(res, r, i)); mRecordSet.add(row); diff --git a/src/dal/recordset.cpp b/src/dal/recordset.cpp index 065bbd77..0529325f 100644 --- a/src/dal/recordset.cpp +++ b/src/dal/recordset.cpp @@ -61,7 +61,7 @@ bool RecordSet::isEmpty() const * * @return the number of rows. */ -unsigned int RecordSet::rows() const +unsigned RecordSet::rows() const { return mRows.size(); } @@ -71,7 +71,7 @@ unsigned int RecordSet::rows() const * * @return the number of columns. */ -unsigned int RecordSet::cols() const +unsigned RecordSet::cols() const { return mHeaders.size(); } @@ -93,7 +93,7 @@ void RecordSet::setColumnHeaders(const Row &headers) */ void RecordSet::add(const Row &row) { - const unsigned int nCols = mHeaders.size(); + const unsigned nCols = mHeaders.size(); if (nCols == 0) { throw RsColumnHeadersNotSet(); @@ -110,8 +110,8 @@ void RecordSet::add(const Row &row) mRows.push_back(row); } -const std::string &RecordSet::operator()(const unsigned int row, - const unsigned int col) const +const std::string &RecordSet::operator()(const unsigned row, + const unsigned col) const { if ((row >= mRows.size()) || (col >= mHeaders.size())) { std::ostringstream os; @@ -125,7 +125,7 @@ const std::string &RecordSet::operator()(const unsigned int row, return mRows[row][col]; } -const std::string &RecordSet::operator()(const unsigned int row, +const std::string &RecordSet::operator()(const unsigned row, const std::string& name) const { if (row >= mRows.size()) { @@ -147,8 +147,8 @@ const std::string &RecordSet::operator()(const unsigned int row, } // find the field index. - const unsigned int nCols = mHeaders.size(); - unsigned int i; + const unsigned nCols = mHeaders.size(); + unsigned i; for (i = 0; i < nCols; ++i) { if (mHeaders[i] == name) { break; diff --git a/src/dal/recordset.h b/src/dal/recordset.h index 80c2e68f..91b434de 100644 --- a/src/dal/recordset.h +++ b/src/dal/recordset.h @@ -67,14 +67,14 @@ class RecordSet * * @return the number of rows. */ - unsigned int rows() const; + unsigned rows() const; /** * Get the number of columns. * * @return the number of columns. */ - unsigned int cols() const; + unsigned cols() const; /** * Set the column headers. @@ -115,8 +115,8 @@ class RecordSet * @exception std::invalid_argument if the recordset is empty. */ const std::string& - operator()(const unsigned int row, - const unsigned int col) const; + operator()(const unsigned row, + const unsigned col) const; /** @@ -134,7 +134,7 @@ class RecordSet * the recordset is empty. */ const std::string& - operator()(const unsigned int row, + operator()(const unsigned row, const std::string &name) const; diff --git a/src/game-server/attribute.cpp b/src/game-server/attribute.cpp index 31d743f4..3d0f5510 100644 --- a/src/game-server/attribute.cpp +++ b/src/game-server/attribute.cpp @@ -133,7 +133,7 @@ bool durationCompare(const AttributeModifierState *lhs, return lhs->mDuration < rhs->mDuration; } -bool AttributeModifiersEffect::remove(double value, unsigned int id, +bool AttributeModifiersEffect::remove(double value, unsigned id, bool fullCheck) { /* We need to find and check this entry exists, and erase the entry @@ -249,7 +249,7 @@ bool AttributeModifiersEffect::recalculateModifiedValue(double newPrevLayerValue bool Attribute::add(unsigned short duration, double value, - unsigned int layer, int level) + unsigned layer, int level) { assert(mMods.size() > layer); LOG_DEBUG("Adding modifier to attribute with duration " << duration << @@ -277,7 +277,7 @@ bool Attribute::add(unsigned short duration, double value, return false; } -bool Attribute::remove(double value, unsigned int layer, +bool Attribute::remove(double value, unsigned layer, int lvl, bool fullcheck) { assert(mMods.size() > layer); @@ -321,7 +321,7 @@ Attribute::Attribute(const AttributeManager::AttributeInfo &info): const std::vector<AttributeModifier> &modifiers = info.modifiers; LOG_DEBUG("Construction of new attribute with '" << modifiers.size() << "' layers."); - for (unsigned int i = 0; i < modifiers.size(); ++i) + for (unsigned i = 0; i < modifiers.size(); ++i) { LOG_DEBUG("Adding layer with stackable type " << modifiers[i].stackableType diff --git a/src/game-server/attribute.h b/src/game-server/attribute.h index 046c8f63..8c8d3b8e 100644 --- a/src/game-server/attribute.h +++ b/src/game-server/attribute.h @@ -31,7 +31,7 @@ class AttributeModifierState public: AttributeModifierState(unsigned short duration, double value, - unsigned int id) + unsigned id) : mDuration(duration) , mValue(value) , mId(id) @@ -48,7 +48,7 @@ class AttributeModifierState * dispells or similar. Exact usage depends on the effect, * origin, etc. */ - const unsigned int mId; + const unsigned mId; friend bool durationCompare(const AttributeModifierState*, const AttributeModifierState*); friend class AttributeModifiersEffect; @@ -75,7 +75,7 @@ class AttributeModifiersEffect /** * remove() - as with Attribute::remove(). */ - bool remove(double value, unsigned int id, bool fullCheck); + bool remove(double value, unsigned id, bool fullCheck); /** * Performs the necessary modifications to mMod when the states change. @@ -160,7 +160,7 @@ class Attribute * @param id Used to identify this effect. * @return Whether the modified attribute value was changed. */ - bool add(unsigned short duration, double value, unsigned int layer, int id = 0); + bool add(unsigned short duration, double value, unsigned layer, int id = 0); /** * @param value The value of the modifier to be removed. @@ -174,7 +174,7 @@ class Attribute * or only those that are otherwise permanent (ie. duration of 0) * @returns Whether the modified attribute value was changed. */ - bool remove(double value, unsigned int layer, int id, bool fullcheck); + bool remove(double value, unsigned layer, int id, bool fullcheck); /** * clearMods() removes *all* modifications present in this Attribute (!) diff --git a/src/game-server/attributemanager.cpp b/src/game-server/attributemanager.cpp index 3a70fd9a..018de28e 100644 --- a/src/game-server/attributemanager.cpp +++ b/src/game-server/attributemanager.cpp @@ -33,7 +33,7 @@ void AttributeManager::reload() { mTagMap.clear(); mAttributeMap.clear(); - for (unsigned int i = 0; i < MaxScope; ++i) + for (unsigned i = 0; i < MaxScope; ++i) mAttributeScopes[i].clear(); readAttributesFile(); @@ -43,11 +43,11 @@ void AttributeManager::reload() << ", NonStackableBonus is " << NonStackableBonus << "."); LOG_DEBUG("Additive is " << Additive << ", Multiplicative is " << Multiplicative << "."); const std::string *tag; - unsigned int count = 0; + unsigned count = 0; for (AttributeMap::const_iterator i = mAttributeMap.begin(); i != mAttributeMap.end(); ++i) { - unsigned int lCount = 0; + unsigned lCount = 0; LOG_DEBUG(" "<<i->first<<" : "); for (std::vector<AttributeModifier>::const_iterator j = i->second.modifiers.begin(); diff --git a/src/game-server/being.cpp b/src/game-server/being.cpp index 2064cfc5..ea7540ca 100644 --- a/src/game-server/being.cpp +++ b/src/game-server/being.cpp @@ -497,22 +497,22 @@ void Being::setAction(BeingAction action) } } -void Being::applyModifier(unsigned int attr, double value, unsigned int layer, - unsigned int duration, unsigned int id) +void Being::applyModifier(unsigned attr, double value, unsigned layer, + unsigned duration, unsigned id) { mAttributes.at(attr).add(duration, value, layer, id); updateDerivedAttributes(attr); } -bool Being::removeModifier(unsigned int attr, double value, unsigned int layer, - unsigned int id, bool fullcheck) +bool Being::removeModifier(unsigned attr, double value, unsigned layer, + unsigned id, bool fullcheck) { bool ret = mAttributes.at(attr).remove(value, layer, id, fullcheck); updateDerivedAttributes(attr); return ret; } -void Being::setAttribute(unsigned int id, double value) +void Being::setAttribute(unsigned id, double value) { AttributeMap::iterator ret = mAttributes.find(id); if (ret == mAttributes.end()) @@ -532,7 +532,7 @@ void Being::setAttribute(unsigned int id, double value) } } -double Being::getAttribute(unsigned int id) const +double Being::getAttribute(unsigned id) const { AttributeMap::const_iterator ret = mAttributes.find(id); if (ret == mAttributes.end()) @@ -545,7 +545,7 @@ double Being::getAttribute(unsigned int id) const } -double Being::getModifiedAttribute(unsigned int id) const +double Being::getModifiedAttribute(unsigned id) const { AttributeMap::const_iterator ret = mAttributes.find(id); if (ret == mAttributes.end()) @@ -557,14 +557,14 @@ double Being::getModifiedAttribute(unsigned int id) const return ret->second.getModifiedAttribute(); } -void Being::setModAttribute(unsigned int, double) +void Being::setModAttribute(unsigned, double) { // No-op to satisfy shared structure. // The game-server calculates this manually. return; } -bool Being::recalculateBaseAttribute(unsigned int attr) +bool Being::recalculateBaseAttribute(unsigned attr) { LOG_DEBUG("Being: Received update attribute recalculation request for " << attr << "."); @@ -614,7 +614,7 @@ bool Being::recalculateBaseAttribute(unsigned int attr) return false; } -void Being::updateDerivedAttributes(unsigned int attr) +void Being::updateDerivedAttributes(unsigned attr) { LOG_DEBUG("Being: Updating derived attribute(s) of: " << attr); switch (attr) diff --git a/src/game-server/being.h b/src/game-server/being.h index eee81470..0083be1f 100644 --- a/src/game-server/being.h +++ b/src/game-server/being.h @@ -36,7 +36,7 @@ class Being; class MapComposite; class StatusEffect; -typedef std::map< unsigned int, Attribute > AttributeMap; +typedef std::map< unsigned, Attribute > AttributeMap; struct Status { @@ -49,7 +49,7 @@ typedef std::map< int, Status > StatusEffects; /** * Type definition for a list of hits */ -typedef std::vector<unsigned int> Hits; +typedef std::vector<unsigned> Hits; /** * Generic being (living actor). Keeps direction, destination and a few other @@ -192,31 +192,31 @@ class Being : public Actor /** * Sets an attribute. */ - void setAttribute(unsigned int id, double value); + void setAttribute(unsigned id, double value); /** * Gets an attribute. */ - double getAttribute(unsigned int id) const; + double getAttribute(unsigned id) const; /** * Gets an attribute after applying modifiers. */ - double getModifiedAttribute(unsigned int id) const; + double getModifiedAttribute(unsigned id) const; /** * No-op to satisfy shared structure. * @note The game server calculates this manually, so nothing happens * here. */ - void setModAttribute(unsigned int, double); + void setModAttribute(unsigned, double); /** * Checks whether or not an attribute exists in this being. * @returns True if the attribute is present in the being, false otherwise. */ - bool checkAttributeExists(unsigned int id) const + bool checkAttributeExists(unsigned id) const { return mAttributes.count(id); } /** @@ -226,11 +226,11 @@ class Being : public Actor * @param lvl If non-zero, indicates that a temporary modifier can be * dispelled prematuraly by a spell of given level. */ - void applyModifier(unsigned int attr, double value, unsigned int layer, - unsigned int duration = 0, unsigned int id = 0); + void applyModifier(unsigned attr, double value, unsigned layer, + unsigned duration = 0, unsigned id = 0); - bool removeModifier(unsigned int attr, double value, unsigned int layer, - unsigned int id = 0, bool fullcheck = false); + bool removeModifier(unsigned attr, double value, unsigned layer, + unsigned id = 0, bool fullcheck = false); /** * Called when an attribute modifier is changed. @@ -238,14 +238,14 @@ class Being : public Actor * attributes if it has changed. * @returns Whether it was changed. */ - virtual bool recalculateBaseAttribute(unsigned int); + virtual bool recalculateBaseAttribute(unsigned); /** * Attribute has changed, recalculate base value of dependant * attributes (and handle other actions for the modified * attribute) */ - virtual void updateDerivedAttributes(unsigned int); + virtual void updateDerivedAttributes(unsigned); /** * Sets a statuseffect on this being diff --git a/src/game-server/buysell.cpp b/src/game-server/buysell.cpp index 78c2bfe0..1a0d8d91 100644 --- a/src/game-server/buysell.cpp +++ b/src/game-server/buysell.cpp @@ -76,7 +76,7 @@ int BuySell::registerPlayerItems() for (InventoryData::const_iterator it = inventoryData.begin(), it_end = inventoryData.end(); it != it_end; ++it) { - unsigned int nb = it->second.amount; + unsigned nb = it->second.amount; if (!nb) continue; diff --git a/src/game-server/buysell.h b/src/game-server/buysell.h index 506dc8ad..38566005 100644 --- a/src/game-server/buysell.h +++ b/src/game-server/buysell.h @@ -76,7 +76,7 @@ class BuySell typedef std::vector< TradedItem > TradedItems; /** The attribute ID of the currency to use. Hardcoded for now (FIXME) */ - unsigned int mCurrencyId; + unsigned mCurrencyId; Character *mChar; /**< Character involved. */ TradedItems mItems; /**< Traded items. */ diff --git a/src/game-server/character.cpp b/src/game-server/character.cpp index 5d96cab5..15ba940a 100644 --- a/src/game-server/character.cpp +++ b/src/game-server/character.cpp @@ -465,7 +465,7 @@ void Character::modifiedAllAttribute() } } -bool Character::recalculateBaseAttribute(unsigned int attr) +bool Character::recalculateBaseAttribute(unsigned attr) { /* * `attr' may or may not have changed. Recalculate the base value. @@ -524,7 +524,7 @@ bool Character::recalculateBaseAttribute(unsigned int attr) return false; } -void Character::updateDerivedAttributes(unsigned int attr) +void Character::updateDerivedAttributes(unsigned attr) { /* * `attr' has changed, perform updates accordingly. diff --git a/src/game-server/character.h b/src/game-server/character.h index 11762291..5f3d3a64 100644 --- a/src/game-server/character.h +++ b/src/game-server/character.h @@ -45,22 +45,22 @@ class Trade; struct SpecialValue { - SpecialValue(unsigned int currentMana, + SpecialValue(unsigned currentMana, const SpecialManager::SpecialInfo *specialInfo) : currentMana(currentMana) , rechargeSpeed(specialInfo->defaultRechargeSpeed) , specialInfo(specialInfo) {} - unsigned int currentMana; - unsigned int rechargeSpeed; + unsigned currentMana; + unsigned rechargeSpeed; const SpecialManager::SpecialInfo *specialInfo; }; /** * Stores specials by their id. */ -typedef std::map<unsigned int, SpecialValue> SpecialMap; +typedef std::map<unsigned, SpecialValue> SpecialMap; /** * The representation of a player's character in the game world. @@ -255,14 +255,14 @@ class Character : public Being * attributes if it has changed. * @returns Whether it was changed. */ - bool recalculateBaseAttribute(unsigned int); + bool recalculateBaseAttribute(unsigned); /** * Attribute has changed, recalculate base value of dependant * attributes (and handle other actions for the modified * attribute) */ - void updateDerivedAttributes(unsigned int); + void updateDerivedAttributes(unsigned); /** * Calls all the "disconnected" listener. diff --git a/src/game-server/commandhandler.cpp b/src/game-server/commandhandler.cpp index b48f1188..6de22242 100644 --- a/src/game-server/commandhandler.cpp +++ b/src/game-server/commandhandler.cpp @@ -177,7 +177,7 @@ static void say(const std::string message, Character *player) } /* -static bool checkPermission(Character *player, unsigned int permissions) +static bool checkPermission(Character *player, unsigned permissions) { if (player->getAccountLevel() & permissions) { @@ -196,7 +196,7 @@ static bool checkPermission(Character *player, unsigned int permissions) static std::string playerRights(Character *ch) { std::stringstream str; - str << (unsigned int)ch->getAccountLevel(); + str << (unsigned)ch->getAccountLevel(); str << " ( "; std::list<std::string> classes = PermissionManager::getClassList(ch); diff --git a/src/game-server/gamehandler.cpp b/src/game-server/gamehandler.cpp index 8dde8d9a..114e65b7 100644 --- a/src/game-server/gamehandler.cpp +++ b/src/game-server/gamehandler.cpp @@ -43,7 +43,7 @@ #include "utils/logger.h" #include "utils/tokendispenser.h" -const unsigned int TILES_TO_BE_NEAR = 7; +const unsigned TILES_TO_BE_NEAR = 7; GameHandler::GameHandler(): mTokenCollector(this) diff --git a/src/game-server/inventory.cpp b/src/game-server/inventory.cpp index 532b3f42..0eddfd04 100644 --- a/src/game-server/inventory.cpp +++ b/src/game-server/inventory.cpp @@ -68,7 +68,7 @@ void Inventory::initialize() /* * Construct a set of item Ids to keep track of duplicate item Ids. */ - std::set<unsigned int> itemIds; + std::set<unsigned> itemIds; /* * Construct a set of itemIds to keep track of duplicate itemIds. @@ -136,19 +136,19 @@ void Inventory::initialize() } } -unsigned int Inventory::getItem(unsigned int slot) const +unsigned Inventory::getItem(unsigned slot) const { InventoryData::iterator item = mPoss->inventory.find(slot); return item != mPoss->inventory.end() ? item->second.itemId : 0; } -unsigned int Inventory::insert(unsigned int itemId, unsigned int amount) +unsigned Inventory::insert(unsigned itemId, unsigned amount) { if (!itemId || !amount) return 0; MessageOut invMsg(GPMSG_INVENTORY); - unsigned int maxPerSlot = itemManager->getItem(itemId)->getMaxPerSlot(); + unsigned maxPerSlot = itemManager->getItem(itemId)->getMaxPerSlot(); LOG_DEBUG("Inventory: Inserting " << amount << " item(s) Id: " << itemId << " for character '" << mCharacter->getName() << "'."); @@ -217,10 +217,10 @@ unsigned int Inventory::insert(unsigned int itemId, unsigned int amount) return amount; } -unsigned int Inventory::count(unsigned int itemId, +unsigned Inventory::count(unsigned itemId, bool inInventory, bool inEquipment) const { - unsigned int nb = 0; + unsigned nb = 0; if (inInventory) { for (InventoryData::iterator it = mPoss->inventory.begin(), @@ -248,7 +248,7 @@ unsigned int Inventory::count(unsigned int itemId, return nb; } -int Inventory::getFirstSlot(unsigned int itemId) +int Inventory::getFirstSlot(unsigned itemId) { for (InventoryData::iterator it = mPoss->inventory.begin(), it_end = mPoss->inventory.end(); it != it_end; ++it) @@ -257,7 +257,7 @@ int Inventory::getFirstSlot(unsigned int itemId) return -1; } -unsigned int Inventory::remove(unsigned int itemId, unsigned int amount) +unsigned Inventory::remove(unsigned itemId, unsigned amount) { if (!itemId || !amount) return amount; @@ -276,7 +276,7 @@ unsigned int Inventory::remove(unsigned int itemId, unsigned int amount) { if (amount) { - unsigned int sub = std::min(amount, it->second.amount); + unsigned sub = std::min(amount, it->second.amount); amount -= sub; it->second.amount -= sub; invMsg.writeInt16(it->first); @@ -319,8 +319,8 @@ unsigned int Inventory::remove(unsigned int itemId, unsigned int amount) return amount; } -unsigned int Inventory::move(unsigned int slot1, unsigned int slot2, - unsigned int amount) +unsigned Inventory::move(unsigned slot1, unsigned slot2, + unsigned amount) { LOG_DEBUG(amount << " item(s) requested to move from: " << slot1 << " to " << slot2 << " for character: '" << mCharacter->getName() << "'."); @@ -337,7 +337,7 @@ unsigned int Inventory::move(unsigned int slot1, unsigned int slot2, MessageOut invMsg(GPMSG_INVENTORY); - unsigned int nb = std::min(amount, it1->second.amount); + unsigned nb = std::min(amount, it1->second.amount); if (it2 == inv_end) { // Slot2 does not yet exist. @@ -350,7 +350,7 @@ unsigned int Inventory::move(unsigned int slot1, unsigned int slot2, amount -= nb; //Save the itemId in case of deletion of the iterator - unsigned int itemId = it1->second.itemId; + unsigned itemId = it1->second.itemId; invMsg.writeInt16(slot1); // Slot if (it1->second.amount) { @@ -380,8 +380,8 @@ unsigned int Inventory::move(unsigned int slot1, unsigned int slot2, // and when all the amount of slot 1 is moving onto slot 2. if (amount >= it1->second.amount) { - unsigned int itemId = it1->second.itemId; - unsigned int amount = it1->second.amount; + unsigned itemId = it1->second.itemId; + unsigned amount = it1->second.amount; it1->second.itemId = it2->second.itemId; it1->second.amount = it2->second.amount; it2->second.itemId = itemId; @@ -443,7 +443,7 @@ unsigned int Inventory::move(unsigned int slot1, unsigned int slot2, return amount; } -unsigned int Inventory::removeFromSlot(unsigned int slot, unsigned int amount) +unsigned Inventory::removeFromSlot(unsigned slot, unsigned amount) { InventoryData::iterator it = mPoss->inventory.find(slot); @@ -474,7 +474,7 @@ unsigned int Inventory::removeFromSlot(unsigned int slot, unsigned int amount) if (!exists && it->second.itemId) lastSlotOfItemRemaining = true; - unsigned int sub = std::min(amount, it->second.amount); + unsigned sub = std::min(amount, it->second.amount); amount -= sub; it->second.amount -= sub; invMsg.writeInt16(it->first); @@ -503,7 +503,7 @@ unsigned int Inventory::removeFromSlot(unsigned int slot, unsigned int amount) } -void Inventory::updateEquipmentTrigger(unsigned int oldId, unsigned int newId) +void Inventory::updateEquipmentTrigger(unsigned oldId, unsigned newId) { if (!oldId && !newId) return; @@ -525,7 +525,7 @@ void Inventory::updateEquipmentTrigger(ItemClass *oldI, ItemClass *newI) newI->useTrigger(mCharacter, ITT_EQUIP); } -unsigned int Inventory::getNewEquipItemInstance() +unsigned Inventory::getNewEquipItemInstance() { std::set<int> alreadyUsed; for (EquipData::const_iterator it = mPoss->equipSlots.begin(); @@ -534,15 +534,15 @@ unsigned int Inventory::getNewEquipItemInstance() alreadyUsed.insert(it->second.itemInstance); } - unsigned int itemInstance = 1; + unsigned itemInstance = 1; while (alreadyUsed.count(itemInstance)) itemInstance++; return itemInstance; } -bool Inventory::checkEquipmentCapacity(unsigned int equipmentSlot, - unsigned int capacityRequested) +bool Inventory::checkEquipmentCapacity(unsigned equipmentSlot, + unsigned capacityRequested) { int capacity = itemManager->getEquipSlotCapacity(equipmentSlot); @@ -596,7 +596,7 @@ bool Inventory::equip(int inventorySlot) } // List of potential unique itemInstances to unequip first. - std::set<unsigned int> equipInstancesToUnequipFirst; + std::set<unsigned> equipInstancesToUnequipFirst; // We first check the equipment slots for: // - 1. whether enough total equip slot space is available. @@ -643,7 +643,7 @@ bool Inventory::equip(int inventorySlot) } // Potential Pre-unequipment process - for (std::set<unsigned int>::const_iterator it3 = + for (std::set<unsigned>::const_iterator it3 = equipInstancesToUnequipFirst.begin(); it3 != equipInstancesToUnequipFirst.end(); ++it3) { @@ -666,8 +666,8 @@ bool Inventory::equip(int inventorySlot) // Compute an unique equip item Instance id (unicity is per character only.) int itemInstance = getNewEquipItemInstance(); - unsigned int capacityLeft = equipReq.capacityRequired; - unsigned int capacityUsed = 0; + unsigned capacityLeft = equipReq.capacityRequired; + unsigned capacityUsed = 0; // Apply equipment changes for (EquipData::iterator it4 = mPoss->equipSlots.begin(), it4_end = mPoss->equipSlots.end(); it4 != it4_end; ++it4) @@ -697,7 +697,7 @@ bool Inventory::equip(int inventorySlot) // Hence, we add them back if(capacityLeft) { - unsigned int maxCapacity = + unsigned maxCapacity = itemManager->getEquipSlotCapacity(equipReq.equipSlotId); // A should never happen case @@ -707,7 +707,7 @@ bool Inventory::equip(int inventorySlot) { EquipmentItem equipItem(it->second.itemId, itemInstance); mPoss->equipSlots.insert( - std::make_pair<unsigned int, EquipmentItem> + std::make_pair<unsigned, EquipmentItem> (equipReq.equipSlotId, equipItem)); --capacityLeft; } @@ -734,7 +734,7 @@ bool Inventory::equip(int inventorySlot) return true; } -unsigned int Inventory::getSlotItemInstance(unsigned int slot) +unsigned Inventory::getSlotItemInstance(unsigned slot) { EquipData::iterator it = mPoss->equipSlots.find(slot); if (it != mPoss->equipSlots.end()) @@ -742,7 +742,7 @@ unsigned int Inventory::getSlotItemInstance(unsigned int slot) return 0; } -bool Inventory::unequipItem(unsigned int itemId) +bool Inventory::unequipItem(unsigned itemId) { std::set<unsigned> itemInstances; for (EquipData::iterator it = mPoss->equipSlots.begin(), @@ -765,14 +765,14 @@ bool Inventory::unequipItem(unsigned int itemId) return true; } -bool Inventory::unequip(unsigned int itemInstance) +bool Inventory::unequip(unsigned itemInstance) { if (!itemInstance) return false; // The itemId to unequip - unsigned int itemId = 0; - unsigned int slotTypeId = 0; + unsigned itemId = 0; + unsigned slotTypeId = 0; bool addedToInventory = false; @@ -821,7 +821,7 @@ bool Inventory::unequip(unsigned int itemInstance) return true; } -void Inventory::checkLookchanges(unsigned int slotTypeId) +void Inventory::checkLookchanges(unsigned slotTypeId) { if (itemManager->isEquipSlotVisible(slotTypeId)) mCharacter->raiseUpdateFlags(UPDATEFLAG_LOOKSCHANGE); diff --git a/src/game-server/inventory.h b/src/game-server/inventory.h index 3dacb919..42856bff 100644 --- a/src/game-server/inventory.h +++ b/src/game-server/inventory.h @@ -70,64 +70,64 @@ class Inventory * @returns whether all item id could be unequipped. * @note returns true when no item with given ids were equipped. */ - bool unequipItem(unsigned int itemId); + bool unequipItem(unsigned itemId); /** * Unequips item from given equipment slot. * @param itemInstance The item instance id used to know what to unequip * @returns Whether it was unequipped. */ - bool unequip(unsigned int itemInstance); + bool unequip(unsigned itemInstance); /** * Gets the item instance from the given equipment slot. * Return 0 if none. */ - unsigned int getSlotItemInstance(unsigned int slot); + unsigned getSlotItemInstance(unsigned slot); /** * Inserts some items into the inventory. * @return number of items not inserted (to be dropped on floor?). */ - unsigned int insert(unsigned int itemId, unsigned int amount); + unsigned insert(unsigned itemId, unsigned amount); /** * Removes some items from inventory. * @return number of items not removed. */ - unsigned int remove(unsigned int itemId, unsigned int amount); + unsigned remove(unsigned itemId, unsigned amount); /** * Moves some items from the first slot to the second one. * @returns number of items not moved. */ - unsigned int move(unsigned int slot1, unsigned int slot2, - unsigned int amount); + unsigned move(unsigned slot1, unsigned slot2, + unsigned amount); /** * Removes some items from inventory. * @return number of items not removed. */ - unsigned int removeFromSlot(unsigned int slot, unsigned int amount); + unsigned removeFromSlot(unsigned slot, unsigned amount); /** * Counts number of items with given Id. * @param inInventory Search in player's inventory. * @param inEquipment Search in player's equipment. */ - unsigned int count(unsigned int itemId, bool inInventory = true, + unsigned count(unsigned itemId, bool inInventory = true, bool inEquipment = true) const; /** * Gets the ID of the items in a given slot. */ - unsigned int getItem(unsigned int slot) const; + unsigned getItem(unsigned slot) const; /** * Returns the first inventory slot with the given item Id. * Returns -1 otherwise. */ - int getFirstSlot(unsigned int itemId); + int getFirstSlot(unsigned itemId); private: /** @@ -135,15 +135,15 @@ class Inventory * @param equipmentSlot the slot in equipement to check. * @param capacityRequested the capacity needed. */ - bool checkEquipmentCapacity(unsigned int equipmentSlot, - unsigned int capacityRequested); + bool checkEquipmentCapacity(unsigned equipmentSlot, + unsigned capacityRequested); /** * Test whether the inventory has enough space to welcome * the willing-to-be equipment slot. * @todo */ - bool hasInventoryEnoughSpace(unsigned int /* equipmentSlot */) + bool hasInventoryEnoughSpace(unsigned /* equipmentSlot */) { return true; } /** @@ -151,14 +151,14 @@ class Inventory * This is especially useful for scripted equipment. * @todo */ - bool testUnequipScriptRequirements(unsigned int /* equipementSlot */) + bool testUnequipScriptRequirements(unsigned /* equipementSlot */) { return true; } /** * Test the items equipment for scripted requirements. * @todo */ - bool testEquipScriptRequirements(unsigned int /* itemId */) + bool testEquipScriptRequirements(unsigned /* itemId */) { return true; } /** @@ -167,7 +167,7 @@ class Inventory * This is used to differenciate some items that can be equipped * multiple times, like one-handed weapons for instance. */ - unsigned int getNewEquipItemInstance(); + unsigned getNewEquipItemInstance(); /** * Check the inventory is within the slot limit and capacity. @@ -179,12 +179,12 @@ class Inventory /** * Check potential visible character sprite changes. */ - void checkLookchanges(unsigned int slotTypeId); + void checkLookchanges(unsigned slotTypeId); /** * Apply equipment triggers. */ - void updateEquipmentTrigger(unsigned int oldId, unsigned int itemId); + void updateEquipmentTrigger(unsigned oldId, unsigned itemId); void updateEquipmentTrigger(ItemClass *oldI, ItemClass *newI); Possessions *mPoss; /**< Pointer to the modified possessions. */ diff --git a/src/game-server/item.h b/src/game-server/item.h index 7004a2d8..eddc2dad 100644 --- a/src/game-server/item.h +++ b/src/game-server/item.h @@ -37,7 +37,7 @@ struct ItemEquipRequirement { capacityRequired(0) {} - unsigned int equipSlotId, capacityRequired; + unsigned equipSlotId, capacityRequired; }; /** @@ -110,8 +110,8 @@ class ItemEffectInfo class ItemEffectAttrMod : public ItemEffectInfo { public: - ItemEffectAttrMod(unsigned int attrId, unsigned int layer, double value, - unsigned int id, unsigned int duration = 0) : + ItemEffectAttrMod(unsigned attrId, unsigned layer, double value, + unsigned id, unsigned duration = 0) : mAttributeId(attrId), mAttributeLayer(layer), mMod(value), mDuration(duration), mId(id) {} @@ -120,11 +120,11 @@ class ItemEffectAttrMod : public ItemEffectInfo void dispell(Being *itemUser); private: - unsigned int mAttributeId; - unsigned int mAttributeLayer; + unsigned mAttributeId; + unsigned mAttributeLayer; double mMod; - unsigned int mDuration; - unsigned int mId; + unsigned mDuration; + unsigned mId; }; class ItemEffectAttack : public ItemEffectInfo @@ -178,7 +178,7 @@ class ItemEffectScript : public ItemEffectInfo class ItemClass { public: - ItemClass(int id, unsigned int maxperslot): + ItemClass(int id, unsigned maxperslot): mDatabaseID(id), mName("unnamed"), mSpriteID(0), @@ -215,7 +215,7 @@ class ItemClass /** * Gets max item per slot. */ - unsigned int getMaxPerSlot() const + unsigned getMaxPerSlot() const { return mMaxPerSlot; } bool hasTrigger(ItemTriggerType id) @@ -273,7 +273,7 @@ class ItemClass unsigned short mSpriteID; unsigned short mCost; /**< Unit cost the item. */ /** Max item amount per slot in inventory. */ - unsigned int mMaxPerSlot; + unsigned mMaxPerSlot; std::multimap< ItemTriggerType, ItemEffectInfo * > mEffects; std::multimap< ItemTriggerType, ItemEffectInfo * > mDispells; diff --git a/src/game-server/itemmanager.cpp b/src/game-server/itemmanager.cpp index 946815ad..4837ce98 100644 --- a/src/game-server/itemmanager.cpp +++ b/src/game-server/itemmanager.cpp @@ -54,7 +54,7 @@ void ItemManager::deinitialize() delete i->second; } - for (std::map< unsigned int, EquipSlotInfo* >::iterator it = + for (std::map< unsigned, EquipSlotInfo* >::iterator it = mEquipSlotsInfo.begin(), it_end = mEquipSlotsInfo.end(); it != it_end; ++it) { @@ -76,24 +76,24 @@ ItemClass *ItemManager::getItemByName(const std::string &name) const return mItemClassesByName.value(name); } -unsigned int ItemManager::getDatabaseVersion() const +unsigned ItemManager::getDatabaseVersion() const { return mItemDatabaseVersion; } -unsigned int ItemManager::getEquipSlotIdFromName(const std::string &name) const +unsigned ItemManager::getEquipSlotIdFromName(const std::string &name) const { EquipSlotInfo *slotInfo = mNamedEquipSlotsInfo.value(name); return slotInfo ? slotInfo->slotId : 0; } -unsigned int ItemManager::getEquipSlotCapacity(unsigned int id) const +unsigned ItemManager::getEquipSlotCapacity(unsigned id) const { EquipSlotsInfo::const_iterator i = mEquipSlotsInfo.find(id); return i != mEquipSlotsInfo.end() ? i->second->slotCapacity : 0; } -bool ItemManager::isEquipSlotVisible(unsigned int id) const +bool ItemManager::isEquipSlotVisible(unsigned id) const { EquipSlotsInfo::const_iterator i = mEquipSlotsInfo.find(id); return i != mEquipSlotsInfo.end() ? i->second->visibleSlot : false; @@ -160,7 +160,7 @@ void ItemManager::readEquipSlotsFile() EquipSlotInfo *equipSlotInfo = new EquipSlotInfo(slotId, name, capacity, visible); mEquipSlotsInfo.insert( - std::make_pair<unsigned int, EquipSlotInfo*>(slotId, equipSlotInfo)); + std::make_pair<unsigned, EquipSlotInfo*>(slotId, equipSlotInfo)); mNamedEquipSlotsInfo.insert(name, equipSlotInfo); totalCapacity += capacity; @@ -222,7 +222,7 @@ void ItemManager::readItemNode(xmlNodePtr itemNode) return; } - unsigned int maxPerSlot = XML::getProperty(itemNode, "max-per-slot", 0); + unsigned maxPerSlot = XML::getProperty(itemNode, "max-per-slot", 0); if (!maxPerSlot) { LOG_WARN("Item Manager: Missing max-per-slot property for " @@ -373,7 +373,7 @@ void ItemManager::readEffectNode(xmlNodePtr effectNode, ItemClass *item) "but no attribute specified!"); continue; } - unsigned int duration = XML::getProperty(subNode, + unsigned duration = XML::getProperty(subNode, "duration", 0); ModifierLocation location = attributeManager->getLocation(tag); diff --git a/src/game-server/itemmanager.h b/src/game-server/itemmanager.h index cc4fb0ae..6a1f459b 100644 --- a/src/game-server/itemmanager.h +++ b/src/game-server/itemmanager.h @@ -36,14 +36,14 @@ struct EquipSlotInfo slotId(0), slotCapacity(0), visibleSlot(false) {} - EquipSlotInfo(unsigned int id, const std::string &name, - unsigned int capacity, bool visible): + EquipSlotInfo(unsigned id, const std::string &name, + unsigned capacity, bool visible): slotId(id), slotName(name), slotCapacity(capacity), visibleSlot(visible) {} - unsigned int slotId; + unsigned slotId; std::string slotName; - unsigned int slotCapacity; + unsigned slotCapacity; bool visibleSlot; }; @@ -92,16 +92,16 @@ class ItemManager /** * Gets the version of the loaded item database. */ - unsigned int getDatabaseVersion() const; + unsigned getDatabaseVersion() const; - unsigned int getEquipSlotIdFromName(const std::string &name) const; + unsigned getEquipSlotIdFromName(const std::string &name) const; - unsigned int getEquipSlotCapacity(unsigned int id) const; + unsigned getEquipSlotCapacity(unsigned id) const; - unsigned int getVisibleEquipSlotCount() const + unsigned getVisibleEquipSlotCount() const { return mVisibleEquipSlotCount; } - bool isEquipSlotVisible(unsigned int id) const; + bool isEquipSlotVisible(unsigned id) const; private: /** Loads the equip slots that a character has available to them. */ @@ -118,9 +118,9 @@ class ItemManager utils::NameMap<ItemClass*> mItemClassesByName; // Map an equip slot id with the equip slot info. - typedef std::map< unsigned int, EquipSlotInfo* > EquipSlotsInfo; + typedef std::map< unsigned, EquipSlotInfo* > EquipSlotsInfo; // Reference to the vector position of equipSlots - typedef std::vector< unsigned int > VisibleEquipSlots; + typedef std::vector< unsigned > VisibleEquipSlots; EquipSlotsInfo mEquipSlotsInfo; // Map a string (name of slot) with (str-id, max-per-equip-slot) @@ -129,10 +129,10 @@ class ItemManager std::string mItemsFile; std::string mEquipSlotsFile; - unsigned int mVisibleEquipSlotCount; // Cache + unsigned mVisibleEquipSlotCount; // Cache /** Version of the loaded items database file.*/ - unsigned int mItemDatabaseVersion; + unsigned mItemDatabaseVersion; }; extern ItemManager *itemManager; diff --git a/src/game-server/monster.cpp b/src/game-server/monster.cpp index 71ff09b6..cdfe063a 100644 --- a/src/game-server/monster.cpp +++ b/src/game-server/monster.cpp @@ -83,7 +83,7 @@ Monster::Monster(MonsterClass *specy): for (AttributeManager::AttributeScope::const_iterator it = mobAttr.begin(), it_end = mobAttr.end(); it != it_end; ++it) { - mAttributes.insert(std::pair< unsigned int, Attribute > + mAttributes.insert(std::pair< unsigned, Attribute > (it->first, Attribute(*it->second))); } @@ -484,7 +484,7 @@ void Monster::died() } } -bool Monster::recalculateBaseAttribute(unsigned int attr) +bool Monster::recalculateBaseAttribute(unsigned attr) { LOG_DEBUG("Monster: Received update attribute recalculation request for " << attr << "."); diff --git a/src/game-server/monster.h b/src/game-server/monster.h index ea6cd305..73fec6aa 100644 --- a/src/game-server/monster.h +++ b/src/game-server/monster.h @@ -334,7 +334,7 @@ class Monster : public Being * attributes if it has changed. * @returns Whether it was changed. */ - virtual bool recalculateBaseAttribute(unsigned int); + virtual bool recalculateBaseAttribute(unsigned); protected: /** diff --git a/src/game-server/skillmanager.cpp b/src/game-server/skillmanager.cpp index 52e95e9a..2e78194c 100644 --- a/src/game-server/skillmanager.cpp +++ b/src/game-server/skillmanager.cpp @@ -131,7 +131,7 @@ void SkillManager::readSkillNode(xmlNodePtr skillNode, } mSkillsInfo.insert( - std::make_pair<unsigned int, SkillInfo*>(skillInfo->id, skillInfo)); + std::make_pair<unsigned, SkillInfo*>(skillInfo->id, skillInfo)); std::string keyName = setName + "_" + skillInfo->skillName; mNamedSkillsInfo.insert(keyName, skillInfo); @@ -180,13 +180,13 @@ unsigned SkillManager::getId(const std::string &skillName) const return skillInfo ? skillInfo->id : 0; } -const std::string SkillManager::getSkillName(unsigned int id) const +const std::string SkillManager::getSkillName(unsigned id) const { SkillsInfo::const_iterator it = mSkillsInfo.find(id); return it != mSkillsInfo.end() ? it->second->skillName : ""; } -const std::string SkillManager::getSetName(unsigned int id) const +const std::string SkillManager::getSetName(unsigned id) const { SkillsInfo::const_iterator it = mSkillsInfo.find(id); return it != mSkillsInfo.end() ? it->second->setName : ""; diff --git a/src/game-server/skillmanager.h b/src/game-server/skillmanager.h index f296e192..85f7f42e 100644 --- a/src/game-server/skillmanager.h +++ b/src/game-server/skillmanager.h @@ -49,20 +49,20 @@ class SkillManager /** * Gets the skill Id from a set and a skill string. */ - unsigned int getId(const std::string &set, const std::string &name) const; + unsigned getId(const std::string &set, const std::string &name) const; /** * Gets the skill Id from a string formatted in this way: * "setname_skillname" */ - unsigned int getId(const std::string &skillName) const; + unsigned getId(const std::string &skillName) const; - const std::string getSkillName(unsigned int id) const; - const std::string getSetName(unsigned int id) const; + const std::string getSkillName(unsigned id) const; + const std::string getSetName(unsigned id) const; bool exists(unsigned id) const; - unsigned int getDefaultSkillId() const + unsigned getDefaultSkillId() const { return mDefaultSkillId; } private: struct SkillInfo { @@ -70,7 +70,7 @@ class SkillManager id(0) {} - unsigned int id; + unsigned id; std::string setName; std::string skillName; }; @@ -88,13 +88,13 @@ class SkillManager std::string mSkillFile; // The skill map - typedef std::map<unsigned int, SkillInfo*> SkillsInfo; + typedef std::map<unsigned, SkillInfo*> SkillsInfo; SkillsInfo mSkillsInfo; // A map used to get skills per name. utils::NameMap<SkillInfo*> mNamedSkillsInfo; // The default skill id - unsigned int mDefaultSkillId; + unsigned mDefaultSkillId; }; extern SkillManager *skillManager; diff --git a/src/game-server/specialmanager.cpp b/src/game-server/specialmanager.cpp index 32669bca..39616faa 100644 --- a/src/game-server/specialmanager.cpp +++ b/src/game-server/specialmanager.cpp @@ -143,14 +143,14 @@ void SpecialManager::clear() mNamedSpecialsInfo.clear(); } -unsigned int SpecialManager::getId(const std::string &set, - const std::string &name) const +unsigned SpecialManager::getId(const std::string &set, + const std::string &name) const { std::string key = utils::toLower(set) + "_" + utils::toLower(name); return getId(key); } -unsigned int SpecialManager::getId(const std::string &specialName) const +unsigned SpecialManager::getId(const std::string &specialName) const { if (mNamedSpecialsInfo.contains(specialName)) return mNamedSpecialsInfo.value(specialName)->id; diff --git a/src/game-server/specialmanager.h b/src/game-server/specialmanager.h index b7a4f54b..e9203a34 100644 --- a/src/game-server/specialmanager.h +++ b/src/game-server/specialmanager.h @@ -48,12 +48,12 @@ public: target(TARGET_BEING) {} - unsigned int id; + unsigned id; std::string name; std::string setName; bool rechargeable; int defaultRechargeSpeed; - unsigned int neededMana; + unsigned neededMana; TargetMode target; Script::Ref rechargedCallback; Script::Ref useCallback; @@ -79,13 +79,13 @@ public: /** * Gets the specials Id from a set and a special string. */ - unsigned int getId(const std::string &set, const std::string &name) const; + unsigned getId(const std::string &set, const std::string &name) const; /** * Gets the specials Id from a string formatted in this way: * "setname_skillname" */ - unsigned int getId(const std::string &specialName) const; + unsigned getId(const std::string &specialName) const; const std::string getSpecialName(int id) const; const std::string getSetName(int id) const; @@ -102,7 +102,7 @@ private: const std::string &setName); std::string mSpecialFile; - typedef std::map<unsigned int, SpecialInfo*> SpecialsInfo; + typedef std::map<unsigned, SpecialInfo*> SpecialsInfo; SpecialsInfo mSpecialsInfo; typedef utils::NameMap<SpecialInfo*> NamedSpecialsInfo; NamedSpecialsInfo mNamedSpecialsInfo; diff --git a/src/game-server/state.cpp b/src/game-server/state.cpp index 83417763..ede94f86 100644 --- a/src/game-server/state.cpp +++ b/src/game-server/state.cpp @@ -84,11 +84,11 @@ static void serializeLooks(Character *ch, MessageOut &msg) // We'll use a set to check whether we already sent the update for the given // item instance. - std::set<unsigned int> itemInstances; + std::set<unsigned> itemInstances; // The map storing the info about the look changes to send //{ slot type id, item id } - std::map <unsigned int, unsigned int> lookChanges; + std::map <unsigned, unsigned> lookChanges; // Note that we can send several updates on the same slot type as different // items may have been equipped. @@ -105,8 +105,8 @@ static void serializeLooks(Character *ch, MessageOut &msg) // we encounter the item, so we can send the look change. // We also send empty slots for unequipment handling. lookChanges.insert( - std::make_pair<unsigned int, unsigned int>(it->first, - it->second.itemId)); + std::make_pair<unsigned, unsigned>(it->first, + it->second.itemId)); } } @@ -115,7 +115,7 @@ static void serializeLooks(Character *ch, MessageOut &msg) // Number of look changes to send msg.writeInt8(lookChanges.size()); - for (std::map<unsigned int, unsigned int>::const_iterator it2 = + for (std::map<unsigned, unsigned>::const_iterator it2 = lookChanges.begin(), it2_end = lookChanges.end(); it2 != it2_end; ++it2) { diff --git a/src/game-server/trade.h b/src/game-server/trade.h index d425767a..43b674fb 100644 --- a/src/game-server/trade.h +++ b/src/game-server/trade.h @@ -101,7 +101,7 @@ class Trade TradedItems mItems1, mItems2; /**< Traded items. */ int mMoney1, mMoney2; /**< Traded money. */ TradeState mState; /**< State of transaction. */ - unsigned int mCurrencyId; /**< The attribute to use as currency. */ + unsigned mCurrencyId; /**< The attribute to use as currency. */ }; #endif diff --git a/src/net/connectionhandler.cpp b/src/net/connectionhandler.cpp index 5aaf90e0..d116aa93 100644 --- a/src/net/connectionhandler.cpp +++ b/src/net/connectionhandler.cpp @@ -162,7 +162,7 @@ void ConnectionHandler::sendToEveryone(const MessageOut &msg) } } -unsigned int ConnectionHandler::getClientCount() const +unsigned ConnectionHandler::getClientCount() const { return clients.size(); } diff --git a/src/net/connectionhandler.h b/src/net/connectionhandler.h index 96fc90cd..7dde004f 100644 --- a/src/net/connectionhandler.h +++ b/src/net/connectionhandler.h @@ -79,7 +79,7 @@ class ConnectionHandler /** * Return the number of connected clients. */ - unsigned int getClientCount() const; + unsigned getClientCount() const; private: ENetAddress address; /**< Includes the port to listen to. */ diff --git a/src/net/messageout.cpp b/src/net/messageout.cpp index d39fd23e..00bb623b 100644 --- a/src/net/messageout.cpp +++ b/src/net/messageout.cpp @@ -32,10 +32,10 @@ #include <enet/enet.h> /** Initial amount of bytes allocated for the messageout data buffer. */ -const unsigned int INITIAL_DATA_CAPACITY = 16; +const unsigned INITIAL_DATA_CAPACITY = 16; /** Factor by which the messageout data buffer is increased when too small. */ -const unsigned int CAPACITY_GROW_FACTOR = 2; +const unsigned CAPACITY_GROW_FACTOR = 2; static bool debugModeEnabled = false; diff --git a/src/net/messageout.h b/src/net/messageout.h index a39e306b..af5980f4 100644 --- a/src/net/messageout.h +++ b/src/net/messageout.h @@ -75,7 +75,7 @@ class MessageOut /** * Returns the length of the data. */ - unsigned int getLength() const { return mPos; } + unsigned getLength() const { return mPos; } /** * Sets whether the debug mode is enabled. In debug mode, the internal @@ -96,8 +96,8 @@ class MessageOut void writeValueType(ManaServ::ValueType type); char *mData; /**< Data building up. */ - unsigned int mPos; /**< Position in the data. */ - unsigned int mDataSize; /**< Allocated datasize. */ + unsigned mPos; /**< Position in the data. */ + unsigned mDataSize; /**< Allocated datasize. */ bool mDebugMode; /**< Include debugging information. */ /** diff --git a/src/net/netcomputer.cpp b/src/net/netcomputer.cpp index c4af3420..8834f4a6 100644 --- a/src/net/netcomputer.cpp +++ b/src/net/netcomputer.cpp @@ -57,7 +57,7 @@ void NetComputer::disconnect(const MessageOut &msg) } void NetComputer::send(const MessageOut &msg, bool reliable, - unsigned int channel) + unsigned channel) { LOG_DEBUG("Sending message " << msg << " to " << *this); diff --git a/src/net/netcomputer.h b/src/net/netcomputer.h index ee5d2cdc..09840348 100644 --- a/src/net/netcomputer.h +++ b/src/net/netcomputer.h @@ -68,7 +68,7 @@ class NetComputer * be sent. */ void send(const MessageOut &msg, bool reliable = true, - unsigned int channel = 0); + unsigned channel = 0); /** * Returns IP address of computer in 32bit int form diff --git a/src/serialize/characterdata.h b/src/serialize/characterdata.h index cab51197..abcc6114 100644 --- a/src/serialize/characterdata.h +++ b/src/serialize/characterdata.h @@ -132,10 +132,10 @@ void deserializeCharacterData(T &data, MessageIn &msg) data.setCorrectionPoints(msg.readInt16()); // character attributes - unsigned int attrSize = msg.readInt16(); - for (unsigned int i = 0; i < attrSize; ++i) + unsigned attrSize = msg.readInt16(); + for (unsigned i = 0; i < attrSize; ++i) { - unsigned int id = msg.readInt16(); + unsigned id = msg.readInt16(); double base = msg.readDouble(), mod = msg.readDouble(); data.setAttribute(id, base); @@ -193,7 +193,7 @@ void deserializeCharacterData(T &data, MessageIn &msg) Possessions &poss = data.getPossessions(); EquipData equipData; int equipSlotsSize = msg.readInt16(); - unsigned int eqSlot; + unsigned eqSlot; EquipmentItem equipItem; for (int j = 0; j < equipSlotsSize; ++j) { diff --git a/src/utils/string.cpp b/src/utils/string.cpp index b74b91ee..fdc5eb59 100644 --- a/src/utils/string.cpp +++ b/src/utils/string.cpp @@ -40,7 +40,7 @@ std::string toLower(std::string s) bool isNumeric(const std::string &s) { - for (unsigned int i = 0; i < s.size(); ++i) + for (unsigned i = 0; i < s.size(); ++i) { if (!isdigit(s[i])) { diff --git a/src/utils/stringfilter.cpp b/src/utils/stringfilter.cpp index b48d267f..e3696097 100644 --- a/src/utils/stringfilter.cpp +++ b/src/utils/stringfilter.cpp @@ -100,8 +100,8 @@ bool StringFilter::filterContent(const std::string &text) const bool StringFilter::isEmailValid(const std::string &email) const { - unsigned int min = Configuration::getValue("account_minEmailLength", 7); - unsigned int max = Configuration::getValue("account_maxEmailLength", 128); + unsigned min = Configuration::getValue("account_minEmailLength", 7); + unsigned max = Configuration::getValue("account_maxEmailLength", 128); // Testing email validity if (email.length() < min || email.length() > max) diff --git a/src/utils/timer.cpp b/src/utils/timer.cpp index aea10add..c01a4134 100644 --- a/src/utils/timer.cpp +++ b/src/utils/timer.cpp @@ -43,7 +43,7 @@ static uint64_t getTimeInMillisec() namespace utils { -Timer::Timer(unsigned int ms) +Timer::Timer(unsigned ms) { active = false; interval = ms; @@ -97,7 +97,7 @@ void Timer::stop() active = false; } -void Timer::changeInterval(unsigned int newinterval) +void Timer::changeInterval(unsigned newinterval) { interval = newinterval; } diff --git a/src/utils/timer.h b/src/utils/timer.h index 2c6ca891..2fb9e7b1 100644 --- a/src/utils/timer.h +++ b/src/utils/timer.h @@ -42,7 +42,7 @@ class Timer * * @param ms the interval in milliseconds */ - Timer(unsigned int ms); + Timer(unsigned ms); /** * Returns the number of elapsed ticks since last call. @@ -67,13 +67,13 @@ class Timer /** * Changes the interval between two pulses. */ - void changeInterval(unsigned int newinterval); + void changeInterval(unsigned newinterval); private: /** * Interval between two pulses. */ - unsigned int interval; + unsigned interval; /** * The time the last pulse occured. |