summaryrefslogtreecommitdiff
path: root/src/account-server/dalstorage.cpp
diff options
context:
space:
mode:
authorAndreas Habel <mail@exceptionfault.de>2008-11-05 14:43:20 +0000
committerAndreas Habel <mail@exceptionfault.de>2008-11-05 14:43:20 +0000
commit8d10e647c6cdb77e998548c7ed43c0a131d71cd9 (patch)
tree6c73756f5ddac2082e2243437a82a4059dc2e276 /src/account-server/dalstorage.cpp
parent1af60893e6737942c2079c794d53a4e21cf87c58 (diff)
downloadmanaserv-8d10e647c6cdb77e998548c7ed43c0a131d71cd9.tar.gz
manaserv-8d10e647c6cdb77e998548c7ed43c0a131d71cd9.tar.bz2
manaserv-8d10e647c6cdb77e998548c7ed43c0a131d71cd9.tar.xz
manaserv-8d10e647c6cdb77e998548c7ed43c0a131d71cd9.zip
Splitting image name and dye string of items while synchronizing local database from items.xml
Diffstat (limited to 'src/account-server/dalstorage.cpp')
-rw-r--r--src/account-server/dalstorage.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/account-server/dalstorage.cpp b/src/account-server/dalstorage.cpp
index 4a39b39c..4f992165 100644
--- a/src/account-server/dalstorage.cpp
+++ b/src/account-server/dalstorage.cpp
@@ -1509,6 +1509,15 @@ void DALStorage::SyncDatabase(void)
std::string desc = XML::getProperty(node, "description", "");
std::string eff = XML::getProperty(node, "effect", "");
std::string image = XML::getProperty(node, "image", "");
+ std::string dye("");
+
+ // split image name and dye string
+ size_t pipe = image.find("|");
+ if (pipe != std::string::npos)
+ {
+ dye = image.substr(pipe + 1);
+ image = image.substr(0, pipe);
+ }
try
{
@@ -1520,7 +1529,7 @@ void DALStorage::SyncDatabase(void)
<< " weight = " << weight << ", "
<< " itemtype = '" << type << "', "
<< " effect = '" << mDb->escapeSQL(eff) << "', "
- << " dyestring = '' "
+ << " dyestring = '" << dye << "' "
<< " WHERE id = " << id;
mDb->execSql(sql.str());
@@ -1530,7 +1539,7 @@ void DALStorage::SyncDatabase(void)
sql << "INSERT INTO " << ITEMS_TBL_NAME
<< " VALUES ( " << id << ", '" << name << "', '"
<< desc << "', '" << image << "', " << weight << ", '"
- << type << "', '" << eff << "', '' )";
+ << type << "', '" << eff << "', '" << dye << "' )";
mDb->execSql(sql.str());
}
itmCount++;