CIVILIZATION IV:iNoc

That... was sarcasm, right? About half of the swearing I've done in my life was at the computer while playing Dwarf Fortress in the last two days. I barely restrained myself from plunging my hand through the screen on multiple occasions. So I am really mad at you right now.
No, I was dead serious. I take it you might be too...dam DF usually does it to me. A couple of hours working on getting that falling kitten dispenser or that trap corridor just right. Murdering some kias and figuring out ways to trap kobolds... Fun you know? I usually play DF in study breaks during my exams. It recharges my batteries.

There is nothing quite like trapping a dragon in a wooden cage, training it and feeding it captured elves (you need to mod the game to let you butcher sentients thou) and than assigning it as a war animal to your main axeman whom you have previously trained in the kitten dispenser and danger room (bonus points if you can combine them) until he becomes a legendary emotionless husk of a bearded murder machine. You know?
 
No, I was dead serious. I take it you might be too...dam DF usually does it to me. A couple of hours working on getting that falling kitten dispenser or that trap corridor just right. Murdering some kias and figuring out ways to trap kobolds... Fun you know? I usually play DF in study breaks during my exams. It recharges my batteries.

There is nothing quite like trapping a dragon in a wooden cage, training it and feeding it captured elves (you need to mod the game to let you butcher sentients thou) and than assigning it as a war animal to your main axeman whom you have previously trained in the kitten dispenser and danger room (bonus points if you can combine them) until he becomes a legendary emotionless husk of a bearded murder machine. You know?

I could recommend a psychiatrist, if you like? :D
 
I read on the Civilization facebook page that Sweden under Gustavus Adolphus will be in CiV GaK. Firaxis agrees with me!
 
This is the longest and hardest single thing I've ever done. It compiles![party]:band:

Anyone want to see the code?

Code:
void CvPlot::doConsumeSupply()
{ 
	if (getPlotCity() != NULL)
	{
		return; //Units in cities do not require supply
	}
	//Construct the needed entities...
	int iConIt; //Or Construct Iterator, if you perfer.
	typedef std::vector<int > intVector;

	intVector* paiFoodUnits[MAX_CIV_PLAYERS];
	for (iConIt = 0; iConIt < MAX_CIV_PLAYERS; iConIt++)
	{
		paiFoodUnits[iConIt] = new intVector;
	}

	intVector* paiMechUnits[MAX_CIV_PLAYERS];
	for (iConIt = 0; iConIt < MAX_CIV_PLAYERS; iConIt++)
	{
		paiMechUnits[iConIt] = new intVector;
	}
	int iI;

	//Organize Data
	CvUnit* pUnit;
	for(iI = 0; iI < getNumUnits(); iI++)
	{
		pUnit = getUnitByIndex(iI);
		if (pUnit->getUnitInfo().getUnitCombatType() == -1)
		{
			continue;
		}
		if (pUnit->getUnitInfo().isNoSupply())
		{
			continue;
		}
		if (pUnit->getDomainType() == DOMAIN_SEA)
		{
			continue;
		}

		if (pUnit->getUnitInfo().isMechUnit())
		{
			paiMechUnits[(int)pUnit->getOwnerINLINE()]->push_back(iI);
		}
		else
		{
			paiFoodUnits[(int)pUnit->getOwnerINLINE()]->push_back(iI);
		}
	}

	//Data Organized! Now for the supply!
	for (iI = 0; iI < MAX_CIV_PLAYERS; iI++)
	{
		if ((paiMechUnits[iI]->size() == 0) && (paiFoodUnits[iI]->size() == 0))
		{
			continue;
		}
		int iJ;
		std::vector<int> apBonusFoodVector; //This is a vector of the ammount of food each bonus produces when spent, ordered according to the order in the XML
		std::vector<int> apBonusVector; //This a vector of the BonusType value of each CvBonusInfo sorted by the ammount of food they produce
		for (iJ = 0; iJ < GC.getNumBonusInfos(); iJ++)
		{
			if (GC.getBonusInfo((BonusTypes)iJ).getSpendYieldProduced() != YIELD_FOOD)
			{
				apBonusFoodVector.push_back(0);
				continue;
			}
			apBonusFoodVector.push_back(GC.getBonusInfo((BonusTypes)iJ).getAmmountProduced());
		}
		for (iJ = 0; iJ < GC.getNumBonusInfos(); iJ++)
		{
			apBonusVector.push_back(GC.getVectorHighestVal(&apBonusFoodVector));
			apBonusFoodVector[GC.getVectorHighestVal(&apBonusFoodVector)] = 0;
		}
		int iCounter = 0;
		int iFoodNeeded = paiFoodUnits[iI]->size();
		int iFood = 0; //The ammount of food you accumulate
		int iBonusFoodProduced;
		for (iJ = 0; iJ < GC.getNumBonusInfos(); iJ++)//In this loop, iJ != BonusTypes!!!! Use apBonusVector[iJ] instead.
		{
			if (GC.getBonusInfo((BonusTypes)iJ).getSpendYieldProduced() != YIELD_FOOD)
			{
				break; //No point in bothering to continue because all the ones after this will also produce 0 food
			}
			int iBonusFoodProduced = GC.getBonusInfo((BonusTypes)apBonusVector[iJ]).getAmmountProduced();
			int iResourceTemp = 0;
			//Increase the ammount of the resource you're going to consume untill it's at the max it can be.
			for(int iK = 0; iK < getNumResourceOnTileByPlayer((BonusTypes)apBonusVector.at(iJ), (PlayerTypes)iI); iK++) //iK = the ammount of the food resource that the units can consume
			{
				if ((iK * iBonusFoodProduced + (iFoodNeeded-iFood) <= iFoodNeeded) && ((iK+1 * iBonusFoodProduced + (iFoodNeeded-iFood) <= iFoodNeeded) || (iK+1 == getNumResourceOnTileByPlayer((BonusTypes)apBonusVector.at(iJ), (PlayerTypes)iI)) || (iK == getNumResourceOnTileByPlayer((BonusTypes)apBonusVector.at(iJ), (PlayerTypes)iI))))
				{
					for (int iL = 0; iL < getNumUnits(); iL++)
					{
						if (getUnitByIndex(iL)->getOwnerINLINE() == PlayerTypes(iI))
						{
							if (iK - iResourceTemp > getUnitByIndex(iL)->getNumResourcesCarried(apBonusVector[iJ]))
							{
								iResourceTemp += getUnitByIndex(iL)->getNumResourcesCarried(apBonusVector[iJ]);
								getUnitByIndex(iL)->setNumResourcesCarried(apBonusVector.at(iJ), 0);
							}
							else
							{
								getUnitByIndex(iL)->changeNumResourcesCarried(apBonusVector[iJ], (iResourceTemp - iK));
								iResourceTemp = iK;
							}
						}
					}
					iFood += iK * iBonusFoodProduced;
				}
			}
			if (iFood == iFoodNeeded) //If we have enough food
			{
				break;
			}
		}
		if (iFood < iFoodNeeded)
		{
			for (iJ = iFood; iJ < paiFoodUnits[iI]->size(); iJ++)//Start at the first unit that was not fed
			{
				getUnitByIndex(paiFoodUnits[iI]->at(iJ))->changeMorale(NOSUPPLY_MORALE_LOSS);
			}
		}
		
		//Now, if you wish, we will do the same thing for mech units
		if (paiMechUnits[iI]->size() > 0)
		{
			int iFuelBonus = GC.getInfoTypeForString(GC.getDefineSTRING("FUEL_RESOURCE")); //Unless someone has changed it, this will be oil.
			int iAccumulated = 0;
			if (getNumResourceOnTileByPlayer((BonusTypes)iFuelBonus, (PlayerTypes)iI) >= paiMechUnits[iI]->size())
			{
				//paiMechUnits already does not include units such as catapults that do not need supply
				for (int iJ = 0; iJ < getNumUnits(); iJ++)
				{
					if (getUnitByIndex(iI)->getOwner() == (PlayerTypes)iI)
					{
						if (getUnitByIndex(iJ)->getNumResourcesCarried(iFuelBonus) <= (paiMechUnits[iI]->size() - iAccumulated))
						{
							iAccumulated += getUnitByIndex(iJ)->getNumResourcesCarried(iFuelBonus);
							getUnitByIndex(iJ)->setNumResourcesCarried(iFuelBonus, 0);
						}
						else
						{
							getUnitByIndex(iJ)->changeNumResourcesCarried(iFuelBonus, iAccumulated - paiMechUnits[iI]->size());
							iAccumulated = paiMechUnits[iI]->size();
						}
					}
				}
				for (int iK = iAccumulated; iK < paiMechUnits[iI]->size(); iK++)
				{
					getUnitByIndex(paiMechUnits[iI]->at(iK))->setMoves(0); //Vehicles without fuel cannot move
				}
			}
		}
	}
}
 
Suggestion: At the end of the function you should use the delete statement to free each thing you allocated via the new statement. If you don't, you've added a memory leak.
 
Thanks. My relative inexperience shows through.
 
I finished the Gaul Civ. Uploading screenshots now...
 
Spent the last few days debugging the Method of Death. Still not done. I'll post if I survive.
 
I'm alive.
 
Yeah, it no longer crashes. However, there's still MUCH more of the Morale mechanic to do.
 
I haven't been getting much work done recently because Real Life stuff is getting the way. It will soon be resolved and I will be back to modding.
 
Is there a download available yet?
 
Unfortunately, iNoc is far from done, however, I am working on it. I just started work on the Civilization Traits feature yesterday. Stay tuned! You have no idea how much I appreciate the interest.
 
Well, if you need someone to help with playtesting and whatnot, I'd be happy to. I have finally gotten tired of Civ3 (via the Rhye's of Civilization Random Mod) and am moving on to Civ4. I hate the vanilla game and this is one of the only modpacks that looks like it might be to my liking.

Are you open to suggestions?
 
You hate Vanilla? Why? And are you talking about true Vanilla or BtS?

If you like the look of iNoc, I would recommend Legends of Revolution and History in the Making. History Rewritten also looks appealing.
 
BtS, also I've tried those mods, they really didn't make civ4 any more enjoyable for me, but I guess I should give them a second try.
 
If you don't like Civ4, maybe you should try Civ5. Most of the people who liked Civ4 hated Civ5, so maybe it works the other way, too? Also, what made you dislike Civ4?
 
You should try Fall from Heaven. It just introduces a completely new gameplay. Especially the scenarios. It's been ages since I plaid anything else. Although I shall give this mod a try once it's done. It promises to be just as epic.
 
Top Bottom