Move ServerInfo to separate file
FossilOrigin-Name: 53f10f3320267c06cbe2ba5325fbc8fc3fc652b35a8e2ac0d0fdbcf7e96aa352
This commit is contained in:
parent
a084fb1cab
commit
2c939e6535
4 changed files with 57 additions and 39 deletions
37
src/ServerInfo.mm
Normal file
37
src/ServerInfo.mm
Normal file
|
@ -0,0 +1,37 @@
|
|||
#import "ServerInfo.h"
|
||||
|
||||
#include "cube.h"
|
||||
|
||||
@implementation ServerInfo
|
||||
- (instancetype)initWithName:(OFString *)name
|
||||
{
|
||||
self = [super init];
|
||||
|
||||
_name = [name copy];
|
||||
_full = @"";
|
||||
_mode = 0;
|
||||
_numplayers = 0;
|
||||
_ping = 9999;
|
||||
_protocol = 0;
|
||||
_minremain = 0;
|
||||
_map = @"";
|
||||
_sdesc = @"";
|
||||
_address.host = ENET_HOST_ANY;
|
||||
_address.port = CUBE_SERVINFO_PORT;
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (OFComparisonResult)compare:(id)otherObject
|
||||
{
|
||||
if (![otherObject isKindOfClass:ServerInfo.class])
|
||||
@throw [OFInvalidArgumentException exception];
|
||||
|
||||
if (_ping > [otherObject ping])
|
||||
return OFOrderedDescending;
|
||||
if (_ping < [otherObject ping])
|
||||
return OFOrderedAscending;
|
||||
|
||||
return [_name compare:[otherObject name]];
|
||||
}
|
||||
@end
|
Loading…
Add table
Add a link
Reference in a new issue