Modified:
/trunk/database/src/MySQL/modules/GetCharacterInfo.cpp
/trunk/database/src/MySQL/modules/GetCharacterList.cpp
/trunk/gogo/src/modules/OnCharInfo.cpp
/trunk/gogo/src/modules/OnCharList.cpp
/trunk/gogo/src/modules/OnCharSelect.cpp
/trunk/include/database/GunzDB.h
/trunk/include/database/MySQLGunzDB.h
=======================================
--- /trunk/database/src/MySQL/modules/GetCharacterInfo.cpp Sun Jun 27
13:12:05 2010
+++ /trunk/database/src/MySQL/modules/GetCharacterInfo.cpp Sun Jun 27
16:05:52 2010
@@ -64,14 +64,14 @@
}
}
-CharacterInfo MySQLGunzDB::GetCharacterInfo(uint32_t aid, uint8_t slot)
-{
- if(aid == 0xFFFFFFFF)
+CharacterInfo MySQLGunzDB::GetCharacterInfo(const AccountInfo& acc,
uint8_t slot)
+{
+ if(!acc.isValid)
throw InvalidAccountInfo();
// Normal, clan, equip, inventory.
CharacterInfo ret = run_query<CharacterInfo>(
- bind(make_get_character_info_query, _1, aid,
static_cast<uint32_t>(slot)),
+ bind(make_get_character_info_query, _1, acc.AccountId,
static_cast<uint32_t>(slot)),
bind(handle_get_character_info, _1, slot)
);
=======================================
--- /trunk/database/src/MySQL/modules/GetCharacterList.cpp Sun Jun 27
13:12:05 2010
+++ /trunk/database/src/MySQL/modules/GetCharacterList.cpp Sun Jun 27
16:05:52 2010
@@ -38,13 +38,13 @@
return charList;
}
-SmallVector<CharacterEntry, 4> MySQLGunzDB::GetCharacterList(uint32_t aid)
-{
- if(aid == 0xFFFFFFFF)
+SmallVector<CharacterEntry, 4> MySQLGunzDB::GetCharacterList(const
AccountInfo& account)
+{
+ if(!account.isValid)
throw InvalidAccountInfo();
return run_query<SmallVector<CharacterEntry, 4> >(
- bind(make_get_character_list_query, _1, aid),
+ bind(make_get_character_list_query, _1, (account.AccountId)),
handle_get_character_list
);
}
=======================================
--- /trunk/gogo/src/modules/OnCharInfo.cpp Sun Jun 27 13:12:05 2010
+++ /trunk/gogo/src/modules/OnCharInfo.cpp Sun Jun 27 16:05:52 2010
@@ -30,7 +30,7 @@
return transmitter->disconnect();
try {
- myCharacter = database->GetCharacterInfo(myAccount.AccountId, marker);
+ myCharacter = database->GetCharacterInfo(myAccount, marker);
} catch(InvalidCharacterInfo& e) {
logger->debug(e.what());
return;
=======================================
--- /trunk/gogo/src/modules/OnCharList.cpp Sun Jun 27 13:12:05 2010
+++ /trunk/gogo/src/modules/OnCharList.cpp Sun Jun 27 16:05:52 2010
@@ -24,7 +24,7 @@
if(!myAccount.isValid)
return transmitter->disconnect();
- CharList charList = database->GetCharacterList(myAccount.AccountId);
+ CharList charList = database->GetCharacterList(myAccount);
blob charBlob(charList.size(), 34);
if (charList.size() == 0)
=======================================
--- /trunk/gogo/src/modules/OnCharSelect.cpp Sun Jun 27 13:12:05 2010
+++ /trunk/gogo/src/modules/OnCharSelect.cpp Sun Jun 27 16:05:52 2010
@@ -30,7 +30,7 @@
try
{
- myCharacter = database->GetCharacterInfo(myAccount.AccountId, marker);
+ myCharacter = database->GetCharacterInfo(myAccount, marker);
} catch(InvalidCharacterInfo& e) {
logger->debug(e.what());
return transmitter->disconnect();
=======================================
--- /trunk/include/database/GunzDB.h Sun Jun 27 16:05:47 2010
+++ /trunk/include/database/GunzDB.h Sun Jun 27 16:05:52 2010
@@ -44,13 +44,12 @@
/**
Gets the character info from an account identifier.
- @param aid The account identifier to get the character list for. This
- can be found inside AccountInfo.
+ @param account The account to get the character list for.
@return Information about each and every character the account owns.
This can be anywhere from 0-4 items.
*/
- virtual SmallVector<CharacterEntry, 4> GetCharacterList(boost::uint32_t
aid) = 0;
+ virtual SmallVector<CharacterEntry, 4> GetCharacterList(const
AccountInfo& account) = 0;
/**
Creates a character.
@@ -81,39 +80,14 @@
/**
Gets the associated info for a character represented by the ID.
- @param aid The ID for the account we'll look for the character info
in.
+ @param acc The account for the account we'll look for the character
info in.
@param marker The position (0-3) of the character in the character list.
@return The character's full info.
@throws InvalidCharacterInfo If there's no such AID, the marker is bad,
etc.
*/
- virtual CharacterInfo GetCharacterInfo(boost::uint32_t aid,
boost::uint8_t marker) = 0;
-
- /**
- Gets all the equipment currently equipped on the character specified by
- a character ID.
-
- @param cid The character's unique identification number. This can be
- retrieved from the CharacterInfo struct.
-
- @return All items currently equipped onto the character.
-
- @throws InvalidCID When the CID is invalid, of course!
- */
- virtual SmallVector<Item, 12> GetEquipment(boost::uint32_t cid) = 0;
-
- /**
- Gets the full inventory for the character represented by the ID.
-
- @param cid The character's unique identification number retrieved from
- the CharacterInfo struct.
-
- @return The contents of the character's inventory.
-
- @throws InvalidCID When the CID is invalid, of course!
- */
- virtual std::vector<Item> GetInventory(boost::uint32_t cid) = 0;
+ virtual CharacterInfo GetCharacterInfo(const AccountInfo& acc,
boost::uint8_t marker) = 0;
virtual ~GunzDB()
{
=======================================
--- /trunk/include/database/MySQLGunzDB.h Sun Jun 27 16:05:47 2010
+++ /trunk/include/database/MySQLGunzDB.h Sun Jun 27 16:05:52 2010
@@ -65,6 +65,8 @@
{
try
{
+ // TODO: Does the ResultHandler have to have an active connection to
+ // work properly? Hell if I know. I just did this to be safe.
scoped_connection c(connectionPool);
return ResultHandler(QueryMaker(*(c.connection)).store());
}
@@ -90,12 +92,15 @@
void DeleteCharacter(boost::uint32_t cid, boost::uint32_t marker);
//Character processing related functions
+private:
SmallVector<Item, 12> GetEquipment(boost::uint32_t cid);
std::vector<Item> GetInventory(boost::uint32_t cid);
- SmallVector<CharacterEntry, 4> GetCharacterList(boost::uint32_t aid);
+
+public:
+ SmallVector<CharacterEntry, 4> GetCharacterList(const AccountInfo&
account);
bool NameExists(std::string name);
void CreateCharacter(const AccountInfo& account, std::string name,
boost::uint32_t marker, boost::uint32_t sex, boost::uint32_t hair,
boost::uint32_t face, boost::uint32_t costume);
- CharacterInfo GetCharacterInfo(boost::uint32_t cid, boost::uint8_t slot);
+ CharacterInfo GetCharacterInfo(const AccountInfo& acc, boost::uint8_t
slot);
boost::uint32_t GetCID(uint32_t aid, uint32_t marker);
};