How can i overlap the Improvements?

Pharaoh_sxh

Chieftain
Joined
May 19, 2006
Messages
4
:confused:
i'm a freshman,und also a CivFan.
now i have a problem in Modding.i want to overlap the Improvements. this means that farm und watermill can be builded in same tile.
how can i realizate it?
Please help!
Thanks
 
Yes, a bit of c++ tweaking indeed, if you don't count all the tweaks to the UI you'd have to make to allow people to know what improvements a plot has.

Each plot has a CvPlot class associated in it. In that class there is a simple variable called m_eImproventType which holds the enumerated value of type ImprovementTypes. In order to make multiple improvements, you'd need to change this to some other data structure (probably a linked list, using their circularly linked-list class). However, you'd ALSO need to change the functions that deal with this. You could easily change getImprovementYieldChanges to include all of the improvements rather than just one, but changing "getImprovemenType" would be more tricky, since you can only return the enumerated value. Perhaps changing this function to allow input of the index of the improvement (say, "getImprovementType(0)", "getImprovementType(1)", "getImprovementType(i)", etc), but then you'd have to change everywhere that getImprovementType is called and get them all, unless you are okay with defaulting to the first in the list.

But even if that's done, I think that the GUI changes to somehow show that they're all there would be tough. What does a plot with multiple improvements look like?

So, there would have to be quite a bit of tweaking for such a small change. Although not impossible, enough of a hassle I'd say. :P
 
Thanks 3rd floor fur teaching me so much
for example,i want that watermill und farm can be built in same tile,also windmill und mine ,workshop und cottage,lumbermill can be built in forst und jungle.
 
The Civ4AC project is planning to do something along these lines as they want to replicate SMAC which allowed up to 2 improvments per tile (that dosn't count the route which in all Civ games has been in addition to all other improvments and usaly has its own data member).

Gerikes: A link list would alow a potentialy unlimited number of improvments, which is not realy nessary, rather an additional slot or 2 would be all you need and that would be considerably simpler to implement as an array. You would still have basicaly all the same problems with the UI and pre-existing functions though.
 
Each plot has a CvPlot class associated in it. In that class there is a simple variable called m_eImproventType which holds the enumerated value of type ImprovementTypes. In order to make multiple improvements, you'd need to change this to some other data structure (probably a linked list, using their circularly linked-list class). However, you'd ALSO need to change the functions that deal with this. You could easily change getImprovementYieldChanges to include all of the improvements rather than just one, but changing "getImprovemenType" would be more tricky, since you can only return the enumerated value. Perhaps changing this function to allow input of the index of the improvement (say, "getImprovementType(0)", "getImprovementType(1)", "getImprovementType(i)", etc), but then you'd have to change everywhere that getImprovementType is called and get them all, unless you are okay with defaulting to the first in the list.
It should be noted that change parameters and such on DllExported functions, can be dangrous.
What I mean is that often functions are called from the exe, and that can be a problem. So preferably you should only alter the inside of the functions.

And an addition to this, virtual functions seems to be impossible to make work. I have tried, and failed. They game kept crashing for some unknow thing. See my other thread on this.
 
NikG said:
It should be noted that change parameters and such on DllExported functions, can be dangrous.
What I mean is that often functions are called from the exe, and that can be a problem. So preferably you should only alter the inside of the functions.

And an addition to this, virtual functions seems to be impossible to make work. I have tried, and failed. They game kept crashing for some unknow thing. See my other thread on this.

That's true. At the very least, some sort of default argument should be made so that any caller who uses the original fingerprint doesn't crash. I guess you could make the default argument return the "first" improvement. Do you think that would get around the problem?

@Impaler That works as well. I think it's simply a matter of choice, since you can also put a limit on both arrays and linked lists. As long as however you go about it you leave a spot that can easily be changed if you want to change the limit later.
 
That's true. At the very least, some sort of default argument should be made so that any caller who uses the original fingerprint doesn't crash. I guess you could make the default argument return the "first" improvement. Do you think that would get around the problem?

I think we could have somekind of "activeImprovement" variable. Then a function nextImprovment, which increments activeImprovement. When the default is called, it returns only the activeImprovement. A little hack, but it would function.
 
While you're waiting for the Civ4/AC community to complete this, there are a couple of possible hacks:

1. Create all the graphics for all of the possible combinations, and offer all possible cominations as different improvements. This would also cause the AI to properly figure out how to lay out the improvements. E.g. "Farm+Watermill" is considered one improvement.

2. Same as 1, but easier to do if you don't have graphical skills but have Python skills. Turn the improvement into a terrain Feature and insert it via Python code upon building the combined improvement. The Feature would be graphical only.

Your biggest problem with either of these options is going to be with the AI not making good decisions as a result of these combined improvements. See my threads in this forum for a sense of what awaits you...

If OTOH you have SDK skills you probably should go over to the Civ4:AC community and help them out there... the AI will probably be an even bigger problem once you can improve each tile TWICE rather than ONCE.
 
Back
Top Bottom