mirror of
https://github.com/vcmi/vcmi.git
synced 2025-06-23 00:28:08 +02:00
Merge branch 'develop' of https://github.com/vcmi/vcmi into RMG
This commit is contained in:
@ -1415,14 +1415,15 @@ void VCAI::completeGoal (Goals::TSubgoal goal)
|
|||||||
}
|
}
|
||||||
else //complete goal for all heroes maybe?
|
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
|
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();
|
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 AI:
|
||||||
|
|
||||||
ADVENTURE MAP:
|
ADVENTURE MAP:
|
||||||
|
* Heroes auto-level primary and secondary skill levels according to experience
|
||||||
|
|
||||||
BATTLES:
|
BATTLES:
|
||||||
|
* Wall hit/miss sound will be played when using catapult during siege
|
||||||
|
|
||||||
SPELLS:
|
SPELLS:
|
||||||
* New configuration format: http://wiki.vcmi.eu/index.php?title=Spell_Format
|
* 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)
|
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};
|
int xpos[] = {23, 55, 88, 121, 306, 339};
|
||||||
const char * names[] = {"SCBUTT1.DEF", "SCBUTT2.DEF", "SCBUTCP.DEF", "SCBUTT3.DEF", "SCBUTT4.DEF", "SCBUTT5.DEF"};
|
const char * names[] = {"SCBUTT1.DEF", "SCBUTT2.DEF", "SCBUTCP.DEF", "SCBUTT3.DEF", "SCBUTT4.DEF", "SCBUTT5.DEF"};
|
||||||
for(int i = 0; i < 6; i++)
|
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
|
else
|
||||||
@ -1327,8 +1334,8 @@ void SelectionTab::sortBy( int criteria )
|
|||||||
|
|
||||||
void SelectionTab::sort()
|
void SelectionTab::sort()
|
||||||
{
|
{
|
||||||
if(sortingBy != _name)
|
if(sortingBy != generalSortingBy)
|
||||||
std::stable_sort(curItems.begin(), curItems.end(), mapSorter(_name));
|
std::stable_sort(curItems.begin(), curItems.end(), mapSorter(generalSortingBy));
|
||||||
std::stable_sort(curItems.begin(), curItems.end(), mapSorter(sortingBy));
|
std::stable_sort(curItems.begin(), curItems.end(), mapSorter(sortingBy));
|
||||||
|
|
||||||
if(!ascending)
|
if(!ascending)
|
||||||
@ -3013,6 +3020,8 @@ bool mapSorter::operator()(const CMapInfo *aaa, const CMapInfo *bbb)
|
|||||||
break;
|
break;
|
||||||
case _name: //by name
|
case _name: //by name
|
||||||
return boost::ilexicographical_compare(a->name, b->name);
|
return boost::ilexicographical_compare(a->name, b->name);
|
||||||
|
case _fileName: //by filename
|
||||||
|
return boost::ilexicographical_compare(aaa->fileURI, bbb->fileURI);
|
||||||
default:
|
default:
|
||||||
return boost::ilexicographical_compare(a->name, b->name);
|
return boost::ilexicographical_compare(a->name, b->name);
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ struct PlayerInfo;
|
|||||||
|
|
||||||
namespace boost{ class thread; class recursive_mutex;}
|
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 which handles map sorting by different criteria
|
||||||
class mapSorter
|
class mapSorter
|
||||||
@ -160,6 +160,7 @@ public:
|
|||||||
std::function<void(CMapInfo *)> onSelect;
|
std::function<void(CMapInfo *)> onSelect;
|
||||||
|
|
||||||
ESortBy sortingBy;
|
ESortBy sortingBy;
|
||||||
|
ESortBy generalSortingBy;
|
||||||
bool ascending;
|
bool ascending;
|
||||||
|
|
||||||
CTextInput *txt;
|
CTextInput *txt;
|
||||||
|
@ -5,6 +5,7 @@ else
|
|||||||
# Download and unpack OS X prebuilt dependencies
|
# Download and unpack OS X prebuilt dependencies
|
||||||
curl -o ../xcode-pack.zip -L http://download.vcmi.eu/xcode-pack.zip
|
curl -o ../xcode-pack.zip -L http://download.vcmi.eu/xcode-pack.zip
|
||||||
unzip ../xcode-pack.zip -d ../
|
unzip ../xcode-pack.zip -d ../
|
||||||
|
rm -rf ../__MACOSX
|
||||||
|
|
||||||
# Build vcmibuilder
|
# Build vcmibuilder
|
||||||
xcodebuild -project osx/osx-vcmibuilder/vcmibuilder.xcodeproj/ -configuration Release
|
xcodebuild -project osx/osx-vcmibuilder/vcmibuilder.xcodeproj/ -configuration Release
|
||||||
|
@ -206,14 +206,46 @@
|
|||||||
|
|
||||||
// Extract
|
// Extract
|
||||||
[self showProgressText:@"Extracting game data using unshield..."];
|
[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"];
|
return [self showErrorText:@"Failed to extract game data using unshield"];
|
||||||
}
|
}
|
||||||
|
|
||||||
dataDir = [tempDir stringByAppendingString:@"/Heroes3"];
|
NSArray* knownDataDirs = @[
|
||||||
if (![[NSFileManager defaultManager] fileExistsAtPath:dataDir]) {
|
@"/Heroes3",
|
||||||
// Some releases have "Program_Files" folder instead of "Heroes3"
|
@"/Program_Files",
|
||||||
dataDir = [tempDir stringByAppendingString:@"/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
|
// Unmount CD1. Unmount CD2 if needed
|
||||||
|
@ -293,6 +293,11 @@ bool CGarrisonDialogQuery::blocksPack(const CPack *pack) const
|
|||||||
return !vstd::contains(ourIds, dismiss->id);
|
return !vstd::contains(ourIds, dismiss->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (auto dismiss = dynamic_cast<const AssembleArtifacts*>(pack))
|
||||||
|
{
|
||||||
|
return !vstd::contains(ourIds, dismiss->heroID);
|
||||||
|
}
|
||||||
|
|
||||||
return CDialogQuery::blocksPack(pack);
|
return CDialogQuery::blocksPack(pack);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user