(findlost): Static linkage.
This commit is contained in:
parent
ec086428e5
commit
15448392f3
2 changed files with 13 additions and 9 deletions
|
@ -33,6 +33,7 @@
|
||||||
|
|
||||||
#ifndef _LOST_H_
|
#ifndef _LOST_H_
|
||||||
#define _LOST_H_
|
#define _LOST_H_
|
||||||
|
|
||||||
struct loststr {
|
struct loststr {
|
||||||
short ef_type;
|
short ef_type;
|
||||||
natid lost_owner; /* Who lost it */
|
natid lost_owner; /* Who lost it */
|
||||||
|
@ -48,7 +49,7 @@ struct loststr {
|
||||||
#define putlost(n, p) ef_write(EF_LOST, n, p)
|
#define putlost(n, p) ef_write(EF_LOST, n, p)
|
||||||
|
|
||||||
/* src/lib/subs/lostsub.c */
|
/* src/lib/subs/lostsub.c */
|
||||||
extern int findlost(char, natid, short, coord, coord, int);
|
|
||||||
extern void makelost(char, natid, short, coord, coord);
|
extern void makelost(char, natid, short, coord, coord);
|
||||||
extern void makenotlost(char, natid, short, coord, coord);
|
extern void makenotlost(char, natid, short, coord, coord);
|
||||||
|
|
||||||
#endif /* _LOST_H_ */
|
#endif /* _LOST_H_ */
|
||||||
|
|
|
@ -40,6 +40,8 @@
|
||||||
#include "lost.h"
|
#include "lost.h"
|
||||||
#include "prototypes.h"
|
#include "prototypes.h"
|
||||||
|
|
||||||
|
static int findlost(char, natid, short, coord, coord, int);
|
||||||
|
|
||||||
void
|
void
|
||||||
makelost(char type, natid owner, short int id, coord x, coord y)
|
makelost(char type, natid owner, short int id, coord x, coord y)
|
||||||
{
|
{
|
||||||
|
@ -80,20 +82,21 @@ makenotlost(char type, natid owner, short int id, coord x, coord y)
|
||||||
putlost(n, &lost);
|
putlost(n, &lost);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
|
||||||
|
/*
|
||||||
|
* Find a suitable slot in the lost file.
|
||||||
|
* If a record for TYPE, OWNER, ID, X, Y exists, return its index.
|
||||||
|
* Else if FREE is non-zero, return the index of an unused record if
|
||||||
|
* there is one.
|
||||||
|
* Else return -1.
|
||||||
|
*/
|
||||||
|
static int
|
||||||
findlost(char type, natid owner, short int id, coord x, coord y, int free)
|
findlost(char type, natid owner, short int id, coord x, coord y, int free)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Give me the item of a free slot */
|
|
||||||
{
|
{
|
||||||
struct loststr lost;
|
struct loststr lost;
|
||||||
int n;
|
int n;
|
||||||
int freeslot = -1;
|
int freeslot = -1;
|
||||||
|
|
||||||
/* Find a free slot, or find this item again */
|
|
||||||
for (n = 0; getlost(n, &lost); n++) {
|
for (n = 0; getlost(n, &lost); n++) {
|
||||||
if (!lost.lost_owner && freeslot == -1 && free == 1)
|
if (!lost.lost_owner && freeslot == -1 && free == 1)
|
||||||
freeslot = n;
|
freeslot = n;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue