#include "knet.h"
#include "rule.h"

KNet::KNet()
: MNet()
{
}

KNet::~KNet()
{
}

KNet &KNet::operator<<(Rule *rule)
{
	Net::operator<<(Net::begin);
	Net::operator<<(rule->custom());
	Net::operator<<(rule->player_lives);
	Net::operator<<(rule->player_power);
	Net::operator<<(rule->player_bombs);
	Net::operator<<(rule->monster_lives);
	Net::operator<<(rule->monster_power);
	Net::operator<<(rule->monster_bombs);
	Net::operator<<(rule->monster_blastfrequency);
	Net::operator<<(rule->invisible_number);
	Net::operator<<(rule->flash_number);
	Net::operator<<(rule->grail_number);
	Net::operator<<(rule->speed_number);
	Net::operator<<(rule->power_number);
	Net::operator<<(rule->life_number);
	Net::operator<<(rule->bomb_number);
	Net::operator<<(rule->bomb_destroy);
	Net::operator<<(rule->bomb_lock);
	Net::operator<<(rule->bomb_duration);
	Net::operator<<(rule->timebomb_allowed);
	Net::operator<<(rule->moveablebomb_allowed);
	Net::operator<<(rule->scree_percentage);
	Net::operator<<(rule->wall_damage);
	Net::operator<<(rule->ground_damage);
	Net::operator<<(Net::end);
	Net::operator<<(Net::flush);
	return *this;
}

KNet &KNet::operator>>(Rule **rule)
{
	int custom;

	Net::operator<<(Net::begin);
	Net::operator>>(&custom);
	if(custom) (*rule)->setCustom();
	Net::operator>>(&(*rule)->player_lives);
	Net::operator>>(&(*rule)->player_power);
	Net::operator>>(&(*rule)->player_bombs);
	Net::operator>>(&(*rule)->monster_lives);
	Net::operator>>(&(*rule)->monster_power);
	Net::operator>>(&(*rule)->monster_bombs);
	Net::operator>>(&(*rule)->monster_blastfrequency);
	Net::operator>>(&(*rule)->invisible_number);
	Net::operator>>(&(*rule)->flash_number);
	Net::operator>>(&(*rule)->grail_number);
	Net::operator>>(&(*rule)->speed_number);
	Net::operator>>(&(*rule)->power_number);
	Net::operator>>(&(*rule)->life_number);
	Net::operator>>(&(*rule)->bomb_number);
	Net::operator>>(&(*rule)->bomb_destroy);
	Net::operator>>(&(*rule)->bomb_lock);
	Net::operator>>(&(*rule)->bomb_duration);
	Net::operator>>(&(*rule)->timebomb_allowed);
	Net::operator>>(&(*rule)->moveablebomb_allowed);
	Net::operator>>(&(*rule)->scree_percentage);
	Net::operator>>(&(*rule)->wall_damage);
	Net::operator>>(&(*rule)->ground_damage);
	Net::operator<<(Net::end);
	Net::operator<<(Net::flush);
	return *this;
}

