Author Topic: Merchant XML error  (Read 792 times)

Miya

  • Hydlaa Resident
  • *
  • Posts: 69
    • View Profile
Merchant XML error
« on: September 09, 2005, 07:50:37 am »
OK, so earlier I and others reported that the merchant window was not showing the items that the merchant will buy or sell, but will still show the categories it will buy/sell. Now, I noticed an error when I started trading with the merchant, or switched between buy/sell. Here it is:

Code: [Select]

HandleMerchant
:
  No XML root in
  No XML root in



Now, I took a look at the code it references here:

Code: [Select]

void pawsMerchantWindow::HandleMerchant( const char* merchantData )
{
    Show();

    csRef xml = CS_QUERY_REGISTRY( windowManager->GetObjectRegistry(), iDocumentSystem );

    csRef doc = xml->CreateDocument();
   if(!doc)
    {
        Error2(\"Parse error in %s\", merchantData );
        return;
    }

    csRef merchant = doc->GetRoot();
   if(!merchant)
   {
       Error2(\"No XML root in %s\", merchantData);
        return;
 }
    csRef data = merchant->GetNode(\"MERCHANT\");
   if(!data)
   {
       Error2(\"No tag in %s\", merchantData);
      return;
 }

    merchantID   = data->GetAttributeValueAsInt( \"ID\" );
    tradeCommand = data->GetAttributeValueAsInt( \"TRADE_CMD\" );
   
    bool buy = true;
    if ( tradeCommand == psGUIMerchantMessage::SELL )
    {
        buy = false;
    }

    pawsRadioButtonGroup* group = (pawsRadioButtonGroup*)FindWidget(\"BuySell\");
    if ( buy )
        group->SetActive( \"Buy\" );
    else
        group->SetActive( \"Sell\" );
       
}


So basically the client is requesting xml data from the server, and the server gives it:

Now the code here is looking for ID and TRADE_CMD, which are present in the string sent to the client here, but somehow doc->GetRoot() does not work.
Code: [Select]
Love(clk89);

Miya

  • Hydlaa Resident
  • *
  • Posts: 69
    • View Profile
(No subject)
« Reply #1 on: September 09, 2005, 08:04:37 am »
Ah, it seems that the solution is to revert src/client/gui/pawsmerchantwindow.cpp to v1.23

thanks stfrn!
Code: [Select]
Love(clk89);

stfrn

  • Hydlaa Citizen
  • *
  • Posts: 324
  • the beaver ex-dev :B
    • View Profile
(No subject)
« Reply #2 on: September 10, 2005, 02:35:21 am »
Well, my patch was commited, so now you can comiple the latest and buy at the merchant. If the binary was from in that time, he will have to remake it, and everyone will have to update again.... sorry :/
Quote

Update of /cvsroot/planeshift/planeshift/src/client/gui
Modified Files:
pawsgmgui.cpp pawsguildwindow.cpp pawsmerchantwindow.cpp
psmainwidget.cpp
Log Message:
- Patch from stfrn to fix merchant exchanges and some compile warnings.
player -> gm -> dev -> bum