Exported cScoreboard::ForEachObjective
This commit is contained in:
@@ -2583,6 +2583,10 @@ void ManualBindings::Bind(lua_State * tolua_S)
|
||||
tolua_beginmodule(tolua_S, "cMapManager");
|
||||
tolua_function(tolua_S, "DoWithMap", tolua_DoWithID<cMapManager, cMap, &cMapManager::DoWithMap>);
|
||||
tolua_endmodule(tolua_S);
|
||||
|
||||
tolua_beginmodule(tolua_S, "cScoreboard");
|
||||
tolua_function(tolua_S, "ForEachObjective", tolua_ForEach<cScoreboard, cObjective, &cScoreboard::ForEachObjective>);
|
||||
tolua_endmodule(tolua_S);
|
||||
|
||||
tolua_beginmodule(tolua_S, "cPlugin");
|
||||
tolua_function(tolua_S, "Call", tolua_cPlugin_Call);
|
||||
|
||||
+22
-2
@@ -457,7 +457,7 @@ cObjective * cScoreboard::GetObjectiveIn(eDisplaySlot a_Slot)
|
||||
|
||||
|
||||
|
||||
void cScoreboard::ForEachObjectiveWith(cObjective::eType a_Type, cObjectiveCallback& a_Callback)
|
||||
bool cScoreboard::ForEachObjectiveWith(cObjective::eType a_Type, cObjectiveCallback& a_Callback)
|
||||
{
|
||||
cCSLock Lock(m_CSObjectives);
|
||||
|
||||
@@ -468,10 +468,30 @@ void cScoreboard::ForEachObjectiveWith(cObjective::eType a_Type, cObjectiveCallb
|
||||
// Call callback
|
||||
if (a_Callback.Item(&it->second))
|
||||
{
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
bool cScoreboard::ForEachObjective(cObjectiveCallback& a_Callback)
|
||||
{
|
||||
cCSLock Lock(m_CSObjectives);
|
||||
|
||||
for (cObjectiveMap::iterator it = m_Objectives.begin(); it != m_Objectives.end(); ++it)
|
||||
{
|
||||
// Call callback
|
||||
if (a_Callback.Item(&it->second))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
+17
-2
@@ -92,6 +92,12 @@ public:
|
||||
/** Send this objective to the specified client */
|
||||
void SendTo(cClientHandle & a_Client);
|
||||
|
||||
static const char * GetClassStatic(void) // Needed for ManualBindings's ForEach templates
|
||||
{
|
||||
return "cObjective";
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
|
||||
typedef std::pair<AString, Score> cTrackedPlayer;
|
||||
@@ -246,8 +252,17 @@ public:
|
||||
|
||||
cTeam * QueryPlayerTeam(const AString & a_Name); // WARNING: O(n logn)
|
||||
|
||||
/** Execute callback for each objective with the specified type */
|
||||
void ForEachObjectiveWith(cObjective::eType a_Type, cObjectiveCallback& a_Callback);
|
||||
/** Execute callback for each objective with the specified type
|
||||
*
|
||||
* Returns true if all objectives processed, false if the callback aborted by returning true.
|
||||
*/
|
||||
bool ForEachObjectiveWith(cObjective::eType a_Type, cObjectiveCallback& a_Callback);
|
||||
|
||||
/** Execute callback for each objective.
|
||||
*
|
||||
* Returns true if all objectives processed, false if the callback aborted by returning true.
|
||||
*/
|
||||
bool ForEachObjective(cObjectiveCallback& a_Callback); // Exported in ManualBindings.cpp
|
||||
|
||||
void SetDisplay(cObjective * a_Objective, eDisplaySlot a_Slot);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user