home *** CD-ROM | disk | FTP | other *** search
- Path: uunet!ogicse!zephyr.ens.tek.com!master!saab!billr
- From: billr@saab.CNA.TEK.COM (Bill Randle)
- Newsgroups: comp.sources.games
- Subject: v15i010: xminesweeper - minesweeper for X/XView, Patch1
- Message-ID: <3814@master.CNA.TEK.COM>
- Date: 26 Oct 92 16:35:20 GMT
- Article-I.D.: master.3814
- Sender: news@master.CNA.TEK.COM
- Lines: 465
- Approved: billr@saab.CNA.TEK.COM
- Xref: uunet comp.sources.games:1509
-
- Submitted-by: etxtsg@solsta.ericsson.se (Thomas Grennefors TX/DKF)
- Posting-number: Volume 15, Issue 10
- Archive-name: xminesweeper/Patch1
- Patch-To: xminesweeper: Volume 15, Issue 3
- Environment: XView, Xlib, X11
-
- [Here is a patch to xminesweeper. See CHANGE.LOG for changes. Version
- is now 1.1.]
-
- #! /bin/sh
- # This is a shell archive. Remove anything before this line, then unpack
- # it by saving it into a file and typing "sh file". To overwrite existing
- # files, type "sh file -c". You can also feed this as standard input via
- # unshar, or by typing "sh <file", e.g.. If this archive is complete, you
- # will see the following message at the end:
- # "End of shell archive."
- # Contents: patches01
- # Wrapped by billr@saab on Mon Oct 26 08:34:15 1992
- PATH=/bin:/usr/bin:/usr/ucb ; export PATH
- if test -f 'patches01' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'patches01'\"
- else
- echo shar: Extracting \"'patches01'\" \(11901 characters\)
- sed "s/^X//" >'patches01' <<'END_OF_FILE'
- X--------
- X*** /dev/null Mon Oct 12 08:12:48 1992
- X--- CHANGE.LOG Mon Oct 12 16:27:16 1992
- X***************
- X*** 0 ****
- X--- 1,24 ----
- X+ Ver. 1.1 (12 October 1992)
- X+ --------------------------------------------------
- X+
- X+ Larger font for the numbers displayed in the squares to improve readability.
- X+
- X+ Sweeper now accepts the standard Xview options on startup.
- X+
- X+ Function clock renamed to tick_clock. The name clock caused name clash
- X+ on some systems (f.ex HP-UX).
- X+
- X+ Corrected a problem with the clock starting to count directly when New Game button
- X+ was selected instead of when the first square was selected.
- X+
- X+ if you start the game from a pty, there isn't an entry in
- X+ /etc/utmp so getlogin() fails. I have added a check to use
- X+ getpwuid() if getlogin() fails.
- X+
- X+ The string used to display the clock was too short and causes a
- X+ memory overwrite.
- X+
- X+ Thanks to backbone!wayne@tssi.com and
- X+ Michael.Salmon@eos.ericsson.se
- X+ gerry@frc2.frc.ri.cmu.edu
- X+ for patches and suggestions.
- X*** released/window.c Mon Oct 12 15:10:06 1992
- X--- window.c Mon Oct 12 16:27:49 1992
- X***************
- X*** 1,4 ****
- X! static char sccsid[]="@(#)window.c 1.1 9/30/92";
- X
- X #include "window.h"
- X
- X--- 1,4 ----
- X! static char sccsid[]="@(#)window.c 1.5 10/12/92";
- X
- X #include "window.h"
- X
- X***************
- X*** 90,97 ****
- X NULL);
- X
- X font=(Xv_Font)xv_find(NULL,FONT,
- X! FONT_FAMILY,FONT_FAMILY_DEFAULT_FIXEDWIDTH,
- X! FONT_SIZES_FOR_SCALE,6,12,24,36,
- X NULL);
- X
- X largefont=(Xv_Font)xv_find(NULL,FONT,
- X--- 90,97 ----
- X NULL);
- X
- X font=(Xv_Font)xv_find(NULL,FONT,
- X! FONT_FAMILY,FONT_FAMILY_DEFAULT,
- X! FONT_SIZES_FOR_SCALE,6,12,16,36,
- X NULL);
- X
- X largefont=(Xv_Font)xv_find(NULL,FONT,
- X***************
- X*** 98,103 ****
- X--- 98,109 ----
- X FONT_RESCALE_OF, font, WIN_SCALE_EXTRALARGE,
- X NULL);
- X
- X+ numberfont=(Xv_Font)xv_find(NULL,FONT,
- X+ FONT_FAMILY,FONT_FAMILY_DEFAULT,
- X+ FONT_STYLE,FONT_STYLE_BOLD,
- X+ FONT_SIZE,18,
- X+ NULL);
- X+
- X pw =xv_get(canvas,CANVAS_NTH_PAINT_WINDOW,0);
- X xid=(XID)xv_get(pw,XV_XID);
- X dpy=(Display *)xv_get(pw,XV_DISPLAY);
- X***************
- X*** 241,251 ****
- X--- 247,259 ----
- X char str[5];
- X
- X gc=DefaultGC(dpy,DefaultScreen(dpy));
- X+ XSetFont(dpy,gc,(Font)xv_get(numberfont,XV_XID));
- X sprintf(str,"%d",number);
- X XDrawString(dpy,xwin,gc,
- X col*BOX_SIZE+BOX_SIZE/3,
- X (int)(row*BOX_SIZE+BOX_SIZE*0.66),
- X str,strlen(str));
- X+ XSetFont(dpy,gc,(Font)xv_get(font,XV_XID));
- X }
- X
- X void bang(dpy,xwin)
- X***************
- X*** 273,279 ****
- X notify_set_itimer_func(frame,bang_timer,ITIMER_REAL,&timer,NULL);
- X }
- X
- X! void bang_timer()
- X {
- X static counter=0;
- X
- X--- 281,287 ----
- X notify_set_itimer_func(frame,bang_timer,ITIMER_REAL,&timer,NULL);
- X }
- X
- X! Notify_value bang_timer()
- X {
- X static counter=0;
- X
- X***************
- X*** 285,290 ****
- X--- 293,299 ----
- X xv_set(ngamebutt,PANEL_INACTIVE,FALSE,0);
- X bang_shown=0;
- X }
- X+ return 0;
- X }
- X
- X void expose(x,y,pw,dpy,xwin)
- X***************
- X*** 477,483 ****
- X game_started=1;
- X timer.it_value.tv_usec=92767;
- X timer.it_interval.tv_usec=92767;
- X! notify_set_itimer_func(frame,clock,ITIMER_REAL,&timer,NULL);
- X sprintf(str,"No bombs left: %d",no_bombs);
- X xv_set(frame,FRAME_LEFT_FOOTER,str,0);
- X xv_set(time_msg,PANEL_LABEL_STRING,"Time: 0.00 ",0);
- X--- 486,492 ----
- X game_started=1;
- X timer.it_value.tv_usec=92767;
- X timer.it_interval.tv_usec=92767;
- X! notify_set_itimer_func(frame,tick_clock,ITIMER_REAL,&timer,NULL);
- X sprintf(str,"No bombs left: %d",no_bombs);
- X xv_set(frame,FRAME_LEFT_FOOTER,str,0);
- X xv_set(time_msg,PANEL_LABEL_STRING,"Time: 0.00 ",0);
- X***************
- X*** 493,498 ****
- X--- 502,508 ----
- X sec=0;
- X no_shown_squares=0;
- X init_board();
- X+ stop();
- X repaint_proc((Canvas)NULL,pw,
- X (Display *)xv_get(pw,XV_DISPLAY),
- X xv_get(pw,XV_XID),(Xv_xrectlist *)NULL);
- X***************
- X*** 508,517 ****
- X notify_set_itimer_func(frame,NOTIFY_FUNC_NULL,ITIMER_REAL,NULL,NULL);
- X }
- X
- X! Notify_value clock()
- X {
- X static int cntr=0;
- X! char str[10];
- X
- X if(cntr==0){
- X sec++;
- X--- 518,527 ----
- X notify_set_itimer_func(frame,NOTIFY_FUNC_NULL,ITIMER_REAL,NULL,NULL);
- X }
- X
- X! Notify_value tick_clock()
- X {
- X static int cntr=0;
- X! char str[20];
- X
- X if(cntr==0){
- X sec++;
- X***************
- X*** 601,610 ****
- X int update_highscore()
- X {
- X int i,j;
- X! char name[20];
- X
- X stop();
- X! strcpy(name,getlogin());
- X read_highscore();
- X i=0;
- X while( highscore[level][size][i].score <= sec &&
- X--- 611,627 ----
- X int update_highscore()
- X {
- X int i,j;
- X! char name[30];
- X! struct passwd *passwd_entry;
- X
- X stop();
- X!
- X! if( getlogin() )
- X! strcpy(name,getlogin());
- X! else{
- X! passwd_entry = getpwuid( geteuid() );
- X! strcpy( name, passwd_entry->pw_name );
- X! }
- X read_highscore();
- X i=0;
- X while( highscore[level][size][i].score <= sec &&
- X***************
- X*** 687,692 ****
- X--- 704,710 ----
- X {
- X int i,j,k;
- X
- X+ xv_init(XV_INIT_ARGC_PTR_ARGV, &argc, argv, NULL);
- X for(k=0;k<5;k++)
- X for(j=0;j<3;j++)
- X for(i=0;i<NOHIGHSCORES;i++)
- X*** released/window.h Mon Oct 12 15:10:06 1992
- X--- window.h Mon Oct 12 16:26:35 1992
- X***************
- X*** 1,4 ****
- X! /* static char sccsid[]="@(#)window.h 1.2 9/30/92";*/
- X #include "sweep.h"
- X #ifndef _WINDOWS_H_
- X #define _WINDOWS_H_
- X--- 1,4 ----
- X! /* static char sccsid[]="@(#)window.h 1.5 10/12/92";*/
- X #include "sweep.h"
- X #ifndef _WINDOWS_H_
- X #define _WINDOWS_H_
- X***************
- X*** 12,17 ****
- X--- 12,18 ----
- X #include <xview/svrimage.h>
- X #include <xview/icon.h>
- X #include <xview/notify.h>
- X+ #include <pwd.h>
- X
- X short icon_bits[] = {
- X #include "sweeper.icon"
- X***************
- X*** 21,27 ****
- X #define HIGHSCOREFILE "sweeper.scores"
- X #endif
- X
- X! #define VERSION "Sweeper V 1.0"
- X
- X Frame frame;
- X Canvas canvas;
- X--- 22,28 ----
- X #define HIGHSCOREFILE "sweeper.scores"
- X #endif
- X
- X! #define VERSION "Sweeper V 1.1"
- X
- X Frame frame;
- X Canvas canvas;
- X***************
- X*** 29,35 ****
- X Panel_item time_msg,ngamebutt;
- X struct itimerval timer;
- X int sec,bang_shown,no_shown_squares;
- X! Xv_Font font,largefont;
- X
- X void expose();
- X void repaint_proc();
- X--- 30,36 ----
- X Panel_item time_msg,ngamebutt;
- X struct itimerval timer;
- X int sec,bang_shown,no_shown_squares;
- X! Xv_Font font,numberfont,largefont;
- X
- X void expose();
- X void repaint_proc();
- X***************
- X*** 43,51 ****
- X void set_diff();
- X void new_game();
- X void start();
- X! Notify_value clock();
- X void bang();
- X! void bang_timer();
- X void stop();
- X void highscore_butt();
- X void show_highscore();
- X--- 44,52 ----
- X void set_diff();
- X void new_game();
- X void start();
- X! Notify_value tick_clock();
- X void bang();
- X! Notify_value bang_timer();
- X void stop();
- X void highscore_butt();
- X void show_highscore();
- X*** released/MANIFEST Mon Oct 12 15:10:00 1992
- X--- MANIFEST Mon Oct 12 10:51:54 1992
- X***************
- X*** 1,12 ****
- X! File Name Archive # Description
- X! -----------------------------------------------------------
- X! MANIFEST 1 This shipping list
- X! Makefile 1
- X! README 1
- X! TODO 1
- X! sweep.c 1
- X! sweep.h 1
- X! sweeper.6 1
- X! sweeper.icon 1
- X! window.c 1
- X! window.h 1
- X--- 1,11 ----
- X! When you have unpacked the shar file you should have the
- X! following files:
- X!
- X! MANIFEST
- X! TODO
- X! sweep.c
- X! sweep.h
- X! sweeper.6
- X! sweeper.icon
- X! window.c
- X! window.h
- X*** released/TODO Mon Oct 12 15:10:02 1992
- X--- TODO Wed Sep 30 13:22:38 1992
- X***************
- X*** 1,5 ****
- X
- X! o Better look for colour/grey scale
- X
- X o Make the mines look more like mines...
- X
- X--- 1,5 ----
- X
- X! o Better loock for colour/grey scale
- X
- X o Make the mines look more like mines...
- X
- X*** released/sweeper.6 Mon Oct 12 15:10:03 1992
- X--- sweeper.6 Wed Sep 30 14:08:58 1992
- X***************
- X*** 7,24 ****
- X .SH DESCRIPTION
- X .LP
- X .B Sweeper
- X! is a game where your task is to find the hidden mines in a minefield.
- X .LP
- X To play the game move your mouse pointer to a square and press the left
- X mouse button to mark that you think this is safe square. If there is a
- X! mine on this square the game is over. If there is no mine on this square
- X a number will be shown that shows home many mines there are in the
- X! surronding squares. All surrounding squares, even those diagonally are
- X counted.
- X .LP
- X If you think there is a mine on a square you move the mousepointer to that
- X square and press the middle button. If you want to unmark a square that
- X! you thought that there is a mine on just press the middle button again.
- X .LP
- X If you click with the left button on a mine all squares will be revealed
- X to you. The squares that you have marked will be shaded, all other squares
- X--- 7,24 ----
- X .SH DESCRIPTION
- X .LP
- X .B Sweeper
- X! is a geme where your task is to find the hidden mines in a minefield.
- X .LP
- X To play the game move your mouse pointer to a square and press the left
- X mouse button to mark that you think this is safe square. If there is a
- X! mine on this square the game us oer. If there is no mine on this square
- X a number will be shown that shows home many mines there are in the
- X! surronding squares. All surrounding squares, even thos diagonally is
- X counted.
- X .LP
- X If you think there is a mine on a square you move the mousepointer to that
- X square and press the middle button. If you want to unmark a square that
- X! you thought that there is a mine on yust press the middle button again.
- X .LP
- X If you click with the left button on a mine all squares will be revealed
- X to you. The squares that you have marked will be shaded, all other squares
- X***************
- X*** 25,31 ****
- X will be white. A faulty marked bomb will be marked with a cross over it.
- X .SH BUGS
- X .LP
- X! The manual could be better.
- X .LP
- X The graphic interface could be better, and adapted for colour/gray scale.
- X .LP
- X--- 25,31 ----
- X will be white. A faulty marked bomb will be marked with a cross over it.
- X .SH BUGS
- X .LP
- X! The manual could be better
- X .LP
- X The graphic interface could be better, and adapted for colour/gray scale.
- X .LP
- X*** released/Makefile Mon Oct 12 15:10:01 1992
- X--- Makefile Mon Oct 12 11:00:13 1992
- X***************
- X*** 1,15 ****
- X PROGRAM= sweeper
- X SOURCES= sweep.c window.c
- X INCLUDES= sweep.h window.h
- X! OTHER= MANIFEST TODO sweeper.6 sweeper.icon Makefile
- X OBJECTS= sweep.o window.o
- X SCOREFILE= /home/solsta-b/pub/lib/games/sweeper.scores
- X- #SCOREFILE= sweeper.scores
- X SHARFILE= sweeper.shar
- X
- X CFLAGS= -I/usr/openwin/include -O -DHIGHSCOREFILE=\"$(SCOREFILE)\"
- X- CCFLAGS=-I/usr/openwin/include -g
- X LDFLAGS= -L/usr/openwin/lib -lxview -lolgx -lX11
- X
- X all: $(OBJECTS)
- X cc $(CFLAGS) -o $(PROGRAM) $(OBJECTS) $(LDFLAGS)
- X--- 1,20 ----
- X PROGRAM= sweeper
- X SOURCES= sweep.c window.c
- X INCLUDES= sweep.h window.h
- X! OTHER= MANIFEST TODO sweeper.6 sweeper.icon Makefile CHANGE.LOG
- X OBJECTS= sweep.o window.o
- X SCOREFILE= /home/solsta-b/pub/lib/games/sweeper.scores
- X SHARFILE= sweeper.shar
- X
- X+ ## FLAGS FOR HP-UX
- X+ #CFLAGS = -D_BSD -I/usr/local/xview/usr/include -I/usr/include/X11R4 -DHIGHSCOREFILE=\"$(SCOREFILE)\"
- X+ #LDFLAGS= -L/usr/local/xview/usr/lib -L/usr/lib/X11R4 -lxview -lolgx -lX11
- X+
- X+ ## FLAGS for Sun 0S
- X CFLAGS= -I/usr/openwin/include -O -DHIGHSCOREFILE=\"$(SCOREFILE)\"
- X LDFLAGS= -L/usr/openwin/lib -lxview -lolgx -lX11
- X+
- X+ CCFLAGS=-I/usr/openwin/include -g
- X
- X all: $(OBJECTS)
- X cc $(CFLAGS) -o $(PROGRAM) $(OBJECTS) $(LDFLAGS)
- X
- X
- X
- X
- END_OF_FILE
- if test 11901 -ne `wc -c <'patches01'`; then
- echo shar: \"'patches01'\" unpacked with wrong size!
- fi
- # end of 'patches01'
- fi
- echo shar: End of shell archive.
- exit 0
-