| General | Hosted Sites | Civ5 | CivRev | Civ4Col | Civ4 | Civ3 | Civ2 | Civ1 | Misc | Marketplace |
![]() |
|
|
Welcome to Civilization Fanatics' Center. You are currently viewing our site as a guest which gives you limited access to our site features. By joining our free community, you will be able to participate in the discussions, search the forum, send private messages, vote in polls, upload your own screenshots to the gallery, and access many other special features. Registration is fast, simple and absolutely free, so sign up today! If you have any problems with the registration process or your account login, please contact support. |
|
|||||||
![]() |
|
|
Thread Tools |
|
|
#1 |
|
Emperor
Join Date: Jan 2009
Location: Finland
Posts: 1,077
|
Bug in military unit production modifier
There was found a bug in int CvCity::getProductionModifier(UnitTypes eUnit). It appears when you're running a civic which gives you negative military unit production bonus. It simply ingnores it and gives you assert failure if running a debug dll.
A simple fix: we change the function to return the iMultiplier. Code:
int CvCity::getProductionModifier(UnitTypes eUnit) const
{
int iI;
int iMultiplier = GET_PLAYER(getOwnerINLINE()).getProductionModifier(eUnit);
iMultiplier += getDomainProductionModifier((DomainTypes)(GC.getUnitInfo(eUnit).getDomainType()));
if (GC.getUnitInfo(eUnit).isMilitaryProduction())
{
iMultiplier += getMilitaryProductionModifier();
}
for (iI = 0; iI < GC.getNumBonusInfos(); iI++)
{
if (hasBonus((BonusTypes)iI))
{
iMultiplier += GC.getUnitInfo(eUnit).getBonusProductionModifier(iI);
}
}
if (GET_PLAYER(getOwnerINLINE()).getStateReligion() != NO_RELIGION)
{
if (isHasReligion(GET_PLAYER(getOwnerINLINE()).getStateReligion()))
{
iMultiplier += GET_PLAYER(getOwnerINLINE()).getStateReligionUnitProductionModifier();
}
}
/*************************************************************************************************/
/**BugFixForNegativeUnitProductionBonus 01/04/10 NotSoGood **/
/** **/
/** **/
/*************************************************************************************************/
/**Original code start
return std::max(0, iMultiplier);
/**Original code end**/
return iMultiplier;
/*************************************************************************************************/
/**BugFixForNegativeUnitProductionBonus END **/
/*************************************************************************************************/
}
__________________
|
|
|
|
|
|
#2 |
|
Revolutionary
Join Date: Nov 2003
Location: California
Posts: 2,596
|
Hmmm ... yes, we definitely do want to allow negative modifiers for mods I would think. I wonder why Firaxis has blocked this? There are probably other functions with similar set ups.
Maybe we could allow modifiers from -50 on up ... -100 might cause divide by 0 issues in the code.
__________________
Mods: Better BTS AI | Unofficial 3.19 Patch | Revolution Mod Pack Components: BarbarianCiv | AIAutoPlay | DynamicCivNames
|
|
|
|
|
|
#3 |
|
Emperor
Join Date: Nov 2009
Location: Austria
Posts: 1,147
|
That really does not look like a bug but like a design choice - you simply can't go below 100% production.
That said, no production modifier was ever meant to be negative (just as no maintainance modifiers were meant to be positive, but that's s different story), the AI won't notice that multiple smaller reductions can really hurt output when combined, and would be very prone to hurt itself badly with this - which is why you set the limit to -50 I guess. Still, the only acceptable limits would be -100 or -99 (everything goes, just avoid dividing by 0) or 0 (by design no negative total multipliers). Last edited by Fuyu; May 13, 2010 at 03:31 AM. |
|
|
|
|
|
#4 |
|
Emperor
Join Date: Jun 2007
Location: Hamilton, Ontario
Posts: 1,260
|
I've noticed another AI thing that doesn't read negatives well. Representative gives
in the largest cities, but if you give something in the largest cities the AI seems to still think it's positive and the AI would favour that civic.
__________________
Stuff I've made: Global Warming mod Maps: Puzzle Quest, Final Fantasy 6 World of Balance, Final Fantasy 6 World of Ruin, Tetris 1 Other games: Spore YouTube: Spore: Day of Lavos, iHot Pockets, Lost Girl Tests: Kingdom of Loathing, Wonderfalls |
|
|
|
|
|
#5 |
|
Emperor
Join Date: Nov 2009
Location: Austria
Posts: 1,147
|
The AI is bad at negatives everywhere, since most stuff had only positive effects in the unmodded game. And as I said, I believe that was a deliberate choice (to make it easier for the human players too), not just an oversight or unused opportunity.
|
|
|
|
|
|
#6 |
|
Emperor
Join Date: Jun 2007
Location: Hamilton, Ontario
Posts: 1,260
|
I don't see why they would deliberately make it so mods would have confused AI and how that makes it easier for the human player. Also, I don't know how it would even happen that way. Why allow for negatives and then have the AI ignore them and think they're positives?
__________________
Stuff I've made: Global Warming mod Maps: Puzzle Quest, Final Fantasy 6 World of Balance, Final Fantasy 6 World of Ruin, Tetris 1 Other games: Spore YouTube: Spore: Day of Lavos, iHot Pockets, Lost Girl Tests: Kingdom of Loathing, Wonderfalls |
|
|
|
![]() |
| Bookmarks |
|
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Possible to have production modifier only affect buildings? | jefmart1 | Civ4 - Creation & Customization | 6 | Nov 08, 2008 05:22 AM |
| Checking Military Unit Production (Quick Q) | agoodfella | Civ4 - General Discussions | 3 | May 12, 2007 03:18 PM |
| Bonus Production Modifier in UnitInfos | GRM7584 | Civ4 - Creation & Customization | 17 | Apr 18, 2007 11:27 AM |
| Is "our mutual military assistance" diplomatic modifier too weak? | marioflag | Civ4 - General Discussions | 15 | Apr 24, 2006 09:36 AM |
| Proposal: Add 10x modifier to unit stats | OmniMower | Civ3 - Creation & Customization | 14 | Sep 05, 2002 11:38 AM |