Merging Districts

VainApocalypse

Warlord
Joined
Aug 10, 2010
Messages
245
Is there a way to replace TWO districts with one unique district?

If not, premsumably, you could make several unique buildings that are clones of those that go in the district to be blocked, put them in the new Unique District and put the blocked district behind a tech PreReq, but that all seems very sloppy.

If I try
Code:
    <DistrictReplaces>
        <Row CivUniqueDistrictType="DISTRICT_VN_CUSTOM" ReplacesDistrictType="DISTRICT_HARBOR"/>
        <Row CivUniqueDistrictType="DISTRICT_VN_CUSTOM" ReplacesDistrictType="DISTRICT_COMMERCIAL_HUB"/>
    </DistrictReplaces>

the game crashes to the main-menu and throws this from the database

Code:
[1365002.537] [Localization]: Validating Foreign Key Constraints...
[1365002.538] [Localization]: Passed Validation.
[1365002.555] [Configuration]: Validating Foreign Key Constraints...
[1365002.556] [Configuration]: Passed Validation.
[1365014.844] [FullTextSearch]: Initializing FullTextSearch
[1365015.313] [Gameplay]: Validating Foreign Key Constraints...
[1365015.322] [Gameplay]: Passed Validation.
[1365015.698] [Configuration] ERROR: no such table: Types
[1365015.698] [Configuration]: In Query - insert into Types('Type', 'Kind') values (?, ?);
[1365015.698] [Configuration]: In XMLSerializer while updating table Types from file District.xml.
[1365015.698] [Configuration] ERROR: no such table: Types
[1365015.699] [Configuration]: In Query - insert into Types('Type', 'Kind') values (?, ?);
[1365015.699] [Configuration]: In XMLSerializer while updating table Types from file False_Settler.xml.
[1365015.699] [Configuration] ERROR: no such table: Types
[1365015.699] [Configuration]: In Query - insert into Types('Type', 'Kind') values (?, ?);
[1365015.699] [Configuration]: In XMLSerializer while updating table Types from file Galleass.xml.
[1365015.701] [Configuration]: Validating Foreign Key Constraints...
[1365015.701] [Configuration]: Passed Validation.
[1365045.051] [FullTextSearch]: FTS - Creating Context
[1365051.581] [Gameplay] ERROR: no such table: Players
[1365051.582] [Gameplay] ERROR: UNIQUE constraint failed: DistrictReplaces.CivUniqueDistrictType
[1365051.582] [Gameplay]: While executing - 'insert into DistrictReplaces('CivUniqueDistrictType', 'ReplacesDistrictType') values (?, ?);'
[1365051.582] [Gameplay]: In XMLSerializer while inserting row into table insert into DistrictReplaces('CivUniqueDistrictType', 'ReplacesDistrictType') with  values (DISTRICT_VN_CUSTOM, DISTRICT_COMMERCIAL_HUB, ).
[1365051.582] [Gameplay]: In XMLSerializer while updating table DistrictReplaces from file District.xml.
[1365051.582] [Gameplay] ERROR: UNIQUE constraint failed: DistrictReplaces.CivUniqueDistrictType
[1365051.584] [Gameplay] ERROR: FOREIGN KEY constraint failed
[1365051.584] [Gameplay] ERROR: FOREIGN KEY constraint failed
[1365051.584] [Gameplay]: Validating Foreign Key Constraints...
[1365051.587] [Gameplay] ERROR: Invalid Reference on DistrictReplaces.CivUniqueDistrictType - "DISTRICT_VN_CUSTOM" does not exist in Districts
[1365051.594] [Gameplay]: Failed Validation.
[1365051.612] [Gameplay]: Validating Foreign Key Constraints...
[1365051.622] [Gameplay]: Passed Validation.
[1365052.486] [FullTextSearch]: FTS - Creating Context
[1365052.557] [Configuration] ERROR: no such table: Types
[1365052.557] [Configuration]: In Query - insert into Types('Type', 'Kind') values (?, ?);
[1365052.557] [Configuration]: In XMLSerializer while updating table Types from file District.xml.
[1365052.557] [Configuration] ERROR: no such table: Types
[1365052.557] [Configuration]: In Query - insert into Types('Type', 'Kind') values (?, ?);
[1365052.557] [Configuration]: In XMLSerializer while updating table Types from file False_Settler.xml.
[1365052.557] [Configuration] ERROR: no such table: Types
[1365052.557] [Configuration]: In Query - insert into Types('Type', 'Kind') values (?, ?);
[1365052.557] [Configuration]: In XMLSerializer while updating table Types from file Galleass.xml.
[1365052.559] [Configuration]: Validating Foreign Key Constraints...
[1365052.559] [Configuration]: Passed Validation.

Ideas for merging districts?
 
Last edited:
Interesting. I tried to replicate the idea of inserting two rows for the DistrictReplaces, but I get the same error:
Code:
[1370078.638] [Gameplay] ERROR: UNIQUE constraint failed: DistrictReplaces.CivUniqueDistrictType
[1370078.639] [Gameplay] ERROR: UNIQUE constraint failed: DistrictReplaces.CivUniqueDistrictType
but I am allowed to play the game without a problem. I tried to replace the Harbor and Theater districts and only the Theater was replaced.
 
There are probably some assumptions going on in the C++ that there is a one-to-one relationship for replacement.

It is a bit clumsy but you could disable the 2 districts for your civilization and give then a completely new district. Then find all the effects that boost either of the 2 disabled districts and have them also boost the new district.
 
There are probably some assumptions going on in the C++ that there is a one-to-one relationship for replacement.

It is a bit clumsy but you could disable the 2 districts for your civilization and give then a completely new district. Then find all the effects that boost either of the 2 disabled districts and have them also boost the new district.

This seems to be the case. Do you know of a way to disable districts beside prereqing them to Future Tech and Social Media?
 
It should be possible to use the same table that prevents Kongo:
Code:
<ExcludedDistricts>
       <Row DistrictType="DISTRICT_HOLY_SITE" TraitType="TRAIT_LEADER_RELIGIOUS_CONVERT"/>
</ExcludedDistricts>
 
Code:
CREATE TABLE "DistrictReplaces" (
		"CivUniqueDistrictType" TEXT NOT NULL,
		"ReplacesDistrictType" TEXT NOT NULL,
		PRIMARY KEY(CivUniqueDistrictType),
		FOREIGN KEY (CivUniqueDistrictType) REFERENCES Districts(DistrictType) ON DELETE CASCADE ON UPDATE CASCADE,
		FOREIGN KEY (ReplacesDistrictType) REFERENCES Districts(DistrictType) ON DELETE CASCADE ON UPDATE CASCADE);
Column CivUniqueDistrictType is a primary column in the table (and in this case the only one) so all rows within the table must have a different designation for CivUniqueDistrictType. Violating this constraint, as this attempt does:
Code:
    <DistrictReplaces>
        <Row CivUniqueDistrictType="DISTRICT_VN_CUSTOM" ReplacesDistrictType="DISTRICT_HARBOR"/>
        <Row CivUniqueDistrictType="DISTRICT_VN_CUSTOM" ReplacesDistrictType="DISTRICT_COMMERCIAL_HUB"/>
    </DistrictReplaces>
Causes a Unique Constraint Error, and discard of the remainder of the contents within the file where it occurs. In this particular case it appears to be taking out the portion of the code wherein "DISTRICT_VN_CUSTOM" was defined, and therefore has a cascade effect resulting in this error
Code:
[1365051.587] [Gameplay] ERROR: Invalid Reference on DistrictReplaces.CivUniqueDistrictType - "DISTRICT_VN_CUSTOM" does not
It is the "Invalid Reference" error that actually causes the game to display "Start Game" for a second or two before you get shunted back to the main menu.
 
There are probably some assumptions going on in the C++ that there is a one-to-one relationship for replacement.

It is a bit clumsy but you could disable the 2 districts for your civilization and give then a completely new district. Then find all the effects that boost either of the 2 disabled districts and have them also boost the new district.

The only drawback to this is that you potentially lose access to wonders that require adjacency to the omitted district.
 
Back
Top Bottom