Skip to content

Commit

Permalink
forgot to run clang. done now.
Browse files Browse the repository at this point in the history
  • Loading branch information
hugomflavio authored and lmoureaux committed Sep 7, 2024
1 parent cf93d72 commit 3c8f75c
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 78 deletions.
152 changes: 78 additions & 74 deletions server/unithand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4060,20 +4060,21 @@ static bool do_attack(struct unit *punit, struct tile *def_tile,
unit_owner(pdefender), unit_tile(pdefender), E_UNIT_TIE_DEF,
ftc_server,
/* TRANS: "Your green Warrior [id:100 ...A:1.0, lost 3 HP,
* 7 HP remaining%s] brushed off a pathetic attack from the Greek
* 7 HP remaining%s] brushed off a pathetic attack from the Greek
* Polish Archer [id:200* ...D:8.0, lost 5 HP, 5 HP remaining%s]!";
* The last %s is either a promoted string or empty */
_("Your %s %s [id:%d %sA:%.1f, lost %d HP, %d HP remaining]"
" brushed off a pathetic attack from the %s %s %s [id:%d %sD:%.1f, lost %d"
" brushed off a pathetic attack from the %s %s %s [id:%d "
"%sD:%.1f, lost %d"
" HP, %d HP remaining%s]!"),
defender_vet, defender_link, pdefender->id, defender_fp,
(float) def_power / POWER_FACTOR, def_hp_start - pdefender->hp,
pdefender->hp, nation_adjective_for_player(unit_owner(punit)),
attacker_vet, attacker_link, punit->id, attacker_fp,
(float) att_power / POWER_FACTOR, att_hp_start - punit->hp,
punit->hp,
(punit->veteran != old_unit_vet) ?
unit_achieved_rank_string(punit) : "");
(punit->veteran != old_unit_vet) ? unit_achieved_rank_string(punit)
: "");
} else {
// notify attacker of battle tie
notify_player(
Expand Down Expand Up @@ -4110,8 +4111,8 @@ static bool do_attack(struct unit *punit, struct tile *def_tile,
attacker_vet, attacker_link, punit->id, attacker_fp,
(float) att_power / POWER_FACTOR, att_hp_start - punit->hp,
punit->hp,
(punit->veteran != old_unit_vet) ?
unit_achieved_rank_string(punit) : "");
(punit->veteran != old_unit_vet) ? unit_achieved_rank_string(punit)
: "");
}

// notify attacker of promotion
Expand Down Expand Up @@ -4141,56 +4142,60 @@ static bool do_attack(struct unit *punit, struct tile *def_tile,
// scorn the defender if the attacker didn't lose any hp
if (att_hp_start == punit->hp) {
// notify the attacker of victory
notify_player(
unit_owner(punit), unit_tile(punit), E_UNIT_WIN_ATT, ftc_server,
/* TRANS: "Your attacking green Legion [id:200 ...A:4.0
* lost 1 HP, has 9 HP remaining%s] eliminated the worthless
* Greek green Warriors [id:100 HP:10]." */
_("Your %s %s [id:%d %s%sA:%.1f, lost %d HP, "
"has %d remaining] eliminated the worthless %s %s %s "
"[id:%d %sD:%.1f, lost %d HP]."),
attacker_vet, attacker_link, punit->id, attacker_fp, attacker_tired,
(float) att_power / POWER_FACTOR, att_hp_start - punit->hp,
punit->hp, nation_adjective_for_player(unit_owner(pdefender)),
defender_vet, defender_link, pdefender->id, defender_fp,
(float) def_power / POWER_FACTOR, def_hp_start);
notify_player(unit_owner(punit), unit_tile(punit), E_UNIT_WIN_ATT,
ftc_server,
/* TRANS: "Your attacking green Legion [id:200 ...A:4.0
* lost 1 HP, has 9 HP remaining%s] eliminated the
* worthless Greek green Warriors [id:100 HP:10]." */
_("Your %s %s [id:%d %s%sA:%.1f, lost %d HP, "
"has %d remaining] eliminated the worthless %s %s %s "
"[id:%d %sD:%.1f, lost %d HP]."),
attacker_vet, attacker_link, punit->id, attacker_fp,
attacker_tired, (float) att_power / POWER_FACTOR,
att_hp_start - punit->hp, punit->hp,
nation_adjective_for_player(unit_owner(pdefender)),
defender_vet, defender_link, pdefender->id, defender_fp,
(float) def_power / POWER_FACTOR, def_hp_start);
// notify defender of defeat
notify_player(unit_owner(pdefender), unit_tile(pdefender),
E_UNIT_LOST_DEF, ftc_server,
notify_player(
unit_owner(pdefender), unit_tile(pdefender), E_UNIT_LOST_DEF,
ftc_server,
/* TRANS: "Your green Warriors [id:100 ...D:1.0 HP:10]
* helplessly perished in an attack by the Greek green Legion
* [id:200 ...A:4.0 lost 1 HP, has 9 HP remaining%s]."
* last %s is either ", promoted ..." or empty string */
_("Your %s %s [id:%d %sD:%.1f HP:%d] helplessly perished in an"
" attack by the %s %s %s [id:%d %s%sA:%.1f, lost %d HP, has %d HP "
" attack by the %s %s %s [id:%d %s%sA:%.1f, lost %d HP, has %d "
"HP "
"remaining%s]."),
defender_vet, defender_link, pdefender->id, defender_fp,
(float) def_power / POWER_FACTOR, def_hp_start,
nation_adjective_for_player(unit_owner(punit)),
attacker_vet, attacker_link, punit->id, attacker_fp,
attacker_tired, (float) att_power / POWER_FACTOR,
att_hp_start - punit->hp, punit->hp,
(punit->veteran != old_unit_vet)
? unit_achieved_rank_string(punit)
: "");
nation_adjective_for_player(unit_owner(punit)), attacker_vet,
attacker_link, punit->id, attacker_fp, attacker_tired,
(float) att_power / POWER_FACTOR, att_hp_start - punit->hp,
punit->hp,
(punit->veteran != old_unit_vet) ? unit_achieved_rank_string(punit)
: "");
} else {
// notify the attacker of victory
notify_player(
unit_owner(punit), unit_tile(punit), E_UNIT_WIN_ATT, ftc_server,
/* TRANS: "Your green Legion [id:200 ...A:4.0
* lost 1 HP, has 9 HP remaining%s] eliminated the
* Greek green Warriors [id:100 HP:10]." */
_("Your %s %s [id:%d %s%sA:%.1f, lost %d HP, "
"has %d remaining] eliminated the %s %s %s "
"[id:%d %sD:%.1f, lost %d HP]."),
attacker_vet, attacker_link, punit->id, attacker_fp, attacker_tired,
(float) att_power / POWER_FACTOR, att_hp_start - punit->hp,
punit->hp, nation_adjective_for_player(unit_owner(pdefender)),
defender_vet, defender_link, pdefender->id, defender_fp,
(float) def_power / POWER_FACTOR, def_hp_start);
notify_player(unit_owner(punit), unit_tile(punit), E_UNIT_WIN_ATT,
ftc_server,
/* TRANS: "Your green Legion [id:200 ...A:4.0
* lost 1 HP, has 9 HP remaining%s] eliminated the
* Greek green Warriors [id:100 HP:10]." */
_("Your %s %s [id:%d %s%sA:%.1f, lost %d HP, "
"has %d remaining] eliminated the %s %s %s "
"[id:%d %sD:%.1f, lost %d HP]."),
attacker_vet, attacker_link, punit->id, attacker_fp,
attacker_tired, (float) att_power / POWER_FACTOR,
att_hp_start - punit->hp, punit->hp,
nation_adjective_for_player(unit_owner(pdefender)),
defender_vet, defender_link, pdefender->id, defender_fp,
(float) def_power / POWER_FACTOR, def_hp_start);
// notify defender of defeat
notify_player(unit_owner(pdefender), unit_tile(pdefender),
E_UNIT_LOST_DEF, ftc_server,
notify_player(
unit_owner(pdefender), unit_tile(pdefender), E_UNIT_LOST_DEF,
ftc_server,
/* TRANS: "Your green Warriors [id:100 ...D:1.0 HP:10]
* perished in an attack by the Greek green Legion
* [id:200 ...A:4.0 lost 1 HP, has 9 HP remaining%s]."
Expand All @@ -4200,13 +4205,12 @@ static bool do_attack(struct unit *punit, struct tile *def_tile,
"remaining%s]."),
defender_vet, defender_link, pdefender->id, defender_fp,
(float) def_power / POWER_FACTOR, def_hp_start,
nation_adjective_for_player(unit_owner(punit)),
attacker_vet, attacker_link, punit->id, attacker_fp,
attacker_tired, (float) att_power / POWER_FACTOR,
att_hp_start - punit->hp, punit->hp,
(punit->veteran != old_unit_vet)
? unit_achieved_rank_string(punit)
: "");
nation_adjective_for_player(unit_owner(punit)), attacker_vet,
attacker_link, punit->id, attacker_fp, attacker_tired,
(float) att_power / POWER_FACTOR, att_hp_start - punit->hp,
punit->hp,
(punit->veteran != old_unit_vet) ? unit_achieved_rank_string(punit)
: "");
}
// notify attacker of promotion
if (punit->veteran != old_unit_vet) {
Expand Down Expand Up @@ -4258,23 +4262,23 @@ static bool do_attack(struct unit *punit, struct tile *def_tile,
// scorn the attacker if the defender didn't lose any hp
if (def_hp_start == pdefender->hp) {
// notify attacker of defeat
notify_player(unit_owner(punit), unit_tile(punit), E_UNIT_LOST_ATT,
ftc_server,
/* TRANS: "Your green Cannon [id:100 ...A:8.0
* failed against the Greek Polish Destroyer [id:200 lost
* 27 HP, 3 HP remaining%s]!";
* last %s is either "and ..." or empty string */
_("Your %s %s [id:%d %sA:%.1f, lost %d HP] failed terribly"
" against the %s %s %s [id:%d lost %d HP, %d HP "
"remaining%s]!"),
attacker_vet, attacker_link, punit->id, attacker_fp,
(float) att_power / POWER_FACTOR, att_hp_start,
nation_adjective_for_player(unit_owner(pdefender)),
defender_vet, defender_link, pdefender->id,
def_hp_start - pdefender->hp, pdefender->hp,
(pdefender->veteran != old_defender_vet)
? unit_achieved_rank_string(pdefender)
: "");
notify_player(
unit_owner(punit), unit_tile(punit), E_UNIT_LOST_ATT, ftc_server,
/* TRANS: "Your green Cannon [id:100 ...A:8.0
* failed against the Greek Polish Destroyer [id:200 lost
* 27 HP, 3 HP remaining%s]!";
* last %s is either "and ..." or empty string */
_("Your %s %s [id:%d %sA:%.1f, lost %d HP] failed terribly"
" against the %s %s %s [id:%d lost %d HP, %d HP "
"remaining%s]!"),
attacker_vet, attacker_link, punit->id, attacker_fp,
(float) att_power / POWER_FACTOR, att_hp_start,
nation_adjective_for_player(unit_owner(pdefender)), defender_vet,
defender_link, pdefender->id, def_hp_start - pdefender->hp,
pdefender->hp,
(pdefender->veteran != old_defender_vet)
? unit_achieved_rank_string(pdefender)
: "");
// notify defender of victory
notify_player(
unit_owner(pdefender), def_tile, E_UNIT_WIN_DEF, ftc_server,
Expand All @@ -4292,8 +4296,8 @@ static bool do_attack(struct unit *punit, struct tile *def_tile,
(float) att_power / POWER_FACTOR, att_hp_start);
} else {
// notify attacker of defeat
notify_player(unit_owner(punit), unit_tile(punit), E_UNIT_LOST_ATT,
ftc_server,
notify_player(
unit_owner(punit), unit_tile(punit), E_UNIT_LOST_ATT, ftc_server,
/* TRANS: "Your green Cannon [id:100 ...A:8.0
* perished while attacking the Greek Polish Destroyer [id:200 lost
* 27 HP, 3 HP remaining%s]!";
Expand All @@ -4303,9 +4307,9 @@ static bool do_attack(struct unit *punit, struct tile *def_tile,
"remaining%s]!"),
attacker_vet, attacker_link, punit->id, attacker_fp,
(float) att_power / POWER_FACTOR, att_hp_start,
nation_adjective_for_player(unit_owner(pdefender)),
defender_vet, defender_link, pdefender->id,
def_hp_start - pdefender->hp, pdefender->hp,
nation_adjective_for_player(unit_owner(pdefender)), defender_vet,
defender_link, pdefender->id, def_hp_start - pdefender->hp,
pdefender->hp,
(pdefender->veteran != old_defender_vet)
? unit_achieved_rank_string(pdefender)
: "");
Expand All @@ -4322,7 +4326,7 @@ static bool do_attack(struct unit *punit, struct tile *def_tile,
pdefender->hp, attacker_tired,
nation_adjective_for_player(unit_owner(punit)), attacker_vet,
attacker_link, punit->id, attacker_fp,
(float) att_power / POWER_FACTOR, att_hp_start);
(float) att_power / POWER_FACTOR, att_hp_start);
}
// notify defender of promotion
if (pdefender->veteran == old_defender_vet ? 0 : 1) {
Expand Down
11 changes: 7 additions & 4 deletions server/unittools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2587,18 +2587,20 @@ void kill_unit(struct unit *pkiller, struct unit *punit, bool vet)
/* TRANS: "One other unit lost when the celtiberian armor
defeated your mech inf. */
PL_("One other unit lost when the %s %s defeated your %s.",
"%4$d other units lost when the %1$s %2$s defeated your %3$s.",
"%4$d other units lost when the %1$s %2$s defeated your "
"%3$s.",
num_killed[i] - 1),
nation_adjective_for_player(pvictor), pkiller_link, punit_link,
num_killed[i] - 1);
}
if ((unitcount-1) > num_killed[i]) {
if ((unitcount - 1) > num_killed[i]) {
notify_player(
player_by_number(i), ptile, E_UNIT_LOST_DEF, ftc_server,
/* TRANS: "One allied unit lost when the celtiberian armor
defeated your mech inf. */
PL_("One allied unit lost when the %s %s defeated your %s.",
"%4$d allied units lost when the %1$s %2$s defeated your %3$s.",
"%4$d allied units lost when the %1$s %2$s defeated your "
"%3$s.",
unitcount),
nation_adjective_for_player(pvictor), pkiller_link, punit_link,
unitcount);
Expand All @@ -2610,7 +2612,8 @@ void kill_unit(struct unit *pkiller, struct unit *punit, bool vet)
/* TRANS: "One unit lost when the celtiberian armor
defeated the roman mech inf. */
PL_("One unit lost when the %s %s defeated the %s %s.",
"%5$d units lost when the %1$s %2$s defeated the %3$s %4$s.",
"%5$d units lost when the %1$s %2$s defeated the %3$s "
"%4$s.",
num_killed[i]),
nation_adjective_for_player(pvictor), pkiller_link,
nation_adjective_for_player(pvictim), punit_link,
Expand Down

0 comments on commit 3c8f75c

Please sign in to comment.