Fixed function CursorByIdent in src/video/cursor.cpp

This function does not correct search for cursor if there are more races
This commit is contained in:
Pali Rohár 2010-08-13 15:34:06 +02:00
parent 77ff728df5
commit 170df2525d

View file

@ -135,12 +135,10 @@ CCursor *CursorByIdent(const std::string &ident)
std::vector<CCursor>::iterator i;
for (i = AllCursors.begin(); i != AllCursors.end(); ++i) {
if ((*i).Ident != ident) {
if ((*i).Ident != ident || ! (*i).G->IsLoaded())
continue;
}
if ((*i).Race.empty() || (*i).G->IsLoaded()) {
if ((*i).Race.empty() || ! ThisPlayer || (*i).Race == PlayerRaces.Name[ThisPlayer->Race])
return &(*i);
}
}
DebugPrint("Cursor `%s' not found, please check your code.\n" _C_ ident.c_str());
return NULL;