2008-06-30 03:06:41 +03:00
|
|
|
#include "../stdafx.h"
|
2007-06-09 16:28:03 +03:00
|
|
|
#include "CSpellHandler.h"
|
2007-08-30 13:11:53 +03:00
|
|
|
#include "../CGameInfo.h"
|
2007-08-29 15:18:31 +03:00
|
|
|
#include "CLodHandler.h"
|
2007-06-09 16:28:03 +03:00
|
|
|
|
|
|
|
void CSpellHandler::loadSpells()
|
|
|
|
{
|
2008-06-13 00:08:04 +03:00
|
|
|
std::string buf = CGI->bitmaph->getTextFile("SPTRAITS.TXT");
|
2007-07-16 17:42:44 +03:00
|
|
|
int andame = buf.size();
|
2007-06-09 23:23:44 +03:00
|
|
|
int i=0; //buf iterator
|
|
|
|
int hmcr=0;
|
|
|
|
for(i; i<andame; ++i)
|
2007-06-09 16:28:03 +03:00
|
|
|
{
|
2007-06-09 23:23:44 +03:00
|
|
|
if(buf[i]=='\r')
|
|
|
|
++hmcr;
|
|
|
|
if(hmcr==5)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
i+=2;
|
|
|
|
bool combSpells=false; //true, if we are reading combat spells
|
|
|
|
while(i<andame)
|
2007-06-09 16:28:03 +03:00
|
|
|
{
|
2007-07-16 17:42:44 +03:00
|
|
|
if(spells.size()==81)
|
|
|
|
break;
|
2007-06-09 23:23:44 +03:00
|
|
|
CSpell nsp; //new currently being read spell
|
|
|
|
int befi=i;
|
|
|
|
for(i; i<andame; ++i)
|
2007-06-09 16:28:03 +03:00
|
|
|
{
|
2007-06-09 23:23:44 +03:00
|
|
|
if(buf[i]=='\t')
|
|
|
|
break;
|
2007-06-09 16:28:03 +03:00
|
|
|
}
|
2007-06-09 23:23:44 +03:00
|
|
|
nsp.name = buf.substr(befi, i-befi);
|
|
|
|
++i;
|
|
|
|
|
|
|
|
if(nsp.name == std::string(""))
|
2007-06-09 16:28:03 +03:00
|
|
|
{
|
2007-06-09 23:23:44 +03:00
|
|
|
combSpells = true;
|
|
|
|
int hmcr=0;
|
|
|
|
for(i; i<andame; ++i)
|
|
|
|
{
|
|
|
|
if(buf[i]=='\r')
|
|
|
|
++hmcr;
|
2007-06-16 23:12:08 +03:00
|
|
|
if(hmcr==3)
|
2007-06-09 23:23:44 +03:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
++i;
|
|
|
|
++i;
|
|
|
|
befi=i;
|
|
|
|
for(i; i<andame; ++i)
|
|
|
|
{
|
|
|
|
if(buf[i]=='\t')
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
nsp.name = buf.substr(befi, i-befi);
|
|
|
|
++i;
|
2007-06-09 16:28:03 +03:00
|
|
|
}
|
|
|
|
|
2007-06-09 23:23:44 +03:00
|
|
|
befi=i;
|
|
|
|
for(i; i<andame; ++i)
|
2007-06-09 16:28:03 +03:00
|
|
|
{
|
2007-06-09 23:23:44 +03:00
|
|
|
if(buf[i]=='\t')
|
|
|
|
break;
|
2007-06-09 16:28:03 +03:00
|
|
|
}
|
2007-06-09 23:23:44 +03:00
|
|
|
nsp.abbName = buf.substr(befi, i-befi);
|
|
|
|
++i;
|
|
|
|
|
|
|
|
befi=i;
|
|
|
|
for(i; i<andame; ++i)
|
2007-06-09 16:28:03 +03:00
|
|
|
{
|
2007-06-09 23:23:44 +03:00
|
|
|
if(buf[i]=='\t')
|
|
|
|
break;
|
2007-06-09 16:28:03 +03:00
|
|
|
}
|
2007-06-09 23:23:44 +03:00
|
|
|
nsp.level = atoi(buf.substr(befi, i-befi).c_str());
|
|
|
|
++i;
|
2007-06-09 16:28:03 +03:00
|
|
|
|
2007-06-09 23:23:44 +03:00
|
|
|
befi=i;
|
|
|
|
for(i; i<andame; ++i)
|
2007-06-09 16:28:03 +03:00
|
|
|
{
|
2007-06-09 23:23:44 +03:00
|
|
|
if(buf[i]=='\t')
|
|
|
|
break;
|
2007-06-09 16:28:03 +03:00
|
|
|
}
|
2007-06-09 23:23:44 +03:00
|
|
|
nsp.earth = buf.substr(befi, i-befi)[0]=='x' ? true : false;
|
|
|
|
++i;
|
2007-06-09 16:28:03 +03:00
|
|
|
|
2007-06-09 23:23:44 +03:00
|
|
|
befi=i;
|
|
|
|
for(i; i<andame; ++i)
|
2007-06-09 16:28:03 +03:00
|
|
|
{
|
2007-06-09 23:23:44 +03:00
|
|
|
if(buf[i]=='\t')
|
|
|
|
break;
|
2007-06-09 16:28:03 +03:00
|
|
|
}
|
2007-06-09 23:23:44 +03:00
|
|
|
nsp.water = buf.substr(befi, i-befi)[0]=='x' ? true : false;
|
|
|
|
++i;
|
2007-06-09 16:28:03 +03:00
|
|
|
|
2007-06-09 23:23:44 +03:00
|
|
|
befi=i;
|
|
|
|
for(i; i<andame; ++i)
|
2007-06-09 16:28:03 +03:00
|
|
|
{
|
2007-06-09 23:23:44 +03:00
|
|
|
if(buf[i]=='\t')
|
|
|
|
break;
|
2007-06-09 16:28:03 +03:00
|
|
|
}
|
2007-06-09 23:23:44 +03:00
|
|
|
nsp.fire = buf.substr(befi, i-befi)[0]=='x' ? true : false;
|
|
|
|
++i;
|
2007-06-09 16:28:03 +03:00
|
|
|
|
2007-06-09 23:23:44 +03:00
|
|
|
befi=i;
|
|
|
|
for(i; i<andame; ++i)
|
2007-06-09 16:28:03 +03:00
|
|
|
{
|
2007-06-09 23:23:44 +03:00
|
|
|
if(buf[i]=='\t')
|
|
|
|
break;
|
2007-06-09 16:28:03 +03:00
|
|
|
}
|
2007-06-09 23:23:44 +03:00
|
|
|
nsp.air = buf.substr(befi, i-befi)[0]=='x' ? true : false;
|
|
|
|
++i;
|
2007-06-09 16:28:03 +03:00
|
|
|
|
2007-06-09 23:23:44 +03:00
|
|
|
befi=i;
|
|
|
|
for(i; i<andame; ++i)
|
2007-06-09 16:28:03 +03:00
|
|
|
{
|
2007-06-09 23:23:44 +03:00
|
|
|
if(buf[i]=='\t')
|
|
|
|
break;
|
2007-06-09 16:28:03 +03:00
|
|
|
}
|
2007-06-09 23:23:44 +03:00
|
|
|
nsp.costNone = atoi(buf.substr(befi, i-befi).c_str());
|
|
|
|
++i;
|
2007-06-09 16:28:03 +03:00
|
|
|
|
2007-06-09 23:23:44 +03:00
|
|
|
befi=i;
|
|
|
|
for(i; i<andame; ++i)
|
2007-06-09 16:28:03 +03:00
|
|
|
{
|
2007-06-09 23:23:44 +03:00
|
|
|
if(buf[i]=='\t')
|
|
|
|
break;
|
2007-06-09 16:28:03 +03:00
|
|
|
}
|
2007-06-09 23:23:44 +03:00
|
|
|
nsp.costBas = atoi(buf.substr(befi, i-befi).c_str());
|
|
|
|
++i;
|
2007-06-09 16:28:03 +03:00
|
|
|
|
2007-06-09 23:23:44 +03:00
|
|
|
befi=i;
|
|
|
|
for(i; i<andame; ++i)
|
2007-06-09 16:28:03 +03:00
|
|
|
{
|
2007-06-09 23:23:44 +03:00
|
|
|
if(buf[i]=='\t')
|
|
|
|
break;
|
2007-06-09 16:28:03 +03:00
|
|
|
}
|
2007-06-09 23:23:44 +03:00
|
|
|
nsp.costAdv = atoi(buf.substr(befi, i-befi).c_str());
|
|
|
|
++i;
|
2007-06-09 16:28:03 +03:00
|
|
|
|
2007-06-09 23:23:44 +03:00
|
|
|
befi=i;
|
|
|
|
for(i; i<andame; ++i)
|
2007-06-09 16:28:03 +03:00
|
|
|
{
|
2007-06-09 23:23:44 +03:00
|
|
|
if(buf[i]=='\t')
|
|
|
|
break;
|
2007-06-09 16:28:03 +03:00
|
|
|
}
|
2007-06-09 23:23:44 +03:00
|
|
|
nsp.costExp = atoi(buf.substr(befi, i-befi).c_str());
|
|
|
|
++i;
|
2007-06-09 16:28:03 +03:00
|
|
|
|
2007-06-09 23:23:44 +03:00
|
|
|
befi=i;
|
|
|
|
for(i; i<andame; ++i)
|
2007-06-09 16:28:03 +03:00
|
|
|
{
|
2007-06-09 23:23:44 +03:00
|
|
|
if(buf[i]=='\t')
|
|
|
|
break;
|
2007-06-09 16:28:03 +03:00
|
|
|
}
|
2007-06-09 23:23:44 +03:00
|
|
|
nsp.power = atoi(buf.substr(befi, i-befi).c_str());
|
|
|
|
++i;
|
2007-06-09 16:28:03 +03:00
|
|
|
|
2007-06-09 23:23:44 +03:00
|
|
|
befi=i;
|
|
|
|
for(i; i<andame; ++i)
|
2007-06-09 16:28:03 +03:00
|
|
|
{
|
2007-06-09 23:23:44 +03:00
|
|
|
if(buf[i]=='\t')
|
|
|
|
break;
|
2007-06-09 16:28:03 +03:00
|
|
|
}
|
2007-06-09 23:23:44 +03:00
|
|
|
nsp.powerNone = atoi(buf.substr(befi, i-befi).c_str());
|
|
|
|
++i;
|
2007-06-09 16:28:03 +03:00
|
|
|
|
2007-06-09 23:23:44 +03:00
|
|
|
befi=i;
|
|
|
|
for(i; i<andame; ++i)
|
2007-06-09 16:28:03 +03:00
|
|
|
{
|
2007-06-09 23:23:44 +03:00
|
|
|
if(buf[i]=='\t')
|
|
|
|
break;
|
2007-06-09 16:28:03 +03:00
|
|
|
}
|
2007-06-09 23:23:44 +03:00
|
|
|
nsp.powerBas = atoi(buf.substr(befi, i-befi).c_str());
|
|
|
|
++i;
|
2007-06-09 16:28:03 +03:00
|
|
|
|
2007-06-09 23:23:44 +03:00
|
|
|
befi=i;
|
|
|
|
for(i; i<andame; ++i)
|
2007-06-09 16:28:03 +03:00
|
|
|
{
|
2007-06-09 23:23:44 +03:00
|
|
|
if(buf[i]=='\t')
|
|
|
|
break;
|
2007-06-09 16:28:03 +03:00
|
|
|
}
|
2007-06-09 23:23:44 +03:00
|
|
|
nsp.powerAdv = atoi(buf.substr(befi, i-befi).c_str());
|
|
|
|
++i;
|
2007-06-09 16:28:03 +03:00
|
|
|
|
2007-06-09 23:23:44 +03:00
|
|
|
befi=i;
|
|
|
|
for(i; i<andame; ++i)
|
2007-06-09 16:28:03 +03:00
|
|
|
{
|
2007-06-09 23:23:44 +03:00
|
|
|
if(buf[i]=='\t')
|
|
|
|
break;
|
2007-06-09 16:28:03 +03:00
|
|
|
}
|
2007-06-09 23:23:44 +03:00
|
|
|
nsp.powerExp = atoi(buf.substr(befi, i-befi).c_str());
|
|
|
|
++i;
|
2007-06-09 16:28:03 +03:00
|
|
|
|
2007-06-09 23:23:44 +03:00
|
|
|
befi=i;
|
|
|
|
for(i; i<andame; ++i)
|
2007-06-09 16:28:03 +03:00
|
|
|
{
|
2007-06-09 23:23:44 +03:00
|
|
|
if(buf[i]=='\t')
|
|
|
|
break;
|
2007-06-09 16:28:03 +03:00
|
|
|
}
|
2007-06-09 23:23:44 +03:00
|
|
|
nsp.castle = atoi(buf.substr(befi, i-befi).c_str());
|
|
|
|
++i;
|
2007-06-09 16:28:03 +03:00
|
|
|
|
2007-06-09 23:23:44 +03:00
|
|
|
befi=i;
|
|
|
|
for(i; i<andame; ++i)
|
2007-06-09 16:28:03 +03:00
|
|
|
{
|
2007-06-09 23:23:44 +03:00
|
|
|
if(buf[i]=='\t')
|
|
|
|
break;
|
2007-06-09 16:28:03 +03:00
|
|
|
}
|
2007-06-09 23:23:44 +03:00
|
|
|
nsp.rampart = atoi(buf.substr(befi, i-befi).c_str());
|
|
|
|
++i;
|
2007-06-09 16:28:03 +03:00
|
|
|
|
2007-06-09 23:23:44 +03:00
|
|
|
befi=i;
|
|
|
|
for(i; i<andame; ++i)
|
2007-06-09 16:28:03 +03:00
|
|
|
{
|
2007-06-09 23:23:44 +03:00
|
|
|
if(buf[i]=='\t')
|
|
|
|
break;
|
2007-06-09 16:28:03 +03:00
|
|
|
}
|
2007-06-09 23:23:44 +03:00
|
|
|
nsp.tower = atoi(buf.substr(befi, i-befi).c_str());
|
|
|
|
++i;
|
2007-06-09 16:28:03 +03:00
|
|
|
|
2007-06-09 23:23:44 +03:00
|
|
|
befi=i;
|
|
|
|
for(i; i<andame; ++i)
|
2007-06-09 16:28:03 +03:00
|
|
|
{
|
2007-06-09 23:23:44 +03:00
|
|
|
if(buf[i]=='\t')
|
|
|
|
break;
|
2007-06-09 16:28:03 +03:00
|
|
|
}
|
2007-06-09 23:23:44 +03:00
|
|
|
nsp.inferno = atoi(buf.substr(befi, i-befi).c_str());
|
|
|
|
++i;
|
2007-06-09 16:28:03 +03:00
|
|
|
|
2007-06-09 23:23:44 +03:00
|
|
|
befi=i;
|
|
|
|
for(i; i<andame; ++i)
|
2007-06-09 16:28:03 +03:00
|
|
|
{
|
2007-06-09 23:23:44 +03:00
|
|
|
if(buf[i]=='\t')
|
|
|
|
break;
|
2007-06-09 16:28:03 +03:00
|
|
|
}
|
2007-06-09 23:23:44 +03:00
|
|
|
nsp.necropolis = atoi(buf.substr(befi, i-befi).c_str());
|
|
|
|
++i;
|
2007-06-09 16:28:03 +03:00
|
|
|
|
2007-06-09 23:23:44 +03:00
|
|
|
befi=i;
|
|
|
|
for(i; i<andame; ++i)
|
2007-06-09 16:28:03 +03:00
|
|
|
{
|
2007-06-09 23:23:44 +03:00
|
|
|
if(buf[i]=='\t')
|
|
|
|
break;
|
2007-06-09 16:28:03 +03:00
|
|
|
}
|
2007-06-09 23:23:44 +03:00
|
|
|
nsp.dungeon = atoi(buf.substr(befi, i-befi).c_str());
|
|
|
|
++i;
|
2007-06-09 16:28:03 +03:00
|
|
|
|
2007-06-09 23:23:44 +03:00
|
|
|
befi=i;
|
|
|
|
for(i; i<andame; ++i)
|
2007-06-09 16:28:03 +03:00
|
|
|
{
|
2007-06-09 23:23:44 +03:00
|
|
|
if(buf[i]=='\t')
|
|
|
|
break;
|
2007-06-09 16:28:03 +03:00
|
|
|
}
|
2007-06-09 23:23:44 +03:00
|
|
|
nsp.stronghold = atoi(buf.substr(befi, i-befi).c_str());
|
|
|
|
++i;
|
2007-06-09 16:28:03 +03:00
|
|
|
|
2007-06-09 23:23:44 +03:00
|
|
|
befi=i;
|
|
|
|
for(i; i<andame; ++i)
|
2007-06-09 16:28:03 +03:00
|
|
|
{
|
2007-06-09 23:23:44 +03:00
|
|
|
if(buf[i]=='\t')
|
|
|
|
break;
|
2007-06-09 16:28:03 +03:00
|
|
|
}
|
2007-06-09 23:23:44 +03:00
|
|
|
nsp.fortress = atoi(buf.substr(befi, i-befi).c_str());
|
|
|
|
++i;
|
2007-06-09 16:28:03 +03:00
|
|
|
|
2007-06-09 23:23:44 +03:00
|
|
|
befi=i;
|
|
|
|
for(i; i<andame; ++i)
|
2007-06-09 16:28:03 +03:00
|
|
|
{
|
2007-06-09 23:23:44 +03:00
|
|
|
if(buf[i]=='\t')
|
|
|
|
break;
|
2007-06-09 16:28:03 +03:00
|
|
|
}
|
2007-06-09 23:23:44 +03:00
|
|
|
nsp.conflux = atoi(buf.substr(befi, i-befi).c_str());
|
|
|
|
++i;
|
2007-06-09 16:28:03 +03:00
|
|
|
|
2007-06-09 23:23:44 +03:00
|
|
|
befi=i;
|
|
|
|
for(i; i<andame; ++i)
|
2007-06-09 16:28:03 +03:00
|
|
|
{
|
2007-06-09 23:23:44 +03:00
|
|
|
if(buf[i]=='\t')
|
|
|
|
break;
|
2007-06-09 16:28:03 +03:00
|
|
|
}
|
2007-06-09 23:23:44 +03:00
|
|
|
nsp.none2 = atoi(buf.substr(befi, i-befi).c_str());
|
|
|
|
++i;
|
2007-06-09 16:28:03 +03:00
|
|
|
|
2007-06-09 23:23:44 +03:00
|
|
|
befi=i;
|
|
|
|
for(i; i<andame; ++i)
|
2007-06-09 16:28:03 +03:00
|
|
|
{
|
2007-06-09 23:23:44 +03:00
|
|
|
if(buf[i]=='\t')
|
|
|
|
break;
|
2007-06-09 16:28:03 +03:00
|
|
|
}
|
2007-06-09 23:23:44 +03:00
|
|
|
nsp.bas2 = atoi(buf.substr(befi, i-befi).c_str());
|
|
|
|
++i;
|
2007-06-09 16:28:03 +03:00
|
|
|
|
2007-06-09 23:23:44 +03:00
|
|
|
befi=i;
|
|
|
|
for(i; i<andame; ++i)
|
2007-06-09 16:28:03 +03:00
|
|
|
{
|
2007-06-09 23:23:44 +03:00
|
|
|
if(buf[i]=='\t')
|
|
|
|
break;
|
2007-06-09 16:28:03 +03:00
|
|
|
}
|
2007-06-09 23:23:44 +03:00
|
|
|
nsp.adv2 = atoi(buf.substr(befi, i-befi).c_str());
|
|
|
|
++i;
|
2007-06-09 16:28:03 +03:00
|
|
|
|
2007-06-09 23:23:44 +03:00
|
|
|
befi=i;
|
|
|
|
for(i; i<andame; ++i)
|
2007-06-09 16:28:03 +03:00
|
|
|
{
|
2007-06-09 23:23:44 +03:00
|
|
|
if(buf[i]=='\t')
|
|
|
|
break;
|
2007-06-09 16:28:03 +03:00
|
|
|
}
|
2007-06-09 23:23:44 +03:00
|
|
|
nsp.exp2 = atoi(buf.substr(befi, i-befi).c_str());
|
|
|
|
++i;
|
2007-06-09 16:28:03 +03:00
|
|
|
|
2007-06-09 23:23:44 +03:00
|
|
|
befi=i;
|
|
|
|
for(i; i<andame; ++i)
|
2007-06-09 16:28:03 +03:00
|
|
|
{
|
2007-06-09 23:23:44 +03:00
|
|
|
if(buf[i]=='\t')
|
|
|
|
break;
|
2007-06-09 16:28:03 +03:00
|
|
|
}
|
2007-06-09 23:23:44 +03:00
|
|
|
nsp.noneTip = buf.substr(befi, i-befi).c_str();
|
|
|
|
++i;
|
2007-06-09 16:28:03 +03:00
|
|
|
|
2007-06-09 23:23:44 +03:00
|
|
|
befi=i;
|
|
|
|
for(i; i<andame; ++i)
|
2007-06-09 16:28:03 +03:00
|
|
|
{
|
2007-06-09 23:23:44 +03:00
|
|
|
if(buf[i]=='\t')
|
|
|
|
break;
|
2007-06-09 16:28:03 +03:00
|
|
|
}
|
2007-06-09 23:23:44 +03:00
|
|
|
nsp.basTip = buf.substr(befi, i-befi).c_str();
|
|
|
|
++i;
|
2007-06-09 16:28:03 +03:00
|
|
|
|
2007-06-09 23:23:44 +03:00
|
|
|
befi=i;
|
|
|
|
for(i; i<andame; ++i)
|
2007-06-09 16:28:03 +03:00
|
|
|
{
|
2007-06-09 23:23:44 +03:00
|
|
|
if(buf[i]=='\t')
|
|
|
|
break;
|
2007-06-09 16:28:03 +03:00
|
|
|
}
|
2007-06-09 23:23:44 +03:00
|
|
|
nsp.advTip = buf.substr(befi, i-befi).c_str();
|
|
|
|
++i;
|
2007-06-09 16:28:03 +03:00
|
|
|
|
2007-06-09 23:23:44 +03:00
|
|
|
befi=i;
|
|
|
|
for(i; i<andame; ++i)
|
2007-06-09 16:28:03 +03:00
|
|
|
{
|
2007-06-09 23:23:44 +03:00
|
|
|
if(buf[i]=='\t')
|
|
|
|
break;
|
2007-06-09 16:28:03 +03:00
|
|
|
}
|
2007-06-09 23:23:44 +03:00
|
|
|
nsp.expTip = buf.substr(befi, i-befi).c_str();
|
|
|
|
++i;
|
2007-06-09 16:28:03 +03:00
|
|
|
|
2007-06-09 23:23:44 +03:00
|
|
|
befi=i;
|
|
|
|
for(i; i<andame; ++i)
|
|
|
|
{
|
|
|
|
if(buf[i]=='\r')
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
nsp.attributes = buf.substr(befi, i-befi).c_str();
|
|
|
|
++i;
|
|
|
|
++i;
|
|
|
|
|
|
|
|
nsp.combatSpell = combSpells;
|
2007-06-09 16:28:03 +03:00
|
|
|
spells.push_back(nsp);
|
|
|
|
}
|
2007-06-09 23:23:44 +03:00
|
|
|
}
|