Freeciv-3.2: hud_unit_combat Class Reference

Freeciv-3.2

Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
hud_unit_combat Class Reference

`#include <hudwidget.h>`

Inheritance diagram for hud_unit_combat:

## Public Member Functions

| hud_unit_combat (int attacker_unit_id, int defender_unit_id, int attacker_hp, int defender_hp, bool make_att_veteran, bool make_def_veteran, float scale, QWidget *parent)
| ~hud_unit_combat ()
bool | get_focus ()
void | set_fading (float fade)
void | set_scale (float scale)

## Protected Member Functions

void | paintEvent (QPaintEvent *event)
void | mousePressEvent (QMouseEvent *e)
void | leaveEvent (QEvent *event)
void | enterEvent (QEnterEvent *event)

## Private Member Functions

void | init_images (bool redraw=false)

## Private Attributes

int | att_hp
int | def_hp
int | att_hp_loss
int | def_hp_loss
bool | att_veteran
bool | def_veteran
struct unit * | attacker
struct unit * | defender
const struct unit_type * | type_attacker
const struct unit_type * | type_defender
struct tile * | center_tile
bool | focus
float | fading
float | hud_scale
QImage | dimg
QImage | aimg

## Detailed Description

Definition at line 294 of file hudwidget.h.

## Constructor & Destructor Documentation

## ◆ hud_unit_combat()

hud_unit_combat::hud_unit_combat | ( | int | attacker_unit_id,
|  | int | defender_unit_id,
|  | int | attacker_hp,
|  | int | defender_hp,
|  | bool | make_att_veteran,
|  | bool | make_def_veteran,
|  | float | scale,
|  | QWidget * | parent
| ) |  |

Hud unit combat contructor, prepares images to show as result

Definition at line 1712 of file hudwidget.cpp.

## ◆ ~hud_unit_combat()

hud_unit_combat::~hud_unit_combat | ( |  | ) |

Hud unit combat destructor

Definition at line 1816 of file hudwidget.cpp.

## Member Function Documentation

## ◆ enterEvent()

void hud_unit_combat::enterEvent | ( | QEnterEvent * | event | ) |

protected

Leave event for hud unit combat. Shows highlight.

Definition at line 1925 of file hudwidget.cpp.

## ◆ get_focus()

bool hud_unit_combat::get_focus | ( |  | ) |

Returns true if widget has focus (used to prevent hiding parent)

Definition at line 1832 of file hudwidget.cpp.

## ◆ init_images()

void hud_unit_combat::init_images | ( | bool | redraw = `false` | ) |

private

Draws images of units to pixmaps for later use

Definition at line 1740 of file hudwidget.cpp.

Referenced by hud_unit_combat(), and set_scale().

## ◆ leaveEvent()

void hud_unit_combat::leaveEvent | ( | QEvent * | event | ) |

protected

Leave event for hud unit combat. Stops showing highlight.

Definition at line 1915 of file hudwidget.cpp.

## ◆ mousePressEvent()

void hud_unit_combat::mousePressEvent | ( | QMouseEvent * | e | ) |

protected

Mouse press event, centers on highlighted combat

Definition at line 1907 of file hudwidget.cpp.

## ◆ paintEvent()

void hud_unit_combat::paintEvent | ( | QPaintEvent * | event | ) |

protected

Paint event for hud_unit combat

Definition at line 1840 of file hudwidget.cpp.

## ◆ set_fading()

void hud_unit_combat::set_fading | ( | float | fade | ) |

Sets widget fading

Definition at line 1823 of file hudwidget.cpp.

Referenced by hud_battle_log::showEvent(), and hud_battle_log::te_inner().

## ◆ set_scale()

void hud_unit_combat::set_scale | ( | float | scale | ) |

Sets scale for images

Definition at line 1807 of file hudwidget.cpp.

## Field Documentation

## ◆ aimg

QImage hud_unit_combat::aimg

private

Definition at line 331 of file hudwidget.h.

Referenced by init_images(), and paintEvent().

## ◆ att_hp

int hud_unit_combat::att_hp

private

Definition at line 317 of file hudwidget.h.

Referenced by hud_unit_combat().

## ◆ att_hp_loss

int hud_unit_combat::att_hp_loss

private

Definition at line 319 of file hudwidget.h.

Referenced by hud_unit_combat(), and paintEvent().

## ◆ att_veteran

bool hud_unit_combat::att_veteran

private

Definition at line 321 of file hudwidget.h.

Referenced by hud_unit_combat(), and paintEvent().

## ◆ attacker

struct unit* hud_unit_combat::attacker

private

Definition at line 323 of file hudwidget.h.

Referenced by hud_unit_combat(), and init_images().

## ◆ center_tile

struct tile* hud_unit_combat::center_tile

private

Definition at line 327 of file hudwidget.h.

Referenced by hud_unit_combat(), and mousePressEvent().

## ◆ def_hp

int hud_unit_combat::def_hp

private

Definition at line 318 of file hudwidget.h.

Referenced by hud_unit_combat(), and paintEvent().

## ◆ def_hp_loss

int hud_unit_combat::def_hp_loss

private

Definition at line 320 of file hudwidget.h.

Referenced by hud_unit_combat(), and paintEvent().

## ◆ def_veteran

bool hud_unit_combat::def_veteran

private

Definition at line 322 of file hudwidget.h.

Referenced by hud_unit_combat(), and paintEvent().

## ◆ defender

struct unit* hud_unit_combat::defender

private

Definition at line 324 of file hudwidget.h.

Referenced by hud_unit_combat(), and init_images().

## ◆ dimg

QImage hud_unit_combat::dimg

private

Definition at line 331 of file hudwidget.h.

Referenced by init_images(), and paintEvent().

## ◆ fading

float hud_unit_combat::fading

private

Definition at line 329 of file hudwidget.h.

Referenced by paintEvent(), and set_fading().

## ◆ focus

bool hud_unit_combat::focus

private

Definition at line 328 of file hudwidget.h.

Referenced by get_focus(), init_images(), leaveEvent(), and paintEvent().

## ◆ hud_scale

float hud_unit_combat::hud_scale

private

Definition at line 330 of file hudwidget.h.

Referenced by hud_unit_combat(), init_images(), paintEvent(), and set_scale().

## ◆ type_attacker

const struct unit_type* hud_unit_combat::type_attacker

private

Definition at line 325 of file hudwidget.h.

Referenced by hud_unit_combat(), and init_images().

## ◆ type_defender

const struct unit_type* hud_unit_combat::type_defender

private

Definition at line 326 of file hudwidget.h.

Referenced by hud_unit_combat(), and init_images().