Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Next City Name Cycles When Build City Dialog Opened but City Not Built #424

Open
pcen opened this issue Sep 18, 2023 · 2 comments
Open

Next City Name Cycles When Build City Dialog Opened but City Not Built #424

pcen opened this issue Sep 18, 2023 · 2 comments
Labels
bug Something isn't working enhancement New feature or request

Comments

@pcen
Copy link
Contributor

pcen commented Sep 18, 2023

Repro:

  1. open build city dialog: default city name is cities[n]
  2. close build city dialog instead of building city
  3. open build city dialog: default city name is cities[n + 1]

The cause is that Player.GetNextCityName always increments cityNameIndex:

in C7GameData/Player.cs

public string GetNextCityName() {
    string name = civilization.cityNames[cityNameIndex % civilization.cityNames.Count];
    int bonusLoops = cityNameIndex / civilization.cityNames.Count;
    if (bonusLoops % 2 == 1) {
	name = "New " + name;
    }
    int suffix = (bonusLoops / 2) + 1;
    if (suffix > 1) {
	name = name + " " + suffix; //e.g. for bonusLoops = 2, we'll have "Athens 2"
    }
    cityNameIndex++;
    return name;
}

Instead, behaviour should increment cityNameIndex when a city is built. MsgCityBuilt is implement in #407 so once merged we can fix this behaviour easily

@pcen pcen added the bug Something isn't working label Sep 18, 2023
@WildWeazel
Copy link
Member

Technically this is faithful to Civ3 but I agree on fixing it :)

@pcen
Copy link
Contributor Author

pcen commented Sep 18, 2023

lol good to know, I guess this should be categorised as an enhancement 😆

@pcen pcen added the enhancement New feature or request label Sep 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants