… | |
… | |
1047 | { |
1047 | { |
1048 | object *tmp; |
1048 | object *tmp; |
1049 | |
1049 | |
1050 | if (!op || !op->contr) |
1050 | if (!op || !op->contr) |
1051 | return NULL; |
1051 | return NULL; |
|
|
1052 | |
1052 | if (!op->contr->mark) |
1053 | if (!op->contr->mark) |
1053 | { |
1054 | { |
1054 | |
|
|
1055 | /* new_draw_info(NDI_UNIQUE,0,op,"You have no marked object");*/ |
1055 | /* new_draw_info(NDI_UNIQUE,0,op,"You have no marked object");*/ |
1056 | return NULL; |
1056 | return 0; |
1057 | } |
1057 | } |
|
|
1058 | |
1058 | /* This may seem like overkill, but we need to make sure that they |
1059 | /* This may seem like overkill, but we need to make sure that they |
1059 | * player hasn't dropped the item. We use count on the off chance that |
1060 | * player hasn't dropped the item. We use count on the off chance that |
1060 | * an item got reincarnated at some point. |
1061 | * an item got reincarnated at some point. |
1061 | */ |
1062 | */ |
1062 | for (tmp = op->inv; tmp; tmp = tmp->below) |
1063 | for (tmp = op->inv; tmp; tmp = tmp->below) |
1063 | { |
1064 | { |
1064 | if (tmp->invisible) |
1065 | if (tmp->invisible) |
1065 | continue; |
1066 | continue; |
|
|
1067 | |
1066 | if (tmp == op->contr->mark) |
1068 | if (tmp == op->contr->mark) |
1067 | { |
1069 | { |
1068 | if (tmp->count == op->contr->mark_count) |
1070 | if (!tmp->destroyed ()) |
1069 | return tmp; |
1071 | return tmp; |
1070 | else |
1072 | else |
1071 | { |
1073 | { |
1072 | op->contr->mark = NULL; |
1074 | op->contr->mark = 0; |
1073 | op->contr->mark_count = 0; |
|
|
1074 | |
|
|
1075 | /* new_draw_info(NDI_UNIQUE,0,op,"You have no marked object");*/ |
1075 | /* new_draw_info(NDI_UNIQUE,0,op,"You have no marked object");*/ |
1076 | return NULL; |
1076 | return 0; |
1077 | } |
1077 | } |
1078 | } |
1078 | } |
1079 | } |
1079 | } |
|
|
1080 | |
1080 | return NULL; |
1081 | return 0; |
1081 | } |
1082 | } |
1082 | |
1083 | |
1083 | |
1084 | |
1084 | /* op should be a player, params is any params. |
1085 | /* op should be a player, params is any params. |
1085 | * If no params given, we print out the currently marked object. |
1086 | * If no params given, we print out the currently marked object. |
… | |
… | |
1088 | int |
1089 | int |
1089 | command_mark (object *op, char *params) |
1090 | command_mark (object *op, char *params) |
1090 | { |
1091 | { |
1091 | if (!op->contr) |
1092 | if (!op->contr) |
1092 | return 1; |
1093 | return 1; |
|
|
1094 | |
1093 | if (!params) |
1095 | if (!params) |
1094 | { |
1096 | { |
1095 | object *mark = find_marked_object (op); |
1097 | object *mark = find_marked_object (op); |
1096 | |
1098 | |
1097 | if (!mark) |
1099 | if (!mark) |
… | |
… | |
1109 | return 1; |
1111 | return 1; |
1110 | } |
1112 | } |
1111 | else |
1113 | else |
1112 | { |
1114 | { |
1113 | op->contr->mark = mark1; |
1115 | op->contr->mark = mark1; |
1114 | op->contr->mark_count = mark1->count; |
|
|
1115 | new_draw_info_format (NDI_UNIQUE, 0, op, "Marked item %s", query_name (mark1)); |
1116 | new_draw_info_format (NDI_UNIQUE, 0, op, "Marked item %s", query_name (mark1)); |
1116 | return 0; |
1117 | return 0; |
1117 | } |
1118 | } |
1118 | } |
1119 | } |
|
|
1120 | |
1119 | return 0; /*shouldnt get here */ |
1121 | return 0; /*shouldnt get here */ |
1120 | } |
1122 | } |
1121 | |
1123 | |
1122 | |
1124 | |
1123 | /* op is the player |
1125 | /* op is the player |