forked from github/server
reduce code obfuscation
This commit is contained in:
parent
1789bc06e9
commit
8cec4b20e0
3 changed files with 6 additions and 10 deletions
|
@ -55,6 +55,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#include <util/language.h>
|
||||
#include <util/lists.h>
|
||||
#include <util/log.h>
|
||||
#include <util/rand.h>
|
||||
#include <util/resolve.h>
|
||||
#include <util/rng.h>
|
||||
#include <util/variant.h>
|
||||
|
@ -1161,10 +1162,11 @@ void set_number(unit * u, int count)
|
|||
u->number = (unsigned short)count;
|
||||
}
|
||||
|
||||
bool learn_skill(unit * u, skill_t sk, double chance)
|
||||
bool learn_skill(unit * u, skill_t sk, double learn_chance)
|
||||
{
|
||||
skill *sv = u->skills;
|
||||
if (chance < 1.0 && rng_int() % 10000 >= chance * 10000)
|
||||
if (learn_chance < 1.0 && rng_int() % 10000 >= learn_chance * 10000)
|
||||
if (!chance(learn_chance))
|
||||
return false;
|
||||
while (sv != u->skills + u->skill_size) {
|
||||
assert(sv->weeks > 0);
|
||||
|
|
|
@ -655,7 +655,7 @@ static void test_unarmed_races_can_guard(CuTest *tc) {
|
|||
|
||||
setup_guard(&fix, false);
|
||||
rc = rc_get_or_create(fix.u->_race->_name);
|
||||
rc->flags |= RCF_UNARMEDGUARD;
|
||||
fset(rc, RCF_UNARMEDGUARD);
|
||||
update_guards();
|
||||
CuAssertTrue(tc, fval(fix.u, UFL_GUARD));
|
||||
test_cleanup();
|
||||
|
|
|
@ -766,8 +766,7 @@ void plan_monsters(faction * f)
|
|||
|
||||
for (r = regions; r; r = r->next) {
|
||||
unit *u;
|
||||
double rchance = attack_chance;
|
||||
bool attacking = false;
|
||||
bool attacking = chance(attack_chance);
|
||||
|
||||
for (u = r->units; u; u = u->next) {
|
||||
attrib *ta;
|
||||
|
@ -785,11 +784,6 @@ void plan_monsters(faction * f)
|
|||
produceexp(u, SK_PERCEPTION, u->number);
|
||||
}
|
||||
|
||||
if (rchance > 0.0) {
|
||||
if (chance(rchance))
|
||||
attacking = true;
|
||||
rchance = 0.0;
|
||||
}
|
||||
if (u->status > ST_BEHIND) {
|
||||
setstatus(u, ST_FIGHT);
|
||||
/* all monsters fight */
|
||||
|
|
Loading…
Reference in a new issue