ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/server/player.C
(Generate patch)

Comparing deliantra/server/server/player.C (file contents):
Revision 1.111 by root, Mon Apr 23 11:43:22 2007 UTC vs.
Revision 1.112 by root, Tue Apr 24 00:42:02 2007 UTC

868 * appropriate action with it (change race, or other things). 868 * appropriate action with it (change race, or other things).
869 * The function name is for historical reasons - now we have 869 * The function name is for historical reasons - now we have
870 * separate race and class; this actually changes the RACE, 870 * separate race and class; this actually changes the RACE,
871 * not the class. 871 * not the class.
872 */ 872 */
873int 873void
874key_change_class (object *op, char key) 874player::chargen_race_done ()
875{ 875{
876 int tmp_loop;
877
878 if (key == 'd' || key == 'D')
879 {
880 char buf[MAX_BUF];
881
882 /* this must before then initial items are given */ 876 /* this must before then initial items are given */
883 esrv_new_player (op->contr, op->weight + op->carrying); 877 esrv_new_player (ob->contr, ob->weight + ob->carrying);
884 878
885 treasurelist *tl = treasurelist::find ("starting_wealth"); 879 treasurelist *tl = treasurelist::find ("starting_wealth");
886 if (tl) 880 if (tl)
887 create_treasure (tl, op, 0, 0, 0); 881 create_treasure (tl, ob, 0, 0, 0);
888 882
889 INVOKE_PLAYER (BIRTH, op->contr); 883 INVOKE_PLAYER (BIRTH, ob->contr);
890 INVOKE_PLAYER (LOGIN, op->contr); 884 INVOKE_PLAYER (LOGIN, ob->contr);
891 885
892 op->contr->ns->state = ST_PLAYING; 886 ob->contr->ns->state = ST_PLAYING;
893 887
894 if (op->msg) 888 if (ob->msg)
895 op->msg = NULL; 889 ob->msg = 0;
896 890
897 /* We create this now because some of the unique maps will need it 891 /* We create this now because some of the unique maps will need it
898 * to save here. 892 * to save here.
899 */ 893 */
894 {
895 char buf[MAX_BUF];
900 sprintf (buf, "%s/%s/%s", settings.localdir, settings.playerdir, &op->name); 896 sprintf (buf, "%s/%s/%s", settings.localdir, settings.playerdir, &ob->name);
901 make_path_to_file (buf); 897 make_path_to_file (buf);
898 }
902 899
903 start_info (op); 900 start_info (ob);
904 CLEAR_FLAG (op, FLAG_WIZ); 901 CLEAR_FLAG (ob, FLAG_WIZ);
905 give_initial_items (op, op->randomitems); 902 give_initial_items (ob, ob->randomitems);
906 link_player_skills (op); 903 link_player_skills (ob);
907 esrv_send_inventory (op, op); 904 esrv_send_inventory (ob, ob);
908 op->update_stats (); 905 ob->update_stats ();
909 906
910 /* This moves the player to a different start map, if there 907 /* This moves the player to a different start map, if there
911 * is one for this race 908 * is one for this race
912 */ 909 */
913 if (*first_map_ext_path) 910 if (*first_map_ext_path)
914 { 911 {
915 object *tmp; 912 object *tmp;
916 char mapname[MAX_BUF]; 913 char mapname[MAX_BUF];
917 914
918 snprintf (mapname, MAX_BUF - 1, "%s/%s", &first_map_ext_path, &op->arch->name); 915 snprintf (mapname, MAX_BUF - 1, "%s/%s", &first_map_ext_path, &ob->arch->name);
919 tmp = object::create (); 916 tmp = object::create ();
920 EXIT_PATH (tmp) = mapname; 917 EXIT_PATH (tmp) = mapname;
921 EXIT_X (tmp) = op->x; 918 EXIT_X (tmp) = ob->x;
922 EXIT_Y (tmp) = op->y; 919 EXIT_Y (tmp) = ob->y;
923 op->enter_exit (tmp); /* we don't really care if it succeeded; 920 ob->enter_exit (tmp); /* we don't really care if it succeeded;
924 * if the map isn't there, then stay on the 921 * if the map isn't there, then stay on the
925 * default initial map */ 922 * default initial map */
926 tmp->destroy (); 923 tmp->destroy ();
927 } 924 }
928 else 925 else
929 LOG (llevDebug, "first_map_ext_path not set\n"); 926 LOG (llevDebug, "first_map_ext_path not set\n");
927}
930 928
931 return 0; 929void
932 } 930player::chargen_race_next ()
933 931{
934 /* Following actually changes the race - this is the default command 932 /* Following actually changes the race - this is the default command
935 * if we don't match with one of the options above. 933 * if we don't match with one of the options above.
936 */ 934 */
937 935
938 tmp_loop = 0; 936 do
939 while (!tmp_loop)
940 { 937 {
941 shstr name = op->name; 938 shstr name = ob->name;
942 int x = op->x, y = op->y; 939 int x = ob->x, y = ob->y;
943 940
944 op->remove_statbonus (); 941 ob->remove_statbonus ();
945 op->remove (); 942 ob->remove ();
946 op->arch = get_player_archetype (op->arch); 943 ob->arch = get_player_archetype (ob->arch);
947 op->arch->clone.copy_to (op); 944 ob->arch->clone.copy_to (ob);
948 op->instantiate (); 945 ob->instantiate ();
949 op->stats = op->contr->orig_stats; 946 ob->stats = ob->contr->orig_stats;
950 op->name = op->name_pl = name; 947 ob->name = ob->name_pl = name;
951 op->x = x; 948 ob->x = x;
952 op->y = y; 949 ob->y = y;
953 SET_ANIMATION (op, 2); /* So player faces south */ 950 SET_ANIMATION (ob, 2); /* So player faces south */
954 insert_ob_in_map (op, op->map, op, 0); 951 insert_ob_in_map (ob, ob->map, ob, 0);
955 assign (op->contr->title, op->arch->clone.name); 952 assign (ob->contr->title, ob->arch->clone.name);
956 op->add_statbonus (); 953 ob->add_statbonus ();
957 tmp_loop = allowed_class (op);
958 } 954 }
955 while (!allowed_class (ob));
959 956
960 update_object (op, UP_OBJ_FACE); 957 update_object (ob, UP_OBJ_FACE);
961 esrv_update_item (UPD_FACE, op, op); 958 esrv_update_item (UPD_FACE, ob, ob);
962 op->update_stats (); 959 ob->update_stats ();
963 op->stats.hp = op->stats.maxhp; 960 ob->stats.hp = ob->stats.maxhp;
964 op->stats.sp = op->stats.maxsp; 961 ob->stats.sp = ob->stats.maxsp;
965 op->stats.grace = 0; 962 ob->stats.grace = 0;
966
967 if (op->msg)
968 new_draw_info (NDI_BLUE, 0, op, op->msg);
969
970 send_query (op->contr->ns, CS_QUERY_SINGLECHAR, "Press any key for the next race.\nPress `d' to play this race.\n");
971 return 0;
972} 963}
973 964
974void 965void
975flee_player (object *op) 966flee_player (object *op)
976{ 967{

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines