contact: Avoid unnecessary nation updates
Make setcont() update the nation only when it actually changes the contact value. For added benefit, map all non-zero values to one when option LOSE_CONTACT is disabled. This saves I/O, in particular xdump bandwidth. Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
parent
00d0664bcd
commit
e61c332295
1 changed files with 5 additions and 2 deletions
|
@ -123,9 +123,12 @@ setcont(natid us, natid them, int contact)
|
|||
if (CANT_HAPPEN(contact > 255))
|
||||
contact = 255;
|
||||
|
||||
if (np->nat_contact[them] < contact)
|
||||
if (!opt_LOSE_CONTACT)
|
||||
contact = !!contact;
|
||||
if (np->nat_contact[them] < contact) {
|
||||
np->nat_contact[them] = contact;
|
||||
putnat(np);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue