home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 8
/
FreshFishVol8-CD1.bin
/
new
/
game
/
think
/
chaos
/
src
/
playersami.c
< prev
next >
Wrap
C/C++ Source or Header
|
1994-11-19
|
26KB
|
770 lines
/* Chaos: The Chess HAppening Organisation System V5.3
Copyright (C) 1993 Jochen Wiedmann
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$RCSfile: PlayersAmi.c,v $
$Revision: 3.2 $
$Date: 1994/11/19 19:32:01 $
This file contains the system dependent functions for the Players menu.
Computer: Amiga 1200 Compiler: Dice 2.07.54 (3.0)
Author: Jochen Wiedmann
Am Eisteich 9
72555 Metzingen
Tel. 07123 / 14881
Internet: wiedmann@mailserv.zdv.uni-tuebingen.de
*/
#ifndef CHAOS_H
#include "chaos.h"
#endif
/*
AskExtContinue() brings up a requester asking a question and lets the
user select between different possibilities.
Inputs: str a printf()-like format string
buttons a string containing the different choices, separated by
a '|', for example "Yes|No|Cancel"
Other arguments may follow. These are used in the format string.
Results: 0 for the rightmost choice and 1, 2, 3, ... for the other
choices. (In the "Yes|No|Cancel" example this would be 1 for
"Yes", 2 for "No" and 0 for "Cancel".
*/
int AskExtContinue(char *str, char *buttons, ...)
#ifdef AMIGA
{ return(MUI_RequestA(App, MainWnd, 0, (char *) GetChaosString(MSG_ATTENTION),
buttons, str, (APTR) ((&buttons)+1)));
}
#endif
/*
The AskContinue() function brings up a requester asking a Yes/No
question like "Do you really want to delete player p?"
Inputs: a printf()-like format string, possibly followed by
the corresponding arguments.
Results: TRUE, if the user selected Ok, FALSE otherwise
*/
int AskContinue(char *str, ...)
#ifdef AMIGA
{ return(MUI_RequestA(App, MainWnd, 0,
(char *) GetChaosString(MSG_ATTENTION),
(char *) GetChaosString(MSG_YES_NO),
str, (APTR) ((&str)+1)));
}
#endif /* AMIGA */
/*
The TerminatePlrWnd() function deletes the window that allows to edit
players.
*/
#ifdef AMIGA
static APTR PlrWnd = NULL; /* Player window */
static APTR PlrOkGad; /* Ok gadget (player window) */
static APTR PlrCancelGad; /* Cancel gadget (player window) */
static APTR NameGad; /* Name gadget */
static APTR StreetGad; /* Street gadget */
static APTR VillageGad; /* Village gadget */
static APTR ChessClubGad; /* Chess club gadget */
static APTR PhoneGad; /* Phone gadget */
static APTR BirthdayGad; /* Birthday gadget */
static APTR DWZGad; /* DWZ gadget */
static APTR ELOGad; /* ELO gadget */
static APTR SeniorGad; /* Senior gadget */
static APTR JuniorGad; /* Junior gadget */
static APTR WomanGad; /* Woman gadget */
static APTR JuniorAGad; /* Junior (A) gadget */
static APTR JuniorBGad; /* Junior (B) gadget */
static APTR JuniorCGad; /* Junior (C) gadget */
static APTR JuniorDGad; /* Junior (D) gadget */
static APTR JuniorEGad; /* Junior (E) gadget */
void TerminatePlrWnd(void)
{ if (PlrWnd != NULL)
{ set(PlrWnd, MUIA_Window_Open, FALSE);
DoMethod(App, OM_REMMEMBER, PlrWnd);
MUI_DisposeObject(PlrWnd);
PlrWnd = NULL;
}
}
#endif /* AMIGA */
/*
The InitPlrWnd() function creates the window that allows to edit
a player.
Inputs: title the windows title
Results: TRUE, if successful, FALSE otherwise
*/
#define ID_PlrWnd_Cancel 303
#define ID_PlrWnd_Ok 304
int InitPlrWnd(char *title)
#ifdef AMIGA
{ int Ok_SC = *GetChaosString(MSG_OK_SC);
int Cancel_SC = *GetChaosString(MSG_CANCEL_SC);
PlrWnd = WindowObject,
MUIA_Window_ID, MAKE_ID('P','L','R','I'),
MUIA_Window_Width, MUIV_Window_Width_MinMax(50),
MUIA_Window_Title, title,
WindowContents, VGroup,
Child, HGroup,
Child, VGroup,
MUIA_Weight, 300,
Child, ColGroup(2),
Child, Label2(GetChaosString(MSG_NAME_INPUT)),
Child, NameGad = StringObject,
StringFrame,
MUIA_String_MaxLen, NAMELEN+1,
End,
Child, Label2(GetChaosString(MSG_STREET_INPUT)),
Child, StreetGad = StringObject,
StringFrame,
MUIA_String_MaxLen, NAMELEN+1,
End,
Child, Label2(GetChaosString(MSG_VILLAGE_INPUT)),
Child, VillageGad = StringObject,
StringFrame,
MUIA_String_MaxLen, NAMELEN+1,
End,
Child, Label2(GetChaosString(MSG_CHESS_CLUB_INPUT)),
Child, ChessClubGad = StringObject,
StringFrame,
MUIA_String_MaxLen, NAMELEN+1,
End,
Child, Label2(GetChaosString(MSG_PHONE_INPUT)),
Child, PhoneGad = StringObject,
StringFrame,
MUIA_String_MaxLen, PHONENRLEN+1,
End,
Child, Label2(GetChaosString(MSG_BIRTHDAY_INPUT)),
Child, BirthdayGad = StringObject,
StringFrame,
MUIA_String_MaxLen, BIRTHDAYLEN+1,
End,
End,
Child, HGroup,
Child, Label2(GetChaosString(MSG_DWZ_INPUT)),
Child, DWZGad = StringObject, StringFrame,
MUIA_String_MaxLen, DWZLEN+1,
MUIA_String_Accept, "0123456789-",
End,
Child, HSpace(0),
Child, Label2(GetChaosString(MSG_ELO_INPUT)),
Child, ELOGad = StringObject, StringFrame,
MUIA_String_MaxLen, DWZLEN+1,
MUIA_String_Accept, "0123456789",
End,
End,
End,
Child, MUI_NewObject(MUIC_Rectangle,
MUIA_Weight, 50,
End,
Child, ColGroup(2),
Child, SeniorGad = CheckMark(FALSE),
Child, Label2(GetChaosString(MSG_SENIORS_INPUT)),
Child, JuniorGad = CheckMark(FALSE),
Child, Label2(GetChaosString(MSG_JUNIORS_INPUT)),
Child, WomanGad = CheckMark(FALSE),
Child, Label2(GetChaosString(MSG_WOMEN_INPUT)),
Child, JuniorAGad = CheckMark(FALSE),
Child, Label2(GetChaosString(MSG_JUNIORSA_INPUT)),
Child, JuniorBGad = CheckMark(FALSE),
Child, Label2(GetChaosString(MSG_JUNIORSB_INPUT)),
Child, JuniorCGad = CheckMark(FALSE),
Child, Label2(GetChaosString(MSG_JUNIORSC_INPUT)),
Child, JuniorDGad = CheckMark(FALSE),
Child, Label2(GetChaosString(MSG_JUNIORSD_INPUT)),
Child, JuniorEGad = CheckMark(FALSE),
Child, Label2(GetChaosString(MSG_JUNIORSE_INPUT)),
End,
End,
Child, HGroup,
MUIA_Group_SameSize, TRUE,
Child, PlrOkGad = KeyButton(GetChaosString(MSG_OK), Ok_SC),
Child, HSpace(0),
Child, HSpace(0),
Child, PlrCancelGad = KeyButton(GetChaosString(MSG_CANCEL_INPUT), Cancel_SC),
End,
End,
End;
if (!PlrWnd)
{ return(FALSE);
}
DoMethod(App, OM_ADDMEMBER, PlrWnd);
/*
Setting up the notification events for the player input window
*/
DoMethod(PlrWnd, MUIM_Notify, MUIA_Window_CloseRequest, TRUE, App, 2,
MUIM_Application_ReturnID, ID_PlrWnd_Cancel);
DoMethod(PlrWnd, MUIM_Notify, MUIA_Window_InputEvent, "ctrl return",
App, 2, MUIM_Application_ReturnID, ID_PlrWnd_Ok);
DoMethod(PlrOkGad, MUIM_Notify, MUIA_Pressed, FALSE, App, 2,
MUIM_Application_ReturnID, ID_PlrWnd_Ok);
DoMethod(PlrCancelGad, MUIM_Notify, MUIA_Pressed, FALSE, App, 2,
MUIM_Application_ReturnID, ID_PlrWnd_Cancel);
/*
Setting up the cycle chain in the player input window
*/
DoMethod(PlrWnd, MUIM_Window_SetCycleChain,
NameGad, StreetGad, VillageGad, ChessClubGad, PhoneGad,
BirthdayGad, DWZGad, ELOGad, PlrOkGad, PlrCancelGad,
SeniorGad, JuniorGad, WomanGad, JuniorAGad, JuniorBGad,
JuniorCGad, JuniorDGad, JuniorEGad, NULL);
DoMethod(NameGad, MUIM_Notify, MUIA_String_Acknowledge, MUIV_EveryTime,
PlrWnd, 3