- bugfix for xenial network ip address discovery for LAN games + float truncate

This commit is contained in:
SoftCoder 2016-05-23 17:02:44 -07:00
parent a85d12aed1
commit 8a88c4f11e
2 changed files with 13 additions and 2 deletions

View File

@ -892,7 +892,8 @@ Vec2f Unit::getFloatCenteredPos() const {
throw megaglest_runtime_error(szBuf);
}
return Vec2f(pos.x-0.5f+type->getSize()/2.f, pos.y-0.5f+type->getSize()/2.f);
return Vec2f(truncateDecimal<float>(pos.x-0.5f+type->getSize()/2.f,6),
truncateDecimal<float>(pos.y-0.5f+type->getSize()/2.f,6));
}
Vec2i Unit::getCellPos() const {

View File

@ -686,7 +686,7 @@ std::vector<std::string> Socket::getLocalIPAddressList() {
for(int ipIdx = 0; myhostent->h_addr_list[ipIdx] != NULL; ++ipIdx) {
Ip::Inet_NtoA(SockAddrToUint32((struct in_addr *)myhostent->h_addr_list[ipIdx]), myhostaddr);
//printf("ipIdx = %d [%s]\n",ipIdx,myhostaddr);
printf("ipIdx = %d [%s]\n",ipIdx,myhostaddr);
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] myhostaddr = [%s]\n",__FILE__,__FUNCTION__,__LINE__,myhostaddr);
if(strlen(myhostaddr) > 0 &&
@ -709,6 +709,16 @@ std::vector<std::string> Socket::getLocalIPAddressList() {
intfTypes.push_back("vboxnet");
intfTypes.push_back("br-lan");
intfTypes.push_back("br-gest");
intfTypes.push_back("enp0s");
intfTypes.push_back("enp1s");
intfTypes.push_back("enp2s");
intfTypes.push_back("enp3s");
intfTypes.push_back("enp4s");
intfTypes.push_back("enp5s");
intfTypes.push_back("enp6s");
intfTypes.push_back("enp7s");
intfTypes.push_back("enp8s");
intfTypes.push_back("enp9s");
for(int intfIdx = 0; intfIdx < (int)intfTypes.size(); intfIdx++) {
string intfName = intfTypes[intfIdx];