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

Comparing deliantra/server/server/player.C (file contents):
Revision 1.221 by root, Wed Dec 31 17:35:38 2008 UTC vs.
Revision 1.222 by root, Thu Jan 1 11:41:17 2009 UTC

1221 } 1221 }
1222 1222
1223 /* careful: chairs and tables are weapons! */ 1223 /* careful: chairs and tables are weapons! */
1224 if (op->contr->mode & PU_ALLWEAPON) 1224 if (op->contr->mode & PU_ALLWEAPON)
1225 { 1225 {
1226 if (tmp->type == WEAPON && tmp->name != NULL) 1226 if (tmp->type == WEAPON && !tmp->name)
1227 { 1227 {
1228 if (strstr (tmp->name, "table") == NULL && strstr (tmp->arch->archname, "table") == NULL && 1228 if (strstr (tmp->name, "table") == NULL && strstr (tmp->arch->archname, "table") == NULL &&
1229 strstr (tmp->name, "chair") && strstr (tmp->arch->archname, "chair") == NULL) 1229 strstr (tmp->name, "chair") && strstr (tmp->arch->archname, "chair") == NULL)
1230 { 1230 {
1231 CHK_PICK_PICKUP; 1231 CHK_PICK_PICKUP;
1232 continue; 1232 continue;
1233 } 1233 }
1234 } 1234 }
1235 1235
1236 if (tmp->type == WEAPON && tmp->name == NULL) 1236 if (tmp->type == WEAPON && !tmp->name)
1237 { 1237 {
1238 if (strstr (tmp->arch->archname, "table") == NULL && strstr (tmp->arch->archname, "chair") == NULL) 1238 if (strstr (tmp->arch->archname, "table") == NULL && strstr (tmp->arch->archname, "chair") == NULL)
1239 { 1239 {
1240 CHK_PICK_PICKUP; 1240 CHK_PICK_PICKUP;
1241 continue; 1241 continue;
1310 * against the target. A full test is not performed, simply a basic test 1310 * against the target. A full test is not performed, simply a basic test
1311 * of resistances. The archer is making a quick guess at what he sees down 1311 * of resistances. The archer is making a quick guess at what he sees down
1312 * the hall. Failing that it does it's best to pick the highest plus arrow. 1312 * the hall. Failing that it does it's best to pick the highest plus arrow.
1313 */ 1313 */
1314object * 1314object *
1315find_better_arrow (object *op, object *target, const char *type, int *better) 1315find_better_arrow (object *op, object *target, shstr_cmp type, int *better)
1316{ 1316{
1317 object *tmp = NULL, *arrow, *ntmp; 1317 object *tmp = NULL, *arrow, *ntmp;
1318 int attacknum, attacktype, betterby = 0, i; 1318 int attacknum, attacktype, betterby = 0, i;
1319 1319
1320 if (!type) 1320 if (!type)
1324 { 1324 {
1325 if (arrow->type == CONTAINER && arrow->race == type && QUERY_FLAG (arrow, FLAG_APPLIED)) 1325 if (arrow->type == CONTAINER && arrow->race == type && QUERY_FLAG (arrow, FLAG_APPLIED))
1326 { 1326 {
1327 i = 0; 1327 i = 0;
1328 ntmp = find_better_arrow (arrow, target, type, &i); 1328 ntmp = find_better_arrow (arrow, target, type, &i);
1329
1329 if (i > betterby) 1330 if (i > betterby)
1330 { 1331 {
1331 tmp = ntmp; 1332 tmp = ntmp;
1332 betterby = i; 1333 betterby = i;
1333 } 1334 }
1358 { 1359 {
1359 tmp = arrow; 1360 tmp = arrow;
1360 betterby = (arrow->magic + arrow->stats.dam) * (100 - target->arch->resist[attacknum]) / 100; 1361 betterby = (arrow->magic + arrow->stats.dam) * (100 - target->arch->resist[attacknum]) / 100;
1361 } 1362 }
1362 } 1363 }
1364
1363 if ((2 + arrow->magic + arrow->stats.dam) > betterby) 1365 if ((2 + arrow->magic + arrow->stats.dam) > betterby)
1364 { 1366 {
1365 tmp = arrow; 1367 tmp = arrow;
1366 betterby = 2 + arrow->magic + arrow->stats.dam; 1368 betterby = 2 + arrow->magic + arrow->stats.dam;
1367 } 1369 }
1370
1368 if (arrow->title && (1 + arrow->magic + arrow->stats.dam) > betterby) 1371 if (arrow->title && (1 + arrow->magic + arrow->stats.dam) > betterby)
1369 { 1372 {
1370 tmp = arrow; 1373 tmp = arrow;
1371 betterby = 1 + arrow->magic + arrow->stats.dam; 1374 betterby = 1 + arrow->magic + arrow->stats.dam;
1372 } 1375 }
1386 * op = the shooter 1389 * op = the shooter
1387 * type = bow->race 1390 * type = bow->race
1388 * dir = fire direction 1391 * dir = fire direction
1389 */ 1392 */
1390object * 1393object *
1391pick_arrow_target (object *op, const char *type, int dir) 1394pick_arrow_target (object *op, shstr_cmp type, int dir)
1392{ 1395{
1393 object *tmp = NULL; 1396 object *tmp = NULL;
1394 maptile *m; 1397 maptile *m;
1395 int i, mflags, found, number; 1398 int i, mflags, found, number;
1396 sint16 x, y; 1399 sint16 x, y;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines