添加注释。
This commit is contained in:
parent
6801e4f6bb
commit
e3b0a9e158
@ -12,7 +12,9 @@ class Career
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
// The prodution which this career makes.
|
||||||
shared_ptr<Production> pdt;
|
shared_ptr<Production> pdt;
|
||||||
|
// Produtions which this career needed.
|
||||||
shared_ptr<Need> ned;
|
shared_ptr<Need> ned;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -4,14 +4,18 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include "Market.h"
|
#include "Market.h"
|
||||||
|
#include "Land.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
class Engine
|
class Engine
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
// Manage all the markets.
|
||||||
vector<shared_ptr<Market>> mkts;
|
vector<shared_ptr<Market>> mkts;
|
||||||
|
// Manage all the lands in the world.
|
||||||
|
vector<shared_ptr<Land>> lands;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
1
Pop Engine/Land.cpp
Normal file
1
Pop Engine/Land.cpp
Normal file
@ -0,0 +1 @@
|
|||||||
|
#include "Land.h"
|
23
Pop Engine/Land.h
Normal file
23
Pop Engine/Land.h
Normal 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;
|
||||||
|
};
|
||||||
|
|
@ -13,9 +13,11 @@ class Market
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
// Selling productions in the market.
|
||||||
vector<unique_ptr<SellProduction>> sl_pdts;
|
vector<unique_ptr<SellProduction>> sl_pdts;
|
||||||
vector<unique_ptr<Population>> pops;
|
// Children markets.
|
||||||
vector<shared_ptr<Market>> sub_mkts;
|
vector<shared_ptr<Market>> sub_mkts;
|
||||||
|
// Parent market.
|
||||||
shared_ptr<Market> pae_mkts;
|
shared_ptr<Market> pae_mkts;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -12,8 +12,11 @@ class Need
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
vector<shared_ptr<Production>> base_pdts;
|
// Certain kinds of production which one of those careers need to matain their lives.
|
||||||
vector<shared_ptr<Production>> improve_pdts;
|
vector<pair<shared_ptr<Production>, float>> base_pdts;
|
||||||
vector<shared_ptr<Production>> high_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;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -153,6 +153,7 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="Career.cpp" />
|
<ClCompile Include="Career.cpp" />
|
||||||
<ClCompile Include="Engine.cpp" />
|
<ClCompile Include="Engine.cpp" />
|
||||||
|
<ClCompile Include="Land.cpp" />
|
||||||
<ClCompile Include="Market.cpp" />
|
<ClCompile Include="Market.cpp" />
|
||||||
<ClCompile Include="Need.cpp" />
|
<ClCompile Include="Need.cpp" />
|
||||||
<ClCompile Include="Pop Engine.cpp" />
|
<ClCompile Include="Pop Engine.cpp" />
|
||||||
@ -163,6 +164,7 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="Career.h" />
|
<ClInclude Include="Career.h" />
|
||||||
<ClInclude Include="Engine.h" />
|
<ClInclude Include="Engine.h" />
|
||||||
|
<ClInclude Include="Land.h" />
|
||||||
<ClInclude Include="Market.h" />
|
<ClInclude Include="Market.h" />
|
||||||
<ClInclude Include="Need.h" />
|
<ClInclude Include="Need.h" />
|
||||||
<ClInclude Include="Population.h" />
|
<ClInclude Include="Population.h" />
|
||||||
|
@ -39,6 +39,9 @@
|
|||||||
<ClCompile Include="SellProduction.cpp">
|
<ClCompile Include="SellProduction.cpp">
|
||||||
<Filter>源文件</Filter>
|
<Filter>源文件</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="Land.cpp">
|
||||||
|
<Filter>源文件</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="Career.h">
|
<ClInclude Include="Career.h">
|
||||||
@ -62,5 +65,8 @@
|
|||||||
<ClInclude Include="SellProduction.h">
|
<ClInclude Include="SellProduction.h">
|
||||||
<Filter>头文件</Filter>
|
<Filter>头文件</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="Land.h">
|
||||||
|
<Filter>头文件</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
@ -10,18 +10,25 @@ using namespace std;
|
|||||||
class Population
|
class Population
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
// Population group working to get production.
|
||||||
void work(void);
|
void work(void);
|
||||||
|
// Sell production to get money.
|
||||||
void sell(void);
|
void sell(void);
|
||||||
|
// Give part of the money to nation.
|
||||||
void tax(void);
|
void tax(void);
|
||||||
|
// Buy the production the population needed from the market.
|
||||||
void buy(void);
|
void buy(void);
|
||||||
|
// Part of the population move to another land
|
||||||
void move(void);
|
void move(void);
|
||||||
|
//Part of the population changes the career
|
||||||
void increase(void);
|
void increase(void);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
// Career of this population group.
|
||||||
shared_ptr<Career> career;
|
shared_ptr<Career> career;
|
||||||
shared_ptr<Market> market;
|
|
||||||
|
|
||||||
|
// The number of people of this population group.
|
||||||
float pop;
|
float pop;
|
||||||
|
// Money rest from all recycle.
|
||||||
float money;
|
float money;
|
||||||
|
|
||||||
};
|
};
|
@ -11,8 +11,11 @@ class Production
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
// Raw material to make this production.
|
||||||
vector<shared_ptr<Production>> material;
|
vector<shared_ptr<Production>> material;
|
||||||
|
// Base value of this prodution.
|
||||||
float value;
|
float value;
|
||||||
|
// Name of this production.
|
||||||
string name;
|
string name;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user