mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-26 22:57:00 +02:00
bca18a31c3
* for screen is updated after buying creatures * fixed crashbug on maps with random monster * proper images of war machines are displayed in blacksmith * picking starting hero should work again * Ice Elemental will be treated as two-hex creature * minor fixes
93 lines
1.9 KiB
C++
93 lines
1.9 KiB
C++
#define VCMI_DLL
|
|
#include "../stdafx.h"
|
|
#include "CArtHandler.h"
|
|
#include "CLodHandler.h"
|
|
#include <boost/assign/std/vector.hpp>
|
|
#include <boost/assign/list_of.hpp>
|
|
#include "../lib/VCMI_Lib.h"
|
|
extern CLodHandler *bitmaph;
|
|
using namespace boost::assign;
|
|
CArtHandler::CArtHandler()
|
|
{
|
|
VLC->arth = this;
|
|
}
|
|
void CArtHandler::loadArtifacts()
|
|
{
|
|
std::vector<ui16> slots;
|
|
slots += 17, 16, 15,14,13, 18, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0;
|
|
std::map<char,EartClass> classes =
|
|
map_list_of('S',SartClass)('T',TartClass)('N',NartClass)('J',JartClass)('R',RartClass);
|
|
std::string buf = bitmaph->getTextFile("ARTRAITS.TXT"), dump, pom;
|
|
int it=0;
|
|
for(int i=0; i<2; ++i)
|
|
{
|
|
loadToIt(dump,buf,it,3);
|
|
}
|
|
for (int i=0; i<ARTIFACTS_QUANTITY; i++)
|
|
{
|
|
CArtifact nart;
|
|
loadToIt(nart.name,buf,it,4);
|
|
loadToIt(pom,buf,it,4);
|
|
nart.price=atoi(pom.c_str());
|
|
for(int j=0;j<slots.size();j++)
|
|
{
|
|
loadToIt(pom,buf,it,4);
|
|
if(pom[0]=='x')
|
|
nart.possibleSlots.push_back(slots[j]);
|
|
}
|
|
loadToIt(pom,buf,it,4);
|
|
nart.aClass = classes[pom[0]];
|
|
loadToIt(nart.description,buf,it,3);
|
|
nart.id=i;
|
|
artifacts.push_back(nart);
|
|
}
|
|
for(int i=0;i<144;i++) //do 144, bo nie chcemy bzdurek
|
|
{
|
|
switch (artifacts[i].aClass)
|
|
{
|
|
case TartClass:
|
|
treasures.push_back(&(artifacts[i]));
|
|
break;
|
|
case NartClass:
|
|
minors.push_back(&(artifacts[i]));
|
|
break;
|
|
case JartClass:
|
|
majors.push_back(&(artifacts[i]));
|
|
break;
|
|
case RartClass:
|
|
relics.push_back(&(artifacts[i]));
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
int CArtHandler::convertMachineID(int id, bool creToArt )
|
|
{
|
|
int dif = 142;
|
|
if(creToArt)
|
|
{
|
|
switch (id)
|
|
{
|
|
case 147:
|
|
dif--;
|
|
break;
|
|
case 148:
|
|
dif++;
|
|
break;
|
|
}
|
|
dif = -dif;
|
|
}
|
|
else
|
|
{
|
|
switch (id)
|
|
{
|
|
case 6:
|
|
dif--;
|
|
break;
|
|
case 5:
|
|
dif++;
|
|
break;
|
|
}
|
|
}
|
|
return id + dif;
|
|
} |