commit b1a5f90d5110984d9bf82f20020215de911d07e8
Author: Jan Rękorajski <bagg...@pld-linux.org>
Date:   Sat Oct 28 22:56:06 2023 +0200

    - up to 1.3.0

 boost-1.66.patch |  78 --------
 erm.patch        | 576 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 no-werror.patch  |  11 --
 vcmi-boost.patch | 221 ---------------------
 vcmi.spec        |  33 ++--
 5 files changed, 589 insertions(+), 330 deletions(-)
---
diff --git a/vcmi.spec b/vcmi.spec
index 0948ac9..f8623d7 100644
--- a/vcmi.spec
+++ b/vcmi.spec
@@ -1,17 +1,15 @@
 Summary:       "Heroes 3: WoG recreated
 Summary(pl.UTF-8):     Gra "Heroes 3: WoG" stworzona od nowa
 Name:          vcmi
-Version:       0.99
-Release:       8
+Version:       1.3.0
+Release:       1
 License:       GPL v2+
 Group:         X11/Applications/Games
 Source0:       
https://github.com/vcmi/vcmi/archive/%{version}/%{name}-%{version}.tar.gz
-# Source0-md5: 686c2a0283184add785d50b447db806f
+# Source0-md5: 6a657666e335bfde5f007b9542a08cfa
 Source1:       http://download.vcmi.eu/core.zip
 # Source1-md5: 5cf75d588cc53b93aceb809a6068ae37
-Patch0:                boost-1.66.patch
-Patch1:                %{name}-boost.patch
-Patch2:                no-werror.patch
+Patch0:                erm.patch
 URL:           http://www.vcmi.eu/
 BuildRequires: Qt5Network-devel >= 5
 BuildRequires: Qt5Widgets-devel >= 5
@@ -46,15 +44,13 @@ możliwościami.
 %prep
 %setup -q
 %patch0 -p1
-%patch1 -p1
-%patch2 -p1
 
 %build
 install -d build
 cd build
 %cmake .. \
-       -DENABLE_ERM=ON
-# -DENABLE_EDITOR=ON breaks build
+       -DENABLE_ERM=ON \
+       -DENABLE_EDITOR=ON
 
 %{__make}
 
@@ -67,14 +63,6 @@ install -d $RPM_BUILD_ROOT%{_datadir}/%{name} \
 %{__make} -C build install \
        DESTDIR=$RPM_BUILD_ROOT
 
-# not packaged
-%{__rm} -r $RPM_BUILD_ROOT{%{_libdir}/libfuzzylite-static.a,%{_includedir}/fl}
-
-install client/icons/vcmiclient.xpm 
$RPM_BUILD_ROOT%{_pixmapsdir}/vcmiclient.xpm
-install client/icons/vcmiclient.64x64.png 
$RPM_BUILD_ROOT%{_iconsdir}/hicolor/64x64/apps/vcmiclient.png
-install client/icons/vcmiclient.48x48.png 
$RPM_BUILD_ROOT%{_iconsdir}/hicolor/48x48/apps/vcmiclient.png
-install client/icons/vcmiclient.32x32.png 
$RPM_BUILD_ROOT%{_iconsdir}/hicolor/32x32/apps/vcmiclient.png
-
 %{__unzip} -o %{SOURCE1} -d $RPM_BUILD_ROOT%{_datadir}/%{name}
 
 %clean
@@ -82,9 +70,10 @@ rm -rf $RPM_BUILD_ROOT
 
 %files
 %defattr(644,root,root,755)
-%doc AUTHORS ChangeLog README.md
+%doc AUTHORS ChangeLog.md README.md
 %attr(755,root,root) %{_bindir}/vcmibuilder
 %attr(755,root,root) %{_bindir}/vcmiclient
+%attr(755,root,root) %{_bindir}/vcmieditor
 %attr(755,root,root) %{_bindir}/vcmilauncher
 %attr(755,root,root) %{_bindir}/vcmiserver
 %dir %{_libdir}/%{name}
@@ -93,8 +82,12 @@ rm -rf $RPM_BUILD_ROOT
 %attr(755,root,root) %{_libdir}/%{name}/AI/lib*.so
 %dir %{_libdir}/%{name}/scripting
 %attr(755,root,root) %{_libdir}/%{name}/scripting/libvcmiERM.so
+%attr(755,root,root) %{_libdir}/%{name}/scripting/libvcmiLua.so
 %{_datadir}/%{name}
 %{_desktopdir}/vcmiclient.desktop
+%{_desktopdir}/vcmieditor.desktop
 %{_desktopdir}/vcmilauncher.desktop
-%{_pixmapsdir}/vcmiclient.xpm
 %{_iconsdir}/hicolor/*x*/apps/vcmiclient.png
+%{_iconsdir}/hicolor/*x*/apps/vcmieditor.png
+%{_iconsdir}/hicolor/scalable/apps/vcmiclient.svg
+%{_datadir}/metainfo/eu.vcmi.VCMI.metainfo.xml
diff --git a/boost-1.66.patch b/boost-1.66.patch
deleted file mode 100644
index 0a6f70a..0000000
--- a/boost-1.66.patch
+++ /dev/null
@@ -1,78 +0,0 @@
-From 83c6ffbda0f373848e11b81f128647bfcaed024f Mon Sep 17 00:00:00 2001
-From: Raphnalor <37222713+raphna...@users.noreply.github.com>
-Date: Sun, 11 Mar 2018 16:02:20 +0300
-Subject: [PATCH] Reflect changes in boost::asio released in Boost 1.66. (#428)
-
-The service template parameters are disabled by default for now.
-Use BOOST_ASIO_ENABLE_OLD_SERVICES macro to enable the old interface.
----
- lib/serializer/Connection.cpp | 3 +++
- lib/serializer/Connection.h   | 6 ++++++
- server/CVCMIServer.cpp        | 3 +++
- server/CVCMIServer.h          | 8 +++++++-
- 4 files changed, 19 insertions(+), 1 deletion(-)
-
-diff --git a/lib/serializer/Connection.cpp b/lib/serializer/Connection.cpp
-index 0a842d1d3..ae1810e8b 100644
---- a/lib/serializer/Connection.cpp
-+++ b/lib/serializer/Connection.cpp
-@@ -14,6 +14,9 @@
- #include "../mapping/CMap.h"
- #include "../CGameState.h"
- 
-+#if BOOST_VERSION >= 106600
-+#define BOOST_ASIO_ENABLE_OLD_SERVICES
-+#endif
- #include <boost/asio.hpp>
- 
- /*
-diff --git a/lib/serializer/Connection.h b/lib/serializer/Connection.h
-index b6ceee7a0..cb134e2b6 100644
---- a/lib/serializer/Connection.h
-+++ b/lib/serializer/Connection.h
-@@ -22,7 +22,13 @@ namespace boost
-               {
-                       class tcp;
-               }
-+
-+#if BOOST_VERSION >= 106600  // Boost version >= 1.66
-+              class io_context;
-+              typedef io_context io_service;
-+#else
-               class io_service;
-+#endif
- 
-               template <typename Protocol> class stream_socket_service;
-               template <typename Protocol,typename StreamSocketService>
-diff --git a/server/CVCMIServer.cpp b/server/CVCMIServer.cpp
-index b077607be..d459a8e95 100644
---- a/server/CVCMIServer.cpp
-+++ b/server/CVCMIServer.cpp
-@@ -9,5 +9,8 @@
- #include "StdInc.h"
- 
-+#if BOOST_VERSION >= 106600
-+#define BOOST_ASIO_ENABLE_OLD_SERVICES
-+#endif
- #include <boost/asio.hpp>
- 
- #include "../lib/filesystem/Filesystem.h"
-diff --git a/server/CVCMIServer.h b/server/CVCMIServer.h
-index 6fa7ad5bb..ad9951f64 100644
---- a/server/CVCMIServer.h
-+++ b/server/CVCMIServer.h
-@@ -26,7 +26,13 @@ namespace boost
-               {
-                       class tcp;
-               }
--              class io_service;
-+
-+#if BOOST_VERSION >= 106600  // Boost version >= 1.66
-+              class io_context;
-+              typedef io_context io_service;
-+#else
-+              class io_service;
-+#endif
- 
-               template <typename Protocol> class stream_socket_service;
-               template <typename Protocol,typename StreamSocketService>
diff --git a/erm.patch b/erm.patch
new file mode 100644
index 0000000..5751cc2
--- /dev/null
+++ b/erm.patch
@@ -0,0 +1,576 @@
+From 6225d8585d215569c4a919171bea1915c306d1c8 Mon Sep 17 00:00:00 2001
+From: Andreas Grois <a...@grois.info>
+Date: Mon, 25 Sep 2023 21:26:23 +0200
+Subject: [PATCH] Make ERM compile again.
+
+This is not a proper clean up. It does not bring the code up to the
+current state of the rest of the codebase. However, the module now
+compiles again.
+---
+ scripting/erm/ERMInterpreter.cpp | 279 +++++++++++++++++--------------
+ scripting/erm/ERMInterpreter.h   |  13 +-
+ scripting/erm/ERMParser.h        |   1 +
+ 3 files changed, 151 insertions(+), 142 deletions(-)
+
+diff --git a/scripting/erm/ERMInterpreter.cpp 
b/scripting/erm/ERMInterpreter.cpp
+index 663cb35722..e4f60105ab 100644
+--- a/scripting/erm/ERMInterpreter.cpp
++++ b/scripting/erm/ERMInterpreter.cpp
+@@ -163,7 +163,7 @@ namespace ERMConverter
+               Variable operator()(const TVarExpNotMacro & val) const
+               {
+                       if(val.val.has_value())
+-                              return Variable(val.varsym, val.val.get());
++                              return Variable(val.varsym, *val.val);
+                       else
+                               return Variable(val.varsym, 0);
+               }
+@@ -392,7 +392,7 @@ namespace ERMConverter
+ 
+                       if(trig.params.has_value())
+                       {
+-                              for(auto & p : trig.params.get())
++                              for(auto & p : *trig.params)
+                                       
optionParams.push_back(std::visit(BodyOption(), p));
+                       }
+ 
+@@ -572,7 +572,7 @@ namespace ERMConverter
+                               {
+                                       if(option.params.has_value())
+                                       {
+-                                              for(auto & p : 
option.params.get())
++                                              for(auto & p : *option.params)
+                                               {
+                                                       std::string macroName = 
std::visit(MC_S(), p);
+ 
+@@ -739,7 +739,7 @@ namespace ERMConverter
+ 
+                                       if(trig.params.has_value())
+                                       {
+-                                              for(auto & p : 
trig.params.get())
++                                              for(auto & p : *trig.params)
+                                                       
optionParams.push_back(std::visit(BodyOption(), p));
+                                       }
+ 
+@@ -759,10 +759,10 @@ namespace ERMConverter
+                               break;
+                       case 'H': //checking if string is empty
+                               {
+-                                      if(!trig.params.has_value() || 
trig.params.get().size() != 1)
++                                      if(!trig.params.has_value() || 
trig.params->size() != 1)
+                                               throw EScriptExecError("VR:H 
option takes exactly 1 parameter!");
+ 
+-                                      std::string opt = std::visit(VR_H(), 
trig.params.get()[0]);
++                                      std::string opt = std::visit(VR_H(), 
(*trig.params)[0]);
+                                       boost::format fmt("ERM.VR(%s):H(%s)");
+                                       fmt % v.str() % opt;
+                                       putLine(fmt.str());
+@@ -770,10 +770,10 @@ namespace ERMConverter
+                               break;
+                       case 'U':
+                               {
+-                                      if(!trig.params.has_value() || 
trig.params.get().size() != 1)
++                                      if(!trig.params.has_value() || 
trig.params->size() != 1)
+                                               throw EScriptExecError("VR:H/U 
need 1 parameter!");
+ 
+-                                      std::string opt = std::visit(VR_S(), 
trig.params.get()[0]);
++                                      std::string opt = std::visit(VR_S(), 
(*trig.params)[0]);
+                                       boost::format fmt("ERM.VR(%s):%c(%s)");
+                                       fmt % v.str() % (trig.optionCode) % opt;
+                                       putLine(fmt.str());
+@@ -781,10 +781,10 @@ namespace ERMConverter
+                               break;
+                       case 'M': //string operations
+                               {
+-                                      if(!trig.params.has_value() || 
trig.params.get().size() < 2)
++                                      if(!trig.params.has_value() || 
trig.params->size() < 2)
+                                               throw EScriptExecError("VR:M 
needs at least 2 parameters!");
+ 
+-                                      std::string opt = std::visit(VR_X(), 
trig.params.get()[0]);
++                                      std::string opt = std::visit(VR_X(), 
(*trig.params)[0]);
+                                       int paramIndex = 1;
+ 
+                                       if(opt == "3")
+@@ -795,16 +795,16 @@ namespace ERMConverter
+                                       }
+                                       else
+                                       {
+-                                              auto target = 
std::visit(VR_X(), trig.params.get()[paramIndex++]);
++                                              auto target = 
std::visit(VR_X(), (*trig.params)[paramIndex++]);
+ 
+                                               boost::format fmt("%s = 
ERM.VR(%s):M%s(");
+                                               fmt % target % v.str() % opt;
+                                               put(fmt.str());
+                                       }
+                                       
+-                                      for(int i = paramIndex; i < 
trig.params.get().size(); i++)
++                                      for(int i = paramIndex; i < 
trig.params->size(); i++)
+                                       {
+-                                              opt = std::visit(VR_X(), 
trig.params.get()[i]);
++                                              opt = std::visit(VR_X(), 
(*trig.params)[i]);
+                                               if(i > paramIndex) put(",");
+                                               put(opt);
+                                       }
+@@ -814,10 +814,10 @@ namespace ERMConverter
+                               break;
+                       case 'X': //bit xor
+                               {
+-                                      if(!trig.params.has_value() || 
trig.params.get().size() != 1)
++                                      if(!trig.params.has_value() || 
trig.params->size() != 1)
+                                               throw EScriptExecError("VR:X 
option takes exactly 1 parameter!");
+ 
+-                                      std::string opt = std::visit(VR_X(), 
trig.params.get()[0]);
++                                      std::string opt = std::visit(VR_X(), 
(*trig.params)[0]);
+ 
+                                       boost::format fmt("%s = bit.bxor(%s, 
%s)");
+                                       fmt % v.str() % v.str() % 
opt;putLine(fmt.str());
+@@ -831,10 +831,10 @@ namespace ERMConverter
+                               break;
+                       case 'S': //setting variable
+                               {
+-                                      if(!trig.params.has_value() || 
trig.params.get().size() != 1)
++                                      if(!trig.params.has_value() || 
trig.params->size() != 1)
+                                               throw EScriptExecError("VR:S 
option takes exactly 1 parameter!");
+ 
+-                                      std::string opt = std::visit(VR_S(), 
trig.params.get()[0]);
++                                      std::string opt = std::visit(VR_S(), 
(*trig.params)[0]);
+                                       put(v.str());
+                                       put(" = ");
+                                       put(opt);
+@@ -849,10 +849,10 @@ namespace ERMConverter
+                               break;
+                       case 'V': //convert string to value
+                               {
+-                                      if(!trig.params.has_value() || 
trig.params.get().size() != 1)
++                                      if(!trig.params.has_value() || 
trig.params->size() != 1)
+                                               throw EScriptExecError("VR:V 
option takes exactly 1 parameter!");
+ 
+-                                      std::string opt = std::visit(VR_X(), 
trig.params.get()[0]);
++                                      std::string opt = std::visit(VR_X(), 
(*trig.params)[0]);
+                                       boost::format fmt("%s = tostring(%s)");
+                                       fmt % v.str() % opt;
+                                       putLine(fmt.str());
+@@ -877,7 +877,7 @@ namespace ERMConverter
+               {
+                       if(body.has_value())
+                       {
+-                              const ERM::Tbody & bo = body.get();
++                              const ERM::Tbody & bo = *body;
+                               for(int g=0; g<bo.size(); ++g)
+                               {
+                                       std::visit(visitor, bo[g]);
+@@ -975,7 +975,7 @@ namespace ERMConverter
+ 
+                               if(body.has_value())
+                               {
+-                                      const ERM::Tbody & bo = body.get();
++                                      const ERM::Tbody & bo = *body;
+                                       if(bo.size() == 1)
+                                       {
+                                               boost::format fmt("ERM.%s(%s)");
+@@ -983,7 +983,7 @@ namespace ERMConverter
+                                               fmt % params;
+ 
+                                               GenericReceiver gr(out, 
fmt.str(), (name == "DO"));
+-                                              bo[0].apply_visitor(gr);
++                                              std::visit(gr,bo[0]);
+                                       }
+                                       else
+                                       {
+@@ -1044,7 +1044,7 @@ namespace ERMConverter
+                                       break;
+                               }
+ 
+-                              convertConditionInner(cond.rhs.get().get(), op);
++                              convertConditionInner(cond.rhs->get(), op);
+                       }
+               }
+ 
+@@ -1067,7 +1067,7 @@ namespace ERMConverter
+                                       break;
+                               }
+ 
+-                              convertConditionInner(cond.rhs.get().get(), 
cond.ctype);
++                              convertConditionInner(cond.rhs->get(), 
cond.ctype);
+                       }
+ 
+                       putLine(" then ");
+@@ -1081,7 +1081,7 @@ namespace ERMConverter
+                       if(name=="if")
+                       {
+                               if(condition.has_value())
+-                                      convertCondition(condition.get());
++                                      convertCondition(*condition);
+                               else
+                                       putLine("if true then");
+                       }
+@@ -1097,7 +1097,7 @@ namespace ERMConverter
+                       {
+                               if(condition.has_value())
+                               {
+-                                      convertCondition(condition.get());
++                                      convertCondition(*condition);
+                                       convert(name, identifier, body);
+                                       putLine("end");
+                               }
+@@ -1181,7 +1181,7 @@ namespace ERMConverter
+               {
+                       (*out) << "{}";
+               }
+-              void operator()(const VNode & opt) const;
++              void operator()(const boost::recursive_wrapper<VNode> & opt) 
const;
+ 
+               void operator()(const VSymbol & opt) const 
+               {
+@@ -1192,7 +1192,7 @@ namespace ERMConverter
+                       TLiteralEval tmp;
+                       (*out) << std::visit(tmp, opt);
+               }
+-              void operator()(ERM const ::Tcommand & opt) const
++              void operator()(const ERM::Tcommand & opt) const
+               {
+                       //this is how FP works, evaluation == producing side 
effects
+                       //TODO: can we evaluate to smth more useful?
+@@ -1202,9 +1202,9 @@ namespace ERMConverter
+               }
+       };
+ 
+-      void VOptionEval::operator()(const VNode & opt) const
++      void VOptionEval::operator()(const boost::recursive_wrapper<VNode> & 
opt) const
+       {
+-              VNode tmpn(opt);
++              VNode tmpn(opt.get());
+ 
+               (*out) << "{";
+ 
+@@ -1375,35 +1375,35 @@ struct ScriptScanner
+       }
+       void operator()(const TERMline & cmd) const
+       {
+-              if(cmd.which() == 0) //TCommand
++              if(std::holds_alternative<Tcommand>(cmd)) //TCommand
+               {
+                       Tcommand tcmd = std::get<Tcommand>(cmd);
+-                      switch (tcmd.cmd.which())
++                      struct Visitor
+                       {
+-                      case 0: //trigger
++                              void operator()(const ERM::Ttrigger& t) const
+                               {
+                                       Trigger trig;
+-                                      trig.line = lp;
+-                                      interpreter->triggers[ 
TriggerType(std::get<ERM::Ttrigger>(tcmd.cmd).name) ].push_back(trig);
++                                      trig.line = l;
++                                      i->triggers[ TriggerType(t.name) 
].push_back(trig);
+                               }
+-                              break;
+-                      case 1: //instruction
++                              void operator()(const ERM::Tinstruction&) const
+                               {
+-                                      interpreter->instructions.push_back(lp);
++                                      i->instructions.push_back(l);
+                               }
+-                              break;
+-                      case 3: //post trigger
++                              void operator()(const ERM::Treceiver&) const {}
++                              void operator()(const ERM::TPostTrigger& pt) 
const
+                               {
+                                       Trigger trig;
+-                                      trig.line = lp;
+-                                      interpreter->postTriggers[ 
TriggerType(std::get<ERM::TPostTrigger>(tcmd.cmd).name) ].push_back(trig);
++                                      trig.line = l;
++                                      i->postTriggers[ TriggerType(pt.name) 
].push_back(trig);
+                               }
+-                              break;
+-                      default:
+-                              break;
+-                      }
+-              }
++                              const decltype(interpreter)& i;
++                              const LinePointer& l;
++                      };
+ 
++                      Visitor v{interpreter, lp};
++                      std::visit(v, tcmd.cmd);
++              }
+       }
+ };
+ 
+@@ -1421,68 +1421,85 @@ ERMInterpreter::~ERMInterpreter()
+ 
+ bool ERMInterpreter::isATrigger( const ERM::TLine & line )
+ {
+-      switch(line.which())
++      if(std::holds_alternative<ERM::TVExp>(line))
+       {
+-      case 0: //v-exp
+-              {
+-                      TVExp vexp = std::get<TVExp>(line);
+-                      if(vexp.children.empty())
+-                              return false;
++              TVExp vexp = std::get<TVExp>(line);
++              if(vexp.children.empty())
++                      return false;
+ 
+-                      switch (getExpType(vexp.children[0]))
+-                      {
+-                      case SYMBOL:
+-                              return false;
+-                              break;
+-                      case TCMD:
+-                              return isCMDATrigger( 
std::get<ERM::Tcommand>(vexp.children[0]) );
+-                              break;
+-                      default:
+-                              return false;
+-                              break;
+-                      }
+-              }
+-              break;
+-      case 1: //erm
++              switch (getExpType(vexp.children[0]))
+               {
+-                      TERMline ermline = std::get<TERMline>(line);
+-                      switch(ermline.which())
+-                      {
+-                      case 0: //tcmd
+-                              return isCMDATrigger( 
std::get<ERM::Tcommand>(ermline) );
+-                              break;
+-                      default:
+-                              return false;
+-                              break;
+-                      }
++              case SYMBOL:
++                      return false;
++                      break;
++              case TCMD:
++                      return isCMDATrigger( 
std::get<ERM::Tcommand>(vexp.children[0]) );
++                      break;
++              default:
++                      return false;
++                      break;
+               }
+-              break;
+-      default:
+-              assert(0); //it should never happen
+-              break;
+       }
+-      assert(0);
++      else if(std::holds_alternative<TERMline>(line))
++      {
++              TERMline ermline = std::get<TERMline>(line);
++              return std::holds_alternative<ERM::Tcommand>(ermline) && 
isCMDATrigger( std::get<ERM::Tcommand>(ermline) );
++      }
++      else
++      {
++              assert(0);
++      }
+       return false;
+ }
+ 
+ ERM::EVOtions ERMInterpreter::getExpType(const ERM::TVOption & opt)
+ {
+-      //MAINTENANCE: keep it correct!
+-      return static_cast<ERM::EVOtions>(opt.which());
++      struct Visitor
++      {
++              ERM::EVOtions operator()(const 
boost::recursive_wrapper<ERM::TVExp>&) const
++              {
++                      return ERM::EVOtions::VEXP;
++              }
++              ERM::EVOtions operator()(const ERM::TSymbol&) const
++              {
++                      return ERM::EVOtions::SYMBOL;
++              }
++              ERM::EVOtions operator()(char) const
++              {
++                      return ERM::EVOtions::CHAR;
++              }
++              ERM::EVOtions operator()(double) const
++              {
++                      return ERM::EVOtions::DOUBLE;
++              }
++              ERM::EVOtions operator()(int) const
++              {
++                      return ERM::EVOtions::INT;
++              }
++              ERM::EVOtions operator()(const ERM::Tcommand&) const
++              {
++                      return ERM::EVOtions::TCMD;
++              }
++              ERM::EVOtions operator()(const ERM::TStringConstant&) const
++              {
++                      return ERM::EVOtions::STRINGC;
++              }
++      };
++      const Visitor v;
++      return std::visit(v, opt);
+ }
+ 
+ bool ERMInterpreter::isCMDATrigger(const ERM::Tcommand & cmd)
+ {
+-      switch (cmd.cmd.which())
++      struct Visitor
+       {
+-      case 0: //trigger
+-      case 3: //post trigger
+-              return true;
+-              break;
+-      default:
+-              return false;
+-              break;
+-      }
++              bool operator()(const ERM::Ttrigger&) const     { return true; }
++              bool operator()(const ERM::TPostTrigger&) const { return true; }
++              bool operator()(const ERM::Tinstruction&) const { return false; 
}
++              bool operator()(const ERM::Treceiver&) const    { return false; 
}
++      };
++      const Visitor v;
++      return std::visit(v, cmd.cmd);
+ }
+ 
+ ERM::TLine & ERMInterpreter::retrieveLine(const LinePointer & linePtr)
+@@ -1492,17 +1509,17 @@ ERM::TLine & ERMInterpreter::retrieveLine(const 
LinePointer & linePtr)
+ 
+ ERM::TTriggerBase & ERMInterpreter::retrieveTrigger(ERM::TLine & line)
+ {
+-      if(line.which() == 1)
++      if(std::holds_alternative<ERM::TERMline>(line))
+       {
+               ERM::TERMline &tl = std::get<ERM::TERMline>(line);
+-              if(tl.which() == 0)
++              if(std::holds_alternative<ERM::Tcommand>(tl))
+               {
+                       ERM::Tcommand &tcm = std::get<ERM::Tcommand>(tl);
+-                      if(tcm.cmd.which() == 0)
++                      if(std::holds_alternative<ERM::Ttrigger>(tcm.cmd))
+                       {
+                               return std::get<ERM::Ttrigger>(tcm.cmd);
+                       }
+-                      else if(tcm.cmd.which() == 3)
++                      else 
if(std::holds_alternative<ERM::TPostTrigger>(tcm.cmd))
+                       {
+                               return std::get<ERM::TPostTrigger>(tcm.cmd);
+                       }
+@@ -1569,6 +1586,40 @@ namespace VERMInterpreter
+ {
+       VOption convertToVOption(const ERM::TVOption & tvo)
+       {
++              struct OptionConverterVisitor
++              {
++                      VOption operator()(const 
boost::recursive_wrapper<ERM::TVExp>& cmd) const
++                      { 
++                              return 
boost::recursive_wrapper<VNode>(VNode(cmd.get()));
++                      }
++                      VOption operator()(const ERM::TSymbol & cmd) const
++                      {
++                              if(cmd.symModifier.empty())
++                                      return VSymbol(cmd.sym);
++                              else
++                                      return 
boost::recursive_wrapper<VNode>(VNode(cmd));
++                      }
++                      VOption operator()(const char & cmd) const 
++                      {
++                              return TLiteral(cmd);
++                      }
++                      VOption operator()(const double & cmd) const
++                      {
++                              return TLiteral(cmd);
++                      }
++                      VOption operator()(const int & cmd) const
++                      {
++                              return TLiteral(cmd);
++                      }
++                      VOption operator()(const ERM::Tcommand & cmd) const
++                      {
++                              return cmd;
++                      }
++                      VOption operator()(const ERM::TStringConstant & cmd) 
const
++                      {
++                              return TLiteral(cmd.str);
++                      }
++              };
+               return std::visit(OptionConverterVisitor(), tvo);
+       }
+ 
+@@ -1706,38 +1757,6 @@ namespace VERMInterpreter
+               return ret;
+       }
+ 
+-      VOption OptionConverterVisitor::operator()(ERM const ::TVExp & cmd) 
const
+-      {
+-              return VNode(cmd);
+-      }
+-      VOption OptionConverterVisitor::operator()(ERM const ::TSymbol & cmd) 
const
+-      {
+-              if(cmd.symModifier.empty())
+-                      return VSymbol(cmd.sym);
+-              else
+-                      return VNode(cmd);
+-      }
+-      VOption OptionConverterVisitor::operator()(const char & cmd) const
+-      {
+-              return TLiteral(cmd);
+-      }
+-      VOption OptionConverterVisitor::operator()(const double & cmd) const
+-      {
+-              return TLiteral(cmd);
+-      }
+-      VOption OptionConverterVisitor::operator()(const int & cmd) const
+-      {
+-              return TLiteral(cmd);
+-      }
+-      VOption OptionConverterVisitor::operator()(ERM const ::Tcommand & cmd) 
const
+-      {
+-              return cmd;
+-      }
+-      VOption OptionConverterVisitor::operator()(ERM const ::TStringConstant 
& cmd) const
+-      {
+-              return TLiteral(cmd.str);
+-      }
+-
+       VermTreeIterator VOptionList::cdr()
+       {
+               VermTreeIterator ret(*this);
+diff --git a/scripting/erm/ERMInterpreter.h b/scripting/erm/ERMInterpreter.h
+index baf3d317ee..ed25509777 100644
+--- a/scripting/erm/ERMInterpreter.h
++++ b/scripting/erm/ERMInterpreter.h
+@@ -134,7 +134,7 @@ namespace VERMInterpreter
+                               "TH", "TM"
+                       };
+ 
+-                      for(int i=0; i<ARRAY_COUNT(validTriggers); ++i)
++                      for(int i=0; i<std::size(validTriggers); ++i)
+                       {
+                               if(validTriggers[i] == trig)
+                                       return static_cast<ETrigType>(i);
+@@ -278,17 +278,6 @@ namespace VERMInterpreter
+               VermTreeIterator cdr();
+       };
+ 
+-      struct OptionConverterVisitor
+-      {
+-              VOption operator()(ERM const ::TVExp & cmd) const;
+-              VOption operator()(ERM const ::TSymbol & cmd) const;
+-              VOption operator()(const char & cmd) const;
+-              VOption operator()(const double & cmd) const;
+-              VOption operator()(const int & cmd) const;
+-              VOption operator()(ERM const ::Tcommand & cmd) const;
+-              VOption operator()(ERM const ::TStringConstant & cmd) const;
+-      };
+-
+       struct VNode
+       {
+       private:
+diff --git a/scripting/erm/ERMParser.h b/scripting/erm/ERMParser.h
+index 29d92e61b6..95b2ccbbf3 100644
+--- a/scripting/erm/ERMParser.h
++++ b/scripting/erm/ERMParser.h
+@@ -10,6 +10,7 @@
+ #pragma once
+ 
+ #include <boost/spirit/home/support/unused.hpp>
++#include <boost/variant/recursive_wrapper.hpp>
+ 
+ namespace spirit = boost::spirit;
+ 
diff --git a/no-werror.patch b/no-werror.patch
deleted file mode 100644
index f49fdcf..0000000
--- a/no-werror.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- vcmi-0.99/AI/FuzzyLite/fuzzylite/CMakeLists.txt.orig       2016-11-01 
19:26:09.000000000 +0100
-+++ vcmi-0.99/AI/FuzzyLite/fuzzylite/CMakeLists.txt    2023-02-22 
21:08:48.008335296 +0100
-@@ -62,7 +62,7 @@
- set(CMAKE_RUNTIME_OUTPUT_DIRECTORY bin)
- 
- if(NOT MSVC)
--    set(CMAKE_CXX_FLAGS "-pedantic -Werror -Wall -Wextra ${CMAKE_CXX_FLAGS}")
-+    set(CMAKE_CXX_FLAGS "-pedantic -Wall -Wextra ${CMAKE_CXX_FLAGS}")
-     set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
-     set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
- 
diff --git a/vcmi-boost.patch b/vcmi-boost.patch
deleted file mode 100644
index 765b44a..0000000
--- a/vcmi-boost.patch
+++ /dev/null
@@ -1,221 +0,0 @@
---- vcmi-0.99/lib/serializer/Connection.h.orig 2019-05-09 18:28:47.786130450 
+0200
-+++ vcmi-0.99/lib/serializer/Connection.h      2019-05-09 20:37:32.790815761 
+0200
-@@ -14,37 +14,20 @@
- #include "BinaryDeserializer.h"
- #include "BinarySerializer.h"
- 
-+#include <boost/asio/basic_stream_socket.hpp>
-+#include <boost/asio/basic_socket_acceptor.hpp>
-+#include <boost/asio/io_service.hpp>
-+#include <boost/asio/ip/tcp.hpp>
-+
- struct CPack;
- 
- namespace boost
- {
--      namespace asio
--      {
--              namespace ip
--              {
--                      class tcp;
--              }
--
--#if BOOST_VERSION >= 106600  // Boost version >= 1.66
--              class io_context;
--              typedef io_context io_service;
--#else
--              class io_service;
--#endif
--
--              template <typename Protocol> class stream_socket_service;
--              template <typename Protocol,typename StreamSocketService>
--              class basic_stream_socket;
--
--              template <typename Protocol> class socket_acceptor_service;
--              template <typename Protocol,typename SocketAcceptorService>
--              class basic_socket_acceptor;
--      }
-       class mutex;
- }
- 
--typedef boost::asio::basic_stream_socket < boost::asio::ip::tcp , 
boost::asio::stream_socket_service<boost::asio::ip::tcp>  > TSocket;
--typedef boost::asio::basic_socket_acceptor<boost::asio::ip::tcp, 
boost::asio::socket_acceptor_service<boost::asio::ip::tcp> > TAcceptor;
-+typedef boost::asio::basic_stream_socket<boost::asio::ip::tcp> TSocket;
-+typedef boost::asio::basic_socket_acceptor<boost::asio::ip::tcp> TAcceptor;
- 
- /// Main class for network communication
- /// Allows establishing connection and bidirectional read-write
---- vcmi-0.99/lib/serializer/Connection.cpp.orig       2016-11-01 
19:26:09.000000000 +0100
-+++ vcmi-0.99/lib/serializer/Connection.cpp    2019-05-10 15:40:32.325291811 
+0200
-@@ -5,9 +5,6 @@
- #include "../mapping/CMap.h"
- #include "../CGameState.h"
- 
--#if BOOST_VERSION >= 106600
--#define BOOST_ASIO_ENABLE_OLD_SERVICES
--#endif
- #include <boost/asio.hpp>
- 
- /*
-@@ -120,7 +117,7 @@
-       throw std::runtime_error("Can't establish connection :(");
- }
- CConnection::CConnection(TSocket * Socket, std::string Name )
--      :iser(this), oser(this), 
socket(Socket),io_service(&Socket->get_io_service()), name(Name)//, send(this), 
rec(this)
-+      :iser(this), oser(this), 
socket(Socket),io_service(&Socket->get_executor().context()), name(Name)//, 
send(this), rec(this)
- {
-       init();
- }
---- vcmi-0.99/lib/CBattleCallback.cpp.orig     2016-11-01 19:26:09.000000000 
+0100
-+++ vcmi-0.99/lib/CBattleCallback.cpp  2019-05-10 16:07:53.901237054 +0200
-@@ -499,7 +499,7 @@
-       else if(defender->owner != battleGetOwner(defender))
-               return true;//mind controlled unit is attackable for both sides
-       else
--              return (battleGetOwner(attacker) == battleGetOwner(defender)) 
== positivness;
-+              return (battleGetOwner(attacker) == battleGetOwner(defender)) 
== bool(positivness);
- }
- 
- si8 CBattleInfoCallback::battleHasWallPenalty( const CStack * stack, 
BattleHex destHex ) const
-@@ -1357,9 +1357,9 @@
- 
-       std::vector<DistStack> stackPairs;
- 
--      std::vector<const CStack *> possibleStacks = 
battleGetStacksIf([=](const CStack * s)
-+      std::vector<const CStack *> possibleStacks = 
battleGetStacksIf([=](const CStack * s) -> bool
-       {
--              return s->isValidTarget(false) && s != closest && 
(boost::logic::indeterminate(attackerOwned) || s->attackerOwned == 
attackerOwned);
-+              return s->isValidTarget(false) && s != closest && 
(boost::logic::indeterminate(attackerOwned) || s->attackerOwned == 
bool(attackerOwned));
-       });
- 
-       for(const CStack * st : possibleStacks)
---- vcmi-0.99/client/windows/CAdvmapInterface.cpp.orig 2016-11-01 
19:26:09.000000000 +0100
-+++ vcmi-0.99/client/windows/CAdvmapInterface.cpp      2019-05-10 
16:27:02.158039352 +0200
-@@ -781,7 +781,7 @@
-       if(boost::logic::indeterminate(hasPath))
-               hasPath = LOCPLINT->paths[h].nodes.size() ? true : false;
- 
--      moveHero->block(!hasPath || (h->movement == 0));
-+      moveHero->block(!bool(hasPath) || (h->movement == 0));
- }
- 
- void CAdvMapInt::updateSpellbook(const CGHeroInstance *h)
---- vcmi-0.99/server/CVCMIServer.h.orig        2019-05-09 18:28:47.786130450 
+0200
-+++ vcmi-0.99/server/CVCMIServer.h     2019-05-10 17:00:46.894142311 +0200
-@@ -12,40 +12,19 @@
-  *
-  */
- 
-+#include <boost/asio/basic_stream_socket.hpp>
-+#include <boost/asio/basic_socket_acceptor.hpp>
-+#include <boost/asio/io_service.hpp>
-+#include <boost/asio/ip/tcp.hpp>
-+
- class CMapInfo;
- 
- class CConnection;
- struct CPackForSelectionScreen;
- class CGameHandler;
- 
--namespace boost
--{
--      namespace asio
--      {
--              namespace ip
--              {
--                      class tcp;
--              }
--
--#if BOOST_VERSION >= 106600  // Boost version >= 1.66
--              class io_context;
--              typedef io_context io_service;
--#else
--              class io_service;
--#endif
--
--              template <typename Protocol> class stream_socket_service;
--              template <typename Protocol,typename StreamSocketService>
--              class basic_stream_socket;
--
--              template <typename Protocol> class socket_acceptor_service;
--              template <typename Protocol,typename SocketAcceptorService>
--              class basic_socket_acceptor;
--      }
--};
--
--typedef boost::asio::basic_socket_acceptor<boost::asio::ip::tcp, 
boost::asio::socket_acceptor_service<boost::asio::ip::tcp> > TAcceptor;
--typedef boost::asio::basic_stream_socket < boost::asio::ip::tcp , 
boost::asio::stream_socket_service<boost::asio::ip::tcp>  > TSocket;
-+typedef boost::asio::basic_socket_acceptor<boost::asio::ip::tcp> TAcceptor;
-+typedef boost::asio::basic_stream_socket<boost::asio::ip::tcp> TSocket;
- 
- class CVCMIServer
- {
---- vcmi-0.99/server/CVCMIServer.cpp.orig      2019-05-10 18:15:18.709042066 
+0200
-+++ vcmi-0.99/server/CVCMIServer.cpp   2019-05-10 18:17:35.062864054 +0200
-@@ -1,8 +1,5 @@
- #include "StdInc.h"
- 
--#if BOOST_VERSION >= 106600
--#define BOOST_ASIO_ENABLE_OLD_SERVICES
--#endif
- #include <boost/asio.hpp>
- 
- #include "../lib/filesystem/Filesystem.h"
-@@ -168,8 +165,8 @@
- 
-                       if(acceptor)
-                       {
--                              acceptor->get_io_service().reset();
--                              acceptor->get_io_service().poll();
-+                              
static_cast<boost::asio::io_context&>(acceptor->get_executor().context()).reset();
-+                              
static_cast<boost::asio::io_context&>(acceptor->get_executor().context()).poll();
-                       }
-               } //frees lock
- 
-@@ -230,7 +227,7 @@
-       assert(!upcomingConnection);
-       assert(acceptor);
- 
--      upcomingConnection = new TSocket(acceptor->get_io_service());
-+      upcomingConnection = new TSocket(acceptor->get_executor());
-       acceptor->async_accept(*upcomingConnection, 
std::bind(&CPregameServer::connectionAccepted, this, _1));
- }
- 
-@@ -415,7 +412,7 @@
- 
-       boost::system::error_code error;
-       logNetwork->info("Listening for connections at port %d", 
acceptor->local_endpoint().port());
--      auto s = new boost::asio::ip::tcp::socket(acceptor->get_io_service());
-+      auto s = new boost::asio::ip::tcp::socket(acceptor->get_executor());
-       boost::thread acc(std::bind(vaccept,acceptor,s,&error));
- #ifndef VCMI_ANDROID
-       sr->setToTrueAndNotify();
-@@ -483,7 +480,7 @@
-               }
-               else
-               {
--                      auto s = new 
boost::asio::ip::tcp::socket(acceptor->get_io_service());
-+                      auto s = new 
boost::asio::ip::tcp::socket(acceptor->get_executor());
-                       acceptor->accept(*s,error);
-                       if(error) //retry
-                       {
---- vcmi-0.99/AI/VCAI/AIUtility.h.orig 2016-11-01 19:26:09.000000000 +0100
-+++ vcmi-0.99/AI/VCAI/AIUtility.h      2019-05-10 17:37:38.490708060 +0200
-@@ -167,5 +167,5 @@
- public:
-       CDistanceSorter(const CGHeroInstance * hero): hero(hero) {}
- 
--      bool operator ()(const CGObjectInstance *lhs, const CGObjectInstance 
*rhs);
-+      bool operator ()(const CGObjectInstance *lhs, const CGObjectInstance 
*rhs) const;
- };
---- vcmi-0.99/AI/VCAI/AIUtility.cpp.orig       2016-11-01 19:26:09.000000000 
+0100
-+++ vcmi-0.99/AI/VCAI/AIUtility.cpp    2019-05-10 17:39:23.702884397 +0200
-@@ -179,7 +179,7 @@
-       return oss.str();
- }
- 
--bool CDistanceSorter::operator ()(const CGObjectInstance *lhs, const 
CGObjectInstance *rhs)
-+bool CDistanceSorter::operator ()(const CGObjectInstance *lhs, const 
CGObjectInstance *rhs) const
- {
-       const CGPathNode *ln = 
ai->myCb->getPathsInfo(hero)->getPathInfo(lhs->visitablePos()),
-                        *rn = 
ai->myCb->getPathsInfo(hero)->getPathInfo(rhs->visitablePos());
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/vcmi.git/commitdiff/b1a5f90d5110984d9bf82f20020215de911d07e8

_______________________________________________
pld-cvs-commit mailing list
pld-cvs-commit@lists.pld-linux.org
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to