Richard Boegli's CnC_Generals_Zero_Hour Fork WIP
This is documentation of Richard Boegil's Zero Hour Fork
 
Loading...
Searching...
No Matches
Handicap Class Reference

#include <Handicap.h>

Public Types

enum  HandicapType { BUILDCOST , BUILDTIME , HANDICAP_TYPE_COUNT }
 

Public Member Functions

 Handicap ()
 
void init ()
 reset all handicaps to a default value.
 
void readFromDict (const Dict *d)
 
Real getHandicap (HandicapType t, const ThingTemplate *tmpl) const
 

Detailed Description

Handicap encapsulates the sets of modifiers to abilities used to balance the game and give different abilities to different Players. Conceptually, it's a large set of coefficients (typically, but not necessarily, in the range of 0.0...1.0).

Usage example (conceptual):

Real armorCoef = this->m_handicap->getHandicap(ARMOR, this); Real actualArmor = this->getArmorValue() * armorCoef;

Definition at line 69 of file Handicap.h.

Member Enumeration Documentation

◆ HandicapType

Enumerator
BUILDCOST 
BUILDTIME 
HANDICAP_TYPE_COUNT 

Definition at line 75 of file Handicap.h.

Constructor & Destructor Documentation

◆ Handicap()

Handicap::Handicap ( )

Definition at line 53 of file Handicap.cpp.

Member Function Documentation

◆ getHandicap()

Real Handicap::getHandicap ( HandicapType t,
const ThingTemplate * tmpl ) const

return the multiplier for the given Handicap type on the given Object. The Object's type (unit, building, etc.) will generally be examined to determine what value to return.

Definition at line 122 of file Handicap.cpp.

◆ init()

void Handicap::init ( )

reset all handicaps to a default value.

Definition at line 59 of file Handicap.cpp.

◆ readFromDict()

void Handicap::readFromDict ( const Dict * d)

initialize from the fields in the Dict. Note that this does NOT call init() internally, so only those fields that are present in the dict will be set. if you want to ensure all fields are something reasonable, you should call init() prior to calling this.

Definition at line 67 of file Handicap.cpp.


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