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.84 by root, Mon Dec 22 21:11:27 2008 UTC vs.
Revision 1.85 by root, Sun Dec 28 10:20:29 2008 UTC

144 } 144 }
145 145
146 pl->change_skill (0); 146 pl->change_skill (0);
147 apply_special (pl, skill, AP_APPLY); 147 apply_special (pl, skill, AP_APPLY);
148 return 1; 148 return 1;
149}
150
151/* These functions (command_search, command_disarm) are really just wrappers for
152 * things like 'use_skill ...'). In fact, they should really be obsoleted
153 * and replaced with those.
154 */
155int
156command_search (object *op, char *params)
157{
158 return use_skill (op, skill_names[SK_FIND_TRAPS]);
159}
160
161int
162command_disarm (object *op, char *params)
163{
164 return use_skill (op, skill_names[SK_DISARM_TRAPS]);
165} 149}
166 150
167/* A little special because we do want to pass the full params along 151/* A little special because we do want to pass the full params along
168 * as it includes the object to throw. 152 * as it includes the object to throw.
169 */ 153 */
1222static void 1206static void
1223display_new_pickup (object *op) 1207display_new_pickup (object *op)
1224{ 1208{
1225 int i = op->contr->mode; 1209 int i = op->contr->mode;
1226 1210
1227 if (!(i & PU_NEWMODE))
1228 return;
1229
1230 new_draw_info_format (NDI_UNIQUE, 0, op, "%d NEWMODE", i & PU_NEWMODE ? 1 : 0);
1231 new_draw_info_format (NDI_UNIQUE, 0, op, "%d DEBUG", i & PU_DEBUG ? 1 : 0); 1211 new_draw_info_format (NDI_UNIQUE, 0, op, "%d DEBUG", i & PU_DEBUG ? 1 : 0);
1232 new_draw_info_format (NDI_UNIQUE, 0, op, "%d INHIBIT", i & PU_INHIBIT ? 1 : 0); 1212 new_draw_info_format (NDI_UNIQUE, 0, op, "%d INHIBIT", i & PU_INHIBIT ? 1 : 0);
1233 new_draw_info_format (NDI_UNIQUE, 0, op, "%d STOP", i & PU_STOP ? 1 : 0); 1213 new_draw_info_format (NDI_UNIQUE, 0, op, "%d STOP", i & PU_STOP ? 1 : 0);
1234 1214
1235 new_draw_info_format (NDI_UNIQUE, 0, op, "%d <= x pickup weight/value RATIO (0==off)", (i & PU_RATIO) * 5); 1215 new_draw_info_format (NDI_UNIQUE, 0, op, "%d <= x pickup weight/value RATIO (0==off)", (i & PU_RATIO) * 5);
1286 }; 1266 };
1287 1267
1288 if (!params) 1268 if (!params)
1289 { 1269 {
1290 /* if the new mode is used, just print the settings */ 1270 /* if the new mode is used, just print the settings */
1291 if (op->contr->mode & PU_NEWMODE)
1292 {
1293 display_new_pickup (op); 1271 display_new_pickup (op);
1294 return 1;
1295 }
1296 if (1)
1297 LOG (llevDebug, "command_pickup: !params\n");
1298 set_pickup_mode (op, (op->contr->mode > 6) ? 0 : op->contr->mode + 1);
1299 return 0; 1272 return 0;
1300 } 1273 }
1301 1274
1302 while (*params == ' ' && *params) 1275 while (*params == ' ' && *params)
1303 params++; 1276 params++;
1309 for (mode = 0; names[mode]; mode++) 1282 for (mode = 0; names[mode]; mode++)
1310 { 1283 {
1311 if (!strcmp (names[mode], params + 1)) 1284 if (!strcmp (names[mode], params + 1))
1312 { 1285 {
1313 i = op->contr->mode; 1286 i = op->contr->mode;
1314 if (!(i & PU_NEWMODE)) 1287
1315 i = PU_NEWMODE;
1316 if (*params == '+') 1288 if (*params == '+')
1317 i = i | modes[mode]; 1289 i = i | modes[mode];
1318 else 1290 else
1319 i = i & ~modes[mode]; 1291 i = i & ~modes[mode];
1292
1320 op->contr->mode = i; 1293 op->contr->mode = i;
1321 display_new_pickup (op); 1294 display_new_pickup (op);
1322 return 1; 1295 return 1;
1323 } 1296 }
1324 } 1297 }
1328 1301
1329 if (sscanf (params, "%u", &i) != 1) 1302 if (sscanf (params, "%u", &i) != 1)
1330 { 1303 {
1331 if (1) 1304 if (1)
1332 LOG (llevDebug, "command_pickup: params==NULL\n"); 1305 LOG (llevDebug, "command_pickup: params==NULL\n");
1333 new_draw_info (NDI_UNIQUE, 0, op, "Usage: pickup <0-7> or <value_density> ."); 1306 new_draw_info (NDI_UNIQUE, 0, op, "Usage: pickup <value_density> .");
1334 return 1; 1307 return 1;
1335 } 1308 }
1336 set_pickup_mode (op, i); 1309
1310 op->contr->mode = i;
1337 1311
1338 return 1; 1312 return 1;
1339}
1340
1341void
1342set_pickup_mode (object *op, int i)
1343{
1344 switch (op->contr->mode = i)
1345 {
1346 case 0:
1347 new_draw_info (NDI_UNIQUE, 0, op, "Mode: Don't pick up.");
1348 break;
1349 case 1:
1350 new_draw_info (NDI_UNIQUE, 0, op, "Mode: Pick up one item.");
1351 break;
1352 case 2:
1353 new_draw_info (NDI_UNIQUE, 0, op, "Mode: Pick up one item and stop.");
1354 break;
1355 case 3:
1356 new_draw_info (NDI_UNIQUE, 0, op, "Mode: Stop before picking up.");
1357 break;
1358 case 4:
1359 new_draw_info (NDI_UNIQUE, 0, op, "Mode: Pick up all items.");
1360 break;
1361 case 5:
1362 new_draw_info (NDI_UNIQUE, 0, op, "Mode: Pick up all items and stop.");
1363 break;
1364 case 6:
1365 new_draw_info (NDI_UNIQUE, 0, op, "Mode: Pick up all magic items.");
1366 break;
1367 case 7:
1368 new_draw_info (NDI_UNIQUE, 0, op, "Mode: Pick up all coins and gems");
1369 break;
1370 }
1371} 1313}
1372 1314
1373int 1315int
1374command_search_items (object *op, char *params) 1316command_search_items (object *op, char *params)
1375{ 1317{
1376 char buf[MAX_BUF]; 1318 char buf[MAX_BUF];
1377 1319
1378 if (settings.search_items == FALSE)
1379 return 1;
1380
1381 if (params == NULL) 1320 if (params == NULL)
1382 { 1321 {
1383 if (op->contr->search_str[0] == '\0') 1322 if (op->contr->search_str[0] == '\0')
1384 { 1323 {
1385 new_draw_info (NDI_UNIQUE, 0, op, "Example: search magic+1"); 1324 new_draw_info (NDI_UNIQUE, 0, op, "Example: search-items magic+1");
1386 new_draw_info (NDI_UNIQUE, 0, op, "Would automatically pick up all"); 1325 new_draw_info (NDI_UNIQUE, 0, op, "Would automatically pick up all");
1387 new_draw_info (NDI_UNIQUE, 0, op, "items containing the word 'magic+1'."); 1326 new_draw_info (NDI_UNIQUE, 0, op, "items containing the word 'magic+1'.");
1388 return 1; 1327 return 1;
1389 } 1328 }
1390 1329
1392 new_draw_info (NDI_UNIQUE, 0, op, "Search mode turned off."); 1331 new_draw_info (NDI_UNIQUE, 0, op, "Search mode turned off.");
1393 op->update_stats (); 1332 op->update_stats ();
1394 return 1; 1333 return 1;
1395 } 1334 }
1396 1335
1397 if ((int) strlen (params) >= MAX_BUF) 1336 if (strlen (params) >= MAX_BUF)
1398 { 1337 {
1399 new_draw_info (NDI_UNIQUE, 0, op, "Search string too long."); 1338 new_draw_info (NDI_UNIQUE, 0, op, "Search string too long.");
1400 return 1; 1339 return 1;
1401 } 1340 }
1402 1341
1403 strcpy (op->contr->search_str, params); 1342 strcpy (op->contr->search_str, params);
1404 sprintf (buf, "Searching for '%s'.", op->contr->search_str); 1343 sprintf (buf, "Now searching for '%s'.", op->contr->search_str);
1405 new_draw_info (NDI_UNIQUE, 0, op, buf); 1344 new_draw_info (NDI_UNIQUE, 0, op, buf);
1406 op->update_stats (); 1345 op->update_stats ();
1346
1407 return 1; 1347 return 1;
1408} 1348}
1409 1349

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines