1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-26 03:52:01 +02:00

Fixed non-const reference issue.

This commit is contained in:
DJWarmonger 2018-07-27 08:10:21 +02:00
parent ea19716fb9
commit 6abebeeb9f
2 changed files with 4 additions and 4 deletions

View File

@ -15,7 +15,7 @@
#define GOLD_RESERVE (10000); //at least we'll be able to reach capitol
ResourceObjective::ResourceObjective(TResources & Res, Goals::TSubgoal Goal)
ResourceObjective::ResourceObjective(const TResources & Res, Goals::TSubgoal Goal)
: resources(Res), goal(Goal)
{
}
@ -248,7 +248,7 @@ bool ResourceManager::updateGoal(Goals::TSubgoal goal)
return false;
}
bool ResourceManager::tryPush(ResourceObjective & o)
bool ResourceManager::tryPush(const ResourceObjective & o)
{
auto goal = o.goal;

View File

@ -22,7 +22,7 @@ class IResourceManager;
struct DLL_EXPORT ResourceObjective
{
ResourceObjective() = default;
ResourceObjective(TResources &res, Goals::TSubgoal goal);
ResourceObjective(const TResources &res, Goals::TSubgoal goal);
bool operator < (const ResourceObjective &ro) const;
TResources resources; //how many resoures do we need
@ -88,7 +88,7 @@ protected: //not-const actions only for AI
virtual void reserveResoures(TResources &res, Goals::TSubgoal goal = Goals::TSubgoal());
virtual bool notifyGoalCompleted(Goals::TSubgoal goal);
virtual bool updateGoal(Goals::TSubgoal goal); //new goal must have same properties but different priority
virtual bool tryPush(ResourceObjective &o);
virtual bool tryPush(const ResourceObjective &o);
//inner processing
virtual TResources estimateIncome() const;