… | |
… | |
211 | player::connect (client *ns) |
211 | player::connect (client *ns) |
212 | { |
212 | { |
213 | this->ns = ns; |
213 | this->ns = ns; |
214 | ns->pl = this; |
214 | ns->pl = this; |
215 | |
215 | |
|
|
216 | run_on = 0; |
|
|
217 | fire_on = 0; |
|
|
218 | |
216 | ns->update_look = 0; |
219 | ns->update_look = 0; |
217 | ns->look_position = 0; |
220 | ns->look_position = 0; |
218 | |
221 | |
219 | clear_los (ob); |
222 | clear_los (ob); |
220 | |
223 | |
221 | //TODO: must move into client |
224 | ns->reset_stats (); |
222 | /* we need to clear these to -1 and not zero - otherwise, |
|
|
223 | * if a player quits and starts a new character, we wont |
|
|
224 | * send new values to the client, as things like exp start |
|
|
225 | * at zero. |
|
|
226 | */ |
|
|
227 | for (int i = 0; i < NUM_SKILLS; i++) |
|
|
228 | last_skill_exp[i] = -1; |
|
|
229 | |
|
|
230 | for (int i = 0; i < NROFATTACKS; i++) |
|
|
231 | last_resist[i] = -1; |
|
|
232 | |
|
|
233 | last_weapon_sp = -1; |
|
|
234 | last_level = -1; |
|
|
235 | last_stats.exp = -1; |
|
|
236 | last_weight = (uint32) - 1; |
|
|
237 | last_flags = 0; |
|
|
238 | last_weight = 0; |
|
|
239 | last_weight_limit = 0; |
|
|
240 | last_path_attuned = 0; |
|
|
241 | last_path_repelled = 0; |
|
|
242 | last_path_denied = 0; |
|
|
243 | last_speed = 0; |
|
|
244 | run_on = 0; |
|
|
245 | fire_on = 0; |
|
|
246 | memset (&last_stats, 0, sizeof (living)); //TODO dirty |
|
|
247 | |
225 | |
248 | /* make sure he's a player -- needed because of class change. */ |
226 | /* make sure he's a player -- needed because of class change. */ |
249 | ob->type = PLAYER; // we are paranoid |
227 | ob->type = PLAYER; // we are paranoid |
250 | ob->race = ob->arch->clone.race; |
228 | ob->race = ob->arch->clone.race; |
251 | |
229 | |
… | |
… | |
914 | * to save here. |
892 | * to save here. |
915 | */ |
893 | */ |
916 | sprintf (buf, "%s/%s/%s", settings.localdir, settings.playerdir, &op->name); |
894 | sprintf (buf, "%s/%s/%s", settings.localdir, settings.playerdir, &op->name); |
917 | make_path_to_file (buf); |
895 | make_path_to_file (buf); |
918 | |
896 | |
919 | #ifdef AUTOSAVE |
|
|
920 | op->contr->last_save_tick = pticks; |
|
|
921 | #endif |
|
|
922 | start_info (op); |
897 | start_info (op); |
923 | CLEAR_FLAG (op, FLAG_WIZ); |
898 | CLEAR_FLAG (op, FLAG_WIZ); |
924 | give_initial_items (op, op->randomitems); |
899 | give_initial_items (op, op->randomitems); |
925 | link_player_skills (op); |
900 | link_player_skills (op); |
926 | esrv_send_inventory (op, op); |
901 | esrv_send_inventory (op, op); |