summaryrefslogtreecommitdiff
path: root/src/net/protocol_trade.cpp
blob: 0271567e5896d3929a2784cc37208cecb0c01289 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#include "protocol_trade.h"

#include "../item.h"
#include "../gui/trade.h"

#include "messageout.h"

cancel_t cancel;
complete_t complete;

/** Start trading with someone */
void trade(Being&);

void trade(int id,int amount)
{
    MessageOut outMsg;
    outMsg.writeInt16(CMSG_TRADE_ITEM_ADD_REQUEST);
    outMsg.writeInt16(id);
    outMsg.writeInt32(amount);
};

/** add trading item*/

void trade(Item& item,int amount)
{
trade(item.getInvIndex(),amount);
}

/** add money to trade */
void trade(int i){trade(0,i);};

/** cancel courent trade */
void trade(cancel_t&)
{
    MessageOut outMsg;
    outMsg.writeInt16(CMSG_TRADE_CANCEL_REQUEST);
};

void trade()
{
    MessageOut outMsg;
    outMsg.writeInt16(CMSG_TRADE_OK);
};

void trade(complete_t&)
{
    MessageOut outMsg;
    outMsg.writeInt16(CMSG_TRADE_ADD_COMPLETE);
};