待辦事項 #44508

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

啟用日期: 2022-05-04 07:41 最後更新: 2022-05-26 23:20

回報者:
負責人:
類型:
狀態:
關閉
元件:
里程碑:
優先權:
5 - 中
嚴重程度:
5 - 中
處理結果:
修正
檔案:
2

細節

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
評語

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
評語

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
評語

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
  • 負責人 Update from (無) to cazfi
  • 處理結果 Update from to Accepted
評語

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
評語

Will push S3_0 version to S2_6 too

2022-05-26 23:20 Updated by: cazfi
  • 狀態 Update from 開啟 to 關閉
  • 處理結果 Update from Accepted to 修正

編輯

Please login to add comment to this ticket » 登入