Hi,
Here my changes for rev 772, that helps successfully compile and run vcmi on mac. Also, I included my workaround for deadlock in CGameHandler, that works for my. of course eventually the game crashes after some period.
$ svn diff
Index: hch/CBuildingHandler.cpp
— hch/CBuildingHandler.cpp (revision 772)
+++ hch/CBuildingHandler.cpp (working copy)
@@ -99,7 +99,7 @@
{
box = it = 0;
ofs.getline(line,100);
-
if(!line[0])
-
if(!line[0] || line[0] == '\n' || line[0] == '\r') ofs.getline(line,100); std::string linia(line); bool areboxes=true;
@@ -152,4 +152,4 @@
return VLC->generaltexth->buildings[tid][bid].second;
tlog2 << "Warning: Cannot find description text for building " << bid << "for " << tid << “town.\n”;
return “”;
-}
\ No newline at end of file
+}
Index: hch/CVideoHandler.h
— hch/CVideoHandler.h (revision 772)
+++ hch/CVideoHandler.h (working copy)
@@ -114,7 +114,7 @@
class DLLHandler
{
public:
-#if !defined(amigaos4) && !defined(unix)
+#if !defined(amigaos4) && !defined(unix) && !defined(APPLE)
HINSTANCE dll;
#else
void *dll;
@@ -131,7 +131,7 @@
public:
DLLHandler ourLib;
int newmode;
-#if !defined(amigaos4) && !defined(unix)
+#if !defined(amigaos4) && !defined(unix) && !defined(APPLE)
HANDLE hBinkFile;
#else
void *hBinkFile;
Index: server/CGameHandler.h
— server/CGameHandler.h (revision 772)
+++ server/CGameHandler.h (working copy)
@@ -39,7 +39,7 @@
{
public:
std::map<ui8,PlayerStatus> players;
- boost::mutex mx;
-
boost::mutex mx,mx2;
boost::condition_variable cv; //notifies when any changes are madevoid addPlayer(ui8 player);
Index: server/CGameHandler.cpp
===================================================================
— server/CGameHandler.cpp (revision 772)
+++ server/CGameHandler.cpp (working copy)
@@ -485,7 +485,8 @@
void CGameHandler::prepareAttack(BattleAttack &bat, CStack *att, CStack *def)
{
bat.stackAttacking = att->ID;
- std::set::iterator bsa = bat.bsa.insert(BattleStackAttacked()).first;
-
std::set::iterator i = bat.bsa.insert(BattleStackAttacked()).first;
-
BattleStackAttacked *bsa = (BattleStackAttacked *) &*i;
bsa->stackAttacked = def->ID;
bsa->damageAmount = BattleInfo::calculateDmg(att, def, gs->getHero(att->attackerOwned ? gs->curB->hero1 : gs->curB->hero2), gs->getHero(def->attackerOwned ? gs->curB->hero1 : gs->curB->hero2), bat.shot());//counting dealt damage
@@ -831,7 +832,7 @@
}//wait till turn is done
-
boost::unique_lock<boost::mutex> lock(states.mx);
-
boost::unique_lock<boost::mutex> lock(states.mx2); while(states.players*.makingTurn && !end2) { boost::posix_time::time_duration p;
@@ -2399,4 +2400,4 @@
gs->map->events.pop_front();
}
}
-}
\ No newline at end of file
+}
Index: lib/NetPacksLib.cpp
— lib/NetPacksLib.cpp (revision 772)
+++ lib/NetPacksLib.cpp (working copy)
@@ -428,7 +428,7 @@
attacker->counterAttacks–;
if(shot())
attacker->shots–;
- BOOST_FOREACH(BattleStackAttacked &stackAttacked, bsa)
- BOOST_FOREACH(BattleStackAttacked stackAttacked, bsa)
stackAttacked.applyGs(gs);
}
@@ -484,4 +484,4 @@
DLL_EXPORT void SetSelection::applyGs( CGameState *gs )
{
gs->getPlayer(player)->currentSelection = id;
-}
\ No newline at end of file
+}
Index: lib/NetPacks.h
— lib/NetPacks.h (revision 772)
+++ lib/NetPacks.h (working copy)
@@ -668,11 +668,11 @@
ui8 flags; //1 - is stack killed; 2 - is there special effect to be shown;
ui32 effect; //set only if flag 2 is present
- bool killed() //if target stack was killed
- bool killed() const//if target stack was killed
{
return flags & 1;
}
- bool isEffect() //if target stack was killed
- bool isEffect() const//if target stack was killed
{
return flags & 2;
}
@@ -1083,4 +1083,4 @@
}
};
-#endif //NETPACKS_H
\ No newline at end of file
+#endif //NETPACKS_H*