1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-12-05 23:28:14 +02:00

zaczytywanie kolejnych tekstów, drobne eksperymenty z odcieniami cieni i obiektami na mapie (defy! królestwo za defy! ;])

This commit is contained in:
mateuszb
2007-06-27 20:17:58 +00:00
parent 118c917a60
commit 0428ea1f86
7 changed files with 176 additions and 48 deletions

View File

@@ -484,4 +484,58 @@ void CPreGameTextHandler::loadToIt(std::string &dest, std::string &src, int &ite
iter+=2;
}
}
}
loadLossConditions();
loadVictoryConditions();
}
void CPreGameTextHandler::loadVictoryConditions()
{
std::ifstream inp("H3bitmap.lod\\VCDESC.TXT", std::ios::in|std::ios::binary);
inp.seekg(0,std::ios::end); // na koniec
int andame = inp.tellg(); // read length
inp.seekg(0,std::ios::beg); // wracamy na poczatek
char * bufor = new char[andame]; // allocate memory
inp.read((char*)bufor, andame); // read map file to buffer
inp.close();
std::string buf = std::string(bufor);
delete [andame] bufor;
int i=0; //buf iterator
for(int gg=0; gg<14; ++gg)
{
int befi=i;
for(i; i<andame; ++i)
{
if(buf[i]=='\r')
break;
}
victoryConditions[gg] = buf.substr(befi, i-befi);
i+=2;
}
}
void CPreGameTextHandler::loadLossConditions()
{
std::ifstream inp("H3bitmap.lod\\LCDESC.TXT", std::ios::in|std::ios::binary);
inp.seekg(0,std::ios::end); // na koniec
int andame = inp.tellg(); // read length
inp.seekg(0,std::ios::beg); // wracamy na poczatek
char * bufor = new char[andame]; // allocate memory
inp.read((char*)bufor, andame); // read map file to buffer
inp.close();
std::string buf = std::string(bufor);
delete [andame] bufor;
int i=0; //buf iterator
for(int gg=0; gg<4; ++gg)
{
int befi=i;
for(i; i<andame; ++i)
{
if(buf[i]=='\r')
break;
}
lossCondtions[gg] = buf.substr(befi, i-befi);
i+=2;
}
}