forked from townforge/townforge
game: add resource availability distance
This commit is contained in:
parent
be7b3bee4a
commit
76000ab6dd
@ -235,6 +235,15 @@
|
||||
market gets a glut of one type of wood and scarcity of another. A canny businessman will see
|
||||
the trends to know what to build.
|
||||
</p>
|
||||
<p>
|
||||
New buildings have to be built close enough to existing resource generating buildings. For
|
||||
instance, if a new building requires some type of stone, it has to be built close enough to
|
||||
a stonecutter (such proximity rule is waived if building at the center of town, since there
|
||||
are no such building yet). The resource availability distance is the furthest away from a
|
||||
resource generating building that can be built without incurring extra labour cost for
|
||||
resource transportation. Beyond 16 times that distance, you cannot build at all without
|
||||
first building intermediate stonecutters or sawmills.
|
||||
</p>
|
||||
|
||||
<h3> Roads </h3>
|
||||
|
||||
|
@ -1300,6 +1300,9 @@ void CityMeshUrho3D::CreateGroundTiles()
|
||||
generatorExtentsNode = node->CreateChild("generator_extents");
|
||||
generatorExtentsNode->SetPosition(Vector3(0.0f, 0.0175f * height_scale, 0.0f));
|
||||
|
||||
maxGeneratorExtentsNode = node->CreateChild("max_generator_extents");
|
||||
maxGeneratorExtentsNode->SetPosition(Vector3(0.0f, 0.0175f * height_scale, 0.0f));
|
||||
|
||||
for (int i = 0; i < 2; ++i)
|
||||
{
|
||||
cursorNode[i] = node->CreateChild("cursor");
|
||||
@ -1414,16 +1417,26 @@ void CityMeshUrho3D::setHighlight(const Selection &selection, const std::shared_
|
||||
generatorExtentsNode->RemoveComponents<StaticModel>();
|
||||
generatorExtentsNode->SetPosition(Vector3(U2F(g, x), 0.3175f * height_scale, U2F(g, y)));
|
||||
create_area(generatorExtentsNode, resources.influenceMaterial, gx0, gy0, gx1, gy1, ox, oy, 0.0f);
|
||||
|
||||
uint32_t mgx0 = flag->x0 - generator_extents * MAX_DISTANCE_PERCENTAGE / 100;
|
||||
uint32_t mgy0 = flag->y0 - generator_extents * MAX_DISTANCE_PERCENTAGE / 100;
|
||||
uint32_t mgx1 = flag->x1 - generator_extents * MAX_DISTANCE_PERCENTAGE / 100;
|
||||
uint32_t mgy1 = flag->y1 - generator_extents * MAX_DISTANCE_PERCENTAGE / 100;
|
||||
maxGeneratorExtentsNode->RemoveComponents<StaticModel>();
|
||||
maxGeneratorExtentsNode->SetPosition(Vector3(U2F(mg, x), 0.3175f * height_scale, U2F(mg, y)));
|
||||
create_area(maxGeneratorExtentsNode, resources.influenceMaterial, mgx0, mgy0, mgx1, mgy1, ox, oy, 0.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
node->RemoveChild(generatorExtentsNode);
|
||||
node->RemoveChild(maxGeneratorExtentsNode);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
node->RemoveChild(influenceNode);
|
||||
node->RemoveChild(generatorExtentsNode);
|
||||
node->RemoveChild(maxGeneratorExtentsNode);
|
||||
}
|
||||
node->AddChild(cursorNode[CURSOR_NEW]);
|
||||
cursorNode[CURSOR_NEW]->SetPosition(Vector3(Vector3(U2F1(top_,x), top_h + 0.5f, U2F1(top_,y))));
|
||||
@ -1439,6 +1452,7 @@ void CityMeshUrho3D::setHighlight(const Selection &selection, const std::shared_
|
||||
{
|
||||
node->RemoveChild(influenceNode);
|
||||
node->RemoveChild(generatorExtentsNode);
|
||||
node->RemoveChild(maxGeneratorExtentsNode);
|
||||
node->RemoveChild(cursorNode[CURSOR_NEW]);
|
||||
node->RemoveChild(cursorNode[CURSOR_SEL]);
|
||||
}
|
||||
|
@ -394,6 +394,9 @@ void UIBuildingSettingsDialog::SetBudget(const Map *map, const GameState *gameSt
|
||||
if (influence)
|
||||
AddRow(rightLayout, "Influence", String(influence));
|
||||
|
||||
if (cc::is_generator(role))
|
||||
AddRow(rightLayout, "Availability", String(RESOURCE_AVAILABILITY_SCALE(influence)));
|
||||
|
||||
const CityState &city = gameState->cityState;
|
||||
uint32_t road_bonus = 100;
|
||||
const uint64_t shares = get_shares(map, flag, role, economic_power, ignore_influence, road_bonus, true);
|
||||
|
Loading…
Reference in New Issue
Block a user