gomoku: migrate remaining functions to type player_color

No functional change.
This commit is contained in:
rillig 2022-05-29 21:02:37 +00:00
parent 2a44525455
commit a9ff97e44e
2 changed files with 17 additions and 17 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: main.c,v 1.72 2022/05/29 20:21:28 rillig Exp $ */
/* $NetBSD: main.c,v 1.73 2022/05/29 21:02:37 rillig Exp $ */
/*
* Copyright (c) 1994
@ -36,7 +36,7 @@
__COPYRIGHT("@(#) Copyright (c) 1994\
The Regents of the University of California. All rights reserved.");
/* @(#)main.c 8.4 (Berkeley) 5/4/95 */
__RCSID("$NetBSD: main.c,v 1.72 2022/05/29 20:21:28 rillig Exp $");
__RCSID("$NetBSD: main.c,v 1.73 2022/05/29 21:02:37 rillig Exp $");
#include <sys/stat.h>
#include <curses.h>
@ -162,7 +162,7 @@ parse_args(int argc, char **argv)
}
static void
set_input_sources(enum input_source *input, int color)
set_input_sources(enum input_source *input, player_color color)
{
switch (test) {
case NORMAL_PLAY:
@ -249,7 +249,7 @@ again:
}
static void
declare_winner(int outcome, const enum input_source *input, int color)
declare_winner(int outcome, const enum input_source *input, player_color color)
{
move(BSZ + 3, 0);
@ -275,7 +275,7 @@ declare_winner(int outcome, const enum input_source *input, int color)
struct outcome {
int result;
int winner;
player_color winner;
};
static struct outcome

View File

@ -1,4 +1,4 @@
/* $NetBSD: pickmove.c,v 1.64 2022/05/29 18:25:39 rillig Exp $ */
/* $NetBSD: pickmove.c,v 1.65 2022/05/29 21:02:37 rillig Exp $ */
/*
* Copyright (c) 1994
@ -34,7 +34,7 @@
#include <sys/cdefs.h>
/* @(#)pickmove.c 8.2 (Berkeley) 5/3/95 */
__RCSID("$NetBSD: pickmove.c,v 1.64 2022/05/29 18:25:39 rillig Exp $");
__RCSID("$NetBSD: pickmove.c,v 1.65 2022/05/29 21:02:37 rillig Exp $");
#include <stdlib.h>
#include <string.h>
@ -69,12 +69,12 @@ static unsigned int tmpmap[MAPSZ]; /* map for blocking <1,x> combos */
static int nforce; /* count of opponent <1,x> combos */
static bool better(spot_index, spot_index, player_color);
static void scanframes(int);
static void scanframes(player_color);
static void makecombo2(struct combostr *, struct spotstr *, u_char, u_short);
static void addframes(unsigned int);
static void makecombo(struct combostr *, struct spotstr *, u_char, u_short);
static void appendcombo(struct combostr *, int);
static void updatecombo(struct combostr *, int);
static void appendcombo(struct combostr *);
static void updatecombo(struct combostr *, player_color);
static void makeempty(struct combostr *);
static int checkframes(struct combostr *, struct combostr *, struct spotstr *,
u_short, struct overlap_info *);
@ -223,11 +223,11 @@ better(spot_index s, spot_index s1, player_color us)
return (random() & 1) != 0;
}
static int curcolor; /* implicit parameter to makecombo() */
static player_color curcolor; /* implicit parameter to makecombo() */
static unsigned int curlevel; /* implicit parameter to makecombo() */
static bool
four_in_a_row(int color, spot_index s, direction r)
four_in_a_row(player_color color, spot_index s, direction r)
{
struct spotstr *sp = &board[s];
@ -250,7 +250,7 @@ four_in_a_row(int color, spot_index s, direction r)
* Also, try to combine frames to find more complex (chained) moves.
*/
static void
scanframes(int color)
scanframes(player_color color)
{
struct combostr *ecbp;
struct spotstr *sp;
@ -530,7 +530,7 @@ makecombo2(struct combostr *ocbp, struct spotstr *osp, u_char off, u_short cv)
makeempty(ncbp);
/* add the new combo to the end of the list */
appendcombo(ncbp, curcolor);
appendcombo(ncbp);
} else {
updatecombo(ncbp, curcolor);
free(ncbp);
@ -565,7 +565,7 @@ addframes(unsigned int level)
curlevel = level;
/* scan for combos at empty spots */
int c = curcolor;
player_color c = curcolor;
for (spot_index s = PT(BSZ, BSZ) + 1; s-- > PT(1, 1); ) {
struct spotstr *sp = &board[s];
for (struct elist *ep = sp->s_empty; ep != NULL; ep = nep) {
@ -953,7 +953,7 @@ makeempty(struct combostr *ocbp)
* would be trying to "complete" the combo or trying to block it.
*/
static void
updatecombo(struct combostr *cbp, int color)
updatecombo(struct combostr *cbp, player_color color)
{
struct combostr *tcbp;
union comboval cb;
@ -1041,7 +1041,7 @@ updatecombo(struct combostr *cbp, int color)
* Add combo to the end of the list.
*/
static void
appendcombo(struct combostr *cbp, int color __unused)
appendcombo(struct combostr *cbp)
{
struct combostr *pcbp, *ncbp;