/* * All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or * its licensors. * * For complete copyright and license terms please see the LICENSE at the root of this * distribution (the "License"). All use of this software is governed by the License, * or, if provided, by the license below or the license accompanying this file. Do not * remove or modify any license notices. This file is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * */ // Original file Copyright Crytek GMBH or its affiliates, used under license. #ifndef CRYINCLUDE_CRYACTION_STATISTICS_SCRIPTBIND_GAMESTATISTICS_H #define CRYINCLUDE_CRYACTION_STATISTICS_SCRIPTBIND_GAMESTATISTICS_H #pragma once #include #include #define STATISTICS_CHECK_BINDING 1 struct IStatsTracker; class CGameStatistics; class CScriptBind_GameStatistics : public CScriptableBase { public: CScriptBind_GameStatistics(CGameStatistics* pGS); virtual ~CScriptBind_GameStatistics (); virtual void GetMemoryUsage(ICrySizer* pSizer) const { pSizer->AddObject(this, sizeof(*this)); #if STATISTICS_CHECK_BINDING pSizer->AddObject(m_boundTrackers); #endif } //! GameStatistics.PushGameScope(scopeID) //! identifier of the scope to be placed on top of the stack. //! Pushes a scope on top of the stack. virtual int PushGameScope(IFunctionHandler* pH, int scopeID); //! GameStatistics.PopGameScope( [checkScopeId] ) //! (optional) //! Removes the scope from the top of the stack. virtual int PopGameScope(IFunctionHandler* pH); //! GameStatistics.CurrentScope() //! Returns the ID of current scope, -1 if stack is empty. virtual int CurrentScope(IFunctionHandler* pH); //! GameStatistics.AddGameElement( scopeID, elementID, locatorID, locatorValue [, table]) //! Adds a game element to specified scope. virtual int AddGameElement(IFunctionHandler* pH); //! GameStatistics.RemoveGameElement( scopeID, elementID, locatorID, locatorValue ) //! Removes element from the specified scope if data parameters match. virtual int RemoveGameElement(IFunctionHandler* pH); //! GameStatistics.Event() virtual int Event(IFunctionHandler* pH); //! GameStatistics.StateValue( ) virtual int StateValue(IFunctionHandler* pH); //! GameStatistics.BindTracker( name, tracker ) bool BindTracker(IScriptTable* pT, const char* name, IStatsTracker* tracker); //! GameStatistics.UnbindTracker( name, tracker ) bool UnbindTracker(IScriptTable* pT, const char* name, IStatsTracker* tracker); private: void RegisterMethods(); void RegisterGlobals(); static IStatsTracker* GetTracker(IFunctionHandler* pH); static IGameStatistics* GetStats(IFunctionHandler* pH); //CScriptableBase m_StatsTracker; //[FINDME][SergeyR]: ctor is protected CGameStatistics* m_pGS; IScriptSystem* m_pSS; #if STATISTICS_CHECK_BINDING std::set m_boundTrackers; #endif }; #endif // CRYINCLUDE_CRYACTION_STATISTICS_SCRIPTBIND_GAMESTATISTICS_H