Пример #1
0
/**
**  Called if training of a unit is completed.
**
**  @param unit  Pointer to unit making.
**  @param what  Pointer to new ready trained unit.
*/
void AiTrainingComplete(CUnit &unit, CUnit &what)
{
	DebugPrint("%d: %d(%s) training %s at %d,%d completed\n" _C_
			   unit.Player->Index _C_ UnitNumber(unit) _C_ unit.Type->Ident.c_str() _C_
			   what.Type->Ident.c_str() _C_ unit.tilePos.x _C_ unit.tilePos.y);

	Assert(unit.Player->Type != PlayerPerson);

	AiRemoveFromBuilt(unit.Player->Ai, *what.Type);

	unit.Player->Ai->Force.RemoveDeadUnit();
	unit.Player->Ai->Force.Assign(what);

}
Пример #2
0
/**
**  Called if work complete (Buildings).
**
**  @param unit  Pointer to unit that builds the building.
**  @param what  Pointer to unit building that was built.
*/
void AiWorkComplete(CUnit *unit, CUnit &what)
{
	if (unit) {
		DebugPrint("%d: %d(%s) build %s at %d,%d completed\n" _C_
				   what.Player->Index _C_ UnitNumber(*unit) _C_ unit->Type->Ident.c_str() _C_
				   what.Type->Ident.c_str() _C_ unit->tilePos.x _C_ unit->tilePos.y);
	} else {
		DebugPrint("%d: building %s at %d,%d completed\n" _C_
				   what.Player->Index _C_ what.Type->Ident.c_str() _C_ what.tilePos.x _C_ what.tilePos.y);
	}

	Assert(what.Player->Type != PlayerPerson);
	AiRemoveFromBuilt(what.Player->Ai, *what.Type);
}
Пример #3
0
/**
**  Called when training of a unit is completed.
**
**  @param unit     Unit that trained the new unit.
**  @param newUnit  The new unit.
*/
void AiTrainingComplete(CUnit *unit, CUnit *newUnit)
{
	DebugPrint("%d: %d(%s) training %s at %d,%d completed\n" _C_
		unit->Player->Index _C_ UnitNumber(unit) _C_ unit->Type->Ident.c_str() _C_
		newUnit->Type->Ident.c_str() _C_ unit->X _C_ unit->Y);

	Assert(unit->Player->Type != PlayerPerson);

	AiRemoveFromBuilt(unit->Player->Ai, newUnit->Type);

	AiPlayer = unit->Player->Ai;
	AiCleanForces();
	AiAssignToForce(newUnit);
}
Пример #4
0
/**
**  Called when work complete (Buildings).
**
**  @param unit     The unit that was building the building.
**  @param newUnit  New unit that was built.
*/
void AiWorkComplete(CUnit *unit, CUnit *newUnit)
{
	if (unit)
	{
		DebugPrint("%d: %d(%s) build %s at %d,%d completed\n" _C_
			newUnit->Player->Index _C_ UnitNumber(unit) _C_ unit->Type->Ident.c_str() _C_
			newUnit->Type->Ident.c_str() _C_ unit->X _C_ unit->Y);
	}
	else
	{
		DebugPrint("%d: building %s at %d,%d completed\n" _C_
			newUnit->Player->Index _C_ newUnit->Type->Ident.c_str() _C_ newUnit->X _C_ newUnit->Y);
	}

	Assert(newUnit->Player->Type != PlayerPerson);
	AiRemoveFromBuilt(newUnit->Player->Ai, newUnit->Type);
}