20 |
20 |
21 |
21 |
22 #import <Foundation/Foundation.h> |
22 #import <Foundation/Foundation.h> |
23 #import "SDL_net.h" |
23 #import "SDL_net.h" |
24 |
24 |
|
25 @protocol EngineProtocolDelegate <NSObject> |
|
26 |
|
27 -(void) gameHasEndedWithStats:(NSArray *)stats; |
|
28 |
|
29 @end |
|
30 |
25 @interface EngineProtocolNetwork : NSObject { |
31 @interface EngineProtocolNetwork : NSObject { |
26 NSMutableArray *statsArray; |
32 id<EngineProtocolDelegate> delegate; |
27 NSString *savePath; |
|
28 NSDictionary *gameConfig; |
|
29 |
33 |
|
34 NSOutputStream *stream; |
30 NSInteger ipcPort; // Port on which engine will listen |
35 NSInteger ipcPort; // Port on which engine will listen |
31 TCPsocket csd; // Client socket descriptor |
36 TCPsocket csd; // Client socket descriptor |
32 } |
37 } |
33 |
38 |
34 @property (nonatomic,retain) NSMutableArray *statsArray; |
39 @property (nonatomic,assign) id<EngineProtocolDelegate> delegate; |
35 @property (nonatomic,retain) NSString *savePath; |
40 @property (nonatomic,retain) NSOutputStream *stream; |
36 @property (nonatomic,retain) NSDictionary *gameConfig; |
|
37 @property (assign) NSInteger ipcPort; |
41 @property (assign) NSInteger ipcPort; |
38 @property (assign) TCPsocket csd; |
42 @property (assign) TCPsocket csd; |
39 |
43 |
40 |
44 |
41 -(id) init; |
45 -(id) init; |
42 -(void) engineProtocol; |
46 -(id) initOnPort:(NSInteger) port; |
43 -(void) spawnThreadOnPort:(NSInteger) port; |
47 |
|
48 -(void) spawnThread:(NSString *)onSaveFile; |
|
49 -(void) spawnThread:(NSString *)onSaveFile withOptions:(NSDictionary *)dictionary; |
|
50 -(void) engineProtocol:(id) object; |
|
51 -(void) gameHasEndedWithStats:(NSArray *)stats; |
|
52 |
44 -(int) sendToEngine:(NSString *)string; |
53 -(int) sendToEngine:(NSString *)string; |
45 -(int) sendToEngineNoSave:(NSString *)string; |
54 -(int) sendToEngineNoSave:(NSString *)string; |
46 -(void) provideTeamData:(NSString *)teamName forHogs:(NSInteger) numberOfPlayingHogs withHealth:(NSInteger) initialHealth ofColor:(NSNumber *)teamColor; |
55 -(void) provideTeamData:(NSString *)teamName forHogs:(NSInteger) numberOfPlayingHogs withHealth:(NSInteger) initialHealth ofColor:(NSNumber *)teamColor; |
47 -(void) provideAmmoData:(NSString *)ammostoreName forPlayingTeams:(NSInteger) numberOfTeams; |
56 -(void) provideAmmoData:(NSString *)ammostoreName forPlayingTeams:(NSInteger) numberOfTeams; |
48 -(NSInteger) provideScheme:(NSString *)schemeName; |
57 -(NSInteger) provideScheme:(NSString *)schemeName; |