Thalassicus / cep-bnw

Civ V Communitas Expansion Pack
32 stars 22 forks source link

Great Person Improvements provide access to resource yields #190

Closed GrantSP closed 10 years ago

GrantSP commented 10 years ago

At the moment we have added in code to make some of the resources available whenever a Great Person improvement is place upon them.

The types of resources are:

Notably excluded from the list are Iron & Coal. Not to mention the luxury resources

Do you think it is worthwhile including ALL strategic and possibly luxury resources for these type of improvements?

stackpoint commented 10 years ago

Where is the code for this? I would say that it would be an oversight since coal and iron unlock in different eras.

GrantSP commented 10 years ago

CET_Start.sql lines 45 - 53

-- Add Great Person Improvements to Strategic Resources Yields
INSERT OR REPLACE INTO Improvement_ResourceType_Yields(ImprovementType,  ResourceType, YieldType, Yield) 
SELECT improve.Type, resTypes.ResourceType, resYields.YieldType, resYields.Yield 
FROM Improvements improve, Improvement_ResourceTypes resTypes, Improvement_ResourceType_Yields resYields, Improvements impBasic
WHERE improve.BuildableOnResources = 1
AND resTypes.ImprovementType = improve.Type
AND resTypes.ResourceType = resYields.ResourceType
AND resYields.ImprovementType = impBasic.Type
AND NOT impBasic.Water = 1;

I haven't been able to quite figure out these shortcut style references.

GrantSP commented 10 years ago

The above can't be used in SQLite Spy so I will need a bit of time to check how this is selecting the resources.

stackpoint commented 10 years ago

It looks like iron is the only resource missing from the Improvement_ResourceType_Yields table.

GrantSP commented 10 years ago

Are you narrowing your selection to just the Great Person types? I only have the list above.

stackpoint commented 10 years ago

I see.

stackpoint commented 10 years ago

Okay the most obvious reason i can see is that both coal and iron do not have Improvement_ResourceType_Yields values in the first place.

GrantSP commented 10 years ago

Coal is listed, but that shouldn't be the problem. The sql code should be pulling the resources, yieldtype & yield from the Improvements table and using the default types and values for each resource. The GP improvements included are from this code, I believe. It just looks like it isn't pulling in all the resources

stackpoint commented 10 years ago

I can't find coal in mine. The code seems to draws on Improvement_ResourceType_Yields values that aren't GP improvements in order to assign the values for the GP improvements.

GrantSP commented 10 years ago

What is the difference between Improvement_ResourceTypes and Improvement_ResourceType_Yields?

stackpoint commented 10 years ago

It seems like Improvement_ResourceType_Yields actually has the values while Improvement_ResourceTypes seems more general. Sort of like Unit vs UnitClass.

GrantSP commented 10 years ago

From what I can understand these lines:

INSERT OR REPLACE INTO Improvement_ResourceType_Yields(ImprovementType, ResourceType, YieldType, Yield) 
SELECT improve.Type, resTypes.ResourceType, resYields.YieldType, resYields.Yield 
FROM Improvements improve, Improvement_ResourceTypes resTypes, Improvement_ResourceType_Yields resYields, Improvements impBasic

are the ones that need attention. In the first line, INSERT OR REPLACE INTO there are 4 columns, the FROM also has 4 columns. If I am understanding this correctly they are inserting them in order.

ImprovementType from Improvements improve ResourceType from Improvement_ResourceTypes resTypes YieldType from Improvement_ResourceType_Yields resYields Yield from Improvements impBasic

Is that how you are reading it?

If we could just take the selections from the Improvement_ResourceTypes table that would give use the correct improvements and resources. There would just need to be the YieldType and Yield to add.

stackpoint commented 10 years ago

Not quite, the SELECT is what's being inserted. The FROM is just the table/variable declarations.

stackpoint commented 10 years ago

The problem is that coal and iron don't get bonus yields from mines.

stackpoint commented 10 years ago

In summary there aren't any resource specific yields for Great Person improvements for Iron and Coal because they both don't get resource specific yields from mines in the first place. That was the crux of the problem, right? I'll close this for now.

GrantSP commented 10 years ago

Thal wanted to make these yields available. I'm not sure if this is the best way to go though. Not sure getting iron from a holy site or incense from a citadel is way to make wise choices in tile improvements. Agreed we can close this for now.

stackpoint commented 10 years ago

Shouldn't you be able to get iron and coal through Great People Improvements? It's just that coal and iron don't have resource yields?

GrantSP commented 10 years ago

I think he wanted all yields from all improvements. Don't think that is what is the case now