@all
I have compiled Beworld's port fheroes2 V1.0.0 (Heroes of Might and Magic II engine). Thanks to Beworld, I made BigEndian fixes.
However after starting the game , game shutdowns itself with these error in CLI windows:
"Expection 'basic_sting::M_create' occured during application time
I looked at sources and basic_string is only used here.
What may be wrong ?
maps_fileinfo.cpp:
namespace
{
const size_t mapNameLength = 16;
const size_t mapDescriptionLength = 200;
template <typename CharType>
bool CaseInsensitiveCompare( const std::basic_string<CharType> & lhs, const std::basic_string<CharType> & rhs )
{
typename std::basic_string<CharType>::const_iterator li = lhs.begin();
typename std::basic_string<CharType>::const_iterator ri = rhs.begin();
while ( li != lhs.end() && ri != rhs.end() ) {
const CharType lc = std::tolower( *li, std::locale() );
const CharType rc = std::tolower( *ri, std::locale() );
++li;
++ri;
if ( lc < rc ) {
return true;
}
if ( lc > rc ) {
return false;
}
// the chars are "equal", so proceed to check the next pair
}
// we came to the end of either (or both) strings, left is "smaller" if it was shorter:
return li == lhs.end() && ri != rhs.end();
}
uint8_t ByteToColor( const int byte )
{
switch ( byte ) {
case 0:
return Color::BLUE;
case 1:
return Color::GREEN;
case 2:
return Color::RED;
case 3:
return Color::YELLOW;
case 4:
return Color::ORANGE;
case 5:
return Color::PURPLE;
default:
break;
}
return Color::NONE;
}
int ByteToRace( const int byte )
{
switch ( byte ) {
case 0x00:
return Race::KNGT;
case 0x01:
return Race::BARB;
case 0x02:
return Race::SORC;
case 0x03:
return Race::WRLK;
case 0x04:
return Race::WZRD;
case 0x05:
return Race::NECR;
case 0x06:
return Race::MULT;
case 0x07:
return Race::RAND;
default:
break;
}
return Race::NONE;
}
}