From: Thomas T. <to...@us...> - 2004-07-05 18:54:36
|
Update of /cvsroot/planeshift/planeshift/src/server/bulkobjects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12650 Modified Files: psitem.cpp Log Message: Moved item quality from item stats to item instances. Fixed problems with incorrectly updating some fields in item save. Index: psitem.cpp =================================================================== RCS file: /cvsroot/planeshift/planeshift/src/server/bulkobjects/psitem.cpp,v retrieving revision 1.61 retrieving revision 1.62 diff -C2 -d -r1.61 -r1.62 *** psitem.cpp 4 Jul 2004 04:50:17 -0000 1.61 --- psitem.cpp 5 Jul 2004 18:54:28 -0000 1.62 *************** *** 87,95 **** - - - - - // Definition of the itempool for psItems PoolAllocator<psItem> psItem::itempool; --- 87,90 ---- *************** *** 186,189 **** --- 181,186 ---- if (row.GetInt("guild_mark_id")) SetGuildID(row.GetInt("guild_mark_id")); + if (row.GetFloat("item_quality")) + SetItemQuality(row.GetFloat("item_quality")); *************** *** 253,261 **** // New Item, need a UID const char *fieldnames[]= { ! "id", ! "char_id_owner", ! "location", ! "item_stats_id_standard", "stack_count", "parent_item_id", "location_in_parent", --- 250,263 ---- // New Item, need a UID const char *fieldnames[]= { ! "id", ! "char_id_owner", "stack_count", + "item_quality", + "creator_mark_id", + "guild_mark_id", + "flags", + "item_stats_id_standard", + "item_stats_id_unique", + "location", "parent_item_id", "location_in_parent", *************** *** 265,273 **** "loc_z", "loc_yrot", ! "sector_info_id", ! "creator_mark_id", ! "guild_mark_id", ! "flags", ! "item_stats_id_unique" }; --- 267,271 ---- "loc_z", "loc_yrot", ! "sector_info_id" }; *************** *** 297,307 **** { // Existing Item, update - - const char *fieldnames[]= { "char_id_owner", - "location", - "item_stats_id_standard", "stack_count", "parent_item_id", "location_in_parent", --- 295,308 ---- { // Existing Item, update const char *fieldnames[]= { "char_id_owner", "stack_count", + "item_quality", + "creator_mark_id", + "guild_mark_id", + "flags", + "item_stats_id_standard", + "item_stats_id_unique", + "location", "parent_item_id", "location_in_parent", *************** *** 311,319 **** "loc_z", "loc_yrot", ! "sector_info_id", ! "creator_mark_id", ! "guild_mark_id", ! "flags", ! "item_stats_id_unique" }; --- 312,316 ---- "loc_z", "loc_yrot", ! "sector_info_id" }; *************** *** 339,361 **** void psItem::GetFieldArray(psStringArray& fields) { ! // Owning character ! psCharacter *owner=GetOwningCharacter(); ! if (owner==NULL) ! fields.FormatPush("%u",0); else ! fields.FormatPush("%u",owner->GetCharacterID()); bool equipped = false; int slotlocation = 0; ! // Location (Equipped, inventory, bank) if (!owner) ! fields.Push("0"); ! else ! { ! // Find the root item, this makes location searches faster psItem *rootitem=this; while (rootitem->GetParentItem()!=NULL) rootitem=rootitem->GetParentItem(); ! // Find the general area if ((slotlocation=(int)owner->FindItemInTopLevelEquipment(rootitem)) != PSCHARACTER_SLOT_NONE) { --- 336,403 ---- void psItem::GetFieldArray(psStringArray& fields) { ! // Owning character ID ! fields.FormatPush("%u",GetCharIDOwner()); ! ! // Stack count ! fields.FormatPush("%u",GetStackCount()); ! ! // Item quality ! fields.FormatPush("%1.2f",GetItemQuality()); ! ! // Crafter ID ! if (GetIsCrafterIDValid()) ! fields.FormatPush("%u",GetCrafterID()); else ! fields.Push(NULL); + // Guild ID + if (GetIsGuildIDValid()) + fields.FormatPush("%u",GetGuildID()); + else + fields.Push(NULL); + + // Flags + csString flagString = ""; + + // Thise two are actualy glyhs things and should be moved to psGlyph + // if a generic way of updating flags are implemented. + if (flags & PSITEM_FLAG_PURIFIED) + { + if (flagString != "") flagString.Append(","); + flagString.Append("PURIFIED"); + } + if (flags & PSITEM_FLAG_PURIFYING) + { + if (flagString != "") flagString.Append(","); + flagString.Append("PURIFYING"); + } + + fields.Push(flagString); + + // item_stats_id_standard - base stats if non unique, unique stats if unique + fields.FormatPush("%u",GetBaseStats()->GetUID()); + + // item_stats_id_unique + fields.FormatPush("%u",0); + + // Owner stuff + psCharacter *owner=GetOwningCharacter(); bool equipped = false; int slotlocation = 0; ! ! // load not owned stuff if (!owner) ! { ! fields.Push(NULL); // location ! } ! else ! { ! ! // Find the root item, this makes location searches faster psItem *rootitem=this; while (rootitem->GetParentItem()!=NULL) rootitem=rootitem->GetParentItem(); ! ! // Find the general area if ((slotlocation=(int)owner->FindItemInTopLevelEquipment(rootitem)) != PSCHARACTER_SLOT_NONE) { *************** *** 389,399 **** } ! // item_stats_id_standard - base stats if non unique, unique stats if unique ! fields.FormatPush("%u",GetBaseStats()->GetUID()); ! ! // Stack count ! fields.FormatPush("%u",GetStackCount()); ! ! // Parent item id, location in parent if (GetParentItem()==NULL) { --- 431,435 ---- } ! // Container stuff if (GetParentItem()==NULL) { *************** *** 457,491 **** } - if (GetIsCrafterIDValid()) - fields.FormatPush("%u",GetCrafterID()); - else - fields.Push(NULL); - if (GetIsGuildIDValid()) - fields.FormatPush("%u",GetGuildID()); - else - fields.Push(NULL); - - // Flags - - csString flagString = ""; - - // Thise two are actualy glyhs tings and should be moved to psGlyph - // if a generic way of updating flags are implemented. - if (flags & PSITEM_FLAG_PURIFIED) - { - if (flagString != "") flagString.Append(","); - flagString.Append("PURIFIED"); - } - if (flags & PSITEM_FLAG_PURIFYING) - { - if (flagString != "") flagString.Append(","); - flagString.Append("PURIFYING"); - } - - fields.Push(flagString); - - // item_stats_id_unique - fields.FormatPush("%u",0); } --- 493,497 ---- *************** *** 583,586 **** --- 589,602 ---- } + float psItem::GetItemQuality() + { + return item_quality; + } + + void psItem::SetItemQuality(float v) + { + item_quality=v; + } + void psItem::GetLocationInWorld(psSectorInfo **sectorinfo,float &loc_x,float &loc_y,float &loc_z,float &loc_yrot) *************** *** 1401,1409 **** } - float psItem::GetItemQuality() - { - return current_stats->GetItemQuality(); - } - float psItem::GetExtraDamagePercent(PSITEMSTATS_DAMAGETYPE dmgtype) { --- 1417,1420 ---- |