MCPcopy Create free account
hub / github.com/Phobos-developers/Phobos / WriteTeams

Method WriteTeams

src/Misc/SyncLogging.cpp:267–320  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

265}
266
267void SyncLogger::WriteTeams(FILE* const pLogFile)
268{
269 if (TeamClass::Array.Count < 1)
270 return;
271
272 fprintf(pLogFile, "AI Teams:\n");
273 char buffer[0x20];
274 size_t count = 0;
275
276 // Set padding for values.
277 for (auto const& pTeam : TeamClass::Array)
278 {
279 SyncLogger::SetTeamLoggingPadding(pTeam);
280 count++;
281 }
282
283 for (size_t i = 0; i < count; i++)
284 {
285 auto const pTeam = TeamClass::Array[i];
286
287 fprintf(pLogFile, "#%05d: Type: %*s",
288 i, SyncLogger::TeamTypeClass_MaxIDLength, pTeam->Type->get_ID());
289
290 if (pTeam->CurrentScript && pTeam->CurrentScript->Type)
291 {
292 sprintf_s(buffer, sizeof(buffer), "%d", pTeam->CurrentScript->CurrentMission);
293 fprintf(pLogFile, " | Script: %*s | Line: %2s", SyncLogger::ScriptTypeClass_MaxIDLength, pTeam->CurrentScript->Type->get_ID(), buffer);
294 }
295
296 if (pTeam->Owner)
297 {
298 sprintf_s(buffer, sizeof(buffer), "(%s)", pTeam->Owner->PlainName);
299 fprintf(pLogFile, " | Owner: %d %*s | OwnerHouse: %*s", pTeam->Owner->ArrayIndex,
300 SyncLogger::HouseName_MaxIDLength, buffer,SyncLogger::HouseTypeClass_MaxIDLength, pTeam->Owner->Type->get_ID());
301 }
302
303 if (pTeam->Focus)
304 {
305 auto const rtti = pTeam->Focus->WhatAmI();
306 fprintf(pLogFile, " | TargetRTTI: %d (%s) | TargetID: %08d", rtti, AbstractClass::GetRTTIName(rtti), pTeam->Focus->UniqueID);
307 }
308
309 if (pTeam->QueuedFocus)
310 {
311 auto const rtti = pTeam->QueuedFocus->WhatAmI();
312 fprintf(pLogFile, " | MissionTargetRTTI: %d (%s) | MissionTargetID: %08d", rtti,AbstractClass::GetRTTIName(rtti),
313 pTeam->QueuedFocus->UniqueID);
314 }
315
316 fprintf(pLogFile, "\n");
317 }
318
319 fprintf(pLogFile, "\n");
320}
321
322void SyncLogger::SetTeamLoggingPadding(TeamClass* pTeam)
323{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected