MCPcopy Create free account
hub / github.com/OGSR/OGSR-Engine / PutNextToSlot

Method PutNextToSlot

ogsr_engine/xrGame/Grenade.cpp:181–216  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

179}
180
181void CGrenade::PutNextToSlot()
182{
183 VERIFY(!getDestroy());
184
185 //выкинуть гранату из инвентаря
186 if (m_pCurrentInventory)
187 {
188 NET_Packet P;
189 m_pCurrentInventory->Ruck(this);
190
191 this->u_EventGen(P, GEG_PLAYER_ITEM2RUCK, this->H_Parent()->ID());
192 P.w_u16(this->ID());
193 this->u_EventSend(P);
194
195 CGrenade* pNext = smart_cast<CGrenade*>(m_pCurrentInventory->Same(this, true));
196 if (!pNext)
197 pNext = smart_cast<CGrenade*>(m_pCurrentInventory->SameSlot(GRENADE_SLOT, this, true));
198
199 VERIFY(pNext != this);
200
201 if (pNext && m_pCurrentInventory->Slot(pNext))
202 {
203 pNext->u_EventGen(P, GEG_PLAYER_ITEM2SLOT, pNext->H_Parent()->ID());
204 P.w_u16(pNext->ID());
205 pNext->u_EventSend(P);
206 m_pCurrentInventory->SetActiveSlot(pNext->GetSlot());
207 }
208 else
209 {
210 CActor* pActor = smart_cast<CActor*>(m_pCurrentInventory->GetOwner());
211
212 if (pActor)
213 pActor->OnPrevWeaponSlot();
214 }
215 }
216}
217
218void CGrenade::TrySwitchGrenade(CGrenade* grenade)
219{

Callers

nothing calls this directly

Calls 12

getDestroyFunction · 0.85
SameMethod · 0.80
SameSlotMethod · 0.80
SetActiveSlotMethod · 0.80
OnPrevWeaponSlotMethod · 0.80
RuckMethod · 0.45
u_EventGenMethod · 0.45
w_u16Method · 0.45
u_EventSendMethod · 0.45
SlotMethod · 0.45
GetSlotMethod · 0.45
GetOwnerMethod · 0.45

Tested by

no test coverage detected