int unique_host( DESCRIPTOR_DATA *d )
{
DESCRIPTOR_DATA *dtemp;
for (dtemp = mud->f_desc ; dtemp ; dtemp = dtemp->next)
{
if (d == dtemp)
{
return 1;
}
if (!strcmp(d->host, dtemp->host))
{
return 0;
}
}
return 0;
}
/*
Give the number of players counting multiple characters from the same
IP as one.
*/
int unique_players(void)
{
DESCRIPTOR_DATA *dtemp;
int cnt = 0;
for (dtemp = mud->f_desc ; dtemp ; dtemp = dtemp->next)
{
if (dtemp->character)
{
cnt += unique_host(dtemp);
}
}
return cnt;
}
// Utility macro
#define INSERT_LEFT(link, rght, first, next, prev) \
{ \
(link)->prev = (rght)->prev; \
(rght)->prev = (link); \
(link)->next = (rght); \
\
if ((link)->prev) \
{ \
(link)->prev->next = (link); \
} \
else \
{ \
(first) = (link); \
} \
}
// Inside the new_descriptor function in comm.c:
for (dtmp = mud->f_desc ; dtmp ; dtmp = dtmp->next)
{
if (strcmp(dtmp->host, dnew->host) < 0)
{
INSERT_LEFT(dnew, dtmp, mud->f_desc, next, prev);
break;
}
}
if (dtmp == NULL)
{
LINK(dnew, mud->f_desc, mud->l_desc, next, prev);
}
// Actual player counting
int unique_players(void)
{
DESCRIPTOR_DATA *desc;
int cnt;
for (desc = mud->f_desc ; desc ; desc = desc->next)
{
if (desc->next && !strcmp(desc->host, desc->next->host))
{
continue;
}
cnt++;
}
return cnt;
}
// Utility macro
#define INSERT_LEFT(link, rght, first, next, prev) \
{ \
(link)->prev = (rght)->prev; \
(rght)->prev = (link); \
(link)->next = (rght); \
\
if ((link)->prev) \
{ \
(link)->prev->next = (link); \
} \
else \
{ \
(first) = (link); \
} \
}
// Inside the new_descriptor function in comm.c:
for (dtmp = mud->f_desc ; dtmp ; dtmp = dtmp->next)
{
if (strcmp(dtmp->host, dnew->host) < 0)
{
INSERT_LEFT(dnew, dtmp, mud->f_desc, next, prev);
break;
}
}
if (dtmp == NULL)
{
LINK(dnew, mud->f_desc, mud->l_desc, next, prev);
}
// The actual player counting
int unique_players(void)
{
DESCRIPTOR_DATA *desc;
int cnt = 0;
for (desc = mud->f_desc ; desc ; desc = desc->next)
{
if (desc->connected < CON_PLAYING)
{
continue;
}
cnt++;
while (desc->next && !strcmp(desc->host, desc->next->host))
{
desc = desc->next;
}
}
return cnt;
}
1. I removed "Educational" from the genre list since it's not a genre, it's still listed in the gameplay list.
2. I added "None" as an option to GENRE, SUBGENRE, GAMEPLAY, and GAMESYSTEM. Mainly for social and educational muds.
3. In the case a World variable's value can't be calculated "-1" should be returned.
4. Now mentions specifically that if no Intermud protocol is supported an empty string should be returned.
I think that settles the most important issues that have been brought forth.