This is RefereeReceiver.m in view mode; [Download] [Up]
#import "RefereeReceiver.h" #import "Referee.h" #import <appkit/Application.h> #import "RefereeListener.h" #import "RefereeSpeaker.h" #import <stdio.h> #define TIMEOUT 1000 @implementation RefereeReceiver - appWillInit:sender; { myRefereeListener = [[RefereeListener alloc] init]; [myRefereeListener setDelegate:NXApp]; [NXApp setAppListener:myRefereeListener]; [myRefereeListener checkInAs:"Referee"]; [myRefereeListener setPriority:5]; [myRefereeListener setTimeout:TIMEOUT]; [myRefereeListener addPort]; //set up the custom speaker myRefereeSpeaker = [[RefereeSpeaker alloc] init]; [myRefereeSpeaker setSendTimeout:TIMEOUT]; [myRefereeSpeaker setDelegate:NXApp]; [NXApp setAppSpeaker:myRefereeSpeaker]; return self; } - appWillTerminate:sender; { [myReferee closeFiles]; return self; } - free; { [myRefereeListener free]; [myRefereeSpeaker free]; [super free]; return self; } - remoteCheckInPlayer:(char *)name atHost:(char *)host { [myReferee checkInPlayer:name atHost:host]; return self; } - remoteReportGameInfoFrom:(int)num side1:(int)s1 side2:(int)s2 push1:(int)ps1 pull1:(int)pl1 push2:(int)ps2 pull2:(int)pl2 choice1:(int)ch1 choice2:(int)ch2 payoff:(int)pay; { [myReferee reportGameInfoFrom:num side1:s1 side2:s2 push1:ps1 pull1:pl1 push2:ps2 pull2:pl2 choice1:ch1 choice2:ch2 payoff:pay]; return self; } - remoteReportChoiceBy:(int)playerNum cardPlayed:(int)hisChoice; { [myReferee reportChoiceBy:(int)playerNum cardPlayed:(int)hisChoice]; return self; } - remoteReportPaymentBy:(int)playerNum amount:(int)sidePayment; { [myReferee reportPaymentBy:(int)playerNum amount:(int)sidePayment]; return self; } - remoteReportPlayerInfo:(int)num Name:(char *)str1 Phone:(char *)str2 SS:(char *)str3 { [myReferee reportPlayerInfo:(int)num Name:(char *)str1 Phone:(char *)str2 SS:(char *)str3]; return self; } @end
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.