class DepletablePoints

Keeps track of a variable value with a maximum possible value. More...

Definition#include <dpoints.h>
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Members


Detailed Description

Keeps track of a variable value with a maximum possible value. Archetypical example is hit points.

DepletablePoints (void)

Creates a DepletablePoints with maximum 0

DepletablePoints (int val)

Creates a DepletablePoints with maximum val

DepletablePoints (int curr,int max)

Creates a DepletablePoints with maximum max but a current value curr

int Change (int delta)

Increases the current value by delta and enforces the maximum. Returns the new current value

int SetCurrent (int val)

Changes the current value to val and enforces the maximum. Returns the new current value

int SetMax (int val)

Sets the maximum value to val and enforces it. Returns the new current value

int ChangeMax (int delta)

Increases the maximum value by delta and enforces it. Returns the new current value

void become (DepletablePoints arg)

Makes the current and maximum values equal to the corresponding values in the argument.

int GetCurrent (void)
[const]

Returns the current value of the object

int GetMax (void)
[const]

Returns the maximum value

bool IsPositive (void)
[const]

What do you think?

DepletablePoints operator++ ()

Increments the current value of the DepletablePoints.

DepletablePoints operator-- ()

Decrements the current value of the DepletablePoints.

int operator+ (int arg)
[const]

Adds the argument to the current value and returns it. Non-destructive.

int operator- (int arg)
[const]

Subtracts the argument from the current value and returns it.

DepletablePoints operator= (int arg)

Assigns the argument to the current value.

DepletablePoints operator= (DepletablePoints arg)

Assigns the current value of the argument to the current value.

DepletablePoints operator+= (int arg)

Increases the current value by the argument.

DepletablePoints operator-= (int arg)

Decreases the current value by the argument.