Project

General

Profile

Feature #157 ยป 0046-Ruledit-Add-unit-type-hitpoints-and-firepower-editin.patch

Marko Lindqvist, 01/09/2024 02:20 AM

View differences:

tools/ruledit/edit_utype.cpp
unit_layout->addWidget(label, row, 0);
unit_layout->addWidget(defense, row++, 1);
label = new QLabel(QString::fromUtf8(R__("Hitpoints")));
label->setParent(this);
hitpoints = new QSpinBox(this);
hitpoints->setRange(0, 1000);
connect(hitpoints, SIGNAL(valueChanged(int)), this, SLOT(set_hitpoints(int)));
unit_layout->addWidget(label, row, 0);
unit_layout->addWidget(hitpoints, row++, 1);
label = new QLabel(QString::fromUtf8(R__("Firepower")));
label->setParent(this);
firepower = new QSpinBox(this);
firepower->setRange(0, 200);
connect(firepower, SIGNAL(valueChanged(int)), this, SLOT(set_firepower(int)));
unit_layout->addWidget(label, row, 0);
unit_layout->addWidget(firepower, row++, 1);
label = new QLabel(QString::fromUtf8(R__("Move Rate")));
label->setParent(this);
......
bcost->setValue(utype->build_cost);
attack->setValue(utype->attack_strength);
defense->setValue(utype->defense_strength);
hitpoints->setValue(utype->hp);
firepower->setValue(utype->firepower);
move_rate->setValue(utype->move_rate);
gfx_tag->setText(utype->graphic_str);
gfx_tag_alt->setText(utype->graphic_alt);
......
}
/**********************************************************************//**
Read move rater from spinbox
Read hitpoints from spinbox
**************************************************************************/
void edit_utype::set_hitpoints(int value)
{
utype->hp = value;
}
/**********************************************************************//**
Read firepower from spinbox
**************************************************************************/
void edit_utype::set_firepower(int value)
{
utype->firepower = value;
}
/**********************************************************************//**
Read move rate from spinbox
**************************************************************************/
void edit_utype::set_move_rate(int value)
{
tools/ruledit/edit_utype.h
QSpinBox *bcost;
QSpinBox *attack;
QSpinBox *defense;
QSpinBox *hitpoints;
QSpinBox *firepower;
QSpinBox *move_rate;
QLineEdit *gfx_tag;
QLineEdit *gfx_tag_alt;
......
void set_bcost_value(int value);
void set_attack_value(int value);
void set_defense_value(int value);
void set_hitpoints(int value);
void set_firepower(int value);
void set_move_rate(int value);
void gfx_tag_given();
void gfx_tag_alt_given();
    (1-1/1)