mirror of
https://github.com/vcmi/vcmi.git
synced 2025-12-16 00:10:48 +02:00
* Replaced boost::shared_ptr with std::shared_ptr.
* Brought shared_ptr and unique_ptr and their factories (make_shared, make_unique) to the global scope. * Removed excessive usage of shared_ptr in bonus system interface. * Fixed bonus system limiters/caching interactions. That covers #823, #859 and a number of rare edge-cases. * Implemented multiple-step limiters applying, fixing hasAnotherBonusLimiter and allowing transitional dependencies between bonuses. * Bonus system should be slightly faster, since we cache limited bonuses. Some rare usages (limiting query against a foreign node) however can't use caching.
This commit is contained in:
@@ -367,7 +367,7 @@ void CClient::newGame( CConnection *con, StartInfo *si )
|
||||
|
||||
if(si->mode != StartInfo::DUEL)
|
||||
{
|
||||
CCallback *cb = new CCallback(gs,color,this);
|
||||
auto cb = make_shared<CCallback>(gs,color,this);
|
||||
if(!it->second.human)
|
||||
{
|
||||
std::string AItoGive = settings["server"]["playerAI"].String();
|
||||
@@ -385,8 +385,8 @@ void CClient::newGame( CConnection *con, StartInfo *si )
|
||||
}
|
||||
battleints[color] = playerint[color];
|
||||
|
||||
playerint[color]->init(cb);
|
||||
callbacks[color] = boost::shared_ptr<CCallback>(cb);
|
||||
playerint[color]->init(cb.get());
|
||||
callbacks[color] = cb;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -473,7 +473,7 @@ void CClient::serialize( Handler &h, const int version )
|
||||
else
|
||||
nInt = new CPlayerInterface(pid);
|
||||
|
||||
callbacks[pid] = boost::shared_ptr<CCallback>(new CCallback(gs,pid,this));
|
||||
callbacks[pid] = make_shared<CCallback>(gs,pid,this);
|
||||
battleints[pid] = playerint[pid] = nInt;
|
||||
nInt->init(callbacks[pid].get());
|
||||
nInt->serialize(h, version);
|
||||
|
||||
Reference in New Issue
Block a user