Ticket #46069

Clean up AI defense building code

Date d'ouverture: 2022-11-16 01:38 Dernière mise à jour: 2022-12-13 22:55

Rapporteur:
Propriétaire:
(Aucun)
Type:
État:
Ouvert
Composant:
Jalon:
(Aucun)
Priorité:
5 - moyen
Sévérité:
5 - moyen
Résolution:
Aucun
Fichier:
Aucun

Détails

More a meta-task related to HRM923112 and #45592, maybe I have missed some more tickets. Just some code location2s seem totally unworking. In autogames, I see whole continents conquered by a handful of barbarians because tbe cities are too busy building libraries or too failed to upkeep a lame warrior. Now, one of places that I'm almost sure does not work, dai_process_defender_want in daimilitary.c:

  bool walls = city_got_defense_effect(pcity, NULL);
Since defense effects are mostly unit class related, we get FALSE here.
  int limit_cost = pcity->shield_stock + 40;
//...
&& limit_cost <= pcity->shield_stock + 40
This variable is not modified, some redundant check. Also, I have already noticed some stange treatment of UTYF_BADCITYDEFENDER across the code.

Ticket History (3/4 Histories)

2022-11-16 01:38 Updated by: ihnatus
  • New Ticket "Clean up AI defense building code" created
2022-12-10 13:59 Updated by: cazfi
Commentaire

Reply To ihnatus

{{{ bool walls = city_got_defense_effect(pcity, NULL); }}} Since defense effects are mostly unit class related, we get FALSE here.

Has city_got_defense_effect() changed to do the checking with "Certain"? I think the problem here used to be that it could not tell Coastal Defense apart from City Walls, and some comments still refer to that.

2022-12-13 20:26 Updated by: ihnatus
Commentaire

Reply To cazfi

Has city_got_defense_effect() changed to do the checking with "Certain"?

Has it ever been different? It uses, underlyingly, get_target_bonus_effects() that evaluates to RPT_CERTAIN.

2022-12-13 22:55 Updated by: cazfi
Commentaire

Reply To ihnatus

Reply To cazfi

Has city_got_defense_effect() changed to do the checking with "Certain"?

Has it ever been different? It uses, underlyingly, get_target_bonus_effects() that evaluates to RPT_CERTAIN.

Ok. Then there has been wrong assumptions (likely by me, but thankfully so long ago that I don't remember. :-)

Attachment File List

No attachments

Modifier

You are not logged in. I you are not logged in, your comment will be treated as an anonymous post. » Connexion