Fix build

ryzomclassic-develop
kaetemi 4 years ago
parent be11ae1fb6
commit 8d4c0d0ef1

@ -2088,8 +2088,10 @@ void getItemText (CDBCtrlSheet *item, string &itemText, const CItemSheet*pIS)
break; break;
case ITEMFAMILY::PET_ANIMAL_TICKET: case ITEMFAMILY::PET_ANIMAL_TICKET:
{ {
#ifdef RYZOM_FORGE
string nr = (itemInfo.PetNumber > 0) ? toString(itemInfo.PetNumber) : "(slot)" + toString(item->getIndexInDB()); string nr = (itemInfo.PetNumber > 0) ? toString(itemInfo.PetNumber) : "(slot)" + toString(item->getIndexInDB());
strFindReplace(itemText, "%petnumber", nr); strFindReplace(itemText, "%petnumber", nr);
#endif
} }
break; break;
default: default:

@ -165,9 +165,9 @@ void CInterfaceItemEdition::CItemEditionWindow::infoReceived()
display->setTextFormatTaged(localDesc); display->setTextFormatTaged(localDesc);
else else
{ {
string text = itemInfo.CustomText.toUtf8(); string text = itemInfo.CustomText;
string::size_type delimiter = text.find(' '); string::size_type delimiter = text.find(' ');
if(text.size() > 3 && text[0]=='@' && text[1]=='W' && text[2]=='E' && text[3]=='B') if (NLMISC::startsWith(text, "@WEB"))
{ {
CGroupHTML *pGH = dynamic_cast<CGroupHTML*>(CWidgetManager::getInstance()->getElementFromId("ui:interface:web_transactions:content:html")); CGroupHTML *pGH = dynamic_cast<CGroupHTML*>(CWidgetManager::getInstance()->getElementFromId("ui:interface:web_transactions:content:html"));
if (pGH) if (pGH)

@ -168,7 +168,7 @@
<leaf name="STOP_USE_XP_CAT" sendto="EGS" format="b" description="client wants to stop using xp catalyser" /> <leaf name="STOP_USE_XP_CAT" sendto="EGS" format="b" description="client wants to stop using xp catalyser" />
<leaf name="LOCK" sendto="EGS" format="u8 u16 b" description="lock or unlock an item. inventory, slot, lock" /> <leaf name="LOCK" sendto="EGS" format="u8 u16 b" description="lock or unlock an item. inventory, slot, lock" />
<leaf name="RENAME" sendot="EGS" format="u8 u16 b s" description="change an item name to a phrase or literal. inventory, slot, literal, name" /> <leaf name="RENAME" sendot="EGS" format="u8 u16 b s" description="change an item name to a phrase or literal. inventory, slot, literal, name" />
<leaf name="WRITE" sendot="EGS" format="u8 u16 s" description="wrrite a crafter's message. inventory, slot, lock" /> <leaf name="WRITE" sendot="EGS" format="u8 u16 s" description="wrrite a crafter's message. inventory, slot, text" />
</branch> </branch>
<branch name="TP"> <branch name="TP">
<leaf name="RESPAWN" sendto="EGS" format="" description="teleport the player to his respawn point" /> <leaf name="RESPAWN" sendto="EGS" format="" description="teleport the player to his respawn point" />

@ -367,14 +367,21 @@ namespace INVENTORIES
bms.serial( _SlotIndex, CInventoryCategoryTemplate::SlotBitSize ); bms.serial( _SlotIndex, CInventoryCategoryTemplate::SlotBitSize );
uint i; uint i;
// SHEET, QUALITY, QUANTITY, USER_COLOR, CREATE_TIME and SERIAL never require compression // SHEET, QUALITY, QUANTITY, and USER_COLOR never require compression
for (i = 0; i < 6; ++i) for (i = 0; i < 4; ++i)
bms.serial((uint32&)_ItemProp[i], DataBitSize[i]); bms.serial((uint32&)_ItemProp[i], DataBitSize[i]);
// For all other the compression is simple the first bit indicates if the value is zero // For all other the compression is simple the first bit indicates if the value is zero
if (bms.isReading()) if (bms.isReading())
{ {
for (; i < NbItemPropId; ++i) for (; i < NbItemPropId; ++i)
{
if (DataBitSize[i] < 3)
{
// Don't compress 1 or 2 bits either
bms.serial((uint32&)_ItemProp[i], DataBitSize[i]);
}
else
{ {
bool b; bool b;
bms.serialBit(b); bms.serialBit(b);
@ -384,9 +391,17 @@ namespace INVENTORIES
bms.serial((uint32 &)_ItemProp[i], DataBitSize[i]); bms.serial((uint32 &)_ItemProp[i], DataBitSize[i]);
} }
} }
}
else else
{ {
for (; i != NbItemPropId; ++i) for (; i != NbItemPropId; ++i)
{
if (DataBitSize[i] < 3)
{
// Don't compress 1 or 2 bits either
bms.serial((uint32&)_ItemProp[i], DataBitSize[i]);
}
else
{ {
bool b = (_ItemProp[i] == 0); bool b = (_ItemProp[i] == 0);
bms.serialBit(b); bms.serialBit(b);
@ -395,6 +410,7 @@ namespace INVENTORIES
} }
} }
} }
}
/// Serial from/to bit stream /// Serial from/to bit stream
template <class CInventoryCategoryTemplate> template <class CInventoryCategoryTemplate>

@ -8317,7 +8317,7 @@ NLMISC_COMMAND(eventSetBotSheet, "Change the sheet of a bot", "<bot eid> <sheet
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
extern sint32 clientEventSetItemCustomText(CCharacter* character, INVENTORIES::TInventory inventory, uint32 slot, ucstring const& text); extern sint32 clientItemWrite(CCharacter* character, INVENTORIES::TInventory inventory, uint32 slot, ucstring const& text);
NLMISC_COMMAND(eventSetItemCustomText, "set an item custom text, which replaces help text", "<eId> <inventory> <slot in inventory> <text>") NLMISC_COMMAND(eventSetItemCustomText, "set an item custom text, which replaces help text", "<eId> <inventory> <slot in inventory> <text>")
{ {
@ -8337,7 +8337,7 @@ NLMISC_COMMAND(eventSetItemCustomText, "set an item custom text, which replaces
NLMISC::fromString(args[2], slot); NLMISC::fromString(args[2], slot);
text.fromUtf8(args[3]); text.fromUtf8(args[3]);
sint32 ret = clientEventSetItemCustomText(c, inventory, slot, text); sint32 ret = clientItemWrite(c, inventory, slot, text);
switch (ret) switch (ret)
{ {

@ -427,7 +427,7 @@ void cbClientItemRename(NLNET::CMessage &msgin, const std::string &serviceName,
/// -1: Invalid inventory /// -1: Invalid inventory
/// -2: Invalid slot /// -2: Invalid slot
/// -3: Empty slot /// -3: Empty slot
sint32 cbClientItemWrite(CCharacter* character, INVENTORIES::TInventory inventory, uint32 slot, ucstring const& text) sint32 clientItemWrite(CCharacter* character, INVENTORIES::TInventory inventory, uint32 slot, ucstring const& text)
{ {
if (inventory==INVENTORIES::UNDEFINED) if (inventory==INVENTORIES::UNDEFINED)
{ {
@ -504,8 +504,8 @@ void cbClientItemWrite( NLNET::CMessage& msgin, const std::string & serviceName,
} }
// prevent use of @WEB at begin // prevent use of @WEB at begin
if (text.size() >= 4 && text[0]=='@' && text[1]=='W' && text[2]=='E' && text[3]=='B') if (NLMISC::startsWith(text, "@WEB"))
text = text.substr(4, text.size() - 4); text = text.substr(4);
// force that the begin of the text for non admin is %mfc // force that the begin of the text for non admin is %mfc
if(!text.empty() && text.substr(0, 4) != string("%mfc")) if(!text.empty() && text.substr(0, 4) != string("%mfc"))
@ -514,7 +514,7 @@ void cbClientItemWrite( NLNET::CMessage& msgin, const std::string & serviceName,
} }
} }
cbClientItemWrite(character, inventory, slot, text); clientItemWrite(character, inventory, slot, text);
} }
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////

@ -1164,7 +1164,7 @@ void CGameItem::setAccessGrade(EGSPD::CGuildGrade::TGuildGrade value)
} }
} }
void CGameItem::setPhraseId(const std::string &str, bool literal = false) void CGameItem::setPhraseId(const std::string &str, bool literal)
{ {
if (literal != _PhraseLiteral || _PhraseId != str) if (literal != _PhraseLiteral || _PhraseId != str)
{ {

Loading…
Cancel
Save