fixed the team number finder
I wasn't really thinking when I wrote the math the first time...
diff --git a/aos/common/network/network.gyp b/aos/common/network/network.gyp
index 7c2edcf..60b37aa 100644
--- a/aos/common/network/network.gyp
+++ b/aos/common/network/network.gyp
@@ -9,6 +9,7 @@
'dependencies': [
'<(AOS)/atom_code/atom_code.gyp:configuration',
'<(AOS)/common/common.gyp:once',
+ '<(AOS)/build/aos.gyp:logging',
],
},
{
diff --git a/aos/common/network/team_number.cc b/aos/common/network/team_number.cc
index 697c9b1..367f991 100644
--- a/aos/common/network/team_number.cc
+++ b/aos/common/network/team_number.cc
@@ -1,9 +1,11 @@
#include "aos/common/network/team_number.h"
#include <netinet/in.h>
+#include <inttypes.h>
#include "aos/common/once.h"
#include "aos/atom_code/configuration.h"
+#include "aos/common/logging/logging.h"
namespace aos {
namespace network {
@@ -11,7 +13,10 @@
uint16_t *DoGetTeamNumber() {
const in_addr &address = configuration::GetOwnIPAddress();
- static uint16_t r = address.s_addr >> 8;
+ static uint16_t r =
+ (((address.s_addr & 0xFF00) >> 8) * 100) +
+ (((address.s_addr & 0xFF0000) >> 16) & 0xFF);
+ LOG(INFO, "team number is %" PRIu16 "\n", r);
return &r;
}