Incidencia #44508

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

Abrir Fecha: 2022-05-04 07:41 Última actualización: 2022-05-26 23:20

Informador:
Propietario:
Tipo:
Estado:
Cerrado
Componente:
Prioridad:
5 - Medium
Gravedad:
5 - Medium
Resolución:
Fixed
Fichero:
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 History (3/9 Histories)

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

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 Updated by: ihnatus
Comentario

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 Updated by: cazfi
Comentario

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 Updated by: cazfi)
2022-05-14 17:12 Updated by: cazfi
  • Propietario Update from (Ninguno) to cazfi
  • Resolución Update from Ninguno to Accepted
Comentario

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 Updated by: cazfi
Comentario

Will push S3_0 version to S2_6 too

2022-05-26 23:20 Updated by: cazfi
  • Estado Update from Open to Cerrado
  • Resolución Update from Accepted to Fixed

Editar

Please login to add comment to this ticket » Entrar