1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-24 08:32:34 +02:00

* removed redundant code for displaying map difficulty

* bumped version name to 0.72b
* more diagnostics in music handler (should help to catch the reported bug with not playing main menu theme)
* probably fixed problems with horde buildings in towns that start with upgraded dwellings (0.72#1 http://vcmi.antypika.aplus.pl/forum/viewtopic.php?t=159)
This commit is contained in:
Michał W. Urbańczyk 2009-06-10 19:44:09 +00:00
parent 914da9d6d6
commit 29e1f2a0b8
6 changed files with 36 additions and 45 deletions

View File

@ -1420,25 +1420,10 @@ void MapSel::printSelectedInfo()
if (selMap.name.length())
CSDL_Ext::printAt(selMap.name,420,41,GEORXX);
else CSDL_Ext::printAt("Unnamed",420,41,GEORXX);
std::string diff;
switch (selMap.difficulty)
{
case 0:
diff=gdiff(CGI->generaltexth->zelp[24].second);
break;
case 1:
diff=gdiff(CGI->generaltexth->zelp[25].second);
break;
case 2:
diff=gdiff(CGI->generaltexth->zelp[26].second);
break;
case 3:
diff=gdiff(CGI->generaltexth->zelp[27].second);
break;
case 4:
diff=gdiff(CGI->generaltexth->zelp[28].second);
break;
}
assert(selMap.difficulty <= 4);
std::string &diff = CGI->generaltexth->arraytxt[142 + selMap.difficulty];
temp=-1;
switch (selMap.width)
{
@ -1512,19 +1497,6 @@ void MapSel::printFlags()
}
}
}
std::string MapSel::gdiff(std::string ss)
{
std::string ret;
for (int i=1;i<ss.length();i++)
{
if (ss[i]==' ')
break;
ret+=ss[i];
}
return ret;
}
// A new size filter (Small, Medium, ...) has been selected. Populate
// selMaps with the relevant data.
void MapSel::updateSelection()

View File

@ -19,7 +19,7 @@ typedef boost::int8_t si8; //signed int 8 bits (1 byte)
#define THC
#endif
#define NAME_VER ("VCMI 0.72")
#define NAME_VER ("VCMI 0.72b")
#define CONSOLE_LOGGING_LEVEL 5
#define FILE_LOGGING_LEVEL 6

View File

@ -47,8 +47,9 @@ void CGeneralTextHandler::load()
buf1.substr(pom+1,eol-pom-1)));
boost::algorithm::replace_all(zelp[zelp.size()-1].first,"\t","");
boost::algorithm::replace_all(zelp[zelp.size()-1].second,"\t","");
if(zelp.back().second[0] == '\"' && zelp.back().second[zelp.back().second.size()-1] == '\"')
zelp.back().second = zelp.back().second.substr(1,zelp.back().second.size()-2);
std::string &op = zelp.back().second;
if(op[0] == '\"' && op[op.size()-1] == '\"')
op =op.substr(1,op.size()-2);
}
itr=eol+2;
}

View File

@ -361,15 +361,14 @@ void CMusicHandler::playMusic(musicBase::musicID musicID, int loop)
{
// A music is already playing. Stop it and the callback will
// start the new one
nextMusic = Mix_LoadMUS(filename.c_str());
nextMusic = LoadMUS(filename.c_str());
nextMusicLoop = loop;
Mix_FadeOutMusic(1000);
}
else
{
currentMusic = Mix_LoadMUS(filename.c_str());
if (Mix_PlayMusic(currentMusic, loop) == -1)
tlog1 << "Unable to play sound file " << musicID << "(" << Mix_GetError() << ")" << std::endl;
currentMusic = LoadMUS(filename.c_str());
PlayMusic(currentMusic,loop);
}
musicMutex.unlock();
@ -421,9 +420,26 @@ void CMusicHandler::musicFinishedCallback(void)
{
currentMusic = nextMusic;
nextMusic = NULL;
if (Mix_PlayMusic(currentMusic, nextMusicLoop) == -1)
tlog1 << "Unable to play music (" << Mix_GetError() << ")" << std::endl;
PlayMusic(currentMusic,nextMusicLoop);
}
musicMutex.unlock();
}
Mix_Music * CMusicHandler::LoadMUS(const char *file)
{
Mix_Music *ret = Mix_LoadMUS(file);
if(!ret) //load music and check for error
tlog1 << "Unable to load music file (" << file <<"). Error: " << Mix_GetError() << std::endl;
return ret;
}
int CMusicHandler::PlayMusic(Mix_Music *music, int loops)
{
int ret = Mix_PlayMusic(music, loops);
if(ret == -1)
tlog1 << "Unable to play music (" << Mix_GetError() << ")" << std::endl;
return ret;
}

View File

@ -77,6 +77,8 @@ private:
Mix_Music *nextMusic;
int nextMusicLoop;
Mix_Music * LoadMUS(const char *file); //calls Mix_LoadMUS and checks for errors
int PlayMusic(Mix_Music *music, int loops); //calls Mix_PlayMusic and checks for errors
public:
CMusicHandler();

View File

@ -45,13 +45,13 @@ static std::set<si32> convertBuildings(const std::set<si32> h3m, int castleID)
else
ret.insert(19);
}
else
{
//else
//{
if(((castleID==1) || (castleID==3)) && ((level==3) || (level==5)))
ret.insert(24);
else
ret.insert(18);
}
//}
}
else
{
@ -746,7 +746,7 @@ void Mapa::loadTown( CGObjectInstance * &nobj, unsigned char * bufor, int &i )
if(readChar(bufor,i))//true if garrison isn't empty
nt->army = readCreatureSet(bufor,i,7,(version>RoE));
nt->army.formation = bufor[i]; ++i;
if(readChar(bufor,i)) //unusualBuildings
if(readChar(bufor,i)) //custom buildings info
{
//built buildings
for(int byte=0;byte<6;byte++)