/** ** Called if building can't be build. ** ** @param unit Pointer to unit what builds the building. ** @param what Pointer to unit-type. */ void AiCanNotBuild(const CUnit &unit, const CUnitType &what) { DebugPrint("%d: %d(%s) Can't build %s at %d,%d\n" _C_ unit.Player->Index _C_ UnitNumber(unit) _C_ unit.Type->Ident.c_str() _C_ what.Ident.c_str() _C_ unit.tilePos.x _C_ unit.tilePos.y); Assert(unit.Player->Type != PlayerPerson); AiReduceMadeInBuilt(*unit.Player->Ai, what); }
/** Called when unit is killed. ** warn the AI module. */ void COrder_Build::AiUnitKilled(CUnit &unit) { DebugPrint("%d: %d(%s) killed, with order %s!\n" _C_ unit.Player->Index _C_ UnitNumber(unit) _C_ unit.Type->Ident.c_str() _C_ this->Type->Ident.c_str()); if (this->BuildingUnit == NULL) { AiReduceMadeInBuilt(*unit.Player->Ai, *this->Type); } }
/** ** Called if building can't be built. ** ** @param unit The unit trying to build. ** @param unitType Unit type trying to be built. */ void AiCanNotBuild(CUnit *unit, const CUnitType *unitType) { DebugPrint("%d: %d(%s) Can't build %s at %d,%d\n" _C_ unit->Player->Index _C_ UnitNumber(unit) _C_ unit->Type->Ident.c_str() _C_ unitType->Ident.c_str() _C_ unit->X _C_ unit->Y); Assert(unit->Player->Type != PlayerPerson); AiReduceMadeInBuilt(unit->Player->Ai, unitType); }
/** ** Called when a unit is killed. ** ** @param unit Pointer to unit. */ void AiUnitKilled(CUnit *unit) { DebugPrint("%d: %d(%s) killed\n" _C_ unit->Player->Index _C_ UnitNumber(unit) _C_ unit->Type->Ident.c_str()); Assert(unit->Player->Type != PlayerPerson); // FIXME: must handle all orders... switch (unit->Orders[0]->Action) { case UnitActionStill: case UnitActionAttack: case UnitActionMove: break; case UnitActionBuilt: DebugPrint("%d: %d(%s) killed, under construction!\n" _C_ unit->Player->Index _C_ UnitNumber(unit) _C_ unit->Type->Ident.c_str()); AiReduceMadeInBuilt(unit->Player->Ai, unit->Type); break; case UnitActionBuild: DebugPrint("%d: %d(%s) killed, with order %s!\n" _C_ unit->Player->Index _C_ UnitNumber(unit) _C_ unit->Type->Ident.c_str() _C_ unit->Orders[0]->Type->Ident.c_str()); if (!unit->Orders[0]->Goal) { AiReduceMadeInBuilt(unit->Player->Ai, unit->Orders[0]->Type); } break; default: DebugPrint("FIXME: %d: %d(%s) killed, with order %d!\n" _C_ unit->Player->Index _C_ UnitNumber(unit) _C_ unit->Type->Ident.c_str() _C_ unit->Orders[0]->Action); break; } }
/** ** Called if building place can't be reached. ** ** @param unit Pointer to unit what builds the building. ** @param what Pointer to unit-type. */ void AiCanNotReach(CUnit &unit, const CUnitType &what) { Assert(unit.Player->Type != PlayerPerson); AiReduceMadeInBuilt(*unit.Player->Ai, what); }
/** Called when unit is killed. ** warn the AI module. */ void COrder_Built::AiUnitKilled(CUnit &unit) { DebugPrint("%d: %d(%s) killed, under construction!\n" _C_ unit.Player->Index _C_ UnitNumber(unit) _C_ unit.Type->Ident.c_str()); AiReduceMadeInBuilt(*unit.Player->Ai, *unit.Type); }
/** ** Called if building place can't be reached. ** ** @param unit The unit trying to build. ** @param unitType Unit type trying to be built. */ void AiCanNotReach(CUnit *unit, const CUnitType *unitType) { Assert(unit->Player->Type != PlayerPerson); AiReduceMadeInBuilt(unit->Player->Ai, unitType); }