~ubuntu-branches/ubuntu/vivid/manaplus/vivid

« back to all changes in this revision

Viewing changes to src/actions/actions.cpp

  • Committer: Package Import Robot
  • Author(s): Patrick Matthäi
  • Date: 2015-02-05 10:52:57 UTC
  • mfrom: (1.1.43)
  • Revision ID: package-import@ubuntu.com-20150205105257-q53e3m1s2wwawu8a
Tags: 1.5.1.31-1
* New upstream release.
* Fix some wildcard-matches-nothing-in-dep5-copyright warnings.

Show diffs side-by-side

added added

removed removed

Lines of Context:
220
220
    const Inventory *inv = nullptr;
221
221
    switch (invType)
222
222
    {
223
 
        case Inventory::STORAGE:
 
223
        case InventoryType::STORAGE:
224
224
            inv = PlayerInfo::getStorageInventory();
225
225
            break;
226
226
 
227
227
        default:
228
 
        case Inventory::INVENTORY:
 
228
        case InventoryType::INVENTORY:
229
229
            inv = PlayerInfo::getInventory();
230
230
            break;
231
231
    }
430
430
 
431
431
impHandler(dropItemInv)
432
432
{
433
 
    Item *const item = getItemByInvIndex(event, Inventory::INVENTORY);
 
433
    Item *const item = getItemByInvIndex(event, InventoryType::INVENTORY);
434
434
    if (item && !PlayerInfo::isItemProtected(item->getId()))
435
435
    {
436
436
        ItemAmountWindow::showWindow(ItemAmountWindow::ItemDrop,
455
455
 
456
456
impHandler(dropItemInvAll)
457
457
{
458
 
    Item *const item = getItemByInvIndex(event, Inventory::INVENTORY);
 
458
    Item *const item = getItemByInvIndex(event, InventoryType::INVENTORY);
459
459
    if (item && !PlayerInfo::isItemProtected(item->getId()))
460
460
        PlayerInfo::dropItem(item, item->getQuantity(), true);
461
461
    return true;
726
726
    return true;
727
727
}
728
728
 
729
 
impHandler0(targetAttack)
 
729
impHandler(targetAttack)
730
730
{
731
731
    if (localPlayer && actorManager)
732
732
    {
733
733
        Being *target = nullptr;
734
 
 
 
734
        std::string args = event.args;
735
735
        const bool newTarget = !inputManager.isActionActive(
736
736
            InputAction::STOP_ATTACK);
 
737
 
 
738
        if (!args.empty())
 
739
        {
 
740
            if (args[0] != ':')
 
741
            {
 
742
                target = actorManager->findNearestByName(args);
 
743
            }
 
744
            else
 
745
            {
 
746
                target = actorManager->findBeing(atoi(args.substr(1).c_str()));
 
747
                if (target && target->getType() != ActorType::Monster)
 
748
                    target = nullptr;
 
749
            }
 
750
        }
 
751
        if (!target)
 
752
            target = localPlayer->getTarget();
737
753
        // A set target has highest priority
738
 
        if (!localPlayer->getTarget())
 
754
        if (!target)
739
755
        {
740
756
            // Only auto target Monsters
741
757
            target = actorManager->findNearestLivingBeing(
742
758
                localPlayer, 90, ActorType::Monster, true);
743
759
        }
744
 
        else
745
 
        {
746
 
            target = localPlayer->getTarget();
747
 
        }
748
760
 
749
761
        localPlayer->attack2(target, newTarget);
750
762
        return true;
1419
1431
 
1420
1432
impHandler(useItemInv)
1421
1433
{
1422
 
    Item *const item = getItemByInvIndex(event, Inventory::INVENTORY);
 
1434
    Item *const item = getItemByInvIndex(event, InventoryType::INVENTORY);
1423
1435
    PlayerInfo::useEquipItem(item, true);
1424
1436
    return true;
1425
1437
}
1427
1439
impHandler(invToStorage)
1428
1440
{
1429
1441
    Item *item = nullptr;
1430
 
    const int amount = getAmountFromEvent(event, item, Inventory::INVENTORY);
 
1442
    const int amount = getAmountFromEvent(event, item,
 
1443
        InventoryType::INVENTORY);
1431
1444
    if (amount)
1432
1445
    {
1433
 
        inventoryHandler->moveItem2(Inventory::INVENTORY,
 
1446
        inventoryHandler->moveItem2(InventoryType::INVENTORY,
1434
1447
            item->getInvIndex(),
1435
1448
            amount,
1436
 
            Inventory::STORAGE);
 
1449
            InventoryType::STORAGE);
1437
1450
    }
1438
1451
    else
1439
1452
    {
1446
1459
impHandler(tradeAdd)
1447
1460
{
1448
1461
    Item *item = nullptr;
1449
 
    const int amount = getAmountFromEvent(event, item, Inventory::INVENTORY);
 
1462
    const int amount = getAmountFromEvent(event, item,
 
1463
        InventoryType::INVENTORY);
1450
1464
    if (!item || PlayerInfo::isItemProtected(item->getId()))
1451
1465
        return true;
1452
1466
 
1465
1479
impHandler(storageToInv)
1466
1480
{
1467
1481
    Item *item = nullptr;
1468
 
    const int amount = getAmountFromEvent(event, item, Inventory::STORAGE);
 
1482
    const int amount = getAmountFromEvent(event, item, InventoryType::STORAGE);
1469
1483
    if (amount)
1470
1484
    {
1471
 
        inventoryHandler->moveItem2(Inventory::STORAGE,
 
1485
        inventoryHandler->moveItem2(InventoryType::STORAGE,
1472
1486
            item->getInvIndex(),
1473
1487
            amount,
1474
 
            Inventory::INVENTORY);
 
1488
            InventoryType::INVENTORY);
1475
1489
    }
1476
1490
    else
1477
1491
    {