MCPcopy Create free account
hub / github.com/assaultcube/AC / selectweapon

Function selectweapon

source/src/weapon.cpp:52–66  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

50}
51
52void selectweapon(weapon *w)
53{
54 if(!w || !player1->weaponsel->deselectable() || ispaused) return;
55 if(w->selectable())
56 {
57 if(player1->attacking && player1->state == CS_ALIVE) attack(false);
58 int i = w->type;
59 // substitute akimbo
60 weapon *akimbo = player1->weapons[GUN_AKIMBO];
61 if(w->type==GUN_PISTOL && akimbo->selectable()) w = akimbo;
62
63 player1->weaponswitch(w);
64 exechook(HOOK_SP, "onWeaponSwitch", "%d", i);
65 }
66}
67
68void requestweapon(char *ws)
69{

Callers 4

requestweaponFunction · 0.85
shiftweaponFunction · 0.85
quicknadethrowFunction · 0.85
thrownadeMethod · 0.85

Calls 5

attackFunction · 0.85
exechookFunction · 0.85
deselectableMethod · 0.80
selectableMethod · 0.80
weaponswitchMethod · 0.80

Tested by

no test coverage detected