… | |
… | |
451 | { |
451 | { |
452 | art = find_artifactlist (at->type)->items; |
452 | art = find_artifactlist (at->type)->items; |
453 | |
453 | |
454 | while (art) |
454 | while (art) |
455 | { |
455 | { |
456 | if (!strcmp (art->item->name, cp)) |
456 | if (!strcmp (&art->item->name, cp)) |
457 | break; |
457 | break; |
458 | |
458 | |
459 | art = art->next; |
459 | art = art->next; |
460 | } |
460 | } |
461 | |
461 | |
… | |
… | |
889 | new_draw_info (NDI_UNIQUE, 0, op, "Who?"); |
889 | new_draw_info (NDI_UNIQUE, 0, op, "Who?"); |
890 | return 1; |
890 | return 1; |
891 | } |
891 | } |
892 | |
892 | |
893 | for_all_players (pl) |
893 | for_all_players (pl) |
894 | if (!strcmp (pl->ob->name, thing)) |
894 | if (!strcmp (&pl->ob->name, thing)) |
895 | { |
895 | { |
896 | sprintf (buf, "Str : %-2d H.P. : %-4d MAX : %d", pl->ob->stats.Str, pl->ob->stats.hp, pl->ob->stats.maxhp); |
896 | sprintf (buf, "Str : %-2d H.P. : %-4d MAX : %d", pl->ob->stats.Str, pl->ob->stats.hp, pl->ob->stats.maxhp); |
897 | new_draw_info (NDI_UNIQUE, 0, op, buf); |
897 | new_draw_info (NDI_UNIQUE, 0, op, buf); |
898 | sprintf (buf, "Dex : %-2d S.P. : %-4d MAX : %d", pl->ob->stats.Dex, pl->ob->stats.sp, pl->ob->stats.maxsp); |
898 | sprintf (buf, "Dex : %-2d S.P. : %-4d MAX : %d", pl->ob->stats.Dex, pl->ob->stats.sp, pl->ob->stats.maxsp); |
899 | new_draw_info (NDI_UNIQUE, 0, op, buf); |
899 | new_draw_info (NDI_UNIQUE, 0, op, buf); |
… | |
… | |
942 | return 1; |
942 | return 1; |
943 | } |
943 | } |
944 | |
944 | |
945 | for_all_players (pl) |
945 | for_all_players (pl) |
946 | { |
946 | { |
947 | if (!strcmp (pl->ob->name, thing)) |
947 | if (!strcmp (&pl->ob->name, thing)) |
948 | { |
948 | { |
949 | if (!strcmp ("str", thing2)) pl->ob->stats.Str = iii, pl->orig_stats.Str = iii; |
949 | if (!strcmp ("str", thing2)) pl->ob->stats.Str = iii, pl->orig_stats.Str = iii; |
950 | if (!strcmp ("dex", thing2)) pl->ob->stats.Dex = iii, pl->orig_stats.Dex = iii; |
950 | if (!strcmp ("dex", thing2)) pl->ob->stats.Dex = iii, pl->orig_stats.Dex = iii; |
951 | if (!strcmp ("con", thing2)) pl->ob->stats.Con = iii, pl->orig_stats.Con = iii; |
951 | if (!strcmp ("con", thing2)) pl->ob->stats.Con = iii, pl->orig_stats.Con = iii; |
952 | if (!strcmp ("wis", thing2)) pl->ob->stats.Wis = iii, pl->orig_stats.Wis = iii; |
952 | if (!strcmp ("wis", thing2)) pl->ob->stats.Wis = iii, pl->orig_stats.Wis = iii; |
… | |
… | |
970 | { /* 'nodm' is alias */ |
970 | { /* 'nodm' is alias */ |
971 | CLEAR_FLAG (op, FLAG_WIZ); |
971 | CLEAR_FLAG (op, FLAG_WIZ); |
972 | CLEAR_FLAG (op, FLAG_WIZPASS); |
972 | CLEAR_FLAG (op, FLAG_WIZPASS); |
973 | CLEAR_FLAG (op, FLAG_WIZCAST); |
973 | CLEAR_FLAG (op, FLAG_WIZCAST); |
974 | CLEAR_FLAG (op, FLAG_WIZLOOK); |
974 | CLEAR_FLAG (op, FLAG_WIZLOOK); |
|
|
975 | op->contr->do_los = 1; |
975 | |
976 | |
976 | if (op->contr->hidden) |
977 | if (op->contr->hidden) |
977 | { |
978 | { |
978 | new_draw_info (NDI_UNIQUE, 0, op, "You are no longer hidden from other players"); |
979 | new_draw_info (NDI_UNIQUE, 0, op, "You are no longer hidden from other players"); |
979 | op->map->players++; |
980 | op->map->players++; |
… | |
… | |
981 | op->contr->hidden = 0; |
982 | op->contr->hidden = 0; |
982 | op->invisible = 1; |
983 | op->invisible = 1; |
983 | } |
984 | } |
984 | else |
985 | else |
985 | new_draw_info (NDI_UNIQUE | NDI_ALL | NDI_LT_GREEN, 1, NULL, "The Dungeon Master is gone.."); |
986 | new_draw_info (NDI_UNIQUE | NDI_ALL | NDI_LT_GREEN, 1, NULL, "The Dungeon Master is gone.."); |
|
|
987 | |
986 | return 1; |
988 | return 1; |
987 | } |
989 | } |
988 | |
990 | |
989 | /** |
991 | /** |
990 | * object *op is trying to become dm. |
992 | * object *op is trying to become dm. |
… | |
… | |
1045 | { |
1047 | { |
1046 | SET_FLAG (op, FLAG_WIZ); |
1048 | SET_FLAG (op, FLAG_WIZ); |
1047 | SET_FLAG (op, FLAG_WIZPASS); |
1049 | SET_FLAG (op, FLAG_WIZPASS); |
1048 | SET_FLAG (op, FLAG_WIZCAST); |
1050 | SET_FLAG (op, FLAG_WIZCAST); |
1049 | SET_FLAG (op, FLAG_WIZLOOK); |
1051 | SET_FLAG (op, FLAG_WIZLOOK); |
|
|
1052 | op->contr->do_los = 1; |
1050 | |
1053 | |
1051 | new_draw_info (NDI_UNIQUE, 0, op, "Ok, you are the Dungeon Master!"); |
1054 | new_draw_info (NDI_UNIQUE, 0, op, "Ok, you are the Dungeon Master!"); |
1052 | op->contr->write_buf[0] = '\0'; |
1055 | op->contr->write_buf[0] = '\0'; |
1053 | |
1056 | |
1054 | if (!silent) |
1057 | if (!silent) |
… | |
… | |
1096 | * Returns spell object (from archetypes) by name. |
1099 | * Returns spell object (from archetypes) by name. |
1097 | * Returns NULL if 0 or more than one spell matches. |
1100 | * Returns NULL if 0 or more than one spell matches. |
1098 | * Used for wizard's learn spell/prayer. |
1101 | * Used for wizard's learn spell/prayer. |
1099 | * |
1102 | * |
1100 | * op is the player issuing the command. |
1103 | * op is the player issuing the command. |
1101 | * |
|
|
1102 | * Ignores archetypes "spelldirect_xxx" since these archetypes are not used |
|
|
1103 | * anymore (but may still be present in some player's inventories and thus |
|
|
1104 | * cannot be removed). We have to ignore them here since they have the same |
|
|
1105 | * name than other "spell_xxx" archetypes and would always conflict. |
|
|
1106 | */ |
1104 | */ |
1107 | static object * |
1105 | static object * |
1108 | get_spell_by_name (object *op, const char *spell_name) |
1106 | get_spell_by_name (object *op, shstr_cmp spell_name) |
1109 | { |
1107 | { |
1110 | archetype *at; |
1108 | archetype *at; |
1111 | archetype *found; |
1109 | archetype *found; |
1112 | int conflict_found; |
1110 | int conflict_found; |
1113 | size_t spell_name_length; |
1111 | size_t spell_name_length; |
… | |
… | |
1118 | for_all_archetypes (at) |
1116 | for_all_archetypes (at) |
1119 | { |
1117 | { |
1120 | if (at->type != SPELL) |
1118 | if (at->type != SPELL) |
1121 | continue; |
1119 | continue; |
1122 | |
1120 | |
1123 | if (strncmp (at->archname, "spelldirect_", 12) == 0) |
1121 | if (at->object::name != spell_name) |
1124 | continue; |
1122 | continue; |
1125 | |
1123 | |
1126 | if (strcmp (at->object::name, spell_name) != 0) |
|
|
1127 | continue; |
|
|
1128 | |
|
|
1129 | if (found != NULL) |
1124 | if (found) |
1130 | { |
1125 | { |
1131 | if (!conflict_found) |
1126 | if (!conflict_found) |
1132 | { |
1127 | { |
1133 | conflict_found = 1; |
1128 | conflict_found = 1; |
1134 | new_draw_info_format (NDI_UNIQUE, 0, op, "More than one archetype matches the spell name %s:", spell_name); |
1129 | new_draw_info_format (NDI_UNIQUE, 0, op, "More than one archetype matches the spell name %s:", &spell_name); |
1135 | new_draw_info_format (NDI_UNIQUE, 0, op, "- %s", &found->archname); |
1130 | new_draw_info_format (NDI_UNIQUE, 0, op, "- %s", &found->archname); |
1136 | } |
1131 | } |
1137 | |
1132 | |
1138 | new_draw_info_format (NDI_UNIQUE, 0, op, "- %s", &at->archname); |
1133 | new_draw_info_format (NDI_UNIQUE, 0, op, "- %s", &at->archname); |
1139 | continue; |
1134 | continue; |
… | |
… | |
1168 | if (found != NULL) |
1163 | if (found != NULL) |
1169 | { |
1164 | { |
1170 | if (!conflict_found) |
1165 | if (!conflict_found) |
1171 | { |
1166 | { |
1172 | conflict_found = 1; |
1167 | conflict_found = 1; |
1173 | new_draw_info_format (NDI_UNIQUE, 0, op, "More than one spell matches %s:", spell_name); |
1168 | new_draw_info_format (NDI_UNIQUE, 0, op, "More than one spell matches %s:", &spell_name); |
1174 | new_draw_info_format (NDI_UNIQUE, 0, op, "- %s", &found->object::name); |
1169 | new_draw_info_format (NDI_UNIQUE, 0, op, "- %s", &found->object::name); |
1175 | } |
1170 | } |
1176 | new_draw_info_format (NDI_UNIQUE, 0, op, "- %s", &at->object::name); |
1171 | new_draw_info_format (NDI_UNIQUE, 0, op, "- %s", &at->object::name); |
1177 | continue; |
1172 | continue; |
1178 | } |
1173 | } |
… | |
… | |
1187 | /* Return if exactly one archetype matches. */ |
1182 | /* Return if exactly one archetype matches. */ |
1188 | if (found != NULL) |
1183 | if (found != NULL) |
1189 | return arch_to_object (found); |
1184 | return arch_to_object (found); |
1190 | |
1185 | |
1191 | /* No spell found: just print an error message. */ |
1186 | /* No spell found: just print an error message. */ |
1192 | new_draw_info_format (NDI_UNIQUE, 0, op, "The spell %s does not exist.", spell_name); |
1187 | new_draw_info_format (NDI_UNIQUE, 0, op, "The spell %s does not exist.", &spell_name); |
1193 | return NULL; |
1188 | return NULL; |
1194 | } |
1189 | } |
1195 | |
1190 | |
1196 | static int |
1191 | static int |
1197 | command_learn_spell_or_prayer (object *op, char *params, int special_prayer) |
1192 | command_learn_spell_or_prayer (object *op, char *params, int special_prayer) |