[gunzemulator] r347 committed - Made CreateCharacter more reliable by depending on an AccountInfo,...

0 views
Skip to first unread message

gunzem...@googlecode.com

unread,
Jun 27, 2010, 7:06:55 PM6/27/10
to gogo-dev...@googlegroups.com
Revision: 347
Author: cg.wowus.cg
Date: Sun Jun 27 16:05:47 2010
Log: Made CreateCharacter more reliable by depending on an AccountInfo,
instead of an arbitrary AID.
http://code.google.com/p/gunzemulator/source/detail?r=347

Modified:
/trunk/database/src/MySQL/modules/CreateCharacter.cpp
/trunk/gogo/src/modules/OnCharCreate.cpp
/trunk/include/database/GunzDB.h
/trunk/include/database/MySQLGunzDB.h

=======================================
--- /trunk/database/src/MySQL/modules/CreateCharacter.cpp Sun Jun 27
13:12:05 2010
+++ /trunk/database/src/MySQL/modules/CreateCharacter.cpp Sun Jun 27
16:05:47 2010
@@ -26,22 +26,22 @@
return q;
}

-void MySQLGunzDB::CreateCharacter(uint32_t aid, string name, uint32_t
marker, uint32_t sex, uint32_t hair, uint32_t face, uint32_t costume)
-{
- if(aid == 0xFFFFFFFF)
+void MySQLGunzDB::CreateCharacter(const AccountInfo& accountInfo, string
name, uint32_t marker, uint32_t sex, uint32_t hair, uint32_t face, uint32_t
costume)
+{
+ if(!accountInfo.isValid)
throw InvalidAccountInfo();

if (!NameExists(name))
throw NameInUse();

bool succeeded = exec_query(
- bind(make_create_character_query, _1, aid, name, marker, sex, hair,
face, costume)
+ bind(make_create_character_query, _1, accountInfo.AccountId, name,
marker, sex, hair, face, costume)
);

if(!succeeded)
throw InvalidCharacterName();

- uint32_t cid = GetCID(aid, marker);
+ uint32_t cid = GetCID(accountInfo.AccountId, marker);

succeeded = exec_query(
bind(make_create_character_equip_query, _1, cid)
=======================================
--- /trunk/gogo/src/modules/OnCharCreate.cpp Sun Jun 27 13:12:05 2010
+++ /trunk/gogo/src/modules/OnCharCreate.cpp Sun Jun 27 16:05:47 2010
@@ -36,7 +36,7 @@
if(charName.length() >= 16)
return reply(transmitter, PEC_NAME_LONG, charName);

- database->CreateCharacter(myAccount.AccountId, charName, charMarker,
charSex, charHair, charFace, charCostume);
+ database->CreateCharacter(myAccount, charName, charMarker, charSex,
charHair, charFace, charCostume);

return reply(transmitter, PEC_NONE, charName);
}
=======================================
--- /trunk/include/database/GunzDB.h Thu Jun 24 18:26:43 2010
+++ /trunk/include/database/GunzDB.h Sun Jun 27 16:05:47 2010
@@ -55,8 +55,8 @@
/**
Creates a character.

- @param aid The account ID of the parent player we will create the
- character for.
+ @param accountInfo The account info of the parent player we will
create the
+ character for.
@param name The name of the new character.
@param marker TODO: USELESS. REMOVE THIS.
@param sex The gender of the character we will create.
@@ -69,7 +69,7 @@
@throws InvalidCharacterName If the character name isn't valid.
*/
virtual void CreateCharacter(
- boost::uint32_t aid,
+ const AccountInfo& accountInfo,
std::string name,
boost::uint32_t marker,
boost::uint32_t sex,
=======================================
--- /trunk/include/database/MySQLGunzDB.h Sun Jun 27 12:31:08 2010
+++ /trunk/include/database/MySQLGunzDB.h Sun Jun 27 16:05:47 2010
@@ -94,7 +94,7 @@
std::vector<Item> GetInventory(boost::uint32_t cid);
SmallVector<CharacterEntry, 4> GetCharacterList(boost::uint32_t aid);
bool NameExists(std::string name);
- void CreateCharacter(boost::uint32_t aid, std::string name,
boost::uint32_t marker, boost::uint32_t sex, boost::uint32_t hair,
boost::uint32_t face, boost::uint32_t costume);
+ 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);

boost::uint32_t GetCID(uint32_t aid, uint32_t marker);

Reply all
Reply to author
Forward
0 new messages