Public Member Functions | Private Attributes

CargoAndTransfer Class Reference

Class for holding a CargoID and a boolean to be used in an anonymous union. More...

Public Member Functions

 operator CargoID () const
CargoID operator= (CargoID cargo)
 When setting the CargoID, initialize transfer.
bool HasTransfer () const
void SetTransfer (bool transfer)

Private Attributes

CargoID cargo
bool transfer

Detailed Description

Class for holding a CargoID and a boolean to be used in an anonymous union.

Anonymous structs in anonymous unions are supported in most compilers, but not part of the standard. The problem here can not be cleanly solved with templates and inheritance as that would require separate types for each "column" of the station GUI (there is no way to recursively typedef template classes). With the general purpose CargoDataEntry I'm avoiding that and reducing code size significantly.

Definition at line 844 of file station_gui.cpp.


Member Function Documentation

CargoID CargoAndTransfer::operator= ( CargoID  cargo  )  [inline]

When setting the CargoID, initialize transfer.

We can't define a constructor as that could not be used in a union, either.

Parameters:
cargo New CargoID.
Returns:
The just set cargo.

Definition at line 856 of file station_gui.cpp.


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