home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / games / volume15 / xmnsweep / patch1 < prev    next >
Encoding:
Internet Message Format  |  1993-01-26  |  13.6 KB

  1. Path: uunet!ogicse!zephyr.ens.tek.com!master!saab!billr
  2. From: billr@saab.CNA.TEK.COM (Bill Randle)
  3. Newsgroups: comp.sources.games
  4. Subject: v15i010:  xminesweeper - minesweeper for X/XView, Patch1
  5. Message-ID: <3814@master.CNA.TEK.COM>
  6. Date: 26 Oct 92 16:35:20 GMT
  7. Article-I.D.: master.3814
  8. Sender: news@master.CNA.TEK.COM
  9. Lines: 465
  10. Approved: billr@saab.CNA.TEK.COM
  11. Xref: uunet comp.sources.games:1509
  12.  
  13. Submitted-by: etxtsg@solsta.ericsson.se (Thomas Grennefors  TX/DKF)
  14. Posting-number: Volume 15, Issue 10
  15. Archive-name: xminesweeper/Patch1
  16. Patch-To: xminesweeper: Volume 15, Issue 3
  17. Environment: XView, Xlib, X11
  18.  
  19. [Here is a patch to xminesweeper. See CHANGE.LOG for changes. Version
  20. is now 1.1.]
  21.  
  22. #! /bin/sh
  23. # This is a shell archive.  Remove anything before this line, then unpack
  24. # it by saving it into a file and typing "sh file".  To overwrite existing
  25. # files, type "sh file -c".  You can also feed this as standard input via
  26. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  27. # will see the following message at the end:
  28. #        "End of shell archive."
  29. # Contents:  patches01
  30. # Wrapped by billr@saab on Mon Oct 26 08:34:15 1992
  31. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  32. if test -f 'patches01' -a "${1}" != "-c" ; then 
  33.   echo shar: Will not clobber existing file \"'patches01'\"
  34. else
  35. echo shar: Extracting \"'patches01'\" \(11901 characters\)
  36. sed "s/^X//" >'patches01' <<'END_OF_FILE'
  37. X--------
  38. X*** /dev/null    Mon Oct 12 08:12:48 1992
  39. X--- CHANGE.LOG    Mon Oct 12 16:27:16 1992
  40. X***************
  41. X*** 0 ****
  42. X--- 1,24 ----
  43. X+ Ver. 1.1 (12 October 1992)
  44. X+ --------------------------------------------------
  45. X+ 
  46. X+ Larger font for the numbers displayed in the squares to improve readability.
  47. X+ 
  48. X+ Sweeper now accepts the standard Xview options on startup.
  49. X+ 
  50. X+ Function clock renamed to tick_clock. The name clock caused name clash
  51. X+ on some systems (f.ex HP-UX).
  52. X+ 
  53. X+ Corrected a problem with the clock starting to count directly when New Game button 
  54. X+ was selected instead of when the first square was selected.
  55. X+ 
  56. X+ if you start the game from a pty, there isn't an entry in
  57. X+ /etc/utmp so getlogin() fails.  I have added a check to use
  58. X+ getpwuid() if getlogin() fails.
  59. X+ 
  60. X+ The string used to display the clock was too short and causes a
  61. X+ memory overwrite.
  62. X+ 
  63. X+ Thanks to backbone!wayne@tssi.com and
  64. X+       Michael.Salmon@eos.ericsson.se
  65. X+       gerry@frc2.frc.ri.cmu.edu
  66. X+ for patches and suggestions.
  67. X*** released/window.c    Mon Oct 12 15:10:06 1992
  68. X--- window.c    Mon Oct 12 16:27:49 1992
  69. X***************
  70. X*** 1,4 ****
  71. X! static char sccsid[]="@(#)window.c    1.1 9/30/92";
  72. X  
  73. X  #include "window.h"
  74. X  
  75. X--- 1,4 ----
  76. X! static char sccsid[]="@(#)window.c    1.5 10/12/92";
  77. X  
  78. X  #include "window.h"
  79. X  
  80. X***************
  81. X*** 90,97 ****
  82. X           NULL);
  83. X  
  84. X        font=(Xv_Font)xv_find(NULL,FONT,
  85. X!                  FONT_FAMILY,FONT_FAMILY_DEFAULT_FIXEDWIDTH,
  86. X!                  FONT_SIZES_FOR_SCALE,6,12,24,36,
  87. X                   NULL);
  88. X  
  89. X        largefont=(Xv_Font)xv_find(NULL,FONT,
  90. X--- 90,97 ----
  91. X           NULL);
  92. X  
  93. X        font=(Xv_Font)xv_find(NULL,FONT,
  94. X!                  FONT_FAMILY,FONT_FAMILY_DEFAULT,
  95. X!                  FONT_SIZES_FOR_SCALE,6,12,16,36,
  96. X                   NULL);
  97. X  
  98. X        largefont=(Xv_Font)xv_find(NULL,FONT,
  99. X***************
  100. X*** 98,103 ****
  101. X--- 98,109 ----
  102. X                   FONT_RESCALE_OF, font, WIN_SCALE_EXTRALARGE,
  103. X                   NULL);
  104. X  
  105. X+       numberfont=(Xv_Font)xv_find(NULL,FONT,
  106. X+                   FONT_FAMILY,FONT_FAMILY_DEFAULT,
  107. X+                   FONT_STYLE,FONT_STYLE_BOLD,
  108. X+                   FONT_SIZE,18,
  109. X+                   NULL);
  110. X+ 
  111. X        pw =xv_get(canvas,CANVAS_NTH_PAINT_WINDOW,0);
  112. X        xid=(XID)xv_get(pw,XV_XID);
  113. X        dpy=(Display *)xv_get(pw,XV_DISPLAY);
  114. X***************
  115. X*** 241,251 ****
  116. X--- 247,259 ----
  117. X        char str[5];
  118. X  
  119. X        gc=DefaultGC(dpy,DefaultScreen(dpy));
  120. X+       XSetFont(dpy,gc,(Font)xv_get(numberfont,XV_XID));
  121. X        sprintf(str,"%d",number);
  122. X        XDrawString(dpy,xwin,gc,
  123. X            col*BOX_SIZE+BOX_SIZE/3,
  124. X            (int)(row*BOX_SIZE+BOX_SIZE*0.66),
  125. X            str,strlen(str));
  126. X+       XSetFont(dpy,gc,(Font)xv_get(font,XV_XID));
  127. X  }
  128. X  
  129. X  void bang(dpy,xwin)
  130. X***************
  131. X*** 273,279 ****
  132. X        notify_set_itimer_func(frame,bang_timer,ITIMER_REAL,&timer,NULL);
  133. X  }
  134. X  
  135. X! void bang_timer()
  136. X  {
  137. X        static counter=0;
  138. X  
  139. X--- 281,287 ----
  140. X        notify_set_itimer_func(frame,bang_timer,ITIMER_REAL,&timer,NULL);
  141. X  }
  142. X  
  143. X! Notify_value bang_timer()
  144. X  {
  145. X        static counter=0;
  146. X  
  147. X***************
  148. X*** 285,290 ****
  149. X--- 293,299 ----
  150. X          xv_set(ngamebutt,PANEL_INACTIVE,FALSE,0);
  151. X          bang_shown=0;
  152. X        }
  153. X+       return 0;
  154. X  }
  155. X  
  156. X  void expose(x,y,pw,dpy,xwin)
  157. X***************
  158. X*** 477,483 ****
  159. X        game_started=1;
  160. X        timer.it_value.tv_usec=92767;
  161. X        timer.it_interval.tv_usec=92767;    
  162. X!       notify_set_itimer_func(frame,clock,ITIMER_REAL,&timer,NULL);
  163. X        sprintf(str,"No bombs left: %d",no_bombs);
  164. X        xv_set(frame,FRAME_LEFT_FOOTER,str,0);
  165. X        xv_set(time_msg,PANEL_LABEL_STRING,"Time: 0.00  ",0);
  166. X--- 486,492 ----
  167. X        game_started=1;
  168. X        timer.it_value.tv_usec=92767;
  169. X        timer.it_interval.tv_usec=92767;    
  170. X!       notify_set_itimer_func(frame,tick_clock,ITIMER_REAL,&timer,NULL);
  171. X        sprintf(str,"No bombs left: %d",no_bombs);
  172. X        xv_set(frame,FRAME_LEFT_FOOTER,str,0);
  173. X        xv_set(time_msg,PANEL_LABEL_STRING,"Time: 0.00  ",0);
  174. X***************
  175. X*** 493,498 ****
  176. X--- 502,508 ----
  177. X        sec=0;
  178. X        no_shown_squares=0;
  179. X        init_board();
  180. X+       stop();
  181. X        repaint_proc((Canvas)NULL,pw,
  182. X             (Display *)xv_get(pw,XV_DISPLAY),
  183. X             xv_get(pw,XV_XID),(Xv_xrectlist *)NULL);
  184. X***************
  185. X*** 508,517 ****
  186. X        notify_set_itimer_func(frame,NOTIFY_FUNC_NULL,ITIMER_REAL,NULL,NULL);
  187. X  }
  188. X  
  189. X! Notify_value clock()
  190. X  {
  191. X        static int cntr=0;
  192. X!       char str[10];
  193. X  
  194. X        if(cntr==0){
  195. X          sec++;
  196. X--- 518,527 ----
  197. X        notify_set_itimer_func(frame,NOTIFY_FUNC_NULL,ITIMER_REAL,NULL,NULL);
  198. X  }
  199. X  
  200. X! Notify_value tick_clock()
  201. X  {
  202. X        static int cntr=0;
  203. X!       char str[20];
  204. X  
  205. X        if(cntr==0){
  206. X          sec++;
  207. X***************
  208. X*** 601,610 ****
  209. X  int update_highscore()
  210. X  {
  211. X        int i,j;
  212. X!       char name[20];
  213. X  
  214. X        stop();
  215. X!       strcpy(name,getlogin());
  216. X        read_highscore();
  217. X        i=0;
  218. X        while( highscore[level][size][i].score <= sec &&
  219. X--- 611,627 ----
  220. X  int update_highscore()
  221. X  {
  222. X        int i,j;
  223. X!       char name[30];
  224. X!       struct passwd *passwd_entry;
  225. X  
  226. X        stop();
  227. X! 
  228. X!       if( getlogin() )
  229. X!         strcpy(name,getlogin());
  230. X!       else{
  231. X!         passwd_entry = getpwuid( geteuid() );
  232. X!         strcpy( name, passwd_entry->pw_name );
  233. X!       }
  234. X        read_highscore();
  235. X        i=0;
  236. X        while( highscore[level][size][i].score <= sec &&
  237. X***************
  238. X*** 687,692 ****
  239. X--- 704,710 ----
  240. X  {
  241. X        int i,j,k;
  242. X  
  243. X+       xv_init(XV_INIT_ARGC_PTR_ARGV, &argc, argv, NULL);
  244. X        for(k=0;k<5;k++)
  245. X          for(j=0;j<3;j++)
  246. X            for(i=0;i<NOHIGHSCORES;i++)
  247. X*** released/window.h    Mon Oct 12 15:10:06 1992
  248. X--- window.h    Mon Oct 12 16:26:35 1992
  249. X***************
  250. X*** 1,4 ****
  251. X! /* static char sccsid[]="@(#)window.h    1.2 9/30/92";*/
  252. X  #include "sweep.h"
  253. X  #ifndef _WINDOWS_H_
  254. X  #define _WINDOWS_H_
  255. X--- 1,4 ----
  256. X! /* static char sccsid[]="@(#)window.h    1.5 10/12/92";*/
  257. X  #include "sweep.h"
  258. X  #ifndef _WINDOWS_H_
  259. X  #define _WINDOWS_H_
  260. X***************
  261. X*** 12,17 ****
  262. X--- 12,18 ----
  263. X  #include <xview/svrimage.h>
  264. X  #include <xview/icon.h>
  265. X  #include <xview/notify.h>
  266. X+ #include <pwd.h>
  267. X  
  268. X  short icon_bits[] = {
  269. X  #include "sweeper.icon"
  270. X***************
  271. X*** 21,27 ****
  272. X  #define HIGHSCOREFILE "sweeper.scores"
  273. X  #endif
  274. X  
  275. X! #define VERSION "Sweeper V 1.0"
  276. X  
  277. X  Frame frame;
  278. X  Canvas canvas;
  279. X--- 22,28 ----
  280. X  #define HIGHSCOREFILE "sweeper.scores"
  281. X  #endif
  282. X  
  283. X! #define VERSION "Sweeper V 1.1"
  284. X  
  285. X  Frame frame;
  286. X  Canvas canvas;
  287. X***************
  288. X*** 29,35 ****
  289. X  Panel_item time_msg,ngamebutt;
  290. X  struct itimerval timer;
  291. X  int sec,bang_shown,no_shown_squares;
  292. X! Xv_Font font,largefont;
  293. X  
  294. X  void expose();
  295. X  void repaint_proc();
  296. X--- 30,36 ----
  297. X  Panel_item time_msg,ngamebutt;
  298. X  struct itimerval timer;
  299. X  int sec,bang_shown,no_shown_squares;
  300. X! Xv_Font font,numberfont,largefont;
  301. X  
  302. X  void expose();
  303. X  void repaint_proc();
  304. X***************
  305. X*** 43,51 ****
  306. X  void set_diff();
  307. X  void new_game();
  308. X  void start();
  309. X! Notify_value clock();
  310. X  void bang();
  311. X! void bang_timer();
  312. X  void stop();
  313. X  void highscore_butt();
  314. X  void show_highscore();
  315. X--- 44,52 ----
  316. X  void set_diff();
  317. X  void new_game();
  318. X  void start();
  319. X! Notify_value tick_clock();
  320. X  void bang();
  321. X! Notify_value bang_timer();
  322. X  void stop();
  323. X  void highscore_butt();
  324. X  void show_highscore();
  325. X*** released/MANIFEST    Mon Oct 12 15:10:00 1992
  326. X--- MANIFEST    Mon Oct 12 10:51:54 1992
  327. X***************
  328. X*** 1,12 ****
  329. X!    File Name        Archive #    Description
  330. X! -----------------------------------------------------------
  331. X!  MANIFEST                   1    This shipping list
  332. X!  Makefile                   1    
  333. X!  README                     1    
  334. X!  TODO                       1    
  335. X!  sweep.c                    1    
  336. X!  sweep.h                    1    
  337. X!  sweeper.6                  1    
  338. X!  sweeper.icon               1    
  339. X!  window.c                   1    
  340. X!  window.h                   1    
  341. X--- 1,11 ----
  342. X! When you have unpacked the shar file you should have the
  343. X! following files:
  344. X! 
  345. X! MANIFEST        
  346. X! TODO        
  347. X! sweep.c     
  348. X! sweep.h     
  349. X! sweeper.6   
  350. X! sweeper.icon
  351. X! window.c    
  352. X! window.h    
  353. X*** released/TODO    Mon Oct 12 15:10:02 1992
  354. X--- TODO    Wed Sep 30 13:22:38 1992
  355. X***************
  356. X*** 1,5 ****
  357. X  
  358. X! o Better look for colour/grey scale
  359. X  
  360. X  o Make the mines look more like mines...
  361. X  
  362. X--- 1,5 ----
  363. X  
  364. X! o Better loock for colour/grey scale
  365. X  
  366. X  o Make the mines look more like mines...
  367. X  
  368. X*** released/sweeper.6    Mon Oct 12 15:10:03 1992
  369. X--- sweeper.6    Wed Sep 30 14:08:58 1992
  370. X***************
  371. X*** 7,24 ****
  372. X  .SH DESCRIPTION
  373. X  .LP
  374. X  .B Sweeper
  375. X! is a game where your task is to find the hidden mines in a minefield.
  376. X  .LP
  377. X  To play the game move your mouse pointer to a square and press the left
  378. X  mouse button to mark that you think this is safe square. If there is a
  379. X! mine on this square the game is over. If there is no mine on this square
  380. X  a number will be shown that shows home many mines there are in the
  381. X! surronding squares. All surrounding squares, even those diagonally are 
  382. X  counted.
  383. X  .LP
  384. X  If you think there is a mine on a square you move the mousepointer to that
  385. X  square and press the middle button. If you want to unmark a square that
  386. X! you thought that there is a mine on just press the middle button again.
  387. X  .LP
  388. X  If you click with the left button on a mine all squares will be revealed
  389. X  to you. The squares that you have marked will be shaded, all other squares 
  390. X--- 7,24 ----
  391. X  .SH DESCRIPTION
  392. X  .LP
  393. X  .B Sweeper
  394. X! is a geme where your task is to find the hidden mines in a minefield.
  395. X  .LP
  396. X  To play the game move your mouse pointer to a square and press the left
  397. X  mouse button to mark that you think this is safe square. If there is a
  398. X! mine on this square the game us oer. If there is no mine on this square
  399. X  a number will be shown that shows home many mines there are in the
  400. X! surronding squares. All surrounding squares, even thos diagonally is 
  401. X  counted.
  402. X  .LP
  403. X  If you think there is a mine on a square you move the mousepointer to that
  404. X  square and press the middle button. If you want to unmark a square that
  405. X! you thought that there is a mine on yust press the middle button again.
  406. X  .LP
  407. X  If you click with the left button on a mine all squares will be revealed
  408. X  to you. The squares that you have marked will be shaded, all other squares 
  409. X***************
  410. X*** 25,31 ****
  411. X  will be white. A faulty marked bomb will be marked with a cross over it.
  412. X  .SH BUGS
  413. X  .LP
  414. X! The manual could be better.
  415. X  .LP 
  416. X  The graphic interface could be better, and adapted for colour/gray scale.
  417. X  .LP
  418. X--- 25,31 ----
  419. X  will be white. A faulty marked bomb will be marked with a cross over it.
  420. X  .SH BUGS
  421. X  .LP
  422. X! The manual could be better
  423. X  .LP 
  424. X  The graphic interface could be better, and adapted for colour/gray scale.
  425. X  .LP
  426. X*** released/Makefile    Mon Oct 12 15:10:01 1992
  427. X--- Makefile    Mon Oct 12 11:00:13 1992
  428. X***************
  429. X*** 1,15 ****
  430. X  PROGRAM= sweeper
  431. X  SOURCES= sweep.c window.c
  432. X  INCLUDES= sweep.h window.h
  433. X! OTHER= MANIFEST TODO sweeper.6 sweeper.icon Makefile
  434. X  OBJECTS= sweep.o window.o
  435. X  SCOREFILE= /home/solsta-b/pub/lib/games/sweeper.scores
  436. X- #SCOREFILE= sweeper.scores
  437. X  SHARFILE= sweeper.shar
  438. X  
  439. X  CFLAGS=    -I/usr/openwin/include -O -DHIGHSCOREFILE=\"$(SCOREFILE)\"
  440. X- CCFLAGS=-I/usr/openwin/include -g 
  441. X  LDFLAGS= -L/usr/openwin/lib -lxview -lolgx -lX11
  442. X  
  443. X  all: $(OBJECTS)
  444. X      cc $(CFLAGS) -o $(PROGRAM) $(OBJECTS) $(LDFLAGS)
  445. X--- 1,20 ----
  446. X  PROGRAM= sweeper
  447. X  SOURCES= sweep.c window.c
  448. X  INCLUDES= sweep.h window.h
  449. X! OTHER= MANIFEST TODO sweeper.6 sweeper.icon Makefile CHANGE.LOG
  450. X  OBJECTS= sweep.o window.o
  451. X  SCOREFILE= /home/solsta-b/pub/lib/games/sweeper.scores
  452. X  SHARFILE= sweeper.shar
  453. X  
  454. X+ ## FLAGS FOR HP-UX
  455. X+ #CFLAGS = -D_BSD -I/usr/local/xview/usr/include -I/usr/include/X11R4 -DHIGHSCOREFILE=\"$(SCOREFILE)\" 
  456. X+ #LDFLAGS= -L/usr/local/xview/usr/lib -L/usr/lib/X11R4 -lxview -lolgx -lX11
  457. X+ 
  458. X+ ## FLAGS for Sun 0S
  459. X  CFLAGS=    -I/usr/openwin/include -O -DHIGHSCOREFILE=\"$(SCOREFILE)\"
  460. X  LDFLAGS= -L/usr/openwin/lib -lxview -lolgx -lX11
  461. X+ 
  462. X+ CCFLAGS=-I/usr/openwin/include -g 
  463. X  
  464. X  all: $(OBJECTS)
  465. X      cc $(CFLAGS) -o $(PROGRAM) $(OBJECTS) $(LDFLAGS)
  466. X
  467. X
  468. X
  469. X
  470. END_OF_FILE
  471. if test 11901 -ne `wc -c <'patches01'`; then
  472.     echo shar: \"'patches01'\" unpacked with wrong size!
  473. fi
  474. # end of 'patches01'
  475. fi
  476. echo shar: End of shell archive.
  477. exit 0
  478.