(att_estimate_defense, att_get_offense): Rename. Remove dead code and

unused last parameter.  Callers changed.
This commit is contained in:
Markus Armbruster 2006-05-20 15:17:30 +00:00
parent 7ea516852b
commit 092a52f2c6
7 changed files with 9 additions and 53 deletions

View file

@ -81,8 +81,8 @@ extern int att_ask_support(int, int *, int *, int *, int *);
extern int att_ask_offense(int, struct combat *, struct combat *, extern int att_ask_offense(int, struct combat *, struct combat *,
struct emp_qelem *, int *, int *); struct emp_qelem *, int *, int *);
extern double sector_strength(struct sctstr *); extern double sector_strength(struct sctstr *);
extern int att_estimate_defense(int, struct combat *, struct emp_qelem *, extern int att_get_offense(int, struct combat *, struct emp_qelem *,
struct combat *, int); struct combat *);
extern int att_empty_attack(int, int, struct combat *); extern int att_empty_attack(int, int, struct combat *);
extern int att_get_defense(struct emp_qelem *, struct combat *, extern int att_get_defense(struct emp_qelem *, struct combat *,
struct emp_qelem *, int, int); struct emp_qelem *, int, int);

View file

@ -129,11 +129,7 @@ assa(void)
return RET_OK; return RET_OK;
} }
/* ototal = att_get_offense(A_ASSAULT, off, &olist, def);
* Estimate the defense strength and give the player a chance to abort
*/
ototal = att_estimate_defense(A_ASSAULT, off, &olist, def, a_spy);
if (att_abort(A_ASSAULT, off, def)) { if (att_abort(A_ASSAULT, off, def)) {
pr("Assault aborted\n"); pr("Assault aborted\n");
att_empty_attack(A_ASSAULT, 0, def); att_empty_attack(A_ASSAULT, 0, def);

View file

@ -120,11 +120,7 @@ atta(void)
return att_free_lists(&olist, 0); return att_free_lists(&olist, 0);
} }
/* ototal = att_get_offense(A_ATTACK, off, &olist, def);
* Estimate the defense strength and give the player a chance to abort
*/
ototal = att_estimate_defense(A_ATTACK, off, &olist, def, a_spy);
if (att_abort(A_ATTACK, off, def)) { if (att_abort(A_ATTACK, off, def)) {
pr("Attack aborted\n"); pr("Attack aborted\n");
att_empty_attack(A_ATTACK, 0, def); att_empty_attack(A_ATTACK, 0, def);

View file

@ -147,11 +147,7 @@ boar(void)
return att_free_lists(&olist, 0); return att_free_lists(&olist, 0);
} }
/* ototal = att_get_offense(A_BOARD, off, &olist, def);
* Estimate the defense strength and give the player a chance to abort
*/
ototal = att_estimate_defense(A_BOARD, off, &olist, def, a_spy);
if (att_abort(A_BOARD, off, def)) { if (att_abort(A_BOARD, off, def)) {
pr("Board aborted\n"); pr("Board aborted\n");
att_empty_attack(A_BOARD, 0, def); att_empty_attack(A_BOARD, 0, def);

View file

@ -118,11 +118,7 @@ lboa(void)
return att_free_lists(&olist, 0); return att_free_lists(&olist, 0);
} }
/* ototal = att_get_offense(A_LBOARD, off, &olist, def);
* Estimate the defense strength and give the player a chance to abort
*/
ototal = att_estimate_defense(A_LBOARD, off, &olist, def, a_spy);
if (att_abort(A_LBOARD, off, def)) { if (att_abort(A_LBOARD, off, def)) {
pr("Land unit boarding aborted\n"); pr("Land unit boarding aborted\n");
att_empty_attack(A_LBOARD, 0, def); att_empty_attack(A_LBOARD, 0, def);

View file

@ -168,9 +168,7 @@ paradrop(struct emp_qelem *list, coord x, coord y)
return RET_OK; return RET_OK;
} }
/* Get ototal */ ototal = att_get_offense(A_PARA, off, &olist, def);
ototal = att_estimate_defense(A_PARA, off, &olist, def, a_spy);
if (att_abort(A_PARA, off, def)) { if (att_abort(A_PARA, off, def)) {
pr("Air-assault aborted\n"); pr("Air-assault aborted\n");
return RET_OK; return RET_OK;

View file

@ -1107,11 +1107,9 @@ att_combat_eff(struct combat *com)
* Estimate the defense strength and give the attacker a chance to abort * Estimate the defense strength and give the attacker a chance to abort
* if the odds are less than 50% * if the odds are less than 50%
*/ */
int int
att_estimate_defense(int combat_mode, struct combat *off, att_get_offense(int combat_mode, struct combat *off,
struct emp_qelem *olist, struct combat *def, struct emp_qelem *olist, struct combat *def)
int a_spy)
{ {
int ototal; int ototal;
int estimate; int estimate;
@ -1128,30 +1126,6 @@ att_estimate_defense(int combat_mode, struct combat *off,
if (combat_mode == A_PARA) if (combat_mode == A_PARA)
return ototal; return ototal;
pr("\n Initial attack strength: %8d\n", ototal); pr("\n Initial attack strength: %8d\n", ototal);
estimate = att_combat_eff(def) * roundintby(def->troops, 10);
estimate += att_combat_eff(def) * get_dlist(def, 0, a_spy, 0);
/*
* Calculate the initial (pre-support) attack odds. If they're less
* than 50%, ask for a confirmation.
*/
odds = (int)(att_calcodds(ototal, estimate) * 100);
/*
if (odds < 50) {
pr(" Estimated defense strength: %8d\n", estimate);
pr(" Estimated odds: %8d%%\n\n",odds);
sprintf(prompt, "Are you sure you want to %s [yn]? ",
att_mode[combat_mode]);
if (!confirm(prompt))
return abort_attack();
ototal = get_ototal(combat_mode, off, olist,1.0,1);
if (att_empty_attack(combat_mode, ototal, def))
return abort_attack();
}
*/
return ototal; return ototal;
} }