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/language.h>
|
||||||
#include <util/lists.h>
|
#include <util/lists.h>
|
||||||
#include <util/log.h>
|
#include <util/log.h>
|
||||||
|
#include <util/rand.h>
|
||||||
#include <util/resolve.h>
|
#include <util/resolve.h>
|
||||||
#include <util/rng.h>
|
#include <util/rng.h>
|
||||||
#include <util/variant.h>
|
#include <util/variant.h>
|
||||||
|
@ -1161,10 +1162,11 @@ void set_number(unit * u, int count)
|
||||||
u->number = (unsigned short)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;
|
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;
|
return false;
|
||||||
while (sv != u->skills + u->skill_size) {
|
while (sv != u->skills + u->skill_size) {
|
||||||
assert(sv->weeks > 0);
|
assert(sv->weeks > 0);
|
||||||
|
|
|
@ -655,7 +655,7 @@ static void test_unarmed_races_can_guard(CuTest *tc) {
|
||||||
|
|
||||||
setup_guard(&fix, false);
|
setup_guard(&fix, false);
|
||||||
rc = rc_get_or_create(fix.u->_race->_name);
|
rc = rc_get_or_create(fix.u->_race->_name);
|
||||||
rc->flags |= RCF_UNARMEDGUARD;
|
fset(rc, RCF_UNARMEDGUARD);
|
||||||
update_guards();
|
update_guards();
|
||||||
CuAssertTrue(tc, fval(fix.u, UFL_GUARD));
|
CuAssertTrue(tc, fval(fix.u, UFL_GUARD));
|
||||||
test_cleanup();
|
test_cleanup();
|
||||||
|
|
|
@ -766,8 +766,7 @@ void plan_monsters(faction * f)
|
||||||
|
|
||||||
for (r = regions; r; r = r->next) {
|
for (r = regions; r; r = r->next) {
|
||||||
unit *u;
|
unit *u;
|
||||||
double rchance = attack_chance;
|
bool attacking = chance(attack_chance);
|
||||||
bool attacking = false;
|
|
||||||
|
|
||||||
for (u = r->units; u; u = u->next) {
|
for (u = r->units; u; u = u->next) {
|
||||||
attrib *ta;
|
attrib *ta;
|
||||||
|
@ -785,11 +784,6 @@ void plan_monsters(faction * f)
|
||||||
produceexp(u, SK_PERCEPTION, u->number);
|
produceexp(u, SK_PERCEPTION, u->number);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rchance > 0.0) {
|
|
||||||
if (chance(rchance))
|
|
||||||
attacking = true;
|
|
||||||
rchance = 0.0;
|
|
||||||
}
|
|
||||||
if (u->status > ST_BEHIND) {
|
if (u->status > ST_BEHIND) {
|
||||||
setstatus(u, ST_FIGHT);
|
setstatus(u, ST_FIGHT);
|
||||||
/* all monsters fight */
|
/* all monsters fight */
|
||||||
|
|
Loading…
Reference in a new issue