… | |
… | |
133 | void |
133 | void |
134 | start_info (object *op) |
134 | start_info (object *op) |
135 | { |
135 | { |
136 | char buf[MAX_BUF]; |
136 | char buf[MAX_BUF]; |
137 | |
137 | |
138 | sprintf (buf, "Welcome to Crossfire, v%s!", VERSION); |
138 | sprintf (buf, "Welcome to Crossfire v%s!", VERSION); |
139 | new_draw_info (NDI_UNIQUE, 0, op, buf); |
139 | new_draw_info (NDI_UNIQUE, 0, op, buf); |
140 | new_draw_info (NDI_UNIQUE, 0, op, "Press `?' for help"); |
140 | new_draw_info (NDI_UNIQUE, 0, op, "Press `?' for help"); |
141 | new_draw_info (NDI_UNIQUE, 0, op, " "); |
141 | new_draw_info (NDI_UNIQUE, 0, op, " "); |
142 | new_draw_info_format (NDI_UNIQUE | NDI_ALL | NDI_DK_ORANGE, 5, op, "%s entered the game.", &op->name); |
142 | new_draw_info_format (NDI_UNIQUE | NDI_ALL | NDI_DK_ORANGE, 5, op, "%s entered the game.", &op->name); |
143 | if (!op->contr->name_changed) |
|
|
144 | { |
|
|
145 | new_draw_info (NDI_UNIQUE, 0, op, "Note that you must set your name with the name"); |
|
|
146 | new_draw_info (NDI_UNIQUE, 0, op, "command to enter the highscore list."); |
|
|
147 | new_draw_info (NDI_UNIQUE, 0, op, "(You can also use the crossfire.name X-resource.)"); |
|
|
148 | } |
|
|
149 | } |
|
|
150 | |
|
|
151 | /* Really, there is no reason to crypt the passwords any system. But easier |
|
|
152 | * to just leave this enabled for backward compatibility. Put the |
|
|
153 | * simple case at top - no encryption - makes it easier to read. |
|
|
154 | */ |
|
|
155 | char * |
|
|
156 | crypt_string (char *str, char *salt) |
|
|
157 | { |
|
|
158 | #if (defined(__FreeBSD__) && !defined(HAVE_LIBDES)) |
|
|
159 | return (str); |
|
|
160 | #else |
|
|
161 | static char *c = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789./"; |
|
|
162 | char s[2]; |
|
|
163 | |
|
|
164 | if (salt == NULL) |
|
|
165 | s[0] = c[RANDOM () % (int) strlen (c)], s[1] = c[RANDOM () % (int) strlen (c)]; |
|
|
166 | else |
|
|
167 | s[0] = salt[0], s[1] = salt[1]; |
|
|
168 | |
|
|
169 | # ifdef HAVE_LIBDES |
|
|
170 | return (char *) des_crypt (str, s); |
|
|
171 | # endif |
|
|
172 | /* Default case - just use crypt */ |
|
|
173 | return (char *) crypt (str, s); |
|
|
174 | #endif |
|
|
175 | } |
|
|
176 | |
|
|
177 | int |
|
|
178 | check_password (char *typed, char *crypted) |
|
|
179 | { |
|
|
180 | return !strcmp (crypt_string (typed, crypted), crypted); |
|
|
181 | } |
143 | } |
182 | |
144 | |
183 | /* This is a basic little function to put the player back to his |
145 | /* This is a basic little function to put the player back to his |
184 | * savebed. We do some error checking - its possible that the |
146 | * savebed. We do some error checking - its possible that the |
185 | * savebed map may no longer exist, so we make sure the player |
147 | * savebed map may no longer exist, so we make sure the player |