forked from townforge/townforge
repair level below 70% affects shares
This commit is contained in:
parent
d9176ad644
commit
fd7eea2f4d
@ -456,6 +456,14 @@ bool get_build_budget(cryptonote::BlockchainDB &db, uint32_t flag, uint32_t dx,
|
||||
return true;
|
||||
}
|
||||
|
||||
uint64_t get_shares(uint32_t x0, uint32_t y0, uint32_t x1, uint32_t y1, uint8_t role, uint32_t economic_power, uint32_t repair, uint32_t influence_bonus)
|
||||
{
|
||||
uint64_t shares = (x1-x0+1) * (y1-y0+1) * economic_power * influence_bonus / 100;
|
||||
if (repair < DEFAULT_REPAIR * REPAIR_EFFICIENCY_THRESHOLD_PERCENT / 100)
|
||||
shares = shares * repair / (DEFAULT_REPAIR * REPAIR_EFFICIENCY_THRESHOLD_PERCENT / 100);
|
||||
return shares;
|
||||
}
|
||||
|
||||
bool overlap(uint32_t x0, uint32_t y0, uint32_t x1, uint32_t y1, uint32_t X0, uint32_t Y0, uint32_t X1, uint32_t Y1)
|
||||
{
|
||||
if (x0 > X1)
|
||||
|
@ -53,6 +53,7 @@ bool get_land_tax(uint32_t x0, uint32_t y0, uint32_t x1, uint32_t y1, uint64_t &
|
||||
uint32_t get_repair_labour_cost(uint32_t x0, uint32_t y0, uint32_t x1, uint32_t y1, uint8_t role, uint32_t economic_power, uint32_t current_repair, uint32_t to_repair);
|
||||
uint32_t get_build_labour_cost_for_height(uint16_t h);
|
||||
bool get_build_budget(cryptonote::BlockchainDB &db, uint32_t flag, uint32_t dx, uint32_t dy, uint32_t width, uint32_t height, uint16_t min_height, const std::vector<uint8_t> &block_data, bool encoded, uint32_t budget[NUM_ITEMS]);
|
||||
uint64_t get_shares(uint32_t x0, uint32_t y0, uint32_t x1, uint32_t y1, uint8_t role, uint32_t economic_power, uint32_t repair, uint32_t influence_bonus);
|
||||
bool has_flag(const cryptonote::BlockchainDB &db, uint32_t x0, uint32_t y0, uint32_t x1, uint32_t y1);
|
||||
bool overlap(uint32_t x0, uint32_t y0, uint32_t x1, uint32_t y1, uint32_t X0, uint32_t Y0, uint32_t X1, uint32_t Y1);
|
||||
bool encode_blocks(const uint8_t *src_types, uint32_t n_src_types, uint8_t *encoded_types, uint32_t *encoded_types_len);
|
||||
|
@ -53,6 +53,7 @@
|
||||
#define ORIGIN_RESOURCE_RADIUS 450
|
||||
#define RESOURCE_AVAILABILITY_SCALE(x) ((x) * 4)
|
||||
#define REPAIR_SCALE(x) (x)
|
||||
#define REPAIR_EFFICIENCY_THRESHOLD_PERCENT 70
|
||||
|
||||
|
||||
enum BuildingRole
|
||||
|
@ -58,7 +58,7 @@ public:
|
||||
inline uint32_t get_up_to(uint8_t role, uint32_t upto) const { return std::max(cumulative_influence[role], upto); }
|
||||
inline void inc_influence_bonus(uint32_t delta) { influence_bonus += delta; }
|
||||
inline void dec_influence_bonus(uint32_t delta) { if (influence_bonus < delta) influence_bonus = 0; else influence_bonus -= delta; }
|
||||
inline uint64_t get_shares() const { return (x1-x0+1) * (y1-y0+1) * economic_power * influence_bonus / 100; }
|
||||
inline uint64_t get_shares() const { return cc::get_shares(x0, y0, x1, y1, role, economic_power, repair, influence_bonus); }
|
||||
|
||||
uint32_t id, owner, city;
|
||||
uint8_t role;
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
using namespace Urho3D;
|
||||
|
||||
static uint32_t get_shares(const Map *map, const std::shared_ptr<Flag> &iflag)
|
||||
static uint64_t get_shares(const Map *map, const std::shared_ptr<Flag> &iflag)
|
||||
{
|
||||
uint32_t cumulative_influence[NUM_ROLES];
|
||||
std::set<std::shared_ptr<Flag>> flags;
|
||||
@ -54,7 +54,7 @@ static uint32_t get_shares(const Map *map, const std::shared_ptr<Flag> &iflag)
|
||||
}
|
||||
|
||||
const uint32_t influence_bonus = cc::calculate_influence(iflag->role, cumulative_influence);
|
||||
return iflag_area * iflag->economic_power * influence_bonus / 100;
|
||||
return cc::get_shares(iflag->x0, iflag->y0, iflag->x1, iflag->y1, iflag->role, iflag->economic_power, iflag->repair, influence_bonus);
|
||||
}
|
||||
|
||||
static SharedPtr<Text> AddText(SharedPtr<UIElement> e, const char *s, float scale = 1.0f)
|
||||
|
Loading…
Reference in New Issue
Block a user