Colobot
Classes | Public Member Functions | List of all members
CScoreboard Class Reference

Scoreboard used to score complex code battles. More...

#include <src/level/scoreboard.h>

Classes

class  CScoreboardEndTakeRule
 Scoreboard rule for EndMissionTake rewards. More...
 
class  CScoreboardKillRule
 Scoreboard rule for destroying other objects. More...
 
class  CScoreboardRule
 Base class for scoreboard rules. More...
 

Public Member Functions

 CScoreboard ()
 
 ~CScoreboard ()
 Destroys the scoreboard. More...
 
void AddKillRule (std::unique_ptr< CScoreboardKillRule > rule)
 Add ScoreboardKillRule. More...
 
void AddEndTakeRule (std::unique_ptr< CScoreboardEndTakeRule > rule)
 Add ScoreboardEndTakeRule. More...
 
void ProcessKill (CObject *target, CObject *killer=nullptr)
 
void ProcessEndTake (int team)
 Called after EndTake contition has been met, used to handle ScoreboardEndTakeRule. More...
 
void AddPoints (int team, int points)
 
int GetScore (int team)
 
void SetScore (int team, int score)
 

Detailed Description

Scoreboard used to score complex code battles.

Todo:
This is pretty much a work-in-progress hack for Diversity. Be wary of possible API changes.
Todo:
Proper documentation
See also
CRobotMain::GetScoreboard()

Usage example

Scoreboard enable=true // enable the scoreboard
ScoreboardKillRule type=WheeledShooter team=1 score=500 // destruction of team 1's WheeledShooter gives 100 points to the team that destroyed it
ScoreboardKillRule type=TargetBot score=100 // destruction of TargetBot (any team) gives 100 points
ScoreboardEndTakeRule score=1000 // completion of EndMissionTake objectives for any team results in 1000 points for that team

Constructor & Destructor Documentation

◆ CScoreboard()

CScoreboard::CScoreboard ( )
inline

Creates the scoreboard The scoreboard exists only if enabled in level file

◆ ~CScoreboard()

CScoreboard::~CScoreboard ( )
inline

Destroys the scoreboard.

Member Function Documentation

◆ AddKillRule()

void CScoreboard::AddKillRule ( std::unique_ptr< CScoreboardKillRule rule)

Add ScoreboardKillRule.

◆ AddEndTakeRule()

void CScoreboard::AddEndTakeRule ( std::unique_ptr< CScoreboardEndTakeRule rule)

Add ScoreboardEndTakeRule.

◆ ProcessKill()

void CScoreboard::ProcessKill ( CObject target,
CObject killer = nullptr 
)

Called after an object is destroyed by another object

Parameters
targetThe object that has just been destroyed
killerThe object that caused the destruction, can be null

◆ ProcessEndTake()

void CScoreboard::ProcessEndTake ( int  team)

Called after EndTake contition has been met, used to handle ScoreboardEndTakeRule.


The documentation for this class was generated from the following files: