Can delete-replace from some tables, but not others. What's going on?

Pazyryk

Deity
Joined
Jun 13, 2008
Messages
3,584
Here's a weird observation. Can someone explain it?

I made a tiny TestMod with two files. An SQL that deletes from a table (e.g., "DELETE FROM Traits;") and an XML that replaces exactly what was deleted (in this case, the whole Traits table contents copied from core XML file). So this works absolutely fine with no ill effects for Units, UnitClasses, UnitPromotions, Builds, SpecialUnits, Civilizations, Traits, Leaders, and BuildingClasses. However, if I try it for Buildings or Technologies, the game crashes during setup.

In fact, I can't even delete-replace a single element from Technologies. For example, SQL and XML files below crash the game:

Code:
DELETE FROM Technologies WHERE Type='TECH_POTTERY';
Code:
<?xml version="1.0" encoding="utf-8"?>
<!-- Created by ModBuddy on 10/9/2010 11:04:24 AM -->
<GameData>
	<Technologies>
		<Row>
			<Type>TECH_POTTERY</Type>
			<Cost>35</Cost>
			<Description>TXT_KEY_TECH_POTTERY_TITLE</Description>
			<Civilopedia>TXT_KEY_TECH_POTTERY_DESC</Civilopedia>
			<Help>TXT_KEY_TECH_POTTERY_HELP</Help>
			<Era>ERA_ANCIENT</Era>
			<Trade>true</Trade>
			<GoodyTech>true</GoodyTech>
			<GridX>1</GridX>
			<GridY>1</GridY>
			<Quote>TXT_KEY_TECH_POTTERY_QUOTE</Quote>
			<PortraitIndex>4</PortraitIndex>
			<IconAtlas>TECH_ATLAS_1</IconAtlas>
			<AudioIntro>AS2D_TECH_POTTERY</AudioIntro>
			<AudioIntroHeader>AS2D_HEADING_TECH_POTTERY</AudioIntroHeader>
		</Row>
	</Technologies>
</GameData>

What's going on here? I'm sure it has nothing to do with foreign keys because I can delete-replace from many tables that also have foreign keys. But not Techs or Buildings. Has anyone succeeded in deleting a single Tech or Building under any circumstances?

Edit: can't delete-replace from Policies either.
 
I think the Techs are hard-coded.

Instead, do:

Code:
<Update>
   <Set Disable="1"/>
   <Where Tech="TECH_POTTERY"/>
</Update>

You will probably have to adjust prereqs. I think you can move the Technology to GridX=-1 to remove it from the techtree although. I haven't tried this yet.
 
Back
Top Bottom