1 | |
1 | |
2 | /* |
2 | /* |
3 | * static char *rcsid_apply_c = |
3 | * static char *rcsid_apply_c = |
4 | * "$Id: apply.C,v 1.24 2006/09/11 20:26:41 root Exp $"; |
4 | * "$Id: apply.C,v 1.25 2006/09/11 23:33:30 root Exp $"; |
5 | */ |
5 | */ |
6 | |
6 | |
7 | /* |
7 | /* |
8 | CrossFire, A Multiplayer game for X-windows |
8 | CrossFire, A Multiplayer game for X-windows |
9 | |
9 | |
… | |
… | |
1348 | * the shop. |
1348 | * the shop. |
1349 | */ |
1349 | */ |
1350 | for (tmp = op->inv; tmp; tmp = next) |
1350 | for (tmp = op->inv; tmp; tmp = next) |
1351 | { |
1351 | { |
1352 | next = tmp->below; |
1352 | next = tmp->below; |
|
|
1353 | |
1353 | if (QUERY_FLAG (tmp, FLAG_UNPAID)) |
1354 | if (QUERY_FLAG (tmp, FLAG_UNPAID)) |
1354 | { |
1355 | { |
1355 | int i = find_free_spot (tmp, op->map, op->x, op->y, 1, 9); |
1356 | int i = find_free_spot (tmp, op->map, op->x, op->y, 1, 9); |
1356 | |
1357 | |
1357 | remove_ob (tmp); |
1358 | remove_ob (tmp); |
… | |
… | |
1387 | /* Removed code that checked for multipart objects - it appears that |
1388 | /* Removed code that checked for multipart objects - it appears that |
1388 | * the teleport function should be able to handle this just fine. |
1389 | * the teleport function should be able to handle this just fine. |
1389 | */ |
1390 | */ |
1390 | rv = teleport (shop_mat, SHOP_MAT, op); |
1391 | rv = teleport (shop_mat, SHOP_MAT, op); |
1391 | } |
1392 | } |
1392 | else if (can_pay (op)) |
1393 | else if (can_pay (op) && get_payment (op)) |
1393 | { |
1394 | { |
1394 | /* this is only used for players */ |
1395 | /* this is only used for players */ |
1395 | get_payment (op, op->inv); |
|
|
1396 | rv = teleport (shop_mat, SHOP_MAT, op); |
1396 | rv = teleport (shop_mat, SHOP_MAT, op); |
1397 | |
1397 | |
1398 | if (shop_mat->msg) |
1398 | if (shop_mat->msg) |
1399 | new_draw_info (NDI_UNIQUE, 0, op, shop_mat->msg); |
1399 | new_draw_info (NDI_UNIQUE, 0, op, shop_mat->msg); |
1400 | /* This check below is a bit simplistic - generally it should be correct, |
1400 | /* This check below is a bit simplistic - generally it should be correct, |
… | |
… | |
1419 | { |
1419 | { |
1420 | /* if we get here, a player tried to leave a shop but was not able |
1420 | /* if we get here, a player tried to leave a shop but was not able |
1421 | * to afford the items he has. We try to move the player so that |
1421 | * to afford the items he has. We try to move the player so that |
1422 | * they are not on the mat anymore |
1422 | * they are not on the mat anymore |
1423 | */ |
1423 | */ |
1424 | |
|
|
1425 | int i = find_free_spot (op, op->map, op->x, op->y, 1, 9); |
1424 | int i = find_free_spot (op, op->map, op->x, op->y, 1, 9); |
1426 | |
1425 | |
1427 | if (i == -1) |
1426 | if (i == -1) |
1428 | { |
1427 | { |
1429 | LOG (llevError, "Internal shop-mat problem.\n"); |
1428 | LOG (llevError, "Internal shop-mat problem.\n"); |
… | |
… | |
1981 | } |
1980 | } |
1982 | |
1981 | |
1983 | if (spell->skill) |
1982 | if (spell->skill) |
1984 | { |
1983 | { |
1985 | spell_skill = find_skill_by_name (op, spell->skill); |
1984 | spell_skill = find_skill_by_name (op, spell->skill); |
|
|
1985 | |
1986 | if (!spell_skill) |
1986 | if (!spell_skill) |
1987 | { |
1987 | { |
1988 | new_draw_info_format (NDI_UNIQUE, 0, op, "You lack the skill %s to use this spell", &spell->skill); |
1988 | new_draw_info_format (NDI_UNIQUE, 0, op, "You lack the skill %s to use this spell", &spell->skill); |
1989 | return; |
1989 | return; |
1990 | } |
1990 | } |
|
|
1991 | |
1991 | if (spell_skill->level < spell->level) |
1992 | if (spell_skill->level < spell->level) |
1992 | { |
1993 | { |
1993 | new_draw_info_format (NDI_UNIQUE, 0, op, "You need to be level %d in %s to learn this spell.", spell->level, &spell->skill); |
1994 | new_draw_info_format (NDI_UNIQUE, 0, op, "You need to be level %d in %s to learn this spell.", spell->level, &spell->skill); |
1994 | return; |
1995 | return; |
1995 | } |
1996 | } |