1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

CIVILIZATION IV:iNoc

Discussion in 'Civ4 - Creation & Customization' started by Voyhkah, Feb 5, 2012.

  1. PPQ_Purple

    PPQ_Purple Techpriest Engineer

    Joined:
    Oct 11, 2008
    Messages:
    3,765
    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?
     
  2. Voyhkah

    Voyhkah Political Activist

    Joined:
    Apr 25, 2009
    Messages:
    1,444
    Location:
    Earth
    I could recommend a psychiatrist, if you like? :D
     
  3. Voyhkah

    Voyhkah Political Activist

    Joined:
    Apr 25, 2009
    Messages:
    1,444
    Location:
    Earth
    I read on the Civilization facebook page that Sweden under Gustavus Adolphus will be in CiV GaK. Firaxis agrees with me!
     
  4. Voyhkah

    Voyhkah Political Activist

    Joined:
    Apr 25, 2009
    Messages:
    1,444
    Location:
    Earth
    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
    				}
    			}
    		}
    	}
    }
    
     
  5. SamSniped

    SamSniped DJ Goodboye

    Joined:
    Jan 1, 2011
    Messages:
    5,413
    Location:
    playing some funky jams
    MY EYES!! THEY BURN!!! :suicide::faint:

    Ahem. Sorry. In all honesty, good job! :D
     
  6. God-Emperor

    God-Emperor Deity

    Joined:
    Jul 18, 2009
    Messages:
    3,551
    Location:
    Texas
    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.
     
  7. Voyhkah

    Voyhkah Political Activist

    Joined:
    Apr 25, 2009
    Messages:
    1,444
    Location:
    Earth
    Thanks. My relative inexperience shows through.
     
  8. Voyhkah

    Voyhkah Political Activist

    Joined:
    Apr 25, 2009
    Messages:
    1,444
    Location:
    Earth
    I finished the Gaul Civ. Uploading screenshots now...
     
  9. Voyhkah

    Voyhkah Political Activist

    Joined:
    Apr 25, 2009
    Messages:
    1,444
    Location:
    Earth
    Spent the last few days debugging the Method of Death. Still not done. I'll post if I survive.
     
  10. Voyhkah

    Voyhkah Political Activist

    Joined:
    Apr 25, 2009
    Messages:
    1,444
    Location:
    Earth
    I'm alive.
     
  11. The_J

    The_J Say No 2 Net Validations Retired Moderator Supporter

    Joined:
    Oct 22, 2008
    Messages:
    32,149
    Location:
    DE/NL/FR
    ...and successfully, I hope.
     
  12. Voyhkah

    Voyhkah Political Activist

    Joined:
    Apr 25, 2009
    Messages:
    1,444
    Location:
    Earth
    Yeah, it no longer crashes. However, there's still MUCH more of the Morale mechanic to do.
     
  13. Voyhkah

    Voyhkah Political Activist

    Joined:
    Apr 25, 2009
    Messages:
    1,444
    Location:
    Earth
    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.
     
  14. epicivfreak

    epicivfreak Warlord

    Joined:
    Apr 23, 2010
    Messages:
    235
    Location:
    USA
    Is there a download available yet?
     
  15. Voyhkah

    Voyhkah Political Activist

    Joined:
    Apr 25, 2009
    Messages:
    1,444
    Location:
    Earth
    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.
     
  16. epicivfreak

    epicivfreak Warlord

    Joined:
    Apr 23, 2010
    Messages:
    235
    Location:
    USA
    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?
     
  17. Voyhkah

    Voyhkah Political Activist

    Joined:
    Apr 25, 2009
    Messages:
    1,444
    Location:
    Earth
    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.
     
  18. epicivfreak

    epicivfreak Warlord

    Joined:
    Apr 23, 2010
    Messages:
    235
    Location:
    USA
    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.
     
  19. Voyhkah

    Voyhkah Political Activist

    Joined:
    Apr 25, 2009
    Messages:
    1,444
    Location:
    Earth
    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?
     
  20. PPQ_Purple

    PPQ_Purple Techpriest Engineer

    Joined:
    Oct 11, 2008
    Messages:
    3,765
    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.
     

Share This Page