… | |
… | |
37 | player * |
37 | player * |
38 | find_player (const char *plname) |
38 | find_player (const char *plname) |
39 | { |
39 | { |
40 | player *pl; |
40 | player *pl; |
41 | |
41 | |
42 | for (pl = first_player; pl != NULL; pl = pl->next) |
42 | for (pl = first_player; pl; pl = pl->next) |
43 | { |
43 | { |
44 | if (pl->ob != NULL && !strcmp (query_name (pl->ob), plname)) |
44 | if (pl->obL && !strcmp (query_name (pl->ob), plname)) |
45 | return pl; |
45 | return pl; |
46 | }; |
46 | }; |
|
|
47 | |
47 | return NULL; |
48 | return 0; |
48 | } |
49 | } |
49 | |
50 | |
50 | player * |
51 | player * |
51 | find_player_partial_name (const char *plname) |
52 | find_player_partial_name (const char *plname) |
52 | { |
53 | { |
53 | player *pl; |
54 | player *pl; |
54 | player *found = NULL; |
55 | player *found = NULL; |
55 | size_t namelen = strlen (plname); |
56 | size_t namelen = strlen (plname); |
56 | |
57 | |
57 | for (pl = first_player; pl != NULL; pl = pl->next) |
58 | for (pl = first_player; pl; pl = pl->next) |
58 | { |
59 | { |
59 | if ((size_t) strlen (pl->ob->name) < namelen) |
60 | if ((size_t) strlen (pl->ob->name) < namelen) |
60 | continue; |
61 | continue; |
61 | |
62 | |
62 | if (!strcmp (pl->ob->name, plname)) |
63 | if (!strcmp (pl->ob->name, plname)) |
63 | return pl; |
64 | return pl; |
64 | |
65 | |
65 | if (!strncasecmp (pl->ob->name, plname, namelen)) |
66 | if (!strncasecmp (pl->ob->name, plname, namelen)) |
66 | { |
67 | { |
67 | if (found) |
68 | if (found) |
68 | return NULL; |
69 | return 0; |
69 | |
70 | |
70 | found = pl; |
71 | found = pl; |
71 | } |
72 | } |
72 | } |
73 | } |
|
|
74 | |
73 | return found; |
75 | return found; |
74 | } |
76 | } |
75 | |
77 | |
76 | void |
78 | void |
77 | display_motd (const object *op) |
79 | display_motd (const object *op) |
… | |
… | |
87 | return; |
89 | return; |
88 | |
90 | |
89 | motd[0] = '\0'; |
91 | motd[0] = '\0'; |
90 | size = 0; |
92 | size = 0; |
91 | |
93 | |
92 | while (fgets (buf, MAX_BUF, fp) != NULL) |
94 | while (fgets (buf, MAX_BUF, fp)) |
93 | { |
95 | { |
94 | if (*buf == '#') |
96 | if (*buf == '#') |
95 | continue; |
97 | continue; |
96 | |
98 | |
97 | strncat (motd + size, buf, HUGE_BUF - size); |
99 | strncat (motd + size, buf, HUGE_BUF - size); |
… | |
… | |
116 | return; |
118 | return; |
117 | |
119 | |
118 | rules[0] = '\0'; |
120 | rules[0] = '\0'; |
119 | size = 0; |
121 | size = 0; |
120 | |
122 | |
121 | while (fgets (buf, MAX_BUF, fp) != NULL) |
123 | while (fgets (buf, MAX_BUF, fp)) |
122 | { |
124 | { |
123 | if (*buf == '#') |
125 | if (*buf == '#') |
124 | continue; |
126 | continue; |
125 | |
127 | |
126 | if (size + strlen (buf) >= HUGE_BUF) |
128 | if (size + strlen (buf) >= HUGE_BUF) |