mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-26 03:52:01 +02:00
Merge branch 'develop' of https://github.com/vcmi/vcmi into RMG
This commit is contained in:
commit
5c431da0f9
@ -1415,14 +1415,15 @@ void VCAI::completeGoal (Goals::TSubgoal goal)
|
||||
}
|
||||
else //complete goal for all heroes maybe?
|
||||
{
|
||||
for (auto p : lockedHeroes)
|
||||
vstd::erase_if(lockedHeroes, [goal](std::pair<HeroPtr, Goals::TSubgoal> p)
|
||||
{
|
||||
if (*(p.second) == *goal || p.second->fulfillsMe(goal)) //we could have fulfilled goals of other heroes by chance
|
||||
{
|
||||
logAi->debugStream() << boost::format("%s") % p.second->completeMessage();
|
||||
lockedHeroes.erase (lockedHeroes.find(p.first)); //is it safe?
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -5,8 +5,10 @@ GENERAL:
|
||||
ADVENTURE AI:
|
||||
|
||||
ADVENTURE MAP:
|
||||
* Heroes auto-level primary and secondary skill levels according to experience
|
||||
|
||||
BATTLES:
|
||||
* Wall hit/miss sound will be played when using catapult during siege
|
||||
|
||||
SPELLS:
|
||||
* New configuration format: http://wiki.vcmi.eu/index.php?title=Spell_Format
|
||||
|
@ -1247,7 +1247,7 @@ SelectionTab::SelectionTab(CMenuScreen::EState Type, const std::function<void(CM
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
generalSortingBy = (tabType == CMenuScreen::loadGame || tabType == CMenuScreen::saveGame) ? _fileName : _name;
|
||||
|
||||
if (tabType != CMenuScreen::campaignList)
|
||||
{
|
||||
@ -1264,7 +1264,14 @@ SelectionTab::SelectionTab(CMenuScreen::EState Type, const std::function<void(CM
|
||||
int xpos[] = {23, 55, 88, 121, 306, 339};
|
||||
const char * names[] = {"SCBUTT1.DEF", "SCBUTT2.DEF", "SCBUTCP.DEF", "SCBUTT3.DEF", "SCBUTT4.DEF", "SCBUTT5.DEF"};
|
||||
for(int i = 0; i < 6; i++)
|
||||
new CAdventureMapButton("", CGI->generaltexth->zelp[107+i].second, boost::bind(&SelectionTab::sortBy, this, i), xpos[i], 86, names[i]);
|
||||
{
|
||||
ESortBy criteria = (ESortBy)i;
|
||||
|
||||
if(criteria == _name)
|
||||
criteria = generalSortingBy;
|
||||
|
||||
new CAdventureMapButton("", CGI->generaltexth->zelp[107+i].second, boost::bind(&SelectionTab::sortBy, this, criteria), xpos[i], 86, names[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -1327,8 +1334,8 @@ void SelectionTab::sortBy( int criteria )
|
||||
|
||||
void SelectionTab::sort()
|
||||
{
|
||||
if(sortingBy != _name)
|
||||
std::stable_sort(curItems.begin(), curItems.end(), mapSorter(_name));
|
||||
if(sortingBy != generalSortingBy)
|
||||
std::stable_sort(curItems.begin(), curItems.end(), mapSorter(generalSortingBy));
|
||||
std::stable_sort(curItems.begin(), curItems.end(), mapSorter(sortingBy));
|
||||
|
||||
if(!ascending)
|
||||
@ -3013,6 +3020,8 @@ bool mapSorter::operator()(const CMapInfo *aaa, const CMapInfo *bbb)
|
||||
break;
|
||||
case _name: //by name
|
||||
return boost::ilexicographical_compare(a->name, b->name);
|
||||
case _fileName: //by filename
|
||||
return boost::ilexicographical_compare(aaa->fileURI, bbb->fileURI);
|
||||
default:
|
||||
return boost::ilexicographical_compare(a->name, b->name);
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ struct PlayerInfo;
|
||||
|
||||
namespace boost{ class thread; class recursive_mutex;}
|
||||
|
||||
enum ESortBy{_playerAm, _size, _format, _name, _viccon, _loscon, _numOfMaps}; //_numOfMaps is for campaigns
|
||||
enum ESortBy{_playerAm, _size, _format, _name, _viccon, _loscon, _numOfMaps, _fileName}; //_numOfMaps is for campaigns
|
||||
|
||||
/// Class which handles map sorting by different criteria
|
||||
class mapSorter
|
||||
@ -160,6 +160,7 @@ public:
|
||||
std::function<void(CMapInfo *)> onSelect;
|
||||
|
||||
ESortBy sortingBy;
|
||||
ESortBy generalSortingBy;
|
||||
bool ascending;
|
||||
|
||||
CTextInput *txt;
|
||||
|
@ -5,6 +5,7 @@ else
|
||||
# Download and unpack OS X prebuilt dependencies
|
||||
curl -o ../xcode-pack.zip -L http://download.vcmi.eu/xcode-pack.zip
|
||||
unzip ../xcode-pack.zip -d ../
|
||||
rm -rf ../__MACOSX
|
||||
|
||||
# Build vcmibuilder
|
||||
xcodebuild -project osx/osx-vcmibuilder/vcmibuilder.xcodeproj/ -configuration Release
|
||||
|
@ -206,14 +206,46 @@
|
||||
|
||||
// Extract
|
||||
[self showProgressText:@"Extracting game data using unshield..."];
|
||||
if ([self runTask:@"/unshield" withArgs:@[@"-d", tempDir, @"x", [cd1 stringByAppendingString:@"/_setup/data1.cab"]] withWorkingDir:tempDir withPipe:nil] != 0) {
|
||||
|
||||
NSArray* knownLocations = @[
|
||||
@"/_setup/data1.cab",
|
||||
@"/Autorun/Setup/data1.cab"
|
||||
];
|
||||
|
||||
bool success = false;
|
||||
for (NSString* location in knownLocations) {
|
||||
NSString* cabLocation = [cd1 stringByAppendingString:location];
|
||||
if ([[NSFileManager defaultManager] fileExistsAtPath:cabLocation]) {
|
||||
int result = [self runTask:@"/unshield" withArgs:@[@"-d", tempDir, @"x", cabLocation] withWorkingDir:tempDir withPipe:nil];
|
||||
|
||||
if (result == 0) {
|
||||
success = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!success) {
|
||||
return [self showErrorText:@"Failed to extract game data using unshield"];
|
||||
}
|
||||
|
||||
dataDir = [tempDir stringByAppendingString:@"/Heroes3"];
|
||||
if (![[NSFileManager defaultManager] fileExistsAtPath:dataDir]) {
|
||||
// Some releases have "Program_Files" folder instead of "Heroes3"
|
||||
dataDir = [tempDir stringByAppendingString:@"/Program_Files"];
|
||||
NSArray* knownDataDirs = @[
|
||||
@"/Heroes3",
|
||||
@"/Program_Files",
|
||||
@"/Data",
|
||||
];
|
||||
|
||||
success = false;
|
||||
for (NSString* knownDir in knownDataDirs) {
|
||||
dataDir = [tempDir stringByAppendingString:knownDir];
|
||||
if ([[NSFileManager defaultManager] fileExistsAtPath:dataDir]) {
|
||||
success = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!success) {
|
||||
return [self showErrorText:@"Failed to extract game data using unshield"];
|
||||
}
|
||||
|
||||
// Unmount CD1. Unmount CD2 if needed
|
||||
|
@ -293,6 +293,11 @@ bool CGarrisonDialogQuery::blocksPack(const CPack *pack) const
|
||||
return !vstd::contains(ourIds, dismiss->id);
|
||||
}
|
||||
|
||||
if (auto dismiss = dynamic_cast<const AssembleArtifacts*>(pack))
|
||||
{
|
||||
return !vstd::contains(ourIds, dismiss->heroID);
|
||||
}
|
||||
|
||||
return CDialogQuery::blocksPack(pack);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user