Ticket #44508

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

Open Date: 2022-05-04 07:41 Last Update: 2022-05-26 23:20

Reporter:
Owner:
Type:
Status:
Closed
Component:
MileStone:
Priority:
5 - Medium
Severity:
5 - Medium
Resolution:
Fixed
File:
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
Comment

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
Comment

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
Comment

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
  • Owner Update from (None) to cazfi
  • Resolution Update from None to Accepted
Comment

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
Comment

Will push S3_0 version to S2_6 too

2022-05-26 23:20 Updated by: cazfi
  • Status Update from Open to Closed
  • Resolution Update from Accepted to Fixed

Edit

Please login to add comment to this ticket » Login