Custom building not being added?

carnivorejoe

Chieftain
Joined
Nov 25, 2019
Messages
7
So I'm working on trying to make the old Ultimate Eras mod compatible with more mods. Most recently, I'm trying to add some compatibility for a simple mod called Coasts and Rivers Yield Gold Again. It does exactly what it sounds like. However, starting in the Prehistoric Era with UEM, most unimproved tiles don't have their usual yields at the start of the game. You have to research a certain tech first, which unlocks a free custom building, which will restore the usual unimproved tile yields that you get from the Ancient Era. With that knowledge, it definitely seems out of place to immediately start earning gold from a river or coast tile in the Prehistoric Era, when nothing else yields gold, and most tiles don't even yield more than 1 food or 1 production.

My approach was to add another free custom building like UEM does, lock it behind a different tech, and when players research the tech, their rivers and coasts will begin yielding gold. To that end, I wrote this SQL code:

Spoiler :

Code:
DECLARE @RiverYield;
DECLARE @CoastYield;
SET @RiverYield = SELECT Yield FROM Feature_YieldChanges WHERE FeatureType = 'FEATURE_RIVER' AND YieldType = 'YIELD_GOLD';
SET @CoastYield = SELECT Yield FROM Terrain_Yields WHERE TerrainType = 'TERRAIN_COAST' AND YieldType = 'YIELD_GOLD';

IF @RiverYield >= 1
    BEGIN
        UPDATE Terrain_YieldChanges
            SET Yield = 0
                WHERE TerrainType = 'TERRAIN_COAST'
                    AND YieldType = 'YIELD_GOLD';
        UPDATE Terrain_RiverYieldChanges
            SET Yield = 0
                WHERE YieldType = 'YIELD_GOLD';
        UPDATE Feature_YieldChanges
            SET Yield = 0
                WHERE FeatureType = 'FEATURE_RIVER'
                    AND YieldType = 'YIELD_GOLD';
        UPDATE Feature_RiverYieldType
            SET Yield = 0
                WHERE YieldType = 'YIELD_GOLD';
        INSERT INTO Buildings    (Type,                        BuildingClass,                    Cost,    PrereqTech,        Help,                                    Description,                        Civilopedia,                            Strategy,                                    ArtDefineTag,                MinAreaSize,    DisplayPosition,    NeverCapture,    IconAtlas,                PortraitIndex)
            VALUES                ('BUILDING_SAILING_YIELDS',    'BUILDINGCLASS_SAILING_YIELDS',    0,        'TECH_SAILING',    'TXT_KEY_BUILDING_SAILING_YIELDS_HELP',    'TXT_KEY_BUILDING_SAILING_YIELDS',    'TXT_KEY_BUILDING_SAILING_YIELDS_TEXT',    'TXT_KEY_BUILDING_SAILING_YIELDS_STRATEGY',    'ART_DEF_BUILDING_PALACE',    -1,                32,                    true,            'UNIT_ACTION_ATLAS',    6);
        INSERT INTO BuildingClasses    (Type,                                DefaultBuilding,            Description)
            VALUES                    ('BUILDINGCLASS_SAILING_YIELDS',    'BUILDING_SAILING_YIELDS',    'TXT_KEY_BUILDING_SAILING_YIELDS');
        INSERT INTO Building_FeaturesYieldChanges    (BuildingType,                FeatureType,        YieldType,        Yield)
            VALUES                                    ('BUILDING_SAILING_YIELDS',    'FEATURE_RIVER',    'YIELD_GOLD',    1);
        INSERT INTO Building_TerrainYieldChanges    (BuildingType,                TerrainType,        YieldType,        Yield)
            VALUES                                    ('BUILDING_SAILING_YIELDS',    'TERRAIN_COAST',    'YIELD_GOLD',    1);
        INSERT INTO Language_en_US    (Tag,                                            Text)
            VALUES                    ('TXT_KEY_BUILDING_SAILING_YIELDS',                'Coast & River Yields'),
                                    ('TXT_KEY_BUILDING_SAILING_YIELDS_TEXT',        'This building will automatically upgrade any coast and river tiles within your cities to grant +1 gold when worked.'),
                                    ('TXT_KEY_BUILDING_SAILING_YIELDS_HELP',        'This building will automatically upgrade any coast and river tiles within your cities to grant +1 gold when worked.'),
                                    ('TXT_KEY_BUILDING_SAILING_YIELDS_STRATEGY',    'This building will automatically upgrade any coast and river tiles within your cities to grant +1 gold when worked.');
    END


However, this doesn't work. I'm no expert at SQL, so I figured in order to see if I just wrote my code wrong, I would just try adding the building with XML:

Spoiler :

Code:
<?xml version="1.0" encoding="utf-8"?>
<!-- Created by ModBuddy on 12/16/2019 6:27:21 PM -->
<GameData>
    <Buildings>
        <Row>
            <Type>BUILDING_SAILING_YIELDS</Type>
            <BuildingClass>BUILDINGCLASS_SAILING_YIELDS</BuildingClass>
            <Cost>0</Cost>
            <PrereqTech>TECH_SAILING</PrereqTech>
            <Help>TXT_KEY_BUILDING_SAILING_YIELDS_HELP</Help>
            <Description>TXT_KEY_BUILDING_SAILING_YIELDS</Description>
            <Civilopedia>TXT_KEY_BUILDING_SAILING_YIELDS_TEXT</Civilopedia>
            <Strategy>TXT_KEY_BUILDING_SAILING_YIELDS_STRATEGY</Strategy>
            <ArtDefineTag>ART_DEF_BUILDING_PALACE</ArtDefineTag>
            <MinAreaSize>-1</MinAreaSize>
            <DisplayPosition>32</DisplayPosition>
            <NeverCapture>true</NeverCapture>
            <IconAtlas>UNIT_ACTION_ATLAS</IconAtlas>
            <PortraitIndex>6</PortraitIndex>
        </Row>
    </Buildings>
    <Building_FeaturesYieldChanges>
        <Row>
            <BuildingType>BUILDING_SAILING_YIELDS</BuildingType>
            <FeatureType>FEATURE_RIVER</FeatureType>
            <YieldType>YIELD_GOLD</YieldType>
            <Yield>1</Yield>
        </Row>
    </Building_FeaturesYieldChanges>
    <Building_TerrainYieldChanges>
        <Row>
            <BuildingType>BUILDING_SAILING_YIELDS</BuildingType>
            <TerrainType>TERRAIN_COAST</TerrainType>
            <YieldType>YIELD_GOLD</YieldType>
            <Yield>1</Yield>
        </Row>
    </Building_TerrainYieldChanges>
    <BuildingClasses>
        <Row>
            <Type>BUILDINGCLASS_SAILING_YIELDS</Type>
            <DefaultBuilding>BUILDING_SAILING_YIELDS</DefaultBuilding>
            <Description>TXT_KEY_BUILDING_SAILING_YIELDS</Description>
        </Row>
    </BuildingClasses>
    <Language_en_US>
        <Row>
            <Tag>TXT_KEY_BUILDING_SAILING_YIELDS</Tag>
            <Text>Coast &amp; River Yields</Text>
        </Row>
        <Row>
            <Tag>TXT_KEY_BUILDING_SAILING_YIELDS_TEXT</Tag>
            <Text>This building will automatically upgrade any coast and river tiles within your cities to grant +1 gold when worked.</Text>
        </Row>
        <Row>
            <Tag>TXT_KEY_BUILDING_SAILING_YIELDS_HELP</Tag>
            <Text>This building will automatically upgrade any coast and river tiles within your cities to grant +1 gold when worked.</Text>
        </Row>
        <Row>
            <Tag>TXT_KEY_BUILDING_SAILING_YIELDS_STRATEGY</Tag>
            <Text>This building will automatically upgrade any coast and river tiles within your cities to grant +1 gold when worked.</Text>
        </Row>
    </Language_en_US>
</GameData>


This didn't work either. I took a look at Kael's guide, and he only referenced the same 3 tables that I did: Buildings, BuildingClasses, and Language_en_US. I also looked at how UEM added their custom building, and I can't find any additional references beyond those 3 tables either. What am I missing here?
 

LeeS

Imperator
Joined
Jul 23, 2013
Messages
7,241
Location
Illinois, USA
  1. There's no such thing as FEATURE_RIVER
  2. The proper game-table to implement River-Tile yields from Buildings is Building_RiverPlotYieldChanges. This is the definition of the table showing its valid column-names and the data requirements for each column
    Code:
    	<Table name="Building_RiverPlotYieldChanges">
    		<Column name="BuildingType" type="text" reference="Buildings(Type)"/>
    		<Column name="YieldType" type="text" reference="Yields(Type)"/>
    		<Column name="Yield" type="integer"/>
    	</Table>
  3. Generally, table Building_SeaPlotYieldChanges is used to implement "sea" plot yield changes rather than table Building_TerrainYieldChanges with TERRAIN_COAST.
    Code:
    	<Table name="Building_SeaPlotYieldChanges">
    		<Column name="BuildingType" type="text" reference="Buildings(Type)"/>
    		<Column name="YieldType" type="text" reference="Yields(Type)"/>
    		<Column name="Yield" type="integer"/>
    	</Table>
    • While TERRAIN_COAST is a valid terrain-type in table Terrains it is generally never used in anything like the way you are attempting to use it. TERRAIN_COAST is essentially for game map-processing purposes (as are TERRAIN_MOUNTAIN and TERRAIN_HILL) to differentiate between lake and "shallow" sea tiles and deep water tiles that are true TERRAIN_OCEAN tiles.
    • Lake tiles are all also TERRAIN_COAST. Water bodies of 9 tiles or less are lakes by definition but the tile terrain-type of all such tiles is still TERRAIN_COAST.
    • It is possible to use table Building_TerrainYieldChanges to implement Coastal-Tile yield-changes, but people generally do not because of the issues inherent in TERRAIN_COAST being used for lakes as well as sea coastal tiles.
  4. You don't want
    Code:
    <DisplayPosition>32</DisplayPosition>
    within the definition of the building. This will not cause code to not be implemented in the database, but you don't need nor want <DisplayPosition> data unless the building is to be rendered on the game's main map as part of the city 3d model.
  5. In your SQL code none of this really accomplishes much of anything
    Code:
    DECLARE @RiverYield;
    DECLARE @CoastYield;
    SET @RiverYield = SELECT Yield FROM Feature_YieldChanges WHERE FeatureType = 'FEATURE_RIVER' AND YieldType = 'YIELD_GOLD';
    SET @CoastYield = SELECT Yield FROM Terrain_Yields WHERE TerrainType = 'TERRAIN_COAST' AND YieldType = 'YIELD_GOLD';
    
    IF @RiverYield >= 1
        BEGIN
    If you want to update to game-tables, you just go ahead and make the updates.
  6. I've never heard of a table called "Feature_RiverYieldType". There is a table called "Feature_RiverYieldChanges".
 

carnivorejoe

Chieftain
Joined
Nov 25, 2019
Messages
7
First off, thanks for all the info about the tables in the game. I've revised my SQL to utilize those instead of the problematic or nonexistent ones I was using before. Also, thanks for quoting the relevant XML from the game files... I'd been scratching my head trying to figure out where to find a list of all the tables that exist in Civ 5's "database," but there are only like 5 SQL files in the whole installation directory, and they only reference some art and audio information. I didn't realize that they would create new SQL tables using XML... instead of, you know, SQL.... >.>

Secondly, let me provide you with a little bit more context. I'm modding the Ultimate Eras Mod to make it compatible with other mods. I've successfully made it compatible with Future Worlds and Enlightenment Era, I patched some compatibility issues it was having with some custom civs starting with their own custom units, now I'm trying to add some integration for this mod - Coasts and Rivers Yield Gold Again - into UEM's tech tree by adding another custom building and locking it behind the Sailing tech. Yes, I could just change the yields straight away, but I don't want that to be a feature of the mod. I only want to create this custom building *if* the Coasts/Rivers Gold mod is detected. I don't know of any precise way of checking to see which mods are loaded, so I just added a reference to it in the .modinfo file, then created this @RiverYield variable to hold the value of river gold yields. I looked into this 'FEATURE_RIVER' bit you mentioned; it turns out that's a custom row added by the mod, which I would think makes it the ideal candidate for some IF/THEN logic.

With that said, here's what my SQL file looks like now:

Spoiler :

Code:
DECLARE @RiverYield;
SET @RiverYield = SELECT Yield FROM Feature_YieldChanges WHERE FeatureType = 'FEATURE_RIVER' AND YieldType = 'YIELD_GOLD';

IF @RiverYield >= 1
    BEGIN
        UPDATE Terrain_YieldChanges
            SET Yield = 0
                WHERE TerrainType = 'TERRAIN_COAST'
                    AND YieldType = 'YIELD_GOLD';
        UPDATE Terrain_RiverYieldChanges
            SET Yield = 0
                WHERE YieldType = 'YIELD_GOLD';
        UPDATE Feature_YieldChanges
            SET Yield = 0
                WHERE FeatureType = 'FEATURE_RIVER'
                    AND YieldType = 'YIELD_GOLD';
        UPDATE Feature_RiverYieldChanges
            SET Yield = 0
                WHERE YieldType = 'YIELD_GOLD';
        INSERT INTO Buildings    (Type,                        BuildingClass,                    Cost,    PrereqTech,        Help,                                    Description,                        Civilopedia,                            Strategy,                                    ArtDefineTag,                MinAreaSize,    NeverCapture,    IconAtlas,                PortraitIndex)
            VALUES                ('BUILDING_SAILING_YIELDS',    'BUILDINGCLASS_SAILING_YIELDS',    0,        'TECH_SAILING',    'TXT_KEY_BUILDING_SAILING_YIELDS_HELP',    'TXT_KEY_BUILDING_SAILING_YIELDS',    'TXT_KEY_BUILDING_SAILING_YIELDS_TEXT',    'TXT_KEY_BUILDING_SAILING_YIELDS_STRATEGY',    'ART_DEF_BUILDING_PALACE',    -1,                true,            'UNIT_ACTION_ATLAS',    6);
        INSERT INTO Building_RiverPlotYieldChanges    (BuildingType,                YieldType,        Yield)
            VALUES                                    ('BUILDING_SAILING_YIELDS',    'YIELD_GOLD',    1);
        INSERT INTO Building_SeaPlotYieldChanges    (BuildingType,                YieldType,        Yield)
            VALUES                                    ('BUILDING_SAILING_YIELDS',    'YIELD_GOLD',    1);
        INSERT INTO BuildingClasses    (Type,                                DefaultBuilding,            Description)
            VALUES                    ('BUILDINGCLASS_SAILING_YIELDS',    'BUILDING_SAILING_YIELDS',    'TXT_KEY_BUILDING_SAILING_YIELDS');
        INSERT INTO Language_en_US    (Tag,                                            Text)
            VALUES                    ('TXT_KEY_BUILDING_SAILING_YIELDS',                'Coast & River Yields'),
                                    ('TXT_KEY_BUILDING_SAILING_YIELDS_TEXT',        'This building will automatically upgrade any coast and river tiles within your cities to grant +1 gold when worked.'),
                                    ('TXT_KEY_BUILDING_SAILING_YIELDS_HELP',        'This building will automatically upgrade any coast and river tiles within your cities to grant +1 gold when worked.'),
                                    ('TXT_KEY_BUILDING_SAILING_YIELDS_STRATEGY',    'This building will automatically upgrade any coast and river tiles within your cities to grant +1 gold when worked.');
    END


And here's the only file added by the Coasts/Rivers Gold mod for reference:

Spoiler :

Code:
<?xml version="1.0" encoding="utf-8"?>
<!-- Created by ModBuddy on 22-Sep-14 23:16:31 -->
<GameData>
    <!-- Rivers -->

    <Terrain_RiverYieldChanges>
        <Row>
            <TerrainType>TERRAIN_GRASS</TerrainType>
            <YieldType>YIELD_GOLD</YieldType>
            <Yield>1</Yield>
        </Row>
        <Row>
            <TerrainType>TERRAIN_PLAINS</TerrainType>
            <YieldType>YIELD_GOLD</YieldType>
            <Yield>1</Yield>
        </Row>
        <Row>
            <TerrainType>TERRAIN_DESERT</TerrainType>
            <YieldType>YIELD_GOLD</YieldType>
            <Yield>1</Yield>
        </Row>
        <Row>
            <TerrainType>TERRAIN_TUNDRA</TerrainType>
            <YieldType>YIELD_GOLD</YieldType>
            <Yield>1</Yield>
        </Row>
    </Terrain_RiverYieldChanges>

    <Feature_YieldChanges>
        <Row>
            <FeatureType>FEATURE_RIVER</FeatureType>
            <YieldType>YIELD_GOLD</YieldType>
            <Yield>1</Yield>
        </Row>
    </Feature_YieldChanges>

    <Feature_RiverYieldChanges>
        <Row>
            <FeatureType>FEATURE_JUNGLE</FeatureType>
            <YieldType>YIELD_GOLD</YieldType>
            <Yield>1</Yield>
        </Row>
        <Row>
            <FeatureType>FEATURE_MARSH</FeatureType>
            <YieldType>YIELD_GOLD</YieldType>
            <Yield>1</Yield>
        </Row>
        <Row>
            <FeatureType>FEATURE_OASIS</FeatureType>
            <YieldType>YIELD_GOLD</YieldType>
            <Yield>1</Yield>
        </Row>
        <Row>
            <FeatureType>FEATURE_FLOOD_PLAINS</FeatureType>
            <YieldType>YIELD_GOLD</YieldType>
            <Yield>1</Yield>
        </Row>
        <Row>
            <FeatureType>FEATURE_FOREST</FeatureType>
            <YieldType>YIELD_GOLD</YieldType>
            <Yield>1</Yield>
        </Row>
    </Feature_RiverYieldChanges>
   
    <!-- Coasts -->

    <Terrain_Yields>
        <Row>
            <TerrainType>TERRAIN_COAST</TerrainType>
            <YieldType>YIELD_GOLD</YieldType>
            <Yield>1</Yield>
        </Row>
    </Terrain_Yields>
</GameData>


Note the row insert for 'FEATURE_RIVER'.

Anyway, I still can't seem to get the building to show up in the game. It's really got me scratching my head. I'm pretty sure I'm doing everything the UEM author did to add his custom building. Any ideas?
 

LeeS

Imperator
Joined
Jul 23, 2013
Messages
7,241
Location
Illinois, USA
  1. Add the building to the database regardess of whether the other mod is active but set its "Cost" to "-1" and its "Prereqtech" to "NULL". This will make it unbuildable:
    Code:
    INSERT INTO BuildingClasses    (Type,                                DefaultBuilding,            Description)
    VALUES                    ('BUILDINGCLASS_SAILING_YIELDS',    'BUILDING_SAILING_YIELDS',    'TXT_KEY_BUILDING_SAILING_YIELDS');
    INSERT INTO Buildings    (Type,                        BuildingClass,                    Cost,    PrereqTech,        Help,                                    Description,                        Civilopedia,                            Strategy,                                    ArtDefineTag,                MinAreaSize,    NeverCapture,    IconAtlas,                PortraitIndex)
    VALUES                ('BUILDING_SAILING_YIELDS',    'BUILDINGCLASS_SAILING_YIELDS',    -1,        NULL,    'TXT_KEY_BUILDING_SAILING_YIELDS_HELP',    'TXT_KEY_BUILDING_SAILING_YIELDS',    'TXT_KEY_BUILDING_SAILING_YIELDS_TEXT',    'TXT_KEY_BUILDING_SAILING_YIELDS_STRATEGY',    'ART_DEF_BUILDING_PALACE',    -1,                1,            'UNIT_ACTION_ATLAS',    6);
    INSERT INTO Language_en_US    (Tag,                                            Text)
    VALUES                    ('TXT_KEY_BUILDING_SAILING_YIELDS',                'Coast & River Yields'),
                              ('TXT_KEY_BUILDING_SAILING_YIELDS_TEXT',        'This building will automatically upgrade any coast and river tiles within your cities to grant +1 gold when worked.'),
                              ('TXT_KEY_BUILDING_SAILING_YIELDS_HELP',        'This building will automatically upgrade any coast and river tiles within your cities to grant +1 gold when worked.'),
                              ('TXT_KEY_BUILDING_SAILING_YIELDS_STRATEGY',    'This building will automatically upgrade any coast and river tiles within your cities to grant +1 gold when worked.');
    INSERT INTO Building_RiverPlotYieldChanges	(BuildingType,			YieldType,	Yield)
    VALUES						('BUILDING_SAILING_YIELDS',	'YIELD_GOLD',	1);
    INSERT INTO Building_SeaPlotYieldChanges	(BuildingType,			YieldType,	Yield)
    VALUES						('BUILDING_SAILING_YIELDS',	'YIELD_GOLD',	1);
  2. Note that I have changed your text-string of "true" to integer "1". SQL does not have true or false, it uses 1 and 0 instead in boolean columns. XML can use text true and false as well as 1 and 0 for boolean columns
  3. Make sure that the other mod (Coasts/Rivers Gold mod) is listed as a reference in your mod so that it will load first when both are enabled.
  4. Now UPDATE your database code using an "and exists" syntax:
    Code:
    UPDATE Buildings 
    SET Cost = 0, PrereqTech = 'TECH_SAILING'
    WHERE Type = 'BUILDING_SAILING_YIELDS'
    AND EXISTS (SELECT 1 FROM Feature_YieldChanges WHERE FeatureType = 'FEATURE_RIVER' AND YieldType = 'YIELD_GOLD');
    an alternate is simply to extract data from the Features table instead:
    Code:
    UPDATE Buildings 
    SET Cost = 0, PrereqTech = 'TECH_SAILING'
    WHERE Type = 'BUILDING_SAILING_YIELDS'
    AND EXISTS (SELECT 1 FROM Features WHERE Type = 'FEATURE_RIVER');
  5. The reason I said that your declare variables code was not really doing anything for you was not only because you can use this method just as effectively but also you need to bear in mind that the version of SQL that Civ5 uses is a custom one. Not all the usual functions available to SQL are available to SQL as used within Civ5. It may be possible to use the method you were using, but I have never seen any mod do so that I can recall.
  6. You can also use this UPDATE method with AND NOT EXISTS to "remove" or redefine data you do not want to leave within the database when some element from another mod is NOT active in the game database.
  7. You can also UPDATE tables Building_RiverPlotYieldChanges and Building_SeaPlotYieldChanges (for example) using the AND EXISTS syntax. So you could set the default value for "Yield" to 0 and then update those rows within the tables when the 'FEATURE_RIVER' exists.
This add to the database then UPDATE with an AND EXISTS clause is the method I use to make my Era Buildings mod compatible with and adapt to the presence of Pooky's/JanBoruta's Enlightenment Era mod.
 

carnivorejoe

Chieftain
Joined
Nov 25, 2019
Messages
7
Ok so I figured out the problem. It was 2-fold. Firstly, you were right about my conditional logic not doing anything. I straight up cannot get any IF statements to work in my SQL code. I encountered this problem previously in this project, but just chalked it up to a syntax error on my part and found a different workaround for it anyway. Apparently, Civ 5's custom implementation of SQL doesn't support IF statements? That seems really dumb and shortsighted to me, but ok... I guess I can just use WHERE EXISTS clauses, but that will definitely make my code longer and more tedious.

Secondly, I misread one of the table names that the Coasts/Rivers Gold mod altered. In my original SQL file, I updated a table called Terrain_YieldChanges, whereas the mod updated a table called Terrain_Yields. Likely the former table doesn't exist, and was causing my whole SQL script to fail and not execute the rest of the code after attempting to update the nonexistent table. It also didn't help that the first statement in my SQL file was trying to update that table.

I fixed those problems, and now the mod works like I expect it to. Here's what my SQL file looks like now:

Spoiler :

Code:
INSERT INTO Buildings    (Type,                        BuildingClass,                    Cost,    PrereqTech,        Help,                                    Description,                        Civilopedia,                            Strategy,                                    ArtDefineTag,                MinAreaSize,    NeverCapture,    IconAtlas,                PortraitIndex)
    VALUES                ('BUILDING_SAILING_YIELDS',    'BUILDINGCLASS_SAILING_YIELDS',    -1,        NULL,    'TXT_KEY_BUILDING_SAILING_YIELDS_HELP',    'TXT_KEY_BUILDING_SAILING_YIELDS',    'TXT_KEY_BUILDING_SAILING_YIELDS_TEXT',    'TXT_KEY_BUILDING_SAILING_YIELDS_STRATEGY',    'ART_DEF_BUILDING_PALACE',    -1,                1,                'UNIT_ACTION_ATLAS',    6);
INSERT INTO Building_RiverPlotYieldChanges    (BuildingType,                YieldType,        Yield)
    VALUES                                    ('BUILDING_SAILING_YIELDS',    'YIELD_GOLD',    1);
INSERT INTO Building_SeaPlotYieldChanges    (BuildingType,                YieldType,        Yield)
    VALUES                                    ('BUILDING_SAILING_YIELDS',    'YIELD_GOLD',    1);
INSERT INTO BuildingClasses    (Type,                                DefaultBuilding,            Description)
    VALUES                    ('BUILDINGCLASS_SAILING_YIELDS',    'BUILDING_SAILING_YIELDS',    'TXT_KEY_BUILDING_SAILING_YIELDS');
INSERT INTO Language_en_US    (Tag,                                            Text)
    VALUES                    ('TXT_KEY_BUILDING_SAILING_YIELDS',                'Coast & River Yields'),
                            ('TXT_KEY_BUILDING_SAILING_YIELDS_TEXT',        'This building will automatically upgrade any coast and river tiles within your cities to grant +1 gold when worked.'),
                            ('TXT_KEY_BUILDING_SAILING_YIELDS_HELP',        'This building will automatically upgrade any coast and river tiles within your cities to grant +1 gold when worked.'),
                            ('TXT_KEY_BUILDING_SAILING_YIELDS_STRATEGY',    'This building will automatically upgrade any coast and river tiles within your cities to grant +1 gold when worked.');

UPDATE Terrain_RiverYieldChanges
    SET Yield = 0
        WHERE YieldType = 'YIELD_GOLD'
            AND EXISTS (SELECT 1 FROM Feature_YieldChanges WHERE FeatureType = 'FEATURE_RIVER');
UPDATE Feature_YieldChanges
    SET Yield = 0
        WHERE FeatureType = 'FEATURE_RIVER'
            AND YieldType = 'YIELD_GOLD'
            AND EXISTS (SELECT 1 FROM Feature_YieldChanges WHERE FeatureType = 'FEATURE_RIVER');
UPDATE Feature_RiverYieldChanges
    SET Yield = 0
        WHERE YieldType = 'YIELD_GOLD'
            AND EXISTS (SELECT 1 FROM Feature_YieldChanges WHERE FeatureType = 'FEATURE_RIVER');
UPDATE Terrain_Yields
    SET Yield = 0
        WHERE TerrainType = 'TERRAIN_COAST'
            AND YieldType = 'YIELD_GOLD'
            AND EXISTS (SELECT 1 FROM Feature_YieldChanges WHERE FeatureType = 'FEATURE_RIVER');
UPDATE Buildings
    SET Cost = 0, PrereqTech = 'TECH_SAILING'
        WHERE Type = 'BUILDING_SAILING_YIELDS'
            AND EXISTS (SELECT 1 FROM Feature_YieldChanges WHERE FeatureType = 'FEATURE_RIVER');
 
Top Bottom