#include <sstream>
using namespace std;

#include "action.h"
#include "misc.h"
#include "globals.h"

void issue_move(long bid, char dir)
{
	if (bid == 0)
	{
		bid = 1;
		e("bid of 0 not allowed", "move", dir);
	}
	ostringstream command;
	command << bid << " Move " << dir;
	send(command.str());
}

void issue_pick(long bid, vector<package> p_list)
{
	if (bid == 0)
	{
		bid = 1;
		e("bid of 0 not allowed", "pick");
	}
	ostringstream command;
	command << bid << " Pick";
	for (vector<package>::iterator i = p_list.begin(); i != p_list.end(); ++i)
		command << " " << i->id;
	send(command.str());
}

void issue_drop(long bid, vector<package> p_list)
{
	if (bid == 0)
	{
		bid = 1;
		e("bid of 0 not allowed", "drop");
	}
	ostringstream command;
	command << bid << " Drop";
	for (vector<package>::iterator i = p_list.begin(); i != p_list.end(); ++i)
		command << " " << i->id;
	send(command.str());
}

void issue_noop(long bid)
{
	if (bid == 0)
	{
		bid = 1;
		e("bid of 0 not allowed", "noop");
	}
	ostringstream command;
	command << bid << " Drop";
	send(command.str());
}