Subversion Repositories Games.Chess Giants

Rev

Rev 140 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 140 Rev 172
Line 11... Line 11...
11
#define TIMER_REFRESHDIALOG 1
11
#define TIMER_REFRESHDIALOG 1
12
 
12
 
13
 
13
 
14
// global variables used in this module only
14
// global variables used in this module only
15
static bool is_challengeaccepted = false;
15
static bool is_challengeaccepted = false;
-
 
16
static wchar_t challenge_gametype[32];
16
static wchar_t challenger_nickname[32];
17
static wchar_t challenger_nickname[32];
17
 
18
 
18
 
19
 
19
// prototypes of local functions
20
// prototypes of local functions
20
static void StartThread_ThisDialog (void *thread_parms);
21
static void StartThread_ThisDialog (void *thread_parms);
Line 52... Line 53...
52
      Player_SendBuffer_Add (network_player, 1000, L"accept %s\n", challenger_nickname);
53
      Player_SendBuffer_Add (network_player, 1000, L"accept %s\n", challenger_nickname);
53
      interlocutor = Interlocutor_FindOrCreate (challenger_nickname);
54
      interlocutor = Interlocutor_FindOrCreate (challenger_nickname);
54
      Interlocutor_Notify (interlocutor, LOCALIZE (L"Chat_InvitationAcceptedByYou"), challenger_nickname);
55
      Interlocutor_Notify (interlocutor, LOCALIZE (L"Chat_InvitationAcceptedByYou"), challenger_nickname);
55
      if (IsWindow (interlocutor->hWnd))
56
      if (IsWindow (interlocutor->hWnd))
56
         ShowWindow (interlocutor->hWnd, SW_MINIMIZE); // minimize chat window immediately
57
         ShowWindow (interlocutor->hWnd, SW_MINIMIZE); // minimize chat window immediately
-
 
58
 
-
 
59
      // remember the game rules
-
 
60
      wcscpy_s (the_board.game_rules, WCHAR_SIZEOF (the_board.game_rules), challenge_gametype);
57
   }
61
   }
58
   else
62
   else
59
   {
63
   {
60
      // send the decline notification and print a notification in this player's chat window
64
      // send the decline notification and print a notification in this player's chat window
61
      Player_SendBuffer_Add (network_player, 1000, L"decline %s\n", challenger_nickname);
65
      Player_SendBuffer_Add (network_player, 1000, L"decline %s\n", challenger_nickname);
Line 159... Line 163...
159
      // OR was it the "decline" button ?
163
      // OR was it the "decline" button ?
160
      if ((wParam_loword == IDCANCEL) || (wParam_loword == BUTTON_DECLINE))
164
      if ((wParam_loword == IDCANCEL) || (wParam_loword == BUTTON_DECLINE))
161
      {
165
      {
162
         challenge = &challenges[GetWindowLongPtr (hWnd, DWLP_USER)]; // quick access to challenge
166
         challenge = &challenges[GetWindowLongPtr (hWnd, DWLP_USER)]; // quick access to challenge
163
         wcscpy_s (challenger_nickname, WCHAR_SIZEOF (challenger_nickname), challenge->challenger); // have a copy of challenger's name
167
         wcscpy_s (challenger_nickname, WCHAR_SIZEOF (challenger_nickname), challenge->challenger); // have a copy of challenger's name
-
 
168
         wcscpy_s (challenge_gametype, WCHAR_SIZEOF (challenge_gametype), challenge->game_type); // have a copy of the game type
164
         KillTimer (hWnd, TIMER_REFRESHDIALOG); // destroy the timer we used to refresh the dialog text
169
         KillTimer (hWnd, TIMER_REFRESHDIALOG); // destroy the timer we used to refresh the dialog text
165
         EndDialog (hWnd, 0); // close the dialog box
170
         EndDialog (hWnd, 0); // close the dialog box
166
      }
171
      }
167
 
172
 
168
      // else was it the "accept" button ?
173
      // else was it the "accept" button ?
169
      else if (wParam_loword == BUTTON_ACCEPT)
174
      else if (wParam_loword == BUTTON_ACCEPT)
170
      {
175
      {
171
         challenge = &challenges[GetWindowLongPtr (hWnd, DWLP_USER)]; // quick access to challenge
176
         challenge = &challenges[GetWindowLongPtr (hWnd, DWLP_USER)]; // quick access to challenge
172
         wcscpy_s (challenger_nickname, WCHAR_SIZEOF (challenger_nickname), challenge->challenger); // have a copy of challenger's name
177
         wcscpy_s (challenger_nickname, WCHAR_SIZEOF (challenger_nickname), challenge->challenger); // have a copy of challenger's name
-
 
178
         wcscpy_s (challenge_gametype, WCHAR_SIZEOF (challenge_gametype), challenge->game_type); // have a copy of the game type
173
         KillTimer (hWnd, TIMER_REFRESHDIALOG); // destroy the timer we used to refresh the dialog text
179
         KillTimer (hWnd, TIMER_REFRESHDIALOG); // destroy the timer we used to refresh the dialog text
174
         EndDialog (hWnd, 1); // close the dialog box and return OK
180
         EndDialog (hWnd, 1); // close the dialog box and return OK
175
      }
181
      }
176
 
182
 
177
      // else did we click the challenger name ?
183
      // else did we click the challenger name ?