mirror of
https://github.com/vcmi/vcmi.git
synced 2025-07-03 00:46:55 +02:00
* fixed reading of guards / granted creatures (for BankConfig)
* minor changes
This commit is contained in:
@ -2422,7 +2422,7 @@ void CBattleInterface::showPieceOfWall(SDL_Surface * to, int hex)
|
||||
if(!siegeH)
|
||||
return;
|
||||
|
||||
static std::map<int, int> hexToPart = boost::assign::map_list_of(12, 8)(16, 1)(29, 7)(62, 12)(78, 6)(112, 10)(147, 5)(165, 11)(182, 4);
|
||||
static const std::map<int, int> hexToPart = boost::assign::map_list_of(12, 8)(16, 1)(29, 7)(62, 12)(78, 6)(112, 10)(147, 5)(165, 11)(182, 4);
|
||||
|
||||
std::map<int, int>::const_iterator it = hexToPart.find(hex);
|
||||
if(it != hexToPart.end())
|
||||
|
@ -326,7 +326,7 @@ void CCreatureHandler::loadCreatures()
|
||||
|
||||
// Map types names
|
||||
#define VCMI_CREATURE_ABILITY_NAME(x) ( #x, StackFeature::x )
|
||||
std::map<std::string, int> type_list = map_list_of VCMI_CREATURE_ABILITY_LIST;
|
||||
static const std::map<std::string, int> type_list = map_list_of VCMI_CREATURE_ABILITY_LIST;
|
||||
#undef VCMI_CREATURE_ABILITY_NAME
|
||||
|
||||
////second part of reading cr_abils.txt////
|
||||
@ -349,7 +349,7 @@ void CCreatureHandler::loadCreatures()
|
||||
reader >> creatureID;
|
||||
|
||||
reader >> type;
|
||||
std::map<std::string, int>::iterator it = type_list.find(type);
|
||||
std::map<std::string, int>::const_iterator it = type_list.find(type);
|
||||
if (it == type_list.end()) {
|
||||
tlog1 << "Error: invalid type " << type << " in cr_abils.txt" << std::endl;
|
||||
break;
|
||||
@ -372,7 +372,7 @@ void CCreatureHandler::loadCreatures()
|
||||
std::string type;
|
||||
reader >> creatureID;
|
||||
reader >> type;
|
||||
std::map<std::string, int>::iterator it = type_list.find(type);
|
||||
std::map<std::string, int>::const_iterator it = type_list.find(type);
|
||||
if (it == type_list.end())
|
||||
{
|
||||
tlog1 << "Error: invalid type " << type << " in cr_abils.txt" << std::endl;
|
||||
|
@ -82,7 +82,7 @@ static void readCreatures(std::istream & is, BankConfig & bc, bool guards) //hel
|
||||
std::pair<si16, si32> guardInfo = std::make_pair(0, 0);
|
||||
std::string creName;
|
||||
|
||||
is >> guardInfo.first;
|
||||
is >> guardInfo.second;
|
||||
//one getline just does not work... probably a kind of left whitespace
|
||||
is.getline(buffer, MAX_BUF, '\t');
|
||||
is.getline(buffer, MAX_BUF, '\t');
|
||||
@ -94,7 +94,7 @@ static void readCreatures(std::istream & is, BankConfig & bc, bool guards) //hel
|
||||
//look for the best creature that is described by given name
|
||||
if( vstd::contains(VLC->creh->nameToID, creName) )
|
||||
{
|
||||
guardInfo.second = VLC->creh->nameToID[creName];
|
||||
guardInfo.first = VLC->creh->nameToID[creName];
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -104,7 +104,7 @@ static void readCreatures(std::istream & is, BankConfig & bc, bool guards) //hel
|
||||
|| VLC->creh->creatures[g].nameRef == creName
|
||||
|| VLC->creh->creatures[g].nameSing == creName)
|
||||
{
|
||||
guardInfo.second = VLC->creh->creatures[g].idNumber;
|
||||
guardInfo.first = VLC->creh->creatures[g].idNumber;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -938,7 +938,7 @@ struct BankConfig
|
||||
std::vector< std::pair <ui16, ui32> > guards; //creature ID, amount
|
||||
ui32 combatValue; //how hard are guards of this level
|
||||
std::vector<si32> resources; //resources given in case of victory
|
||||
std::vector< std::pair <ui16, ui32> > creatures; //creatures granted in case of victory
|
||||
std::vector< std::pair <ui16, ui32> > creatures; //creatures granted in case of victory (creature ID, amount)
|
||||
std::vector<ui16> artifacts; //number of artifacts given in case of victory [0] -> treasure, [1] -> minor [2] -> major [3] -> relic
|
||||
ui32 value; //overall value of given things
|
||||
ui32 rewardDifficulty; //proportion of reward value to difficulty of guards; how profitable is this creature Bank config
|
||||
|
@ -303,13 +303,13 @@ void BattleInfo::getAccessibilityMap(bool *accessibility, bool twoHex, bool atta
|
||||
//walls
|
||||
if(siege >= 0)
|
||||
{
|
||||
static int permanentlyLocked[] = {12, 45, 78, 112, 147, 182};
|
||||
static const int permanentlyLocked[] = {12, 45, 78, 112, 147, 182};
|
||||
for(int b=0; b<ARRAY_COUNT(permanentlyLocked); ++b)
|
||||
{
|
||||
accessibility[permanentlyLocked[b]] = false;
|
||||
}
|
||||
|
||||
static std::pair<int, int> lockedIfNotDestroyed[] = //(which part of wall, which hex is blocked if this part of wall is not destroyed
|
||||
static const std::pair<int, int> lockedIfNotDestroyed[] = //(which part of wall, which hex is blocked if this part of wall is not destroyed
|
||||
{std::make_pair(2, 165), std::make_pair(3, 130), std::make_pair(4, 62), std::make_pair(5, 29)};
|
||||
for(int b=0; b<ARRAY_COUNT(lockedIfNotDestroyed); ++b)
|
||||
{
|
||||
|
Reference in New Issue
Block a user