添加注释。

This commit is contained in:
saturneric 2019-08-13 00:52:11 +08:00
parent 6801e4f6bb
commit e3b0a9e158
10 changed files with 60 additions and 7 deletions

View File

@ -12,7 +12,9 @@ class Career
public:
private:
// The prodution which this career makes.
shared_ptr<Production> pdt;
// Produtions which this career needed.
shared_ptr<Need> ned;
};

View File

@ -4,6 +4,7 @@
#include <memory>
#include "Market.h"
#include "Land.h"
using namespace std;
@ -12,6 +13,9 @@ class Engine
public:
private:
// Manage all the markets.
vector<shared_ptr<Market>> mkts;
// Manage all the lands in the world.
vector<shared_ptr<Land>> lands;
};

1
Pop Engine/Land.cpp Normal file
View File

@ -0,0 +1 @@
#include "Land.h"

23
Pop Engine/Land.h Normal file
View File

@ -0,0 +1,23 @@
#pragma once
#include <memory>
#include <string>
#include <vector>
#include "Population.h"
#include "Production.h"
using namespace std;
class Land
{
public:
private:
vector<unique_ptr<Population>> pops;
shared_ptr<Market> mkt;
vector<shared_ptr<Production>> pdts;
float max_pop;
string name;
};

View File

@ -13,9 +13,11 @@ class Market
public:
private:
// Selling productions in the market.
vector<unique_ptr<SellProduction>> sl_pdts;
vector<unique_ptr<Population>> pops;
// Children markets.
vector<shared_ptr<Market>> sub_mkts;
// Parent market.
shared_ptr<Market> pae_mkts;
};

View File

@ -12,8 +12,11 @@ class Need
public:
private:
vector<shared_ptr<Production>> base_pdts;
vector<shared_ptr<Production>> improve_pdts;
vector<shared_ptr<Production>> high_pdts;
// Certain kinds of production which one of those careers need to matain their lives.
vector<pair<shared_ptr<Production>, float>> base_pdts;
// Certain kinds of production to improve their lives.
vector<pair<shared_ptr<Production>, float>> improve_pdts;
// Certain kinds of production to satisfy their lives.
vector<pair<shared_ptr<Production>, float>> high_pdts;
};

View File

@ -153,6 +153,7 @@
<ItemGroup>
<ClCompile Include="Career.cpp" />
<ClCompile Include="Engine.cpp" />
<ClCompile Include="Land.cpp" />
<ClCompile Include="Market.cpp" />
<ClCompile Include="Need.cpp" />
<ClCompile Include="Pop Engine.cpp" />
@ -163,6 +164,7 @@
<ItemGroup>
<ClInclude Include="Career.h" />
<ClInclude Include="Engine.h" />
<ClInclude Include="Land.h" />
<ClInclude Include="Market.h" />
<ClInclude Include="Need.h" />
<ClInclude Include="Population.h" />

View File

@ -39,6 +39,9 @@
<ClCompile Include="SellProduction.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="Land.cpp">
<Filter>源文件</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="Career.h">
@ -62,5 +65,8 @@
<ClInclude Include="SellProduction.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="Land.h">
<Filter>头文件</Filter>
</ClInclude>
</ItemGroup>
</Project>

View File

@ -10,18 +10,25 @@ using namespace std;
class Population
{
public:
// Population group working to get production.
void work(void);
// Sell production to get money.
void sell(void);
// Give part of the money to nation.
void tax(void);
// Buy the production the population needed from the market.
void buy(void);
// Part of the population move to another land
void move(void);
//Part of the population changes the career
void increase(void);
private:
// Career of this population group.
shared_ptr<Career> career;
shared_ptr<Market> market;
// The number of people of this population group.
float pop;
// Money rest from all recycle.
float money;
};

View File

@ -11,8 +11,11 @@ class Production
public:
private:
// Raw material to make this production.
vector<shared_ptr<Production>> material;
// Base value of this prodution.
float value;
// Name of this production.
string name;
};