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.58 by root, Wed Jul 4 04:15:29 2007 UTC vs.
Revision 1.59 by root, Sun Sep 30 20:22:21 2007 UTC

1233 buf << '\n'; 1233 buf << '\n';
1234 1234
1235 return std::string (buf.linearise (), buf.size ()); 1235 return std::string (buf.linearise (), buf.size ());
1236} 1236}
1237 1237
1238void
1239examine (object *op, object *tmp)
1240{
1241 std::string s = tmp->describe (op);
1242
1243 new_draw_info (NDI_UNIQUE, 0, op, s.c_str ());
1244}
1245
1246/*
1247 * inventory prints object's inventory. If inv==NULL then print player's
1248 * inventory.
1249 * [ Only items which are applied are showed. Tero.Haatanen@lut.fi ]
1250 */
1251void
1252inventory (object *op, object *inv)
1253{
1254 object *tmp;
1255 const char *in;
1256 int items = 0, length;
1257
1258 if (inv == NULL && op == NULL)
1259 {
1260 new_draw_info (NDI_UNIQUE, 0, op, "Inventory of what object?");
1261 return;
1262 }
1263
1264 tmp = inv ? inv->inv : op->inv;
1265
1266 while (tmp)
1267 {
1268 if ((!tmp->invisible &&
1269 (inv == NULL || inv->type == CONTAINER || QUERY_FLAG (tmp, FLAG_APPLIED))) || (!op || QUERY_FLAG (op, FLAG_WIZ)))
1270 items++;
1271 tmp = tmp->below;
1272 }
1273
1274 if (inv == NULL)
1275 { /* player's inventory */
1276 if (items == 0)
1277 {
1278 new_draw_info (NDI_UNIQUE, 0, op, "You carry nothing.");
1279 return;
1280 }
1281 else
1282 {
1283 length = 28;
1284 in = "";
1285 new_draw_info (NDI_UNIQUE, 0, op, "Inventory:");
1286 }
1287 }
1288 else
1289 {
1290 if (items == 0)
1291 return;
1292 else
1293 {
1294 length = 28;
1295 in = " ";
1296 }
1297 }
1298
1299 for (tmp = inv ? inv->inv : op->inv; tmp; tmp = tmp->below)
1300 {
1301 if ((!op || !QUERY_FLAG (op, FLAG_WIZ)) && (tmp->invisible || (inv && inv->type != CONTAINER && !QUERY_FLAG (tmp, FLAG_APPLIED))))
1302 continue;
1303 if ((!op || QUERY_FLAG (op, FLAG_WIZ)))
1304 new_draw_info_format (NDI_UNIQUE, 0, op, "%s- %-*.*s (%5d) %-8s", in, length, length,
1305 query_name (tmp), tmp->count, query_weight (tmp));
1306 else
1307 new_draw_info_format (NDI_UNIQUE, 0, op, "%s- %-*.*s %-8s", in, length + 8, length + 8, query_name (tmp), query_weight (tmp));
1308 }
1309
1310 if (!inv && op)
1311 new_draw_info_format (NDI_UNIQUE, 0, op, "%-*s %-8s", 41, "Total weight :", query_weight (op));
1312}
1313
1314static void 1238static void
1315display_new_pickup (object *op) 1239display_new_pickup (object *op)
1316{ 1240{
1317 int i = op->contr->mode; 1241 int i = op->contr->mode;
1318 1242

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines