Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <iostream>
- #include <fstream>
- using namespace std;
- struct Structures
- {
- int farms;
- int subterraneanFarms;
- int mines;
- int forges;
- int naturePreserves;
- int stables;
- int unicornPens;
- int fisheries;
- int fortresses;
- int towns;
- int graveyards;
- int towers;
- };
- struct Stocks
- {
- int food;
- int wood;
- int horses;
- int coal;
- int sulfur;
- int ironOre;
- int ironBars;
- int ironWeapons;
- int ironArmor;
- int steelBars;
- int steelWeapons;
- int SteelArmor;
- int rawMithril;
- int mithrilBars;
- int mithrilWeapons;
- int mithrilArmor;
- int unicorns;
- int humanPopulation;
- int elfPopulation;
- int dwarfPopulation;
- int koboldPopulation;
- int hobbitPopulation;
- };
- struct Technologies
- {
- bool mining;
- bool mithrilMining;
- bool blastingCharges;
- bool fieldAgriculture;
- bool subterraneanFarming;
- bool horseDomestication;
- bool unicornDomestication;
- bool preservation;
- bool fishDomestication;
- bool woodcutting;
- bool smelting;
- bool steelsmelting;
- bool armoring;
- bool weaponSmithing;
- bool mithrilSmelting;
- bool mithrilSmithing;
- bool charcoalBurning;
- bool theft;
- bool masterTheft;
- bool stealthManeuvering;
- bool fortress;
- bool wallConstruction;
- bool sailing;
- int researchPoints;
- };
- struct Population
- {
- int population;
- };
- class Holdings
- {
- public:
- Structures EmpireStructures;
- Stocks EmpireStocks;
- Technologies EmpireTechnologies;
- Population EmpirePopulation;
- //takes data from EmpireHoldings.dat and assigns it to variables
- int getHoldings(string strStartRead, string strEndRead)
- {
- int x;
- ifstream fin("EmpireHoldings.dat");
- fin >> x;
- EmpireStructures.farms = x; //updates structures with information from file
- fin >> x;
- EmpireStructures.fisheries = x;
- fin >> x;
- EmpireStructures.forges = x;
- fin >> x;
- EmpireStructures.fortresses = x;
- fin >> x;
- EmpireStructures.graveyards = x;
- fin >> x;
- EmpireStructures.mines = x;
- fin >> x;
- EmpireStructures.naturePreserves = x;
- fin >> x;
- EmpireStructures.stables = x;
- fin >> x;
- EmpireStructures.subterraneanFarms = x;
- fin >> x;
- EmpireStructures.towers = x;
- fin >> x;
- EmpireStructures.towns = x;
- fin >> x;
- EmpireStructures.unicornPens = x;
- fin >> x;
- EmpireStocks.food = x; //updates stocks with information from file
- fin >> x;
- EmpireStocks.coal = x;
- fin >> x;
- EmpireStocks.ironArmor = x;
- fin >> x;
- EmpireStocks.ironBars = x;
- fin >> x;
- EmpireStocks.ironOre = x;
- fin >> x;
- EmpireStocks.ironWeapons = x;
- fin >> x;
- EmpireStocks.mithrilArmor = x;
- fin >> x;
- EmpireStocks.mithrilBars = x;
- fin >> x;
- EmpireStocks.mithrilWeapons = x;
- fin >> x;
- EmpireStocks.rawMithril = x;
- fin >> x;
- EmpireStocks.SteelArmor = x;
- fin >> x;
- EmpireStocks.steelBars = x;
- fin >> x;
- EmpireStocks.steelWeapons = x;
- fin >> x;
- EmpireStocks.sulfur = x;
- fin >> x;
- EmpireStocks.unicorns = x;
- fin >> x;
- EmpireStocks.wood = x;
- fin >> x;
- EmpireStocks.humanPopulation = x;
- fin >> x;
- EmpireStocks.elfPopulation = x;
- fin >> x;
- EmpireStocks.dwarfPopulation = x;
- fin >> x;
- EmpireStocks.hobbitPopulation = x;
- fin >> x;
- EmpireStocks.koboldPopulation = x;
- // needs to save current position in the file
- string strY;
- do
- {
- // needs to return to beginning of the file, then stop at strStartRead and end at EndRead
- fin >> strY;
- if (!strcmp (strY, "armoring"))
- EmpireTechnologies.armoring = 1;
- if (strY == "blasting charges")
- EmpireTechnologies.blastingCharges = 1;
- if (strY == "charcoal burning")
- EmpireTechnologies.charcoalBurning = 1;
- if (strY == "field agriculture")
- EmpireTechnologies.fieldAgriculture = 1;
- if (strY == "fish domestication")
- EmpireTechnologies.fishDomestication = 1;
- if (strY == "fortress")
- EmpireTechnologies.fortress = 1;
- if (strY == "horse domestication")
- EmpireTechnologies.horseDomestication = 1;
- if (strY == "master theft")
- EmpireTechnologies.masterTheft = 1;
- if (strY == "mining")
- EmpireTechnologies.mining = 1;
- if (strY == "mithril mining")
- EmpireTechnologies.mithrilMining = 1;
- if (strY == "mithril smelting")
- EmpireTechnologies.mithrilSmelting = 1;
- if (strY == "mithril smithing")
- EmpireTechnologies.mithrilSmithing = 1;
- if (strY == "preservation")
- EmpireTechnologies.preservation = 1;
- if (strY == "sailing")
- EmpireTechnologies.sailing = 1;
- if (strY == "smelting")
- EmpireTechnologies.smelting = 1;
- if (strY == "stealth maneuvering")
- EmpireTechnologies.stealthManeuvering = 1;
- if (strY == "steel smelting")
- EmpireTechnologies.steelsmelting = 1;
- if (strY == "subterranean farming")
- EmpireTechnologies.subterraneanFarming = 1;
- if (strY == "theft")
- EmpireTechnologies.theft = 1;
- if (strY == "unicorn domestication")
- EmpireTechnologies.unicornDomestication = 1;
- if (strY == "wall construction")
- EmpireTechnologies.wallConstruction = 1;
- if (strY == "weapon smithing")
- EmpireTechnologies.weaponSmithing = 1;
- if (strY == "woodcutting")
- EmpireTechnologies.woodcutting = 1;
- }while (strY != strEndRead);
- //needs to return to saved position
- fin >> x;
- EmpireTechnologies.researchPoints = x;
- fin >> x;
- EmpirePopulation.population = x;
- return 0;
- }
- //changes variables based on HFC Input.dat
- int getInputs()
- {
- return 0;
- }
- //prints up-to-date data to EmpireHoldings.dat
- int printHoldings()
- {
- return 0;
- }
- };
- int main()
- {
- Holdings HumanHoldings("HumanEmpire", "endHuman");
- Holdings KoboldHoldings ("KoboldEmpire", "endKobold");
- Holdings DwarvenHoldings ("DwarvenEmpire", "endDwarven");
- Holdings HobbitHoldings ("HobbitEmpire", "endHobbit");
- Holdings ElvenHoldings ("ElvenEmpire", "endElven");
- return 0;
- }
- int printEverything(Structures structx, Stocks stocksx, Technologies technox, int populx)
- {
- printStructures(structx);
- printStocks(stocksx);
- printTechnologies(technox);
- outf << "Population: " << populx << endl << endl;
- return 0;
- }
- int printStructures(Structures x)
- {
- outf << "Structures:" << endl;
- outf << "farms: " << x.farms << endl;
- outf << "fisheries: " << x.fisheries << endl;
- outf << "forges: " << x.forges << endl;
- outf << "fortresses: " << x.fortresses << endl;
- outf << "graveyards: " << x.graveyards << endl;
- outf << "mines: " << x.mines << endl;
- outf << "nature preserves: " << x.naturePreserves << endl;
- outf << "stables: " << x.stables << endl;
- outf << "subterranean farms: " << x.subterraneanFarms << endl;
- outf << "towers: " << x.towers << endl;
- outf << "towns: " << x.towns << endl;
- outf << "unicorn pens: " << x.unicornPens << endl;
- outf << endl;
- return 0;
- }
- int printStocks(Stocks x)
- {
- outf << "Stocks:" << endl;
- outf << "coal: " << x.coal << endl;
- outf << "food: " << x.food << endl;
- outf << "horses: " << x.horses << endl;
- outf << "ironArmor: " << x.ironArmor << endl;
- outf << "ironBars: " << x.ironBars << endl;
- outf << "ironOre: " << x.ironOre << endl;
- outf << "ironWeapons: " << x.ironWeapons << endl;
- outf << "mithrilArmor: " << x.mithrilArmor << endl;
- outf << "mithrilBars: " << x.mithrilBars << endl;
- outf << "mithrilWeapons: " << x.mithrilWeapons << endl;
- outf << "rawMithril: " << x.rawMithril << endl;
- outf << "SteelArmor: " << x.SteelArmor << endl;
- outf << "steelBars: " << x.steelBars << endl;
- outf << "steelWeapons: " << x.steelWeapons << endl;
- outf << "sulfur: " << x.sulfur << endl;
- outf << "unicorns: " << x.unicorns << endl;
- outf << "wood: " << x.wood << endl;
- outf << "humans: " << x.humanPopulation << endl;
- outf << "elves: " << x.elfPopulation << endl;
- outf << "dwarves: " << x.dwarfPopulation << endl;
- outf << "hobbits: " << x.hobbitPopulation << endl;
- outf << "kobolds: " << x.koboldPopulation << endl;
- outf << endl;
- return 0;
- }
- int printTechnologies(Technologies x)
- {
- outf << "Technologies:" << endl;
- if (x.armoring == 1)
- outf << "armoring" << endl;
- if (x.blastingCharges == 1)
- outf << "blasting charges" << endl;
- if (x.charcoalBurning == 1)
- outf << "charcoal burning" << endl;
- if (x.fieldAgriculture == 1)
- outf << "field agriculture" << endl;
- if (x.fishDomestication == 1)
- outf << "fish domestication" << endl;
- if (x.fortress == 1)
- outf << "fortress" << endl;
- if (x.horseDomestication == 1)
- outf << "horse domestication" << endl;
- if (x.masterTheft == 1)
- outf << "master theft" << endl;
- if (x.mining == 1)
- outf << "mining" << endl;
- if (x.mithrilMining == 1)
- outf << "mithril mining" << endl;
- if (x.mithrilSmelting == 1)
- outf << "mithril smelting" << endl;
- if (x.mithrilSmithing == 1)
- outf << "mithril smithing" << endl;
- if (x.preservation == 1)
- outf << "preservation" << endl;
- if (x.sailing == 1)
- outf << "sailing" << endl;
- if (x.smelting == 1)
- outf << "smelting" << endl;
- if (x.stealthManeuvering == 1)
- outf << "stealth maneuvering" << endl;
- if (x.steelsmelting == 1)
- outf << "steel smelting" << endl;
- if (x.subterraneanFarming == 1)
- outf << "subterranean farming" << endl;
- if (x.theft == 1)
- outf << "theft" << endl;
- if (x.unicornDomestication == 1)
- outf << "unicorn domestication" << endl;
- if (x.wallConstruction == 1)
- outf << "wall construction" << endl;
- if (x.weaponSmithing == 1)
- outf << "weapon smithing" << endl;
- if (x.woodcutting == 1)
- outf << "woodcutting" << endl;
- outf << "research points: " << x.researchPoints << endl;
- outf << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement