Esempio n. 1
0
/**
** Send command: Unit starts upgrading to.
**
** @param unit     pointer to unit.
** @param what     pointer to unit-type of the unit upgrade.
** @param flush    Flag flush all pending commands.
*/
void SendCommandTransformInto(CUnit &unit, CUnitType &what, int flush)
{
	if (!IsNetworkGame()) {
		CommandLog("transform-into", &unit, flush, -1, -1, NoUnitP, what.Ident.c_str(), -1);
		CommandTransformIntoType(unit, what);
	} else {
		NetworkSendCommand(MessageCommandUpgrade, unit, 2, 0, NoUnitP, &what, flush); //use X as a way to mark that this is a transformation and not an upgrade
	}
}
Esempio n. 2
0
/**
** Send command: Unit stop.
**
** @param unit pointer to unit.
*/
void SendCommandStopUnit(CUnit &unit)
{
	if (!IsNetworkGame()) {
		CommandLog("stop", &unit, FlushCommands, -1, -1, NoUnitP, NULL, -1);
		CommandStopUnit(unit);
	} else {
		NetworkSendCommand(MessageCommandStop, unit, 0, 0, NoUnitP, 0, FlushCommands);
	}
}
Esempio n. 3
0
/**
** Send command: Produce a resource.
*/
void SendCommandProduceResource(CUnit &unit, int resource)
{
	if (!IsNetworkGame()) {
		CommandLog("produce-resource", &unit, 0, 0, -1, NoUnitP, NULL, resource);
		CommandProduceResource(unit, resource);
	} else {
		NetworkSendCommand(MessageCommandProduceResource, unit, resource, 0, NoUnitP, NULL, 0);
	}
}
Esempio n. 4
0
/**
** Send command: Building starts upgrading to.
**
** @param unit     pointer to unit.
** @param what     pointer to unit-type of the unit upgrade.
** @param flush    Flag flush all pending commands.
*/
void SendCommandUpgradeTo(CUnit &unit, CUnitType &what, int flush)
{
	if (!IsNetworkGame()) {
		CommandLog("upgrade-to", &unit, flush, -1, -1, NoUnitP, what.Ident.c_str(), -1);
		CommandUpgradeTo(unit, what, flush);
	} else {
		NetworkSendCommand(MessageCommandUpgrade, unit, 0, 0, NoUnitP, &what, flush);
	}
}
Esempio n. 5
0
/**
**  Send command: Unit harvests a location (wood for now).
**
** @param unit     pointer to unit.
** @param pos      map tile position where to harvest.
** @param flush    Flag flush all pending commands.
*/
void SendCommandResourceLoc(CUnit &unit, const Vec2i &pos, int flush)
{
	if (!IsNetworkGame()) {
		CommandLog("resource-loc", &unit, flush, pos.x, pos.y, NoUnitP, NULL, -1);
		CommandResourceLoc(unit, pos, flush);
	} else {
		NetworkSendCommand(MessageCommandResourceLoc, unit, pos.x, pos.y, NoUnitP, 0, flush);
	}
}
Esempio n. 6
0
/**
** Send command: Unit return goods.
**
** @param unit    pointer to unit.
** @param goal    pointer to destination of the goods. (NULL=search best)
** @param flush   Flag flush all pending commands.
*/
void SendCommandReturnGoods(CUnit &unit, CUnit *goal, int flush)
{
	if (!IsNetworkGame()) {
		CommandLog("return", &unit, flush, -1, -1, goal, NULL, -1);
		CommandReturnGoods(unit, goal, flush);
	} else {
		NetworkSendCommand(MessageCommandReturn, unit, 0, 0, goal, 0, flush);
	}
}
Esempio n. 7
0
/**
** Send command: Unit unload unit.
**
** @param unit    pointer to unit.
** @param pos     map tile position of unload.
** @param what    Passagier to be unloaded.
** @param flush   Flag flush all pending commands.
*/
void SendCommandUnload(CUnit &unit, const Vec2i &pos, CUnit *what, int flush)
{
	if (!IsNetworkGame()) {
		CommandLog("unload", &unit, flush, pos.x, pos.y, what, NULL, -1);
		CommandUnload(unit, pos, what, flush);
	} else {
		NetworkSendCommand(MessageCommandUnload, unit, pos.x, pos.y, what, 0, flush);
	}
}
Esempio n. 8
0
/**
** Send command: Unit builds building at position.
**
** @param unit    pointer to unit.
** @param pos     map tile position of construction.
** @param what    pointer to unit-type of the building.
** @param flush   Flag flush all pending commands.
*/
void SendCommandBuildBuilding(CUnit &unit, const Vec2i &pos, CUnitType &what, int flush)
{
	if (!IsNetworkGame()) {
		CommandLog("build", &unit, flush, pos.x, pos.y, NoUnitP, what.Ident.c_str(), -1);
		CommandBuildBuilding(unit, pos, what, flush);
	} else {
		NetworkSendCommand(MessageCommandBuild, unit, pos.x, pos.y, NoUnitP, &what, flush);
	}
}
Esempio n. 9
0
/**
** Send command: Unit patrol between current and position.
**
** @param unit     pointer to unit.
** @param pos      map tile position to patrol between.
** @param flush    Flag flush all pending commands.
*/
void SendCommandPatrol(CUnit &unit, const Vec2i &pos, int flush)
{
	if (!IsNetworkGame()) {
		CommandLog("patrol", &unit, flush, pos.x, pos.y, NoUnitP, NULL, -1);
		CommandPatrolUnit(unit, pos, flush);
	} else {
		NetworkSendCommand(MessageCommandPatrol, unit, pos.x, pos.y, NoUnitP, 0, flush);
	}
}
Esempio n. 10
0
/**
** Send command: Unit attack ground.
**
** @param unit     pointer to unit.
** @param pos      map tile position to fire on.
** @param flush    Flag flush all pending commands.
*/
void SendCommandAttackGround(CUnit &unit, const Vec2i &pos, int flush)
{
	if (!IsNetworkGame()) {
		CommandLog("attack-ground", &unit, flush, pos.x, pos.y, NoUnitP, NULL, -1);
		CommandAttackGround(unit, pos, flush);
	} else {
		NetworkSendCommand(MessageCommandGround, unit, pos.x, pos.y, NoUnitP, 0, flush);
	}
}
Esempio n. 11
0
/**
** Send command: Unit attack unit or at position.
**
** @param unit     pointer to unit.
** @param pos      map tile position to attack.
** @param attack   or !=NoUnitP unit to be attacked.
** @param flush    Flag flush all pending commands.
*/
void SendCommandAttack(CUnit &unit, const Vec2i &pos, CUnit *attack, int flush)
{
	if (!IsNetworkGame()) {
		CommandLog("attack", &unit, flush, pos.x, pos.y, attack, NULL, -1);
		CommandAttack(unit, pos, attack, flush);
	} else {
		NetworkSendCommand(MessageCommandAttack, unit, pos.x, pos.y, attack, 0, flush);
	}
}
Esempio n. 12
0
/**
** Send command: Building starts upgrading to.
**
** @param unit     pointer to unit.
** @param what     pointer to unit-type of the unit upgrade.
** @param flush    Flag flush all pending commands.
*/
void SendCommandTransformInto(CUnit &unit, CUnitType &what, int flush)
{
	if (!IsNetworkGame()) {
		CommandLog("transform-into", &unit, flush, -1, -1, NoUnitP, what.Ident.c_str(), -1);
		CommandTransformIntoType(unit, what);
	} else {
		NetworkSendCommand(MessageCommandTransform, unit, 0, 0, NoUnitP, &what, flush);
	}
}
Esempio n. 13
0
/**
** Send command: Buy a resource with copper.
*/
void SendCommandBuyResource(CUnit &unit, int resource, int player)
{
	if (!IsNetworkGame()) {
		CommandLog("buy-resource", &unit, 0, resource, -1, NoUnitP, NULL, player);
		CommandBuyResource(unit, resource, player);
	} else {
		NetworkSendCommand(MessageCommandBuyResource, unit, resource, player, NoUnitP, NULL, 0);
	}
}
Esempio n. 14
0
/**
** Send command: Unit stand ground.
**
** @param unit     pointer to unit.
** @param flush    Flag flush all pending commands.
*/
void SendCommandStandGround(CUnit &unit, int flush)
{
	if (!IsNetworkGame()) {
		CommandLog("stand-ground", &unit, flush, -1, -1, NoUnitP, NULL, -1);
		CommandStandGround(unit, flush);
	} else {
		NetworkSendCommand(MessageCommandStand, unit, 0, 0, NoUnitP, 0, flush);
	}
}
Esempio n. 15
0
/**
** Send command: Unit harvest resources
**
** @param unit    pointer to unit.
** @param dest    pointer to destination (oil-platform,gold mine).
** @param flush   Flag flush all pending commands.
*/
void SendCommandResource(CUnit &unit, CUnit &dest, int flush)
{
	if (!IsNetworkGame()) {
		CommandLog("resource", &unit, flush, -1, -1, &dest, NULL, -1);
		CommandResource(unit, dest, flush);
	} else {
		NetworkSendCommand(MessageCommandResource, unit, 0, 0, &dest, 0, flush);
	}
}
Esempio n. 16
0
/**
** Send command: Unit board unit.
**
** @param unit     pointer to unit.
** @param dest     Destination to be boarded.
** @param flush    Flag flush all pending commands.
*/
void SendCommandBoard(CUnit &unit, CUnit &dest, int flush)
{
	if (!IsNetworkGame()) {
		CommandLog("board", &unit, flush, -1, -1, &dest, NULL, -1);
		CommandBoard(unit, dest, flush);
	} else {
		NetworkSendCommand(MessageCommandBoard, unit, -1, -1, &dest, 0, flush);
	}
}
Esempio n. 17
0
/**
** Send command: Pick up item.
**
** @param unit    pointer to unit.
** @param dest    pick up this item.
** @param flush   Flag flush all pending commands.
*/
void SendCommandPickUp(CUnit &unit, CUnit &dest, int flush)
{
	if (!IsNetworkGame()) {
		CommandLog("pick-up", &unit, flush, -1, -1, &dest, NULL, -1);
		CommandPickUp(unit, dest, flush);
	} else {
		NetworkSendCommand(MessageCommandPickUp, unit, 0, 0, &dest, 0, flush);
	}
}
Esempio n. 18
0
/**
** Send command: Unit auto repair.
**
** @param unit      pointer to unit.
** @param on        1 for auto repair on, 0 for off.
*/
void SendCommandAutoRepair(CUnit &unit, int on)
{
	if (!IsNetworkGame()) {
		CommandLog("auto-repair", &unit, FlushCommands, on, -1, NoUnitP, NULL, 0);
		CommandAutoRepair(unit, on);
	} else {
		NetworkSendCommand(MessageCommandAutoRepair, unit, on, -1, NoUnitP, NULL, FlushCommands);
	}
}
Esempio n. 19
0
/**
** Send command: Accept new quest for the unit's player.
**
** @param unit    pointer to unit.
** @param pos     map tile position to move to.
*/
void SendCommandQuest(CUnit &unit, CQuest *quest)
{
	if (!IsNetworkGame()) {
		CommandLog("quest", &unit, 0, 0, 0, NoUnitP, quest->Ident.c_str(), -1);
		CommandQuest(unit, quest);
	} else {
		NetworkSendCommand(MessageCommandQuest, unit, quest->ID, 0, NoUnitP, NULL, 0);
	}
}
Esempio n. 20
0
/**
** Send command: Buy an item from a building.
**
** @param unit    pointer to unit.
** @param pos     map tile position to move to.
*/
void SendCommandBuy(CUnit &unit, CUnit *sold_unit, int player)
{
	if (!IsNetworkGame()) {
		CommandLog("buy", &unit, 0, -1, -1, sold_unit, NULL, player);
		CommandBuy(unit, sold_unit, player);
	} else {
		NetworkSendCommand(MessageCommandBuy, unit, player, 0, sold_unit, 0, 0);
	}
}
Esempio n. 21
0
/**
** Send command: Set new rally point for unit.
**
** @param unit    pointer to unit.
** @param pos     map tile position to move to.
*/
void SendCommandRallyPoint(CUnit &unit, const Vec2i &pos, int z)
{
	if (!IsNetworkGame()) {
		CommandLog("rally-point", &unit, 0, pos.x, pos.y, NoUnitP, NULL, -1);
		CommandRallyPoint(unit, pos, z);
	} else {
		NetworkSendCommand(MessageCommandMove, unit, pos.x, pos.y, NoUnitP, 0, 0);
	}
}
Esempio n. 22
0
/**
** Send command: Follow unit to position.
**
** @param unit    pointer to unit.
** @param dest    follow this unit.
** @param flush   Flag flush all pending commands.
*/
void SendCommandFollow(CUnit &unit, CUnit &dest, int flush)
{
	if (!IsNetworkGame()) {
		CommandLog("follow", &unit, flush, -1, -1, &dest, NULL, -1);
		CommandFollow(unit, dest, flush);
	} else {
		NetworkSendCommand(MessageCommandFollow, unit, 0, 0, &dest, 0, flush);
	}
}
Esempio n. 23
0
/**
** Send command: Unit repair.
**
** @param unit    Pointer to unit.
** @param pos     map tile position to repair.
** @param dest    Unit to be repaired.
** @param flush   Flag flush all pending commands.
*/
void SendCommandRepair(CUnit &unit, const Vec2i &pos, CUnit *dest, int flush)
{
	if (!IsNetworkGame()) {
		CommandLog("repair", &unit, flush, pos.x, pos.y, dest, NULL, -1);
		CommandRepair(unit, pos, dest, flush);
	} else {
		NetworkSendCommand(MessageCommandRepair, unit, pos.x, pos.y, dest, 0, flush);
	}
}
Esempio n. 24
0
/**
** Send command: Building/unit research.
**
** @param unit     pointer to unit.
** @param what     research-type of the research.
** @param flush    Flag flush all pending commands.
*/
void SendCommandResearch(CUnit &unit, CUpgrade &what, int flush)
{
	if (!IsNetworkGame()) {
		CommandLog("research", &unit, flush, -1, -1, NoUnitP, what.Ident.c_str(), -1);
		CommandResearch(unit, what, flush);
	} else {
		NetworkSendCommand(MessageCommandResearch, unit,
						   what.ID, 0, NoUnitP, NULL, flush);
	}
}
Esempio n. 25
0
/**
** Send command: Cancel building upgrading to.
**
** @param unit  Pointer to unit.
*/
void SendCommandCancelUpgradeTo(CUnit &unit)
{
	if (!IsNetworkGame()) {
		CommandLog("cancel-upgrade-to", &unit, FlushCommands, -1, -1, NoUnitP, NULL, -1);
		CommandCancelUpgradeTo(unit);
	} else {
		NetworkSendCommand(MessageCommandCancelUpgrade, unit,
						   0, 0, NoUnitP, NULL, FlushCommands);
	}
}
Esempio n. 26
0
/**
**  Send command: Cancel this building construction.
**
**  @param unit  pointer to unit.
*/
void SendCommandDismiss(CUnit &unit)
{
	// FIXME: currently unit and worker are same?
	if (!IsNetworkGame()) {
		CommandLog("dismiss", &unit, FlushCommands, -1, -1, NULL, NULL, -1);
		CommandDismiss(unit);
	} else {
		NetworkSendCommand(MessageCommandDismiss, unit, 0, 0, NULL, 0, FlushCommands);
	}
}
Esempio n. 27
0
/**
** Send command: Cancel Building/unit research.
**
** @param unit pointer to unit.
*/
void SendCommandCancelResearch(CUnit &unit)
{
	if (!IsNetworkGame()) {
		CommandLog("cancel-research", &unit, FlushCommands, -1, -1, NoUnitP, NULL, -1);
		CommandCancelResearch(unit);
	} else {
		NetworkSendCommand(MessageCommandCancelResearch, unit,
						   0, 0, NoUnitP, NULL, FlushCommands);
	}
}
Esempio n. 28
0
/**
** Send command: Unit spell cast on position/unit.
**
** @param unit      pointer to unit.
** @param pos       map tile position where to cast spell.
** @param dest      Cast spell on unit (if exist).
** @param spellid   Spell type id.
** @param flush     Flag flush all pending commands.
*/
void SendCommandSpellCast(CUnit &unit, const Vec2i &pos, CUnit *dest, int spellid, int flush)
{
	if (!IsNetworkGame()) {
		CommandLog("spell-cast", &unit, flush, pos.x, pos.y, dest, NULL, spellid);
		CommandSpellCast(unit, pos, dest, *SpellTypeTable[spellid], flush);
	} else {
		NetworkSendCommand(MessageCommandSpellCast + spellid,
						   unit, pos.x, pos.y, dest, NULL, flush);
	}
}
Esempio n. 29
0
/**
** Send command: Unit auto spell cast.
**
** @param unit      pointer to unit.
** @param spellid   Spell type id.
** @param on        1 for auto cast on, 0 for off.
*/
void SendCommandAutoSpellCast(CUnit &unit, int spellid, int on)
{
	if (!IsNetworkGame()) {
		CommandLog("auto-spell-cast", &unit, FlushCommands, on, -1, NoUnitP, NULL, spellid);
		CommandAutoSpellCast(unit, spellid, on);
	} else {
		NetworkSendCommand(MessageCommandSpellCast + spellid,
						   unit, on, -1, NoUnitP, NULL, FlushCommands);
	}
}
Esempio n. 30
0
/**
** Send command: Unit learn ability.
**
** @param unit     pointer to unit.
** @param what     upgrade-type of the ability.
*/
void SendCommandLearnAbility(CUnit &unit, CUpgrade &what)
{
	if (!IsNetworkGame()) {
		CommandLog("learn-ability", &unit, 0, -1, -1, NoUnitP, what.Ident.c_str(), -1);
		CommandLearnAbility(unit, what);
	} else {
		NetworkSendCommand(MessageCommandLearnAbility, unit,
						   what.ID, 0, NoUnitP, NULL, 0);
	}
}