|
|
#1 |
![]() Join Date: Apr 2008
Reputation: 0
Posts: 339
|
Pure virtual function call in think function
I'm just started with modding and C++ in general (I'm experienced at Java though) and I decided to make pistol shoot in short bursts.
To do this I've defined a function BurstThink (the right word would be copied from CHLSelectFireMachineGun), which calls BaseClass::PrimaryAttack() and reschedules itself if the burst size is not exceeded. I've properly declared this function in DATADESC, however as soon as I press mouse button with pistol equipped I get strange error "Pure virtual function call". Unfortunately there was notthing like good old Java stacktrace, so I could not pinpoint the cause. |
|
|
|
|
|
#2 |
![]() Join Date: Apr 2008
Reputation: 0
Posts: 339
|
Here is the code http://pastebin.com/W5aPVyBw
|
|
|
|
|
|
#3 |
![]() Join Date: Aug 2008
Reputation: 416
Posts: 908
|
check here for debugging: https://developer.valvesoftware.com/...he_Source_Code
you know what a pure virtual function call is? its this http://www.artima.com/cppsource/pure_virtual.html |
|
|
|
|
|
#4 |
![]() Join Date: Apr 2008
Reputation: 0
Posts: 339
|
Yes, I'm aware of what is the pure virtual function. The thing is I don't know how to fix this. As far as I can tell the error occurs when BaseClass::PrimaryAttack() is executed from within think function when I set it up as a think function. When I call it directly everything is OK. So it seems that reference to BaseClass is invalid within think context. That said I don't even know where to start looking for the solution
|
|
|
|
|
|
#5 |
![]() Join Date: Aug 2008
Reputation: 416
Posts: 908
|
As far as i can tell (using google one can apparently find most of the hl2 source code, odd...) CBaseHL2MPCombatWeapon has no PrimaryAttack defined (its only declared) which would explain this behaviour. I dont know why calling it outside the think apparently works for you.
|
|
|
|
![]() |
|
||||||
| Thread Tools | |
| Display Modes | |
|
|