
/** number.c *********************************/
/*                                           */
/* Copyright © 1988 by Digital Artists (DgA) */
/* All Rights reserved.                      */
/*                                           */
/*********************************************/

/*
Firma   : Digital Artists (DgA)
Objekt  : reederei/number.c
Version : 1.0
Autor   : [RK]
Datum   : 09-03-1988
Status  : geheim
*/

#include <exec/types.h>
#include <intuition/intuition.h>

extern struct Window *Window;
extern struct TextAttr font[2];
extern struct IntuiMessage *GetMsg();
extern USHORT *box3;

USHORT npts[18] =
 {0,0,223,0,223,49,1,49,1,0,222,0,222,49,0,49,0,0};

struct Image nggim =
 {-2,-1,32,15,4,NULL,0xf,0x0,NULL};

struct IntuiText nggtxt[4] =
 {
  {1,13,JAM2,11,2,&font[0],"1",NULL},
  {1,13,JAM2,10,2,&font[0],"2",NULL},
  {1,13,JAM2,10,2,&font[0],"3",NULL},
  {1,13,JAM2,9,2,&font[0],"4",NULL}
 };

struct Gadget ngg[4] =
 {
  {&ngg[1],25,30,32,15,GADGIMAGE|GADGHCOMP,GADGIMMEDIATE,BOOLGADGET|REQGADGET,&nggim,NULL,&nggtxt[0],0L,NULL,1,NULL},
  {&ngg[2],73,30,32,15,GADGIMAGE|GADGHCOMP,GADGIMMEDIATE,BOOLGADGET|REQGADGET,&nggim,NULL,&nggtxt[1],0L,NULL,2,NULL},
  {&ngg[3],123,30,32,15,GADGIMAGE|GADGHCOMP,GADGIMMEDIATE,BOOLGADGET|REQGADGET,&nggim,NULL,&nggtxt[2],0L,NULL,3,NULL},
  {NULL,173,30,32,15,GADGIMAGE|GADGHCOMP,GADGIMMEDIATE,BOOLGADGET|REQGADGET,&nggim,NULL,&nggtxt[3],0L,NULL,4,NULL}
 };

struct Border nbo =
 {0,0,13,0,JAM2,9,&npts[0],NULL};

struct IntuiText ntxt =
 {11,0,JAM2,35,10,&font[0],"Wieviele Spieler ?",NULL};

struct Requester num =
 {NULL,208,75,224,50,0,0,&ngg[0],&nbo,&ntxt,0,0,NULL,NULL,NULL,NULL,NULL};

GetNumber()
 {
  BOOL choosen = FALSE;
  int id;
  struct Gadget *gg;
  struct IntuiMessage *nmsg;

  nggim.ImageData = box3;

  Request(&num,Window);

  while (!(choosen))
   {
    while((nmsg=(struct IntuiMessage *)GetMsg(Window->UserPort))==NULL);
    ReplyMsg(nmsg);
    if (nmsg->Class == GADGETDOWN)
     {
      gg = (struct Gadget *)nmsg->IAddress;
      id = gg->GadgetID;
      if ((id >= 0) && (id <= 4))
       choosen = TRUE;
     }
   }

  EndRequest(&num,Window);

  return(id);
 }
