Current CvGamecoredll.dll-any adds please merge to the latest upload!

Status
Not open for further replies.

Ploeperpengel

academic precarity
Joined
Feb 2, 2006
Messages
4,748
Location
Berlin
The link holds the Gamecore file of 9th of August including Gerikes support fire code and all earlier SDK changes:

http://www.civfanatics.net/warhammer/files/CvGameCoreDLL.dll

The next one going to change the SDK please merge your code to it and upload the changed file in this thread as base for further changes so that the latest file is allways in the last post.
Don't post anything else than the current CvGamecoredll into this thread and related python and xml with your comments about what changes you included. No chat here please just the facts about the changes!
Files can be discussed in other threads.

Edit: don't forget the sourcecode

Edit2: Note I won't confirm every upload here in order not to spam this thread but be assured I check this frequently and make sure to allways include the latest file into the mod.
 
New dll and sources.

This change adds to the Civilopedia and unit's help pane the fact that a unit provides support fire.

I made limited SDK changes that only affect CvGameTextMgr.cpp, so if you already made a change to this file, you could probably just add the changes yourself rather than replace the file and redo your changes:

Spoiler :


In function CvGameTextMgr::setUnitHelp, Line 727:
Code:
...
	if (pUnit->collateralDamage() > 0)
	{
		if (pUnit->getExtraCollateralDamage() == 0)
		{
			szString += NEWLINE + gDLL->getText("TXT_KEY_UNIT_COLLATERAL_DAMAGE");
		}
		else
		{
			szString += NEWLINE + gDLL->getText("TXT_KEY_UNIT_COLLATERAL_DAMAGE_EXTRA", pUnit->getExtraCollateralDamage());
		}
	}

	// Gerikes / Warhammer Mod / August 8th 2006
	// Support Fire
	if (pUnit->supportFireCollateralDamage() > 0)
	{
		szString += NEWLINE + gDLL->getText("TXT_KEY_UNIT_SUPPORT_FIRE_DAMAGE");
	}
	// Gerikes End

	if (pUnit->getExtraCombatPercent() != 0)
	{
		szString += NEWLINE + gDLL->getText("TXT_KEY_PROMOTION_STRENGTH_TEXT", pUnit->getExtraCombatPercent());
	}
...

In function CvGameTextMgr::setBasicUnitHelp, line 3343:
Code:
...
if (GC.getUnitInfo(eUnit).getCollateralDamage() > 0)
	{
		szBuffer += NEWLINE + gDLL->getText("TXT_KEY_UNIT_COLLATERAL_DAMAGE");
	}

	// Gerikes / Warhammer Mod / August 8th 2006
	// Support Fire
	if (GC.getUnitInfo(eUnit).getSupportFireCollateralDamage() > 0)
	{
		szBuffer += NEWLINE + gDLL->getText("TXT_KEY_UNIT_SUPPORT_FIRE_DAMAGE");
	}
	// Gerikes End

	if (GC.getUnitInfo(eUnit).getCityAttackModifier() == GC.getUnitInfo(eUnit).getCityDefenseModifier())
	{
...



Also, here's a txt key to add to go along with these changes.

Code:
	<TEXT>
		<Tag>TXT_KEY_UNIT_SUPPORT_FIRE_DAMAGE</Tag>
		<English>[ICON_BULLET]Causes Support Fire Damage</English>
		<French>[ICON_BULLET]Causes Support Fire Damage</French>
		<German>[ICON_BULLET]Causes Support Fire Damage</German>
		<Italian>[ICON_BULLET]Causes Support Fire Damage</Italian>
		<Spanish>[ICON_BULLET]Causes Support Fire Damage</Spanish>
	</TEXT>

Please address questions and comments about this patch to me via PM or to the Support Fire Thread.

-------

Also, I'll post this attachment up if anyone wants it. It's a python script I use to easily take all the files modified from a default v1.61 build in the directory and copy them to another directory for easy packaging. Note the .txt needs to be removed.
 

Attachments

New DLL and Sources.

Fixes units collecting support fire points over multiple turns. Also, adds a pointer on the map when you inflict suport fire damage.

Changes:

CvUnit.cpp, line 9912 in supportFireCollateralDamage:

Was...
Code:
		szBuffer = gDLL->getText("TXT_KEY_MISC_YOU_INFLICT_SUPPORT_FIRE_DMG", getNameKey(), iDamageCount);
		gDLL->getInterfaceIFace()->addMessage(getOwnerINLINE(), true, GC.getDefineINT("EVENT_MESSAGE_TIME"), szBuffer, "AS2D_COLLATERAL", MESSAGE_TYPE_INFO, GC.getUnitInfo(getUnitType()).getButton(), (ColorTypes)GC.getInfoTypeForString("COLOR_GREEN"), pSkipUnit->getX_INLINE(), pSkipUnit->getY_INLINE());
...now...
Code:
		szBuffer = gDLL->getText("TXT_KEY_MISC_YOU_INFLICT_SUPPORT_FIRE_DMG", getNameKey(), iDamageCount);
		gDLL->getInterfaceIFace()->addMessage(getOwnerINLINE(), true, GC.getDefineINT("EVENT_MESSAGE_TIME"), szBuffer, "AS2D_COLLATERAL", MESSAGE_TYPE_INFO, GC.getUnitInfo(getUnitType()).getButton(), (ColorTypes)GC.getInfoTypeForString("COLOR_GREEN"), pSkipUnit->getX_INLINE(), pSkipUnit->getY_INLINE()[b], true, true[/b]);

CvUnit.cpp, line 9754, setSupportFireShotsLeft:

Was..
Code:
void CvUnit::setSupportFireShotsLeft(int iShots)
{
	FAssertMsg(iShots >= 0, "Setting support fire shots to a value less than zero!");
	m_iSupportFireShotsLeft = iShots;
}
...now...
Code:
void CvUnit::setSupportFireShotsLeft(int iShots)
{
	FAssertMsg(iShots >= 0, "Setting support fire shots to a value less than zero!");
	m_iSupportFireShotsLeft = [b]min(1, iShots)[/b];
}

Please address questions and comments about this patch to me via PM or to the Support Fire Thread.
 
OK just a couple of minor changes.

Stack_and_Fur_Gold.rar

Added a stack size limit (set to arbituary number of 7 at the moment as this the maximum "dots" seen above a civ stack flag). This limits stacks of the same domain except when the stack is in a city (it's counter intuitive but this way we do not have to explain to the AI to shift units out of its city). Note this will prevent movement THROUGH the stack as well. Works on the theory that large armies take up space, so you can't have a stack of 100000 units in one field.

Second, a bonus gold amount from killing animals. The gold is different depending on whether the unit is attacking or defending. Theory is, a attacking (or hunting) unit will go for a "clean" kill leaving the pelt in a better condition. Gold value is amped by the strength of the animal (5* for Attacking, 2* for defending).

Neither of these were big changes and I have merged them from Gerikes last posts plus the original post.

Also note that I have changed one of the XML files to create a new tag.
 

Attachments

Why is there a maximum stack size? I don't recall any discussion of this. Besides, collateral damage from magic and psychology and support fire will make this unatractive. Why should we forbid the player from doing this? Besides, it makes attacking cities in the end game vertualy impossible. And what happens to ships and cargo. Does each of the cargo count as an individual unit?
 
New DLL and Sources

Official diff output:
Spoiler :

diff -Ebw modifiedSources/CvPlot.cpp modifiedSourcesOld/CvPlot.cpp
7908d7907
< //Modified by Gerikes to change stack limit to a Global Define.
7915d7913
< int iStackLimit;
7921,7925c7919,7920
< iStackLimit = GC.getDefineINT("STACK_MAX_SIZE");
<
< //Get all the units in the plot if it is not a city square.
< // Don't even check if there is no stack limit set.
< if (!isCity() || iStackLimit < 0)
---
> //Get all the units in the plot if it is not a city square
> if (!isCity())
7936,7938c7931,7932
<
< // If the stack has hit it's limit, there is no space.
< if (iNumUnits >= iStackLimit)
---
> //Hardcoded to 7 for prefernce (max visable "dots" above a flag in a unit stack)
> if (iNumUnits >= 7)
diff -Ebw modifiedSources/CvUnit.cpp modifiedSourcesOld/CvUnit.cpp
1871d1870
< // Gerikes / Fixed "Can't attack plot with enemy's stack at limit" bug. / August 12, 06
1873c1872
< if (!( bAttack || pPlot->isUnitSpace(getDomainType()) ))
---
> if (!pPlot->isUnitSpace(getDomainType()))


More readable differences:
Spoiler :

In CvUnit::canMoveInto, line 1870:
Code:
	//ELM **Stack Limit** Warhammer Mod 07/08/06
	[b]// Gerikes / Fixed "Can't attack plot with enemy's stack at limit" bug. / August 12, 06[/b]
	//Limit no. of units in a plot by domain
	[b]if (!( bAttack || pPlot->isUnitSpace(getDomainType()) ))[/b]
	{
		return false;
	
	//ELM End

In CvPlot::isUnitSpace:
Code:
//ELM **Stack Limit** WarHammer Mod 07/08/06
[b]//Modified by Gerikes to change stack limit to a Global Define.[/b]
//Limit no. of units in a plot
bool CvPlot::isUnitSpace(DomainTypes eDomain) const
{
    int iNumUnitsPlot;
    int iNumUnits;
    int iI;
    [b]int iStackLimit;[/b]
    CvUnit* pLoopUnit;

    iNumUnitsPlot = getNumUnits();
    iNumUnits = 0;

    [b]iStackLimit = GC.getDefineINT("STACK_MAX_SIZE");[/b]

    //Get all the units in the plot if it is not a city square.
    [b]// Don't even check if there is no stack limit set.
    if (!isCity() || iStackLimit < 0)[/b]
    {
	for (iI = 0; iI < iNumUnitsPlot; iI++)
        {
            pLoopUnit = getUnit(iI);

            //if the unit is in the same domain, increase the counter
            if(pLoopUnit->getDomainType() == eDomain)
            {
                iNumUnits++;
            }

	    [b]// If the stack has hit it's limit, there is no space.
            if (iNumUnits >= iStackLimit)[/b]
            {
                return false;
            }
        }
    }
    //if we get here, there is either not enough units or units of the same domain to block passage
    return true;
}
//ELM End


Also, added to GlobalDefinesAlt.xml:

Code:
	<Define>
		<DefineName>STACK_MAX_SIZE</DefineName>
		<iDefineIntVal>7</iDefineIntVal>
	</Define>

Don't forget to put the new GlobalDefineAlt.xml into your xml assets directory! Otherwise, your stack size will default to zero!

Please post any comments for this change in the Python / C++ Thread.
 
OK I've attached the source files and dll that contains the first version of animosity.

CODE:
http://www.civfanatics.net/uploads12/animosity.rar

See the animosity thread to see the current state of animoisty and report any issues

http://forums.civfanatics.com/showthread.php?t=182191

I also found a bug with the Animal gold code. If you attacked with an animal and that unit died. You gained the money for sacrifiing the animal. So the barbarians were getting the money in the early stages.

Fix:
Spoiler :
GET_PLAYER(pDefender->getOwnerINLINE()).changeGold(iFurGold);


The attached doc holds cut&paste entries of the code changes in the source / XML

The changes to CIV4UnitSchema.xml are required while the other too are examples on how to use the animosity on a unit.

Feel free to comment on any changes recommended in the animosity thread. This is my first python script so I won't be suprised if there are much easier ways to do things that I have done here.

NOTE: forgot to include the CIV4UnitSchema.xml in the rar file, attached to post instead
 

Attachments

A quick point that just came up. I made the Animoisty code independant, if the global is set to false (g_bAnimosityActive) it will allow the code to work as normal with just the animal gold patch installed.

The other option is you could just not include the python, the C++ will not trigger any animosity work without it.
 
Just realised the XML did not want to upload - how to look like a fool in 1 easy step. Just remove the .txt
 

Attachments

OK, the Animosity code is finally done. Sorry about the delay. In the rar there are the DLL, CIV4UnitSchema.xml, changed python files (from the previous Animosity upload) and the "modified sources".

Animosity.rar

The actual changed C++ files where:
Spoiler :

CvUnits.cpp & h - need to extend the animosity attack function and change the updateCombat arguments (with defaults so no other calls to updateCombat are needed to be changed)

CyInfoInterface1.cpp - new XML tag
CvInfos.cpp & h - new XML tag


Details in the Animosity Thread

EDIT: I haven't done all the XML work to tie the promotions and civipedia together. Just done the Schema and hacked the Promotion XML so I could test the code
 
Here is the latest uplaod, Includes all the Magic stuff as well as anything posted here before.

Can I please ask people to not reveal CvUnitAI.cpp, as it includes all of the code for the AI (obviously). The wizard AI I have made is not particularly good and would be very easy to exploit if you saw the source, so please only send that file to people if they specificaly require it to make sub-mods of this mod.

http://forums.civfanatics.com/uploads/66170/Complete_Source.zip
 
Animosity 2.1

OK, put the 2 requested changes to Animosity in. I only included the 3 changed C++ files instead of the whole "modified sources" set. Included 2 updated Python files, animosity and the CvCustomEventMananger - this was because the one in LO's post didn't have the call to the animosity module, so I changed it to have the call to both the spells and animosity modules. Plus UnitSchema XML

So - 3 C++ files, 2 Python, 1 XML

Example change to a promotion to use the new 3 slot protagonist for animosity
Spoiler :

<!-- Unit that can trigger animosity -->
<AnimosityProtagonist>PROMOTION_ANIMOSITY</AnimosityProtagonist>
<AnimosityProtagonist2>PROMOTION_DISCIPLINE</AnimosityProtagonist2>
<AnimosityProtagonist3>NONE</AnimosityProtagonist3>
<!-- ELM End -->

Entries do not have to exist, you can remove "AnimosityProtagonist3" instead - I was testing a check on a NONE promotion. Also order is not important, so you can populate "AnimosityProtagonist3" and not have any of the rest and it's fine.

 
Sorry for the delay, my local network was down yesterday.

Right, this is the last DLL containing new code to be posted here. It includes actionbuttons2, flyingMod, support fire, aminosity, magic spells (including AI), and Panic (I have commented out the activation part of the code, meaning that it will not do anything). Make sure that you update the source code in your project to include all of the files attached. Note, I have included the python but not the XML from the post above, as ploe has said that he already has that included.

From now on, the only thing which is to be posted here is the same code, minus any bugs. A new thread will be opened for all things warlord.

http://forums.civfanatics.com/uploads/66170/Final_Version.zip
 
Status
Not open for further replies.
Back
Top Bottom