MCPcopy Create free account
hub / github.com/TurningWheel/Barony / copyStats

Method copyStats

src/stat.cpp:629–895  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

627-------------------------------------------------------------------------------*/
628
629Stat* Stat::copyStats()
630{
631 node_t* node;
632 int c;
633
634 // create new stat, using the type (HUMAN, SKELETON) as a reference.
635 // this is handled in stat_shared.cpp by adding 1000 to the type.
636 Stat* newStat = new Stat(this->type + 1000);
637
638 newStat->type = this->type;
639 newStat->sex = this->sex;
640 newStat->stat_appearance = this->stat_appearance;
641 strcpy(newStat->name, this->name);
642 strcpy(newStat->obituary, this->obituary);
643
644 newStat->HP = this->HP;
645 newStat->MAXHP = this->MAXHP;
646 newStat->OLDHP = this->OLDHP;
647
648 newStat->MP = this->MP;
649 newStat->MAXMP = this->MAXMP;
650 newStat->STR = this->STR;
651 newStat->DEX = this->DEX;
652 newStat->CON = this->CON;
653 newStat->INT = this->INT;
654 newStat->PER = this->PER;
655 newStat->CHR = this->CHR;
656 newStat->EXP = this->EXP;
657 newStat->LVL = this->LVL;
658 newStat->GOLD = this->GOLD;
659 newStat->HUNGER = this->HUNGER;
660
661 for (c = 0; c < NUMPROFICIENCIES; c++)
662 {
663 newStat->PROFICIENCIES[c] = this->PROFICIENCIES[c];
664 }
665 for (c = 0; c < NUMEFFECTS; c++)
666 {
667 newStat->EFFECTS[c] = this->EFFECTS[c];
668 newStat->EFFECTS_TIMERS[c] = this->EFFECTS_TIMERS[c];
669 newStat->EFFECTS_ACCRETION_TIME[c] = this->EFFECTS_ACCRETION_TIME[c];
670 }
671
672 for ( c = 0; c < ITEM_SLOT_NUM; c++ )
673 {
674 newStat->EDITOR_ITEMS[c] = this->EDITOR_ITEMS[c];
675 }
676
677 for ( c = 0; c < 32; c++ )
678 {
679 newStat->MISC_FLAGS[c] = this->MISC_FLAGS[c];
680 }
681
682 for ( c = 0; c < NUMSTATS; c++ )
683 {
684 newStat->PLAYER_LVL_STAT_BONUS[c] = this->PLAYER_LVL_STAT_BONUS[c];
685 }
686

Callers 3

gameLogicFunction · 0.45
doNewGameFunction · 0.45
setSpriteAttributesFunction · 0.45

Calls 3

list_CopyFunction · 0.85
list_NodeFunction · 0.85
list_IndexFunction · 0.85

Tested by

no test coverage detected