building commerce and yield by resource

No real reason... but why limit myself to only one bonus and one commerce and yield change?

Because if you make one building that does everything, you only ever need to build 1 building in your cities...

Yes, it's the new and improved Forgranairportheaterackstablibrarductory!

Build that, then just build a courthouse (because some things never change) and you're ready to go.
 
Because if you make one building that does everything, you only ever need to build 1 building in your cities...

It could go obsolete.

But seriously, what if I wanted a bank to give +2% gold per copper, +5% gold per silver and +10% gold per gold resource?

Then I would need those changes.
 
Yeah, I know. I was just posting for humorous effect (by the way, the combined forge + granary that davidallen mentioned is obviously the "forgery"). As it is you could load up all the various normal building effects into one building, so this isn't any different.

World Wonder: Afforess's Haberdashery = +1 gold per sheep (wool) and cow (leather), +2.5 gold per fur, silk, and dye.

Regular building: The hot new restaurant chain, davidallen's Fine Dining = +0.1 gold per banana, clam, corn, cow, crab, deer, fish, pig ,rice, sheep, and wheat, and +0.5 gold per spices, sugar, and wine.

So the question is, is competition for resources in?
Both of the above example buildings use sheep and cow.
Can you build both in the same city?
Do they both get full benefit for both resources?
(Actually, in this case they should since the haberdashery only uses the leather and wool, not the meat.)

Perhaps you ought to implement some sort of "bUnique" boolean flag for each resource listed as consumed so each can be unique or not, but how it would work is debatable. A couple ideas come to mind:
  • If a building has a resource marked as unique, you can't build it an a city that already has a building using that resource and no other building using that resource can be built in the city with this building
  • Allow it in combination with any building that uses the same resource but doesn't have it flagged - but the building without the flag doesn't get the benefit of the resource; prevent any other building that also has it flagged
  • Don't worry about it - forget the flag and allow any combination to all get the full effect for duplicated resources
In any case, resources not flagged can be used by multiple buildings.
 
Originally Posted by Afforess View Post
It could go obsolete.

But seriously, what if I wanted a bank to give +2% gold per copper, +5% gold per silver and +10% gold per gold resource?

Then I would need those changes.

Use modcomp BonusCommerceModifiers for Buildings by saibotlieh.

My modcomp can't cover the 'per' demand. It only gives the +% once for any number of bonuses of the same type.
 
Use modcomp BonusCommerceModifiers for Buildings by saibotlieh.

My modcomp can't cover the 'per' demand. It only gives the +% once for any number of bonuses of the same type.

Exactly. Of course, I have it merged in already. ;)

Yeah, I know. I was just posting for humorous effect (by the way, the combined forge + granary that davidallen mentioned is obviously the "forgery"). As it is you could load up all the various normal building effects into one building, so this isn't any different.

World Wonder: Afforess's Haberdashery = +1 gold per sheep (wool) and cow (leather), +2.5 gold per fur, silk, and dye.

Regular building: The hot new restaurant chain, davidallen's Fine Dining = +0.1 gold per banana, clam, corn, cow, crab, deer, fish, pig ,rice, sheep, and wheat, and +0.5 gold per spices, sugar, and wine.

So the question is, is competition for resources in?
Both of the above example buildings use sheep and cow.
Can you build both in the same city?
Do they both get full benefit for both resources?
(Actually, in this case they should since the haberdashery only uses the leather and wool, not the meat.)

In this case, they do. "Consumed" is a misnomer. It really, to be accurate, should say "per resource present", but that's too verbose.
 
davidlallen said:
I agree that making BonusConsumed into a list would be a good enhancement.
afforess said:
Actually, I did it, in about 10 minutes.
Is it possible for you to attach an update which has the bonus list feature, based on your ten minutes of work? Others have asked for this as well.
 
So the question is, is competition for resources in? Both of the above example buildings use sheep and cow. Can you build both in the same city? Do they both get full benefit for both resources?

In the original discussion thread linked in the OP, we discussed about competition between the same building in multiple cities. If you have N resources and M buildings among your cities, you get a total of N * M benefit. In the late game N and M can both be large so the benefit can be quite large. The consensus was that trying to apportion the N resources among the M cities would be confusing.

We did not consider about competition between the same resource in multiple cities, but the modcomp does not have either type of competition.
 
Is it possible for you to attach an update which has the bonus list feature, based on your ten minutes of work? Others have asked for this as well.

Yes, but I should warn you; it works, but I couldn't get the CvGameTextMgr to work quite right. You did some odd stuff there, that I've never seen before, and I wasn't able to get it to work 100%.

Also, the bonuses all give the same effect, as I said, you'd need a multidimensional array to make them work separately, this is a side effect of using parallel arrays.

I gave up after that, since it wasn't going to be useful to me as parallel arrays. If I wasn't just launching a new forum, I would rewrite them. Perhaps I will over X-mas break, when I have more free time.

View attachment Afforess - Changes to bldg-cy.rar
 
Yes, but I should warn you; it works, but I couldn't get the CvGameTextMgr to work quite right. You did some odd stuff there, that I've never seen before, and I wasn't able to get it to work 100%.

Thanks! I guess you mean the code below the comment "// If any yield or commerce is produced, print one line". The code is copied from setCorporationHelp, except that I wanted both yields and commerces to go onto a single line. What specifically seems "odd" about it?
 
Thanks! I guess you mean the code below the comment "// If any yield or commerce is produced, print one line". The code is copied from setCorporationHelp, except that I wanted both yields and commerces to go onto a single line. What specifically seems "odd" about it?

Yeah, I kinda understood that it was for printing fractional or whole values, but I couldn't get it to work with an array. I probably forgot something silly.
 
Is it working properly now?

I never tried to fix it, since I would have no real use for it, the way it is now. I'm sure DavidAllen, or any other programmer could spot my error and fix it, if they feel so inclined.
 
I have had several requests to add the list of bonuses, instead of a single bonus. I may have the opportunity to try this in the next few days. I will be sure to start a timer, to see how much time it takes me compared to Afforess' time of 10 minutes.
 
I have had several requests to add the list of bonuses, instead of a single bonus. I may have the opportunity to try this in the next few days. I will be sure to start a timer, to see how much time it takes me compared to Afforess' time of 10 minutes.

Can you turn it into 2 arrays of arrays? One for BonusCommerceConsumed and one for BonusYieldConsumed? That way you could make it more extend-able?
 
Can you turn it into 2 arrays of arrays? One for BonusCommerceConsumed and one for BonusYieldConsumed? That way you could make it more extend-able?

At some point it becomes too complicated, and you are better off with two buildings. I will take one step at a time and add a single bonus list.
 
Afforess, are you sure your modifications are working? I tried them but I can't seem to make them work. No effect on yields or commerce, nothing displaying except a rogue NEWLINE... I'm not even sure I can make sense of the code you used. Example:
Code:
	for (int eBldg = 0; eBldg < GC.getNumBuildingInfos(); ++eBldg)
	{
		if (getNumRealBuilding((BuildingTypes)eBldg) > 0)
		{
			for (int iI = 0; iI < GC.getNumBonusInfos(); iI++)
			{
				if (GC.getBuildingInfo((BuildingTypes)eBldg).getBonusConsumed(iI))
				{
					iNewCommerce += GC.getBuildingInfo((BuildingTypes)eBldg).getCommerceProduced(eIndex) * getNumBonuses((BonusTypes)iI) / 100;
				}
			}
		}
	}
I'm not sure but if I refer to the code used by corporations, you would need to skeem through the number of items in BonusesConsumed rather than through all the bonuses of the mod, and then check if the city has the Bonus referred by each item of BonusesConsumed and apply changes accordingly.

However I'm not sure how lists work compared to array so I wouldn't be sure.

Also, I had to make copyNonDefaults, could they bork up things?
 
I wrote it a long time ago - If I was to do it over - I'd rewrite it so it didn't piggyback off of Corporation code.
 
It wasn't really the point of my post though. You're not really answering anything, neither are you helping me fix my issue :p
 
Back
Top Bottom