Ticket #44508

edit.create_city() puts a city on top of existing one

Eröffnet am: 2022-05-04 07:41 Letztes Update: 2022-05-26 23:20

Auswertung:
Verantwortlicher:
Typ:
Status:
Geschlossen
Komponente:
Meilenstein:
Priorität:
5 - Mittel
Schweregrad:
5 - Mittel
Lösung:
Gefixt
Datei:
2

Details

Yup. You can play with three cities in one tile, it's funny but it's clearly a bug.

Suggestion: make create_city() on a built tile adding new citizens to the existing city. Our settlers work like this and this functionality (script creating a city with size > 1) is most clearly missing.

Ticket-Verlauf (3/9 Historien)

2022-05-04 07:41 Aktualisiert von: ihnatus
  • New Ticket "edit.create_city() puts a city on top of existing one" created
2022-05-04 09:58 Aktualisiert von: cazfi
Kommentar

The function seems to check nothing at all. Unless some lower level catches those problems, it will also allow creating a city on an unsuitable terrain, too close to existing cities (check for this would probably catch your initial finding - can't be much closer than on the same tile). Bypassing some rules by the lua script is acceptable (it sets the actual rule for the case), but I think these ones cause real issues with the assumptions that rest of the code makes.

2022-05-05 07:03 Aktualisiert von: ihnatus
Kommentar

A good point to make a step towards #42501. handle_edit_city_create() does the necessary checks and we may centralize the code.

2022-05-14 16:46 Aktualisiert von: cazfi
Kommentar

Reply To ihnatus

handle_edit_city_create() does the necessary checks and we may centralize the code.

There's more things in handle_edit_city_create() to consider for the lua city creation than the checks. It also revives the city owner, if they are dead at the moment (I assume bad things to happen if one currently uses lua to create a city owned by a dead player). It reveals the city tile for the city owner.

OTOH they have quite different needs in what comes to error reporting, making centralizing a bit less trivial.

(Edited, 2022-05-14 16:46 Aktualisiert von: cazfi)
2022-05-14 17:12 Aktualisiert von: cazfi
  • Verantwortlicher Update from (Keine) to cazfi
  • Lösung Update from Keine to Accepted
Kommentar

Untested patches attached.

master/S3_1 version changes the lua API by changing create_city() return value to boolean indicating if it succeeded or not. This should not be an issue even with semi-d3f of S3_1 as nobody testing existing API certainly relies on the return value that is 'void'.

2022-05-14 17:20 Aktualisiert von: cazfi
Kommentar

Will push S3_0 version to S2_6 too

2022-05-26 23:20 Aktualisiert von: cazfi
  • Status Update from Offen to Geschlossen
  • Lösung Update from Accepted to Gefixt

Bearbeiten

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