MCPcopy Create free account
hub / github.com/bfbbdecomp/bfbb / format

Function format

src/SB/Game/zSaveLoad.cpp:353–413  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

351}
352
353S32 format(S32 num, S32 mode)
354{
355 st_XSAVEGAME_DATA* data = zSaveLoadSGInit(XSG_MODE_LOAD);
356 S32 tgtmax;
357
358 S32 rc = 0;
359 switch (xSGTgtCount(data, &tgtmax))
360 {
361 case 2:
362 xSGTgtSelect(data, num);
363 rc = xSGTgtFormatTgt(data, num, 0);
364 zSaveLoadSGDone(data);
365 if (rc == -1)
366 {
367 zSaveLoad_ErrorFormatCardYankedPrompt(mode);
368 rc = 5;
369 }
370 else
371 {
372 if (rc == 0)
373 {
374 zSaveLoad_ErrorFormatPrompt(mode);
375 }
376 if (rc != 0)
377 {
378 rc = 1;
379 }
380 }
381 break;
382 case 1:
383 S32 idx = xSGTgtPhysSlotIdx(data, 0);
384 if (idx != num)
385 {
386 zSaveLoadSGDone(data);
387 rc = 5;
388 }
389 else
390 {
391 if (idx ^ num)
392 {
393 zSaveLoadSGDone(data);
394 }
395 else
396 {
397 xSGTgtSelect(data, 0);
398 rc = xSGTgtFormatTgt(data, num, 0);
399 zSaveLoadSGDone(data);
400 if (rc == 0)
401 {
402 zSaveLoad_ErrorFormatPrompt(mode);
403 }
404 }
405 }
406 break;
407 case 0:
408 rc = 5;
409 zSaveLoadSGDone(data);
410 break;

Callers 1

Calls 8

zSaveLoadSGInitFunction · 0.85
zSaveLoadSGDoneFunction · 0.85
xSGTgtPhysSlotIdxFunction · 0.85
xSGTgtCountFunction · 0.50
xSGTgtSelectFunction · 0.50
xSGTgtFormatTgtFunction · 0.50

Tested by

no test coverage detected