~ubuntu-branches/ubuntu/trusty/manaplus/trusty

« back to all changes in this revision

Viewing changes to src/net/ea/tradehandler.cpp

  • Committer: Package Import Robot
  • Author(s): Patrick Matthäi
  • Date: 2013-10-07 10:26:14 UTC
  • mfrom: (1.1.11)
  • Revision ID: package-import@ubuntu.com-20131007102614-tg2zjdz8vmtl6n7i
Tags: 1.3.9.29-1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
#include "gui/tradewindow.h"
36
36
 
37
37
#include "net/inventoryhandler.h"
 
38
#include "net/net.h"
38
39
 
39
40
#include "net/ea/eaprotocol.h"
40
41
 
74
75
{
75
76
}
76
77
 
77
 
void TradeHandler::processTradeRequest(Net::MessageIn &msg)
 
78
void TradeHandler::processTradeRequest(Net::MessageIn &msg) const
78
79
{
79
80
    // If a trade window or request window is already open, send a
80
81
    // trade cancel to any other trade request.
122
123
    }
123
124
}
124
125
 
125
 
void TradeHandler::processTradeResponse(Net::MessageIn &msg)
 
126
void TradeHandler::processTradeResponse(Net::MessageIn &msg) const
126
127
{
127
128
    if (confirmDlg || tradePartnerName.empty()
128
129
        || !player_relations.hasPermission(tradePartnerName,
181
182
    }
182
183
}
183
184
 
184
 
void TradeHandler::processTradeItemAdd(Net::MessageIn &msg)
 
185
void TradeHandler::processTradeItemAdd(Net::MessageIn &msg) const
185
186
{
186
187
    const int amount = msg.readInt32();
187
188
    const int type = msg.readInt16();
204
205
    }
205
206
}
206
207
 
207
 
void TradeHandler::processTradeItemAddResponse(Net::MessageIn &msg)
 
208
void TradeHandler::processTradeItemAddResponse(Net::MessageIn &msg) const
208
209
{
209
210
    // Trade: New Item add response (was 0x00ea, now 01b1)
210
211
    const int index = msg.readInt16() - INVENTORY_OFFSET;
257
258
    }
258
259
}
259
260
 
260
 
void TradeHandler::processTradeOk(Net::MessageIn &msg)
 
261
void TradeHandler::processTradeOk(Net::MessageIn &msg) const
261
262
{
262
263
    // 0 means ok from myself, 1 means ok from other;
263
264
    if (tradeWindow)
266
267
        msg.readInt8();
267
268
}
268
269
 
269
 
void TradeHandler::processTradeCancel(Net::MessageIn &msg A_UNUSED)
 
270
void TradeHandler::processTradeCancel(Net::MessageIn &msg A_UNUSED) const
270
271
{
271
272
    NotifyManager::notify(NotifyManager::TRADE_CANCELLED);
272
273
    if (tradeWindow)
277
278
    PlayerInfo::setTrading(false);
278
279
}
279
280
 
280
 
void TradeHandler::processTradeComplete(Net::MessageIn &msg A_UNUSED)
 
281
void TradeHandler::processTradeComplete(Net::MessageIn &msg A_UNUSED) const
281
282
{
282
283
    NotifyManager::notify(NotifyManager::TRADE_COMPLETE);
283
284
    if (tradeWindow)