MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / MoveWeaponFromIndex

Function MoveWeaponFromIndex

Descent3/weapon.cpp:703–712  ·  view source on GitHub ↗

Moves a weapon from a given index into a new one (above MAX_STATIC_WEAPONS) returns new index

Source from the content-addressed store, hash-verified

701// Moves a weapon from a given index into a new one (above MAX_STATIC_WEAPONS)
702// returns new index
703int MoveWeaponFromIndex(int index) {
704 ASSERT(index >= 0 && index < MAX_STATIC_WEAPONS);
705 ASSERT(Weapons[index].used);
706
707 int new_index = AllocWeapon();
708 memcpy(&Weapons[new_index], &Weapons[index], sizeof(weapon));
709 FreeWeapon(index);
710
711 return new_index;
712}
713
714// This is a very confusing function. It takes all the weapons that we have loaded
715// and remaps then into their proper places (if they are static).

Callers 1

RemapWeaponsFunction · 0.85

Calls 2

AllocWeaponFunction · 0.85
FreeWeaponFunction · 0.85

Tested by

no test coverage detected