mirror of
https://github.com/vcmi/vcmi.git
synced 2025-02-05 13:04:54 +02:00
7722d058f0
* dismiss Hero works blocked in the castles * the backpack scrollable arrows aren't available (yellow, clickable) even when backpack is empty. * added missing info texts for buttons in hero window (and added functionality of enable tactic formations button) * can select (single click) and enter castle (double click) from the map. Same for hero. * Hero gets automatically selected after End Turn * Hero is automatically selected when exiting town * In Garrison or Hero army: units are selected when we first click on them Fixed (at least partially) also a problem with disappearing path
56 lines
1.2 KiB
C++
56 lines
1.2 KiB
C++
#pragma once
|
|
#include <boost/function.hpp>
|
|
|
|
template<typename Signature>
|
|
class CFunctionList
|
|
{
|
|
public:
|
|
std::vector<boost::function<Signature> > funcs;
|
|
|
|
CFunctionList(int){};
|
|
CFunctionList(){};
|
|
template <typename Functor>
|
|
CFunctionList(const Functor &f)
|
|
{
|
|
funcs.push_back(boost::function<Signature>(f));
|
|
}
|
|
CFunctionList(const boost::function<Signature> &first)
|
|
{
|
|
funcs.push_back(first);
|
|
}
|
|
CFunctionList(boost::function<Signature> &first)
|
|
{
|
|
funcs.push_back(first);
|
|
}
|
|
CFunctionList & operator+=(const boost::function<Signature> &first)
|
|
{
|
|
funcs.push_back(first);
|
|
return *this;
|
|
}
|
|
//CFunctionList<Signature> & operator=(const boost::function<Signature> &first)
|
|
//{
|
|
// funcs.push_back(first);
|
|
// return first;
|
|
//}
|
|
void clear()
|
|
{
|
|
funcs.clear();
|
|
}
|
|
operator bool() const
|
|
{
|
|
return funcs.size();
|
|
}
|
|
void operator()() const
|
|
{
|
|
std::vector<boost::function<Signature> > funcs2 = funcs; //backup
|
|
for(int i=0;i<funcs2.size(); i++)
|
|
funcs2[i]();
|
|
}
|
|
template <typename Arg>
|
|
void operator()(const Arg & a) const
|
|
{
|
|
std::vector<boost::function<Signature> > funcs2 = funcs; //backup
|
|
for(int i=0;i<funcs2.size(); i++)
|
|
funcs2[i](a);
|
|
}
|
|
}; |