#include "stdafx.h" #include "CHeroHandler.h" #include "CGameInfo.h" void CHeroHandler::loadHeroes() { int ID=0; std::ifstream inp("H3bitmap.lod\\HOTRAITS.TXT", std::ios::in); std::string dump; for(int i=0; i<25; ++i) { inp>>dump; } inp.ignore(); while(!inp.eof()) { CHero nher; std::string base; char * tab = new char[500]; int iit = 0; inp.getline(tab, 500); base = std::string(tab); if(base.size()<2) //ended, but some rubbish could still stay end we have something useless { loadSpecialAbilities(); loadBiographies(); loadHeroClasses(); inp.close(); return; } while(base[iit]!='\t') { ++iit; } nher.name = base.substr(0, iit); ++iit; for(int i=iit; i>dump; } inp.ignore(); int whHero=0; while(!inp.eof() && whHeroname = buf.substr(befi, i-befi); ++i; befi=i; for(i; iaggression = atof(buf.substr(befi, i-befi).c_str()); ++i; befi=i; for(i; iinitialAttack = atoi(buf.substr(befi, i-befi).c_str()); ++i; befi=i; for(i; iinitialDefence = atoi(buf.substr(befi, i-befi).c_str()); ++i; befi=i; for(i; iinitialPower = atoi(buf.substr(befi, i-befi).c_str()); ++i; befi=i; for(i; iinitialKnowledge = atoi(buf.substr(befi, i-befi).c_str()); ++i; befi=i; for(i; iproAttack[0] = atoi(buf.substr(befi, i-befi).c_str()); ++i; befi=i; for(i; iproDefence[0] = atoi(buf.substr(befi, i-befi).c_str()); ++i; befi=i; for(i; iproPower[0] = atoi(buf.substr(befi, i-befi).c_str()); ++i; befi=i; for(i; iproKnowledge[0] = atoi(buf.substr(befi, i-befi).c_str()); ++i; befi=i; for(i; iproAttack[1] = atoi(buf.substr(befi, i-befi).c_str()); ++i; befi=i; for(i; iproDefence[1] = atoi(buf.substr(befi, i-befi).c_str()); ++i; befi=i; for(i; iproPower[1] = atoi(buf.substr(befi, i-befi).c_str()); ++i; befi=i; for(i; iproKnowledge[1] = atoi(buf.substr(befi, i-befi).c_str()); ++i; CHero kkk = heroes[0]; for(int dd=0; ddabilh->abilities.size(); ++dd) { befi=i; for(i; iproSec.push_back(buff); } for(int dd=0; dd<9; ++dd) { befi=i; for(i; iselectionProbability[dd] = atoi(buf.substr(befi, i-befi).c_str()); ++i; } ++i; heroClasses.push_back(hc); } }