8 players

This commit is contained in:
Titus Tscharntke
2010-02-28 11:21:01 +00:00
parent 59faabfe14
commit 5cb8aca19c
11 changed files with 90 additions and 45 deletions

View File

@@ -39,13 +39,22 @@ Ip::Ip(){
bytes[1]= 0;
bytes[2]= 0;
bytes[3]= 0;
bytes[4]= 0;
bytes[5]= 0;
bytes[6]= 0;
bytes[7]= 0;
}
Ip::Ip(unsigned char byte0, unsigned char byte1, unsigned char byte2, unsigned char byte3){
Ip::Ip(unsigned char byte0, unsigned char byte1, unsigned char byte2, unsigned char byte3,
unsigned char byte4, unsigned char byte5, unsigned char byte6, unsigned char byte7){
bytes[0]= byte0;
bytes[1]= byte1;
bytes[2]= byte2;
bytes[3]= byte3;
bytes[4]= byte4;
bytes[5]= byte5;
bytes[6]= byte6;
bytes[7]= byte7;
}
@@ -53,7 +62,7 @@ Ip::Ip(const string& ipString){
int offset= 0;
int byteIndex= 0;
for(byteIndex= 0; byteIndex<4; ++byteIndex){
for(byteIndex= 0; byteIndex<8; ++byteIndex){
int dotPos= ipString.find_first_of('.', offset);
bytes[byteIndex]= atoi(ipString.substr(offset, dotPos-offset).c_str());

View File

@@ -1,7 +1,7 @@
// ==============================================================
// This file is part of Glest Shared Library (www.glest.org)
//
// Copyright (C) 2001-2007 Marti<74>o Figueroa
// Copyright (C) 2001-2007 Marti<74>o Figueroa
//
// You can redistribute this code and/or modify it under
// the terms of the GNU General Public License as published
@@ -165,21 +165,29 @@ Ip::Ip(){
bytes[1]= 0;
bytes[2]= 0;
bytes[3]= 0;
bytes[4]= 4;
bytes[5]= 5;
bytes[6]= 6;
bytes[7]= 7;
}
Ip::Ip(unsigned char byte0, unsigned char byte1, unsigned char byte2, unsigned char byte3){
Ip::Ip(unsigned char byte0, unsigned char byte1, unsigned char byte2, unsigned char byte3,
unsigned char byte4, unsigned char byte5, unsigned char byte6, unsigned char byte7){
bytes[0]= byte0;
bytes[1]= byte1;
bytes[2]= byte2;
bytes[3]= byte3;
bytes[4]= byte4;
bytes[5]= byte5;
bytes[6]= byte6;
bytes[7]= byte7;
}
Ip::Ip(const string& ipString){
int offset= 0;
int byteIndex= 0;
for(byteIndex= 0; byteIndex<4; ++byteIndex){
for(byteIndex= 0; byteIndex<8; ++byteIndex){
int dotPos= ipString.find_first_of('.', offset);
bytes[byteIndex]= atoi(ipString.substr(offset, dotPos-offset).c_str());
@@ -188,7 +196,8 @@ Ip::Ip(const string& ipString){
}
string Ip::getString() const{
return intToStr(bytes[0]) + "." + intToStr(bytes[1]) + "." + intToStr(bytes[2]) + "." + intToStr(bytes[3]);
return intToStr(bytes[0]) + "." + intToStr(bytes[1]) + "." + intToStr(bytes[2]) + "." + intToStr(bytes[3])
+ "." +intToStr(bytes[4]) + "." + intToStr(bytes[5]) + "." + intToStr(bytes[6]) + "." + intToStr(bytes[7]);
}
// =====================================================