Skip to content

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

@pcen

Description

@pcen

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions