- added boost patch (fixes build with boost 1.70; it reverts changes from boost-1...
[packages/vcmi.git] / vcmi-boost.patch
1 --- vcmi-0.99/lib/serializer/Connection.h.orig  2019-05-09 18:28:47.786130450 +0200
2 +++ vcmi-0.99/lib/serializer/Connection.h       2019-05-09 20:37:32.790815761 +0200
3 @@ -14,37 +14,20 @@
4  #include "BinaryDeserializer.h"
5  #include "BinarySerializer.h"
6  
7 +#include <boost/asio/basic_stream_socket.hpp>
8 +#include <boost/asio/basic_socket_acceptor.hpp>
9 +#include <boost/asio/io_service.hpp>
10 +#include <boost/asio/ip/tcp.hpp>
11 +
12  struct CPack;
13  
14  namespace boost
15  {
16 -       namespace asio
17 -       {
18 -               namespace ip
19 -               {
20 -                       class tcp;
21 -               }
22 -
23 -#if BOOST_VERSION >= 106600  // Boost version >= 1.66
24 -               class io_context;
25 -               typedef io_context io_service;
26 -#else
27 -               class io_service;
28 -#endif
29 -
30 -               template <typename Protocol> class stream_socket_service;
31 -               template <typename Protocol,typename StreamSocketService>
32 -               class basic_stream_socket;
33 -
34 -               template <typename Protocol> class socket_acceptor_service;
35 -               template <typename Protocol,typename SocketAcceptorService>
36 -               class basic_socket_acceptor;
37 -       }
38         class mutex;
39  }
40  
41 -typedef boost::asio::basic_stream_socket < boost::asio::ip::tcp , boost::asio::stream_socket_service<boost::asio::ip::tcp>  > TSocket;
42 -typedef boost::asio::basic_socket_acceptor<boost::asio::ip::tcp, boost::asio::socket_acceptor_service<boost::asio::ip::tcp> > TAcceptor;
43 +typedef boost::asio::basic_stream_socket<boost::asio::ip::tcp> TSocket;
44 +typedef boost::asio::basic_socket_acceptor<boost::asio::ip::tcp> TAcceptor;
45  
46  /// Main class for network communication
47  /// Allows establishing connection and bidirectional read-write
48 --- vcmi-0.99/lib/serializer/Connection.cpp.orig        2016-11-01 19:26:09.000000000 +0100
49 +++ vcmi-0.99/lib/serializer/Connection.cpp     2019-05-10 15:40:32.325291811 +0200
50 @@ -5,9 +5,6 @@
51  #include "../mapping/CMap.h"
52  #include "../CGameState.h"
53  
54 -#if BOOST_VERSION >= 106600
55 -#define BOOST_ASIO_ENABLE_OLD_SERVICES
56 -#endif
57  #include <boost/asio.hpp>
58  
59  /*
60 @@ -120,7 +117,7 @@
61         throw std::runtime_error("Can't establish connection :(");
62  }
63  CConnection::CConnection(TSocket * Socket, std::string Name )
64 -       :iser(this), oser(this), socket(Socket),io_service(&Socket->get_io_service()), name(Name)//, send(this), rec(this)
65 +       :iser(this), oser(this), socket(Socket),io_service(&Socket->get_executor().context()), name(Name)//, send(this), rec(this)
66  {
67         init();
68  }
69 --- vcmi-0.99/lib/CBattleCallback.cpp.orig      2016-11-01 19:26:09.000000000 +0100
70 +++ vcmi-0.99/lib/CBattleCallback.cpp   2019-05-10 16:07:53.901237054 +0200
71 @@ -499,7 +499,7 @@
72         else if(defender->owner != battleGetOwner(defender))\r
73                 return true;//mind controlled unit is attackable for both sides\r
74         else\r
75 -               return (battleGetOwner(attacker) == battleGetOwner(defender)) == positivness;\r
76 +               return (battleGetOwner(attacker) == battleGetOwner(defender)) == bool(positivness);\r
77  }\r
78  \r
79  si8 CBattleInfoCallback::battleHasWallPenalty( const CStack * stack, BattleHex destHex ) const\r
80 @@ -1357,9 +1357,9 @@
81  \r
82         std::vector<DistStack> stackPairs;\r
83  \r
84 -       std::vector<const CStack *> possibleStacks = battleGetStacksIf([=](const CStack * s)\r
85 +       std::vector<const CStack *> possibleStacks = battleGetStacksIf([=](const CStack * s) -> bool\r
86         {\r
87 -               return s->isValidTarget(false) && s != closest && (boost::logic::indeterminate(attackerOwned) || s->attackerOwned == attackerOwned);\r
88 +               return s->isValidTarget(false) && s != closest && (boost::logic::indeterminate(attackerOwned) || s->attackerOwned == bool(attackerOwned));\r
89         });\r
90  \r
91         for(const CStack * st : possibleStacks)\r
92 --- vcmi-0.99/client/windows/CAdvmapInterface.cpp.orig  2016-11-01 19:26:09.000000000 +0100
93 +++ vcmi-0.99/client/windows/CAdvmapInterface.cpp       2019-05-10 16:27:02.158039352 +0200
94 @@ -781,7 +781,7 @@
95         if(boost::logic::indeterminate(hasPath))\r
96                 hasPath = LOCPLINT->paths[h].nodes.size() ? true : false;\r
97  \r
98 -       moveHero->block(!hasPath || (h->movement == 0));\r
99 +       moveHero->block(!bool(hasPath) || (h->movement == 0));\r
100  }\r
101  \r
102  void CAdvMapInt::updateSpellbook(const CGHeroInstance *h)\r
103 --- vcmi-0.99/server/CVCMIServer.h.orig 2019-05-09 18:28:47.786130450 +0200
104 +++ vcmi-0.99/server/CVCMIServer.h      2019-05-10 17:00:46.894142311 +0200
105 @@ -12,40 +12,19 @@
106   *\r
107   */\r
108  \r
109 +#include <boost/asio/basic_stream_socket.hpp>\r
110 +#include <boost/asio/basic_socket_acceptor.hpp>\r
111 +#include <boost/asio/io_service.hpp>\r
112 +#include <boost/asio/ip/tcp.hpp>\r
113 +\r
114  class CMapInfo;\r
115  \r
116  class CConnection;\r
117  struct CPackForSelectionScreen;\r
118  class CGameHandler;\r
119  \r
120 -namespace boost\r
121 -{\r
122 -       namespace asio\r
123 -       {\r
124 -               namespace ip\r
125 -               {\r
126 -                       class tcp;\r
127 -               }\r
128 -\r
129 -#if BOOST_VERSION >= 106600  // Boost version >= 1.66
130 -               class io_context;
131 -               typedef io_context io_service;
132 -#else
133 -               class io_service;
134 -#endif\r
135 -\r
136 -               template <typename Protocol> class stream_socket_service;\r
137 -               template <typename Protocol,typename StreamSocketService>\r
138 -               class basic_stream_socket;\r
139 -\r
140 -               template <typename Protocol> class socket_acceptor_service;\r
141 -               template <typename Protocol,typename SocketAcceptorService>\r
142 -               class basic_socket_acceptor;\r
143 -       }\r
144 -};\r
145 -\r
146 -typedef boost::asio::basic_socket_acceptor<boost::asio::ip::tcp, boost::asio::socket_acceptor_service<boost::asio::ip::tcp> > TAcceptor;\r
147 -typedef boost::asio::basic_stream_socket < boost::asio::ip::tcp , boost::asio::stream_socket_service<boost::asio::ip::tcp>  > TSocket;\r
148 +typedef boost::asio::basic_socket_acceptor<boost::asio::ip::tcp> TAcceptor;\r
149 +typedef boost::asio::basic_stream_socket<boost::asio::ip::tcp> TSocket;\r
150  \r
151  class CVCMIServer\r
152  {\r
153 --- vcmi-0.99/server/CVCMIServer.cpp.orig       2019-05-10 18:15:18.709042066 +0200
154 +++ vcmi-0.99/server/CVCMIServer.cpp    2019-05-10 18:17:35.062864054 +0200
155 @@ -1,8 +1,5 @@
156  #include "StdInc.h"\r
157  \r
158 -#if BOOST_VERSION >= 106600
159 -#define BOOST_ASIO_ENABLE_OLD_SERVICES
160 -#endif\r
161  #include <boost/asio.hpp>\r
162  \r
163  #include "../lib/filesystem/Filesystem.h"\r
164 @@ -168,8 +165,8 @@
165  \r
166                         if(acceptor)\r
167                         {\r
168 -                               acceptor->get_io_service().reset();\r
169 -                               acceptor->get_io_service().poll();\r
170 +                               static_cast<boost::asio::io_context&>(acceptor->get_executor().context()).reset();\r
171 +                               static_cast<boost::asio::io_context&>(acceptor->get_executor().context()).poll();\r
172                         }\r
173                 } //frees lock\r
174  \r
175 @@ -230,7 +227,7 @@
176         assert(!upcomingConnection);\r
177         assert(acceptor);\r
178  \r
179 -       upcomingConnection = new TSocket(acceptor->get_io_service());\r
180 +       upcomingConnection = new TSocket(acceptor->get_executor());\r
181         acceptor->async_accept(*upcomingConnection, std::bind(&CPregameServer::connectionAccepted, this, _1));\r
182  }\r
183  \r
184 @@ -415,7 +412,7 @@
185  \r
186         boost::system::error_code error;\r
187         logNetwork->info("Listening for connections at port %d", acceptor->local_endpoint().port());\r
188 -       auto s = new boost::asio::ip::tcp::socket(acceptor->get_io_service());\r
189 +       auto s = new boost::asio::ip::tcp::socket(acceptor->get_executor());\r
190         boost::thread acc(std::bind(vaccept,acceptor,s,&error));\r
191  #ifndef VCMI_ANDROID\r
192         sr->setToTrueAndNotify();\r
193 @@ -483,7 +480,7 @@
194                 }\r
195                 else\r
196                 {\r
197 -                       auto s = new boost::asio::ip::tcp::socket(acceptor->get_io_service());\r
198 +                       auto s = new boost::asio::ip::tcp::socket(acceptor->get_executor());\r
199                         acceptor->accept(*s,error);\r
200                         if(error) //retry\r
201                         {\r
202 --- vcmi-0.99/AI/VCAI/AIUtility.h.orig  2016-11-01 19:26:09.000000000 +0100
203 +++ vcmi-0.99/AI/VCAI/AIUtility.h       2019-05-10 17:37:38.490708060 +0200
204 @@ -167,5 +167,5 @@
205  public:\r
206         CDistanceSorter(const CGHeroInstance * hero): hero(hero) {}\r
207  \r
208 -       bool operator ()(const CGObjectInstance *lhs, const CGObjectInstance *rhs);\r
209 +       bool operator ()(const CGObjectInstance *lhs, const CGObjectInstance *rhs) const;\r
210  };\r
211 --- vcmi-0.99/AI/VCAI/AIUtility.cpp.orig        2016-11-01 19:26:09.000000000 +0100
212 +++ vcmi-0.99/AI/VCAI/AIUtility.cpp     2019-05-10 17:39:23.702884397 +0200
213 @@ -179,7 +179,7 @@
214         return oss.str();\r
215  }\r
216  \r
217 -bool CDistanceSorter::operator ()(const CGObjectInstance *lhs, const CGObjectInstance *rhs)\r
218 +bool CDistanceSorter::operator ()(const CGObjectInstance *lhs, const CGObjectInstance *rhs) const\r
219  {\r
220         const CGPathNode *ln = ai->myCb->getPathsInfo(hero)->getPathInfo(lhs->visitablePos()),\r
221                          *rn = ai->myCb->getPathsInfo(hero)->getPathInfo(rhs->visitablePos());\r
This page took 0.115668 seconds and 3 git commands to generate.