forked from townforge/townforge
cc: fix block smoothing change cost
This commit is contained in:
parent
732eab35d9
commit
135822761c
@ -188,7 +188,7 @@ bool cc_command_handler_smooth::check(const cryptonote::BlockchainDB &db, const
|
||||
if (decoded[idx])
|
||||
{
|
||||
const uint32_t added_height = smooth.height >= smoothness[tile_idx].size() ? smooth.height + 1 - smoothness[tile_idx].size() : 0;
|
||||
labour_needed += added_height * LABOUR_PER_SMOOTHNESS_CHANGE;
|
||||
labour_needed += (added_height + 1) * LABOUR_PER_SMOOTHNESS_CHANGE;
|
||||
}
|
||||
++idx;
|
||||
}
|
||||
@ -254,7 +254,7 @@ bool cc_command_handler_smooth::execute(cryptonote::BlockchainDB &db, const cryp
|
||||
{
|
||||
const uint32_t added_height = smooth.height >= smoothness[tile_idx].size() ? smooth.height + 1 - smoothness[tile_idx].size() : 0;
|
||||
const uint8_t previous_tile_smoothness = smooth.height < smoothness[tile_idx].size() ? smoothness[tile_idx][smooth.height] : 0;
|
||||
labour_needed += added_height * LABOUR_PER_SMOOTHNESS_CHANGE;
|
||||
labour_needed += (added_height + 1) * LABOUR_PER_SMOOTHNESS_CHANGE;
|
||||
while (smoothness[tile_idx].size() <= smooth.height)
|
||||
smoothness[tile_idx].push_back(0);
|
||||
|
||||
@ -341,7 +341,7 @@ bool cc_command_handler_smooth::revert(cryptonote::BlockchainDB &db, const crypt
|
||||
smoothness[tile_idx].pop_back();
|
||||
|
||||
const uint32_t added_height = smooth.height >= smoothness[tile_idx].size() ? smooth.height + 1 - smoothness[tile_idx].size() : 0;
|
||||
labour_needed += added_height * LABOUR_PER_SMOOTHNESS_CHANGE;
|
||||
labour_needed += (added_height + 1) * LABOUR_PER_SMOOTHNESS_CHANGE;
|
||||
}
|
||||
|
||||
++idx;
|
||||
|
Loading…
Reference in New Issue
Block a user