Skip to content

Commit

Permalink
Add m_scriptInstance member to INextBotComponent. (#35)
Browse files Browse the repository at this point in the history
This fixes yet another crash from the vscript update.
  • Loading branch information
KitRifty authored Dec 3, 2022
1 parent deb245a commit bbc3fe2
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
4 changes: 4 additions & 0 deletions extension/sourcesdk/NextBot/NextBotComponentInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ bool INextBotComponent::Init(SourceMod::IGameConfig* config, char* error, size_t

INextBotComponent::INextBotComponent(INextBot *bot)
{
#if SOURCE_ENGINE == SE_TF2
m_scriptInstance = 0;
#endif

m_curInterval = TICK_INTERVAL;
m_lastUpdateTime = 0;
m_bot = bot;
Expand Down
14 changes: 13 additions & 1 deletion extension/sourcesdk/NextBot/NextBotComponentInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,20 @@ class INextBotComponent : public INextBotEventResponder
INextBotComponent(INextBot *bot);
virtual ~INextBotComponent() { };

virtual void Reset(void) { m_lastUpdateTime = 0; m_curInterval = TICK_INTERVAL; }
virtual void Reset(void)
{
m_lastUpdateTime = 0.0;
m_curInterval = TICK_INTERVAL;
}

virtual void Update(void) = 0;
virtual void Upkeep(void) { };
virtual INextBot *GetBot(void) const { return m_bot; }

#if SOURCE_ENGINE == SE_TF2
class CUnknown;
virtual CUnknown *GetScriptDesc(void) const { return nullptr; }
#endif

inline bool ComputeUpdateInterval(void);
inline float GetUpdateInterval(void);
Expand All @@ -52,6 +60,10 @@ class INextBotComponent : public INextBotEventResponder
INextBot *m_bot;
INextBotComponent *m_nextComponent;

#if SOURCE_ENGINE == SE_TF2
std::int32_t m_scriptInstance;
#endif

public:
static VCall<void> vUpdate;
};
Expand Down
2 changes: 1 addition & 1 deletion product.version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.8.1
1.8.2

0 comments on commit bbc3fe2

Please sign in to comment.