version 1.163 | | version 1.164 |
---|
| | |
/* | | /* |
* static char *rcsid_player_c = | | * static char *rcsid_player_c = |
* "$Id: player.c,v 1.163 2005/05/21 17:35:31 tchize Exp $"; | | * "$Id: player.c,v 1.164 2005/05/29 15:37:54 tchize Exp $"; |
*/ | | */ |
| | |
/* | | /* |
| | |
motd[0]='\0'; | | motd[0]='\0'; |
size=0; | | size=0; |
while (fgets(buf, MAX_BUF, fp) != NULL) { | | while (fgets(buf, MAX_BUF, fp) != NULL) { |
char *cp; | | |
if( *buf == '#') | | if( *buf == '#') |
continue; | | continue; |
/*cp=strchr(buf, '\n'); | | |
if (cp != NULL) | | |
*cp='\0';*/ | | |
strncat(motd+size,buf,HUGE_BUF-size); | | strncat(motd+size,buf,HUGE_BUF-size); |
size+=strlen(buf); | | size+=strlen(buf); |
} | | } |
| | |
close_and_delete(fp, comp); | | close_and_delete(fp, comp); |
} | | } |
| | |
| | void send_rules(object *op) { |
| | char buf[MAX_BUF]; |
| | char rules[HUGE_BUF]; |
| | FILE *fp; |
| | int comp; |
| | int size; |
| | |
| | sprintf(buf, "%s/%s", settings.confdir, settings.rules); |
| | if ((fp=open_and_uncompress(buf, 0, &comp)) == NULL) { |
| | return; |
| | } |
| | rules[0]='\0'; |
| | size=0; |
| | while (fgets(buf, MAX_BUF, fp) != NULL) { |
| | if( *buf == '#') |
| | continue; |
| | strncat(rules+size,buf,HUGE_BUF-size); |
| | size+=strlen(buf); |
| | } |
| | draw_ext_info(NDI_UNIQUE | NDI_GREEN, 0, op, MSG_TYPE_ADMIN, MSG_TYPE_ADMIN_RULES, rules, NULL); |
| | close_and_delete(fp, comp); |
| | } |
| | |
| | void send_news(object *op) { |
| | char buf[MAX_BUF]; |
| | char news[HUGE_BUF]; |
| | char subject[MAX_BUF]; |
| | FILE *fp; |
| | int comp; |
| | int size; |
| | |
| | sprintf(buf, "%s/%s", settings.confdir, settings.news); |
| | if ((fp=open_and_uncompress(buf, 0, &comp)) == NULL) |
| | return; |
| | news[0]='\0'; |
| | subject[0]='\0'; |
| | size=0; |
| | while (fgets(buf, MAX_BUF, fp) != NULL) { |
| | if( *buf == '#') |
| | continue; |
| | if ( *buf =='%'){ /* send one news */ |
| | if (size>0) |
| | draw_ext_info_format(NDI_UNIQUE | NDI_GREEN, 0, op, |
| | MSG_TYPE_ADMIN, MSG_TYPE_ADMIN_NEWS, |
| | "!! informations: %s\n%s", |
| | "%s\n%s", |
| | subject, news); /*send previously read news*/ |
| | strcpy(subject,buf+1); |
| | strip_endline(subject); |
| | size=0; |
| | news[0]='\0'; |
| | } |
| | else{ |
| | strncat(news+size,buf,HUGE_BUF-size); |
| | size+=strlen(buf); |
| | } |
| | } |
| | |
| | draw_ext_info_format(NDI_UNIQUE | NDI_GREEN, 0, op, |
| | MSG_TYPE_ADMIN, MSG_TYPE_ADMIN_NEWS, |
| | "!! informations: %s\n%s\n", |
| | "%s\n%s", |
| | subject, news); |
| | close_and_delete(fp, comp); |
| | } |
| | |
int playername_ok(char *cp) { | | int playername_ok(char *cp) { |
/* Don't allow - or _ as first character in the name */ | | /* Don't allow - or _ as first character in the name */ |
if (*cp == '-' || *cp == '_') return 0; | | if (*cp == '-' || *cp == '_') return 0; |
| | |
| | |
CLEAR_FLAG(p->ob, FLAG_FRIENDLY); | | CLEAR_FLAG(p->ob, FLAG_FRIENDLY); |
add_friendly_object(p->ob); | | add_friendly_object(p->ob); |
| | send_rules(p->ob); |
| | send_news(p->ob); |
display_motd(p->ob); | | display_motd(p->ob); |
get_name(p->ob); | | get_name(p->ob); |
return 0; | | return 0; |