Example #1
0
static int		check_room(t_env *env, t_parser *p)
{
	char	**splitted;

	if (!(splitted = ft_strsplit(p->line, ' ')))
		error_quit("Failed to malloc split");
	if (splitted[0] && splitted[1] && splitted[2] && !splitted[3])
		return (parse_room(env, p, splitted));
	else if (splitted[0] && splitted[1])
		return (0);
	return (-1);
}
Example #2
0
void fmap (CHAR_DATA * ch, bool forced, bool range, char *argument)
{
char buf1[70];
char buf2[70];
char buf3[70];
int i,j;
int total = 0;
CHAR_DATA * fighters[16];
int fightcount = 0;
CHAR_DATA *rch;
int theturn = 0;

if(!ch->in_room->map.init)
{
ch->in_room->map.init = TRUE;
generate_random_terrain(ch->in_room);
}   

if (IS_SET (ch->comm, COMM_NOMAP) && forced == TRUE)
return;

    for (rch = ch->in_room->people; rch != NULL; rch = rch->next_in_room)
    {
    if(rch->infight)
        {
        if(TURN(rch))
        theturn = 1;
        fighters[fightcount] = rch;
        fightcount++;
        }
     }

printf_to_char(ch,"\n\r%s",echo_off_str);

printf_to_char(ch," {y 0123456789abcdefghijklmnop{x\n\r");
printf_to_char(ch," ----------------------------  |-----------------------------------------------|\n\r");
for(i=0;i<16;i++)
{
char buf2[MSL];
printf_to_char(ch,"{W%c|{x",gridname[i]);
for(j=0;j<26;j++)
{
total += parse_room(ch,i,j,range);
}
if(i < fightcount)
{

sprintf(buf2," %s{x{w{W - %s%-19s {C %3dAT %5dHP %5dMP{W",fighters[i]->fdisp,get_t_color(fighters[i]),fcn(fighters[i]),fighters[i]->AT,fighters[i]->hit,fighters[i]->mana);
}
else
sprintf(buf2,"{x%47s{x"," ");
printf_to_char(ch,"{W|%c |%s|\n\r",gridname[i],buf2);
}

if(ch->in_room->turn != NULL)
{
char buf7[40];
CHAR_DATA *rch = ch->in_room->turn;

if(rch->level > 99)
sprintf(buf7,"{gL{W**{c ---{bexp{W             | PA MA BR FA MV JM SP |");
else
sprintf(buf7,"{gL{R%2d{c %3d{bexp{W             | PA MA BR FA MV JM SP |",rch->level,((rch->level + 1) * 100) - rch->exp);
 
sprintf(buf1," %s%-23s{W|{r%4d{c/{r%4d{RHP {g%3d{c/{g%3d{GMP{W |",get_t_color(rch),fcn(rch),rch->hit,rch->max_hit,rch->mana,rch->max_mana);
sprintf(buf2," %s",buf7);
sprintf(buf3,"                        | %2d %2d %2d %2d %2d %2d %2d {W|",rch->PhysAttack,rch->MagAttack,
rch->Brave,rch->Faith,rch->MoveLeft,rch->jump,rch->speed);
printf_to_char(ch," {W----------------------------  |-----------------------------------------------|\n\r");
printf_to_char(ch," |{y0123456789abcdefghijklmnop{W|  |%-44s",buf1);
//parse_room(ch,(rch->mposy - 1),(rch->mposx - 1),FALSE);
//parse_room(ch,(rch->mposy - 1),rch->mposx,FALSE);
//parse_room(ch,(rch->mposy - 1),(rch->mposx + 1),FALSE);
printf_to_char(ch,"{W\n\r");
printf_to_char(ch," {W----------------------------  |%-44s",buf2);
//parse_room(ch,rch->mposy,(rch->mposx - 1),FALSE);
//parse_room(ch,rch->mposy,rch->mposx,FALSE);
//parse_room(ch,rch->mposy,(rch->mposx + 1),FALSE);
printf_to_char(ch,"{W\n\r");
printf_to_char(ch," {W|%-26s|  |%-44s",ch->in_room->name,buf3);
//parse_room(ch,(rch->mposy + 1),(rch->mposx - 1),FALSE);
//parse_room(ch,(rch->mposy + 1),rch->mposx,FALSE);
//parse_room(ch,(rch->mposy + 1),(rch->mposx + 1),FALSE);
printf_to_char(ch,"{W\n\r");
}


printf_to_char(ch," ----------------------------  |-----------------------------------------------|\n\r");



check_winner(ch->in_room);
printf_to_char(ch,"%s", echo_on_str);

}