/* * MailSaveMessage: Save given message string as given message number. * Return True iff message successfully saved. */ Bool MailSaveMessage(char *msg, int msgnum) { Bool done, saved; int outfile; char filename[MAX_PATH + FILENAME_MAX]; do { done = True; /* If mail directory doesn't exist, try to create it */ saved = MakeDirectory(MAIL_DIR); sprintf(filename, "%s\\%04d.msg", MAIL_DIR, msgnum); if ((outfile = open(filename, _O_BINARY | _O_RDWR | _O_CREAT, _S_IWRITE | _S_IREAD)) == -1) saved = False; if (write(outfile, msg, strlen(msg)) <= 0) saved = False; close(outfile); // Ask user about retrying if (!saved) if (AreYouSure(hInst, hReadMailDlg, YES_BUTTON, IDS_SAVEFAILED)) done = False; } while (!done); return saved; }
/* * UserMailReply: Set up a reply to the given message. If reply_all is True, reply to * all recipients of given message number; otherwise reply just to sender. */ void UserMailReply(int msg_num, Bool reply_all) { MailInfo *reply; reply = (MailInfo *) SafeMalloc(sizeof(MailInfo)); // Freed when reply dialog ends MailParseMessage(msg_num, reply); if (reply_all) { if (reply->num_recipients >= MAX_RECIPIENTS) { // If user wants to go ahead anyway, just truncate recipients if (!AreYouSure(hInst, hReadMailDlg, NO_BUTTON, IDS_TOOMANYRECIPIENTS, MAX_RECIPIENTS)) return; reply->num_recipients--; // Add sender below } strcpy(reply->recipients[reply->num_recipients], reply->sender); reply->num_recipients++; } else { reply->num_recipients = 1; strcpy(reply->recipients[0], reply->sender); } MakeReplySubject(reply->subject, MAX_SUBJECT); MailSendReply(hReadMailDlg, reply); }
/* * ChessDlgCommand: Handle WM_COMMAND messages in the main chess dialog. */ void ChessDlgCommand(HWND hDlg, int cmd_id, HWND hwndCtl, UINT codeNotify) { switch(cmd_id) { case IDC_RESIGN: if (!AreYouSure(hInst, hDlg, NO_BUTTON, IDS_ASKRESIGN)) break; if (b.color == WHITE) b.white_resigned = True; if (b.color == BLACK) b.black_resigned = True; ChessSendMove(); break; case IDC_RESTART_GAME: BoardInitialize(&b); ChessSendMove(); ChessRedrawBoard(); break; case IDC_RESETPLAYERS: RequestGameResetPlayers(game_obj); break; case IDOK: case IDCANCEL: ModuleExit(); break; } }
/* * DownloadUnarchiveFile: Unarchive archive zip_name to given * directory. Return True on success. */ Bool DownloadUnarchiveFile(char *zip_name, char *dir) { Bool retval = True; // Does file exist? struct stat s; if (stat(zip_name, &s) != 0) { ClientError(hInst, hDownloadDialog, IDS_MISSINGARCHIVE, zip_name); return False; } while (1) { extraction_error = 0; TransferMessage(GetString(hInst, IDS_DECOMPRESSING)); ExtractArchive(zip_name, dir); if (extraction_error == 0) // This means the user hit the abort button break; if (!AreYouSure(hInst, hDownloadDialog, YES_BUTTON, IDS_CANTUNCOMPRESS, zip_name, GetString(hInst, extraction_error))) { retval = False; break; } } return retval; }
/* * DownloadNewClient: Spawn external program to get new client executable. * Arguments are passed as command line paramenters to external program. */ void DownloadNewClient(char *hostname, char *filename) { SHELLEXECUTEINFO shExecInfo; char command_line[MAX_CMDLINE]; char exe_name[MAX_PATH]; char client_directory[MAX_PATH]; char update_program_path[MAX_PATH]; char *ptr; SystemInfo sysinfo; if (AreYouSure(hInst, hMain, YES_BUTTON, IDS_NEEDNEWVERSION)) { // Make download dir if not already there DownloadCheckDirs(hMain); // Destination directory is wherever client executable is running. // Because of UAC, this is likely not the current working directory. GetModuleFileName(NULL, exe_name, MAX_PATH); strcpy(client_directory, exe_name); ptr = strrchr(client_directory, '\\'); if (ptr != NULL) *ptr = 0; sprintf(update_program_path, "%s\\%s", client_directory, update_program); sprintf(command_line, "\"%s\" UPDATE \"%s\" \"%s\" \"%s\\%s\" \"%s\"", exe_name, hostname, filename, download_dir, update_filename, client_directory); // Using full pathname of client can overrun 128 character DOS command line limit GetSystemStats(&sysinfo); if (strlen(command_line) >= 127 && (sysinfo.platform == VER_PLATFORM_WIN32_WINDOWS)) { ClientError(hInst, hMain, IDS_LONGCMDLINE, command_line); } shExecInfo.cbSize = sizeof(SHELLEXECUTEINFO); shExecInfo.fMask = 0; shExecInfo.hwnd = NULL; shExecInfo.lpVerb = "runas"; shExecInfo.lpFile = update_program_path; shExecInfo.lpParameters = command_line; // Run in parent of resource directory; club will take care of copying // exes to Program Files if necessary. shExecInfo.lpDirectory = NULL; shExecInfo.nShow = SW_NORMAL; shExecInfo.hInstApp = NULL; if (!ShellExecuteEx(&shExecInfo)) ClientError(hInst, hMain, IDS_CANTUPDATE, update_program); } // Quit client PostMessage(hMain, WM_DESTROY, 0, 0); }
/* * DownloadUncrushFile: Unarchive Crusher archive zip_name to given directory. * Return True on success. */ Bool DownloadUncrushFile(char *zip_name, char *dir) { Bool retval = True; // Does file exist? struct stat s; if (stat(zip_name, &s) != 0) { ClientError(hInst, hDownloadDialog, IDS_MISSINGARCHIVE, zip_name); return False; } if (!WrapIsArchive(zip_name)) { ClientError(hInst, hDownloadDialog, IDS_BADARCHIVE2, zip_name); return False; } WrapSetExtractionCallback(DownloadProgressCallback); while (1) { char temp_path[MAX_PATH]; extraction_error = 0; TransferMessage(GetString(hInst, IDS_DECOMPRESSING)); GetTempPath(sizeof(temp_path), temp_path); WrapExtractArchive(zip_name, dir, temp_path); if (extraction_error == 0) break; if (!AreYouSure(hInst, hDownloadDialog, YES_BUTTON, IDS_CANTUNCOMPRESS, zip_name, GetString(hInst, extraction_error))) { retval = False; break; } } WrapSetExtractionCallback(NULL); return retval; }
/* * MissingResource: What to call if we find that client is missing a resource * from a server message. If user wants to, quit game, automatically redownload * new resources, and reenter game. */ void MissingResource(void) { /* Always display the box, to alert us something is missing. // In release version, we are not doing updates, so don't show dialog. #ifdef NODPRINTFS return; #else*/ /* Maximum of one of these dialogs at a time */ static Bool dialog_up = False; if (dialog_up) return; dialog_up = True; if (!AreYouSure(hInst, hMain, YES_BUTTON, IDS_MISSINGRESOURCE)) return; RequestQuit(); dialog_up = False; //#endif }
/* * DownloadDeleteFile: Delete given file. Return True on success. */ Bool DownloadDeleteFile(char *filename) { struct stat s; Bool done = False; debug(("deleting file %s\n", filename)); // Ignore if file doesn't exist if (stat(filename, &s) != 0) return True; while (!done) { if (!DeleteFile(filename)) { if (!AreYouSure(hInst, hMain, YES_BUTTON, IDS_CANTDELETEFILE, filename)) return False; } else done = True; } return True; }
/* * DownloadNewClient: Open patcher from the default location if installed, * otherwise send user to OpenMeridian.org webpage to * download it. */ void DownloadNewClient(char *hostname, char *filename) { SHELLEXECUTEINFO shExecInfo; TCHAR szPath[MAX_PATH]; if (AreYouSure(hInst, hMain, YES_BUTTON, IDS_NEEDNEWVERSION)) { // No longer use club.exe to update the Meridian executable, instead // we run the patcher if installed, otherwise send the user to download it. if (SUCCEEDED(SHGetFolderPath(NULL, CSIDL_PROGRAMS, NULL, 0, szPath))) strcat(szPath, TEXT(update_program)); shExecInfo.cbSize = sizeof(SHELLEXECUTEINFO); shExecInfo.fMask = 0; shExecInfo.hwnd = NULL; shExecInfo.lpVerb = TEXT("open"); shExecInfo.lpFile = TEXT(szPath); shExecInfo.lpParameters = NULL; shExecInfo.lpDirectory = NULL; shExecInfo.nShow = SW_SHOW; shExecInfo.hInstApp = NULL; if (!ShellExecuteEx(&shExecInfo)) { // Running patcher failed, send them to the webpage. If that fails, // throw an error (telling the user to contact us at the forums) and exit. shExecInfo.lpFile = TEXT(update_internet); if (!ShellExecuteEx(&shExecInfo)) ClientError(hInst, hMain, IDS_CANTUPDATE); } } // Quit client PostMessage(hMain, WM_DESTROY, 0, 0); }
void CreateNewDatabase::reject() { if (AreYouSure()) QDialog::reject(); }
/* * SendMailMessage: hDlg is filled in with mail message info; build up message * and ask server to validate recipient names. * Return True if message successfully sent. */ Bool SendMailMessage(HWND hDlg) { char line[MAX_LINE + 1], *ptr, *temp; int i, j, k; info = (MailInfo *) SafeMalloc(sizeof(MailInfo)); info->num_recipients = 0; // Read recipients GetDlgItemText(hDlg, IDC_RECIPIENTS, line, MAX_LINE); ptr = strtok(line, ","); while (ptr != NULL) { if (info->num_recipients >= MAX_RECIPIENTS) { if (!AreYouSure(hInst, hDlg, NO_BUTTON, IDS_TOOMANYRECIPIENTS, MAX_RECIPIENTS)) { SafeFree(info); info = NULL; return False; } break; } // Skip leading spaces while (*ptr == ' ') ptr++; // Skip trailing spaces temp = ptr + strlen(ptr) - 1; while (temp > ptr && *temp == ' ') temp--; *(temp + 1) = 0; strncpy(info->recipients[info->num_recipients], ptr, MAXUSERNAME); info->recipients[info->num_recipients][MAXUSERNAME - 1] = 0; info->num_recipients++; ptr = strtok(NULL, ","); } /* Must have >= 1 recipient */ if (info->num_recipients == 0) { ClientError(hInst, hDlg, IDS_NORECIPIENTS); return False; } // Remove duplicate recipients for (i = 0; i < info->num_recipients; i++) for (j = i + 1; j < info->num_recipients; j++) if (!stricmp(info->recipients[i], info->recipients[j])) { // Move everyone else up one slot for (k = j; k < info->num_recipients - 1; k++) strcpy(info->recipients[k], info->recipients[k + 1]); info->num_recipients--; j--; } // Translate names into object numbers line[0] = 0; for (i=0; i < info->num_recipients; i++) { if (i != 0) strcat(line, ","); strcat(line, info->recipients[i]); } RequestLookupNames(info->num_recipients, line); // Disable OK button, so that only one lookup happens at once EnableWindow(GetDlgItem(hDlg, IDC_OK), FALSE); SetDlgItemText(hDlg, IDC_SENDMAILMSG, GetString(hInst, IDS_CHECKNAMES)); return True; }
void GuildMemberCommand(HWND hDlg, int ctrl_id, HWND hwndCtl, UINT codeNotify) { ID player_id; int i, index, flags; HWND hList, hCombo; char name[MAXUSERNAME]; GuildMember *member; switch (ctrl_id) { case IDC_RENOUNCE: if (!AreYouSure(hInst, hDlg, NO_BUTTON, IDS_RENOUNCE)) break; RequestRenounce(); PropSheet_PressButton(hGuildConfigDialog, PSBTN_CANCEL); break; case IDC_EXILE: // Get currently selected user (if any), and send exile command hList = GetDlgItem(hDlg, IDC_GUILDLIST); index = ListBox_GetCurSel(hList); if (index == LB_ERR) break; member = (GuildMember *) ListBox_GetItemData(hList, index); player_id = member->id; ListBox_DeleteString(hList, index); RequestExile(player_id); break; case IDC_ABDICATE: // Get currently selected user (if any), and send abdicate command hList = GetDlgItem(hDlg, IDC_GUILDLIST); index = ListBox_GetCurSel(hList); if (index == LB_ERR) break; if (!AreYouSure(hInst, hDlg, NO_BUTTON, IDS_ABDICATE)) break; member = (GuildMember *) ListBox_GetItemData(hList, index); player_id = member->id; RequestAbdicate(player_id); PropSheet_PressButton(hGuildConfigDialog, PSBTN_CANCEL); break; case IDC_VOTE: // Get currently selected user (if any), and send vote command hList = GetDlgItem(hDlg, IDC_GUILDLIST); index = ListBox_GetCurSel(hList); if (index == LB_ERR) break; member = (GuildMember *) ListBox_GetItemData(hList, index); player_id = member->id; RequestVote(player_id); // Display name of person voted for ListBox_GetText(hList, index, name); SetWindowText(GetDlgItem(hDlg, IDC_CURRENTVOTE), name); break; case IDC_GUILDLIST: if (codeNotify != LBN_SELCHANGE) break; hList = hwndCtl; index = ListBox_GetCurSel(hList); if (index == LB_ERR) break; member = (GuildMember *) ListBox_GetItemData(hList, index); player_id = member->id; flags = guild_info->flags; if (flags & GC_EXILE) { // Can't exile self, or someone at or above you if (player_id == cinfo->player->id || member->rank >= guild_info->rank) EnableWindow(GetDlgItem(hDlg, IDC_EXILE), FALSE); else EnableWindow(GetDlgItem(hDlg, IDC_EXILE), TRUE); } ListBox_GetText(hList, index, name); if (flags & GC_VOTE) SetWindowText(GetDlgItem(hDlg, IDC_VOTENAME), name); if (flags & GC_ABDICATE) SetWindowText(GetDlgItem(hDlg, IDC_ABDICATENAME), name); // If rank is settable, set up combo box, otherwise just display rank if (flags & GC_SET_RANK) { // Add ranks to combo box hCombo = GetDlgItem(hDlg, IDC_RANK); ComboBox_ResetContent(hCombo); for (i = 0; i < NUM_GUILD_RANKS; i++) { // Can't set people to ranks at or above your rank (1-based) if (i == guild_info->rank - 1 && member->rank < guild_info->rank) break; if (member->gender == GUILD_MALE) ComboBox_AddString(hCombo, guild_info->male_ranks[i]); else ComboBox_AddString(hCombo, guild_info->female_ranks[i]); } ComboBox_SetCurSel(hCombo, member->rank - 1); // Can't set rank of people at or above your rank if (member->rank >= guild_info->rank) EnableWindow(hCombo, FALSE); else EnableWindow(hCombo, TRUE); } else { if (member->gender == GUILD_MALE) SetWindowText(GetDlgItem(hDlg, IDC_RANKDISPLAY), guild_info->male_ranks[member->rank - 1]); else SetWindowText(GetDlgItem(hDlg, IDC_RANKDISPLAY), guild_info->female_ranks[member->rank - 1]); } break; case IDC_RANK: if (codeNotify != CBN_SELCHANGE) break; hList = GetDlgItem(hDlg, IDC_GUILDLIST); index = ListBox_GetCurSel(hList); if (index == LB_ERR) break; member = (GuildMember *) ListBox_GetItemData(hList, index); player_id = member->id; index = ComboBox_GetCurSel(GetDlgItem(hDlg, IDC_RANK)); if (index == CB_ERR) break; // Can't have more than 2 players of rank 4 if (index + 1 == 4) if (num_rank4 >= MAX_RANK4) { index = 2; ComboBox_SetCurSel(GetDlgItem(hDlg, IDC_RANK), index); } else num_rank4++; else if (member->rank == 4) num_rank4--; member->rank = index + 1; RequestSetRank(player_id, index + 1); break; } }
BOOL CALLBACK PickCharDialogProc(HWND hDlg, UINT message, UINT wParam, LONG lParam) { static HWND hList; int index, i; Character *c; switch (message) { case WM_INITDIALOG: CenterWindow(hDlg, GetParent(hDlg)); hList = GetDlgItem(hDlg, IDC_CHARLIST); info = (PickCharStruct *) lParam; /* Display characters in list */ for (i=0; i < info->num_characters; i++) { // For new characters, show a special string if (info->characters[i].flags == 1) index = ListBox_AddString(hList, GetString(hInst, IDS_NEWCHARACTER)); else index = ListBox_AddString(hList, info->characters[i].name); ListBox_SetItemData(hList, index, i); } /* Select first char */ ListBox_SetCurSel(hList, 0); // Show message of the day Edit_SetText(GetDlgItem(hDlg, IDC_MOTD), info->motd); // Display advertisements for (i=0; i < info->num_ads; i++) { char filename[MAX_PATH + FILENAME_MAX]; sprintf(filename, "%s\\%s", ad_directory, info->ads[i].filename); Animate_Open(GetDlgItem(hDlg, animation_controls[i]), filename); } hPickCharDialog = hDlg; return TRUE; case WM_COMPAREITEM: return ItemListCompareItem(hDlg, (const COMPAREITEMSTRUCT *) lParam); case WM_MEASUREITEM: ItemListMeasureItem(hDlg, (MEASUREITEMSTRUCT *) lParam); return TRUE; case WM_DRAWITEM: return ItemListDrawItem(hDlg, (const DRAWITEMSTRUCT *) lParam); HANDLE_MSG(hDlg, WM_LBUTTONDOWN, CharPickLButtonDown); HANDLE_MSG(hDlg, WM_CTLCOLOREDIT, DialogCtlColor); HANDLE_MSG(hDlg, WM_CTLCOLORLISTBOX, DialogCtlColor); HANDLE_MSG(hDlg, WM_CTLCOLORSTATIC, DialogCtlColor); HANDLE_MSG(hDlg, WM_CTLCOLORDLG, DialogCtlColor); case WM_COMMAND: switch(GET_WM_COMMAND_ID(wParam, lParam)) { case IDC_RESET: /* Get currently chosen character's name */ if ((index = ListBox_GetCurSel(hList)) == LB_ERR) return TRUE; index = ListBox_GetItemData(hList, index); c = &info->characters[index]; if (!AreYouSure(hInst, hDlg, NO_BUTTON, IDS_DELETECHAR, c->name)) return TRUE; char_to_use = c->id; strcpy(name_to_use, c->name); EndDialog(hDlg, IDC_RESET); return TRUE; case IDOK: /* Tell server that we want to use selected character */ if ((index = ListBox_GetCurSel(hList)) == LB_ERR) return TRUE; index = ListBox_GetItemData(hList, index); c = &info->characters[index]; char_to_use = c->id; strcpy(name_to_use, c->name); // If this character hasn't been used before, go to char creation if (c->flags == 1) EndDialog(hDlg, IDC_RESET); else EndDialog(hDlg, IDOK); return TRUE; case IDCANCEL: /* If user verifies, ask to leave game */ if (!AreYouSure(cinfo->hInst, hDlg, NO_BUTTON, IDS_LOGOFF)) break; Logoff(); EndDialog(hDlg, IDCANCEL); return TRUE; } break; case WM_DESTROY: hPickCharDialog = NULL; if (exiting) PostMessage(cinfo->hMain, BK_MODULEUNLOAD, 0, MODULE_ID); break; } return FALSE; }
/* * MenuCommand: A menu item has been selected. */ void MenuCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify) { // Set last action time to now, to prevent keypress from being interpreted as a game action. KeySetLastNorepeatTime(); // See if module wants to handle menu selection if (ModuleEvent(EVENT_MENUITEM, id) == False) return; /* Handle menu selections */ switch (id) { case ID_GAME_EXIT: if (connection != CON_NONE && !AreYouSure(hInst, hMain, NO_BUTTON, IDS_LOGOFF)) break; MainQuit(hwnd); break; case ID_GAME_PRINTMAP: if (state == STATE_GAME) PrintMap(FALSE); break; case ID_GAME_CONNECT: OfflineConnect(); break; case ID_GAME_DISCONNECT: if (!AreYouSure(hInst, hMain, NO_BUTTON, IDS_LOGOFF)) break; Logoff(); MainSetState(STATE_OFFLINE); break; case ID_GAME_SETTINGS: if (DialogBox(hInst, MAKEINTRESOURCE(IDD_SETTINGS), hMain, PreferencesDialogProc) == IDOK) { ModuleEvent(EVENT_CONFIGCHANGED); MenuDisplaySettings(hMain); } break; case ID_CONFIGMENU: ConfigMenuLaunch(); break; case ID_GAME_PASSWORD: PerformAction(A_CHANGEPASSWORD, NULL); break; case ID_OPTIONS_TIMEOUT: UserSetTimeout(); break; case ID_OPTIONS_MUSIC: config.play_music = !config.play_music; CheckMenuItem(menu, ID_OPTIONS_MUSIC, config.play_music ? MF_CHECKED : MF_UNCHECKED); UserToggleMusic(config.play_music); break; case ID_OPTIONS_SOUND: config.play_sound = !config.play_sound; CheckMenuItem(menu, ID_OPTIONS_SOUND, config.play_sound ? MF_CHECKED : MF_UNCHECKED); if (!config.play_sound) SoundStopAll(); break; case ID_OPTIONS_SAVENOW: SaveSettings(); break; case ID_OPTIONS_SAVEEXIT: config.save_settings = !config.save_settings; CheckMenuItem(menu, ID_OPTIONS_SAVEEXIT, config.save_settings ? MF_CHECKED : MF_UNCHECKED); break; case ID_OPTIONS_AREA: // due to issues with certain D3D drivers, this no longer immediately updates the config // it now sets a temporary variable that will update the config on shutdown // this means a shutdown and restart are necessary for window size changes MessageBox(hMain, "You must shutdown and restart Meridian 59 for these changes to take effect", "Direct3D", MB_OK); // config.large_area = !config.large_area; gLargeArea = !gLargeArea; CheckMenuItem(menu, ID_OPTIONS_AREA, gLargeArea ? MF_CHECKED : MF_UNCHECKED); /* if (state == STATE_GAME) // Send ourselves a resize message ResizeAll(); RedrawAll();*/ break; case ID_OPTIONS_FONT_MAP_TITLE: UserSelectFont(FONT_MAP_TITLE); break; case ID_OPTIONS_FONT_MAP_LABEL: UserSelectFont(FONT_MAP_LABEL); break; case ID_OPTIONS_FONT_MAP_TEXT: UserSelectFont(FONT_MAP_TEXT); break; case ID_FONT_GAMETEXT: UserSelectFont(FONT_EDIT); break; case ID_FONT_LIST: UserSelectFont(FONT_LIST); break; case ID_FONT_MAIL: UserSelectFont(FONT_MAIL); break; case ID_FONT_TITLES: UserSelectFont(FONT_TITLES); break; case ID_FONT_STATISTICS: UserSelectFont(FONT_STATS); break; case ID_FONT_INPUT: UserSelectFont(FONT_INPUT); break; case ID_FONT_LABELS: UserSelectFont(FONT_LABELS); break; case ID_FONT_DEFAULTS: FontsRestoreDefaults(); break; case ID_COLOR_MAIN: UserSelectColors(COLOR_FGD, COLOR_BGD); break; case ID_COLOR_LIST: UserSelectColors(COLOR_LISTFGD, COLOR_LISTBGD); break; case ID_COLOR_LISTSEL: UserSelectColors(COLOR_LISTSELFGD, COLOR_LISTSELBGD); break; case ID_COLOR_MAGIC: UserSelectColor(COLOR_ITEM_MAGIC_FG); break; case ID_COLOR_HIGHLIGHT: UserSelectColor(COLOR_HIGHLITE); break; case ID_COLOR_MAIL: UserSelectColors(COLOR_MAILFGD, COLOR_MAILBGD); break; case ID_COLOR_TEXT: UserSelectColors(COLOR_MAINEDITFGD, COLOR_MAINEDITBGD); break; case ID_COLOR_EDIT: UserSelectColors(COLOR_EDITFGD, COLOR_EDITBGD); break; case ID_COLOR_SYSMSG: UserSelectColor(COLOR_SYSMSGFGD); case ID_COLOR_QUESTHEADER: UserSelectColor(COLOR_QUEST_HEADER); break; break; case ID_COLOR_STATS: UserSelectColors(COLOR_STATSFGD, COLOR_STATSBGD); break; case ID_COLOR_BAR1: UserSelectColor(COLOR_BAR1); break; case ID_COLOR_BAR2: UserSelectColor(COLOR_BAR2); break; case ID_COLOR_BAR3: UserSelectColor(COLOR_BAR3); break; case ID_COLOR_BAR4: UserSelectColor(COLOR_BAR4); break; case ID_COLOR_INVNUM: UserSelectColors(COLOR_INVNUMFGD, COLOR_INVNUMBGD); break; case ID_COLOR_DEFAULTS: ColorsRestoreDefaults(); break; case ID_HELP_CONTENTS: StartHelp(); break; case ID_HOMEPAGE: WebLaunchBrowser(GetString(hInst, IDS_HOMEPAGEURL)); break; case ID_FORUM: WebLaunchBrowser(GetString(hInst, IDS_FORUMURL)); break; case ID_WIKI: WebLaunchBrowser(GetString(hInst, IDS_WIKIURL)); break; case ID_HELP_ABOUT: DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUT), hMain, AboutDialogProc); break; } }
void ComplyCB(long ID,short hittype,C_Base *control) { FalconGameEntity *game; C_EditBox *ebox; _TCHAR name[30]; _TCHAR *head,*tail; if(hittype != C_TYPE_LMOUSEUP) return; game=(FalconGameEntity*)gCommsMgr->GetTargetGame(); ebox = (C_EditBox *)control->Parent_->FindControl(INFO_GAMENAME); if(ebox) { if(ebox->GetText()) _tcscpy(name,ebox->GetText()); else _tcscpy(name,GameName); head=name; while(*head && !_istalnum(*head)) head++; tail=head; while(*tail) tail++; while(tail != head && !_istalnum(*tail)) tail--; tail++; *tail=0; if((tail-head) < (3*sizeof(_TCHAR)) || !(*head)) { AreYouSure(TXT_ERROR,TXT_INVALID_GAMENAME,CloseWindowCB,CloseWindowCB); return; } ebox->Refresh(); ebox->SetText(head); ebox->Refresh(); } INFOSaveValues();/* if( PlayerOptions.InCompliance(CurrRules.GetRules()) ) { PlayerOptions.SaveOptions(); CloseWindowCB(ID,hittype,control); } else { PlayerOptions.ComplyWRules(CurrRules.GetRules()); PlayerOptions.SaveOptions(); INFOSetupControls(); }*/ ebox=(C_EditBox*)control->Parent_->FindControl(INFO_PASSWORD); if(ebox) { game=(FalconGameEntity*)gCommsMgr->GetTargetGame(); if(game && OkCB) { if(!game->CheckPassword(ebox->GetText())) { AreYouSure(TXT_ERROR,TXT_WRONGPASSWORD,NULL,CloseWindowCB); return; } } } PlayerOptions.ComplyWRules(CurrRules.GetRules()); PlayerOptions.SaveOptions(); CloseWindowCB(ID,hittype,control); if(OkCB) (*OkCB)(); }