| 1123 | } |
| 1124 | |
| 1125 | void ScriptExt::ChronoshiftToEnemyBase(TeamClass* pTeam, int extraDistance) |
| 1126 | { |
| 1127 | auto pScript = pTeam->CurrentScript; |
| 1128 | auto const pLeader = ScriptExt::FindTheTeamLeader(pTeam); |
| 1129 | |
| 1130 | char logText[1024]; |
| 1131 | sprintf_s(logText, "AI Scripts - ChronoshiftToEnemyBase: [%s] [%s] (line: %d = %d,%d) Jump to next line: %d = %d,%d -> (Reason: %s)\n", pTeam->Type->ID, pScript->Type->ID, pScript->CurrentMission, pScript->Type->ScriptActions[pScript->CurrentMission].Action, pScript->Type->ScriptActions[pScript->CurrentMission].Argument, pScript->CurrentMission + 1, pScript->Type->ScriptActions[pScript->CurrentMission + 1].Action, pScript->Type->ScriptActions[pScript->CurrentMission + 1].Argument, "%s"); |
| 1132 | |
| 1133 | if (!pLeader) |
| 1134 | { |
| 1135 | ScriptExt::Log(logText, "No team leader found"); |
| 1136 | pTeam->StepCompleted = true; |
| 1137 | return; |
| 1138 | } |
| 1139 | |
| 1140 | int houseIndex = pLeader->Owner->EnemyHouseIndex; |
| 1141 | HouseClass* pEnemy = houseIndex != -1 ? HouseClass::Array.GetItem(houseIndex) : nullptr; |
| 1142 | |
| 1143 | if (!pEnemy) |
| 1144 | { |
| 1145 | ScriptExt::Log(logText, "No enemy house found"); |
| 1146 | pTeam->StepCompleted = true; |
| 1147 | return; |
| 1148 | } |
| 1149 | |
| 1150 | auto const pTargetCell = HouseExt::GetEnemyBaseGatherCell(pEnemy, pLeader->Owner, pLeader->GetCoords(), pLeader->GetTechnoType()->SpeedType, extraDistance); |
| 1151 | |
| 1152 | if (!pTargetCell) |
| 1153 | { |
| 1154 | ScriptExt::Log(logText, "No target cell found"); |
| 1155 | pTeam->StepCompleted = true; |
| 1156 | return; |
| 1157 | } |
| 1158 | |
| 1159 | ScriptExt::ChronoshiftTeamToTarget(pTeam, pLeader, pTargetCell); |
| 1160 | } |
| 1161 | |
| 1162 | void ScriptExt::ChronoshiftTeamToTarget(TeamClass* pTeam, TechnoClass* pTeamLeader, AbstractClass* pTarget) |
| 1163 | { |
nothing calls this directly
no test coverage detected