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

Comparing deliantra/server/server/c_object.C (file contents):
Revision 1.76 by root, Sun Sep 7 21:31:23 2008 UTC vs.
Revision 1.78 by root, Mon Sep 29 10:20:49 2008 UTC

614 return; 614 return;
615 615
616 if (QUERY_FLAG (tmp, FLAG_STARTEQUIP)) 616 if (QUERY_FLAG (tmp, FLAG_STARTEQUIP))
617 { 617 {
618 op->statusmsg (format ("You drop the %s.", query_name (tmp))); 618 op->statusmsg (format ("You drop the %s.", query_name (tmp)));
619 op->statusmsg ("The gods who lent it to you retrieves it."); 619 op->statusmsg ("The god who lent it to you retrieves it.");
620 620
621 tmp->destroy (); 621 tmp->destroy (true);
622 op->update_stats (); 622 op->update_stats ();
623 return; 623 return;
624 } 624 }
625 625
626 /* Call this before we update the various windows/players. At least 626 /* Call this before we update the various windows/players. At least
659 if (tmp->env && tmp->env->type != PLAYER) 659 if (tmp->env && tmp->env->type != PLAYER)
660 { 660 {
661 /* Just toss the object - probably shouldn't be hanging 661 /* Just toss the object - probably shouldn't be hanging
662 * around anyways 662 * around anyways
663 */ 663 */
664 tmp->remove ();
665 tmp->destroy (); 664 tmp->destroy (true);
666 return; 665 return;
667 } 666 }
668 else 667 else
669 { 668 {
670 while (tmp && tmp->invisible) 669 while (tmp && tmp->invisible)
970 dynbuf_text buf (512, 512); 969 dynbuf_text buf (512, 512);
971 970
972 object *mon = head ? head : this; 971 object *mon = head ? head : this;
973 972
974 if (QUERY_FLAG (mon, FLAG_UNDEAD)) 973 if (QUERY_FLAG (mon, FLAG_UNDEAD))
975 buf << " - It is an undead force.\n"; 974 buf << "It is an undead force.\r";
976 975
977 if (mon->level > who->level) 976 if (mon->level > who->level)
978 buf << " - It is likely more powerful than you.\n"; 977 buf << "It is likely more powerful than you.\r";
979 else if (mon->level < who->level) 978 else if (mon->level < who->level)
980 buf << " - It is likely less powerful than you.\n"; 979 buf << "It is likely less powerful than you.\r";
981 else 980 else
982 buf << " - It is probably as powerful as you.\n"; 981 buf << "It is probably as powerful as you.\r";
983 982
984 if (mon->attacktype & AT_ACID) 983 if (mon->attacktype & AT_ACID)
985 buf << " - You seem to smell an acrid odor.\n"; 984 buf << "You seem to smell an acrid odor.\r";
986 985
987 /* Anyone know why this used to use the clone value instead of the 986 /* Anyone know why this used to use the clone value instead of the
988 * maxhp field? This seems that it should give more accurate results. 987 * maxhp field? This seems that it should give more accurate results.
989 */ 988 */
990 switch ((mon->stats.hp + 1) * 4 / (mon->stats.maxhp + 1)) 989 switch ((mon->stats.hp + 1) * 4 / (mon->stats.maxhp + 1))
991 { /* From 1-4 */ 990 { /* From 1-4 */
992 case 1: 991 case 1:
993 buf << " - It is in a bad shape.\n"; 992 buf << "It is in a bad shape.\r";
994 break; 993 break;
995 case 2: 994 case 2:
996 buf << " - It is hurt.\n"; 995 buf << "It is hurt.\r";
997 break; 996 break;
998 case 3: 997 case 3:
999 buf << " - It is somewhat hurt.\n"; 998 buf << "It is somewhat hurt.\r";
1000 break; 999 break;
1001 case 4: 1000 case 4:
1002 buf << " - It is in excellent shape.\n"; 1001 buf << "It is in excellent shape.\r";
1003 break; 1002 break;
1004 } 1003 }
1005 1004
1006 if (present_in_ob (POISONING, mon)) 1005 if (present_in_ob (POISONING, mon))
1007 buf << " - It looks very ill.\n"; 1006 buf << "It looks very ill.\r";
1007
1008 buf << '\n';
1008 1009
1009 return buf; 1010 return buf;
1010} 1011}
1011 1012
1012/* tmp is the object being described, pl is who is examing it. */ 1013/* tmp is the object being described, pl is who is examing it. */
1070std::string 1071std::string
1071object::describe (object *who) 1072object::describe (object *who)
1072{ 1073{
1073 dynbuf_text buf (1024, 1024); 1074 dynbuf_text buf (1024, 1024);
1074 1075
1075 buf.printf ("That is: %s.\n\n", long_desc (who).c_str ()); 1076 buf.printf ("That is: %s.\r", long_desc (who).c_str ());
1076 1077
1077 if (custom_name) 1078 if (custom_name)
1078 buf.printf ("You call it %s.\n\n", &custom_name); 1079 buf.printf ("You call it %s.\r", &custom_name);
1079 1080
1080 switch (type) 1081 switch (type)
1081 { 1082 {
1082 case SPELLBOOK: 1083 case SPELLBOOK:
1083 if (flag [FLAG_IDENTIFIED] && inv) 1084 if (flag [FLAG_IDENTIFIED] && inv)
1084 buf.printf ("%s is a %s %s spell.\n", &inv->name, get_levelnumber (inv->level), &inv->skill); 1085 buf.printf ("%s is a %s %s spell.\r", &inv->name, get_levelnumber (inv->level), &inv->skill);
1085 break; 1086 break;
1086 1087
1087 case BOOK: 1088 case BOOK:
1088 if (msg) 1089 if (msg)
1089 buf << "Something is written in it.\n"; 1090 buf << "Something is written in it.\r";
1090 break; 1091 break;
1091 1092
1092 case CONTAINER: 1093 case CONTAINER:
1093 if (race != NULL) 1094 if (race)
1094 { 1095 {
1095 if (weight_limit && stats.Str < 100) 1096 if (weight_limit && stats.Str < 100)
1096 buf.printf ("It can hold only %s and its weight limit is %.1f kg.\n", 1097 buf.printf ("It can hold only %s and its weight limit is %.1f kg.\r",
1097 &race, weight_limit / (10.0 * (100 - stats.Str))); 1098 &race, weight_limit / (10.0 * (100 - stats.Str)));
1098 else 1099 else
1099 buf.printf ("It can hold only %s.\n", &race); 1100 buf.printf ("It can hold only %s.\r", &race);
1100 } 1101 }
1101 else if (weight_limit && stats.Str < 100) 1102 else if (weight_limit && stats.Str < 100)
1102 buf.printf ("Its weight limit is %.1f kg.\n", weight_limit / (10.0 * (100 - stats.Str))); 1103 buf.printf ("Its weight limit is %.1f kg.\r", weight_limit / (10.0 * (100 - stats.Str)));
1103 break; 1104 break;
1104 1105
1105 case WAND: 1106 case WAND:
1106 if (flag [FLAG_IDENTIFIED]) 1107 if (flag [FLAG_IDENTIFIED])
1107 buf.printf ("It has %d charges left.\n", stats.food); 1108 buf.printf ("It has %d charges left.\r", stats.food);
1108 break; 1109 break;
1109 } 1110 }
1110 1111
1111 if (materialname && !msg) 1112 if (materialname && !msg)
1112 buf.printf ("It is made of: %s.\n", &materialname); 1113 buf.printf ("It is made of: %s.\r", &materialname);
1113 1114
1114 if (who) 1115 if (who)
1115 /* Where to wear this item */ 1116 /* Where to wear this item */
1116 for (int i = 0; i < NUM_BODY_LOCATIONS; i++) 1117 for (int i = 0; i < NUM_BODY_LOCATIONS; i++)
1117 if (slot[i].info) 1118 if (slot[i].info)
1119 buf << (who->slot[i].info ? body_locations[i].use_name : body_locations[i].nonuse_name); 1120 buf << (who->slot[i].info ? body_locations[i].use_name : body_locations[i].nonuse_name);
1120 1121
1121 if (slot[i].info < -1 && who->slot[i].info) 1122 if (slot[i].info < -1 && who->slot[i].info)
1122 buf.printf ("(%d)", -slot[i].info); 1123 buf.printf ("(%d)", -slot[i].info);
1123 1124
1124 buf << ".\n"; 1125 buf << ".\r";
1125 } 1126 }
1126 1127
1127 if (weight) 1128 if (weight)
1128 buf.printf (nrof > 1 ? "They weigh %3.3f kg.\n" : "It weighs %3.3f kg.\n", weight * (nrof ? nrof : 1) / 1000.0); 1129 buf.printf ("%s %3.3f kg.\r", nrof > 1 ? "They weigh" : "It weighs", weight * (nrof ? nrof : 1) / 1000.0);
1129 1130
1130 if (value && !flag [FLAG_STARTEQUIP] && !flag [FLAG_NO_PICK] && who) 1131 if (value && !flag [FLAG_STARTEQUIP] && !flag [FLAG_NO_PICK] && who)
1131 { 1132 {
1132 buf.printf ("You reckon %s worth %s.\n", nrof > 1 ? "they are" : "it is", query_cost_string (this, who, F_TRUE | F_APPROX)); 1133 buf.printf ("You reckon %s worth %s.\r", nrof > 1 ? "they are" : "it is", query_cost_string (this, who, F_TRUE | F_APPROX));
1133 1134
1134 if (is_in_shop (who)) 1135 if (is_in_shop (who))
1135 { 1136 {
1136 if (flag [FLAG_UNPAID]) 1137 if (flag [FLAG_UNPAID])
1137 buf.printf ("%s would cost you %s.\n", nrof > 1 ? "They" : "It", query_cost_string (this, who, F_BUY | F_SHOP)); 1138 buf.printf ("%s would cost you %s.\r", nrof > 1 ? "They" : "It", query_cost_string (this, who, F_BUY | F_SHOP));
1138 else 1139 else
1139 buf.printf ("You are offered %s for %s.\n", query_cost_string (this, who, F_SELL + F_SHOP), nrof > 1 ? "them" : "it"); 1140 buf.printf ("You are offered %s for %s.\r", query_cost_string (this, who, F_SELL + F_SHOP), nrof > 1 ? "them" : "it");
1140 } 1141 }
1141 } 1142 }
1142 1143
1143 if (flag [FLAG_MONSTER]) 1144 if (flag [FLAG_MONSTER])
1144 buf << describe_monster (who); 1145 buf << describe_monster (who);
1145 1146
1146 /* Is this item buildable? */ 1147 /* Is this item buildable? */
1147 if (flag [FLAG_IS_BUILDABLE]) 1148 if (flag [FLAG_IS_BUILDABLE])
1148 buf << "This is a buildable item.\n"; 1149 buf << "This is a buildable item.\r";
1149 1150
1150 /* Does the object have a message? Don't show message for all object 1151 /* Does the object have a message? Don't show message for all object
1151 * types - especially if the first entry is a match 1152 * types - especially if the first entry is a match
1152 */ 1153 */
1153 if (msg && type != EXIT && type != BOOK && type != CORPSE && !move_on && !has_dialogue ()) 1154 if (msg && type != EXIT && type != BOOK && type != CORPSE && !move_on && !has_dialogue ())
1154 { 1155 {
1155 /* This is just a hack so when identifying the items, we print 1156 /* This is just a hack so when identifying the items, we print
1156 * out the extra message 1157 * out the extra message
1157 */ 1158 */
1158 if (need_identify (this) && flag [FLAG_IDENTIFIED]) 1159 if (need_identify (this) && flag [FLAG_IDENTIFIED])
1159 buf << "The object has a story:\n\n"; 1160 buf << "The object has a story:\r";
1160 1161
1161 buf << msg << '\n'; 1162 buf << msg << '\n';
1162 } 1163 }
1163 1164
1164 buf << '\n'; 1165 buf << '\n';

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines