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

« back to all changes in this revision

Viewing changes to src/net/eathena/beinghandler.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:
237
237
            break;
238
238
 
239
239
        case SMSG_BEING_STATUS_CHANGE:
 
240
            processBeingStatusChange(msg);
 
241
            break;
 
242
 
240
243
        case SMSG_BEING_STATUS_CHANGE2:
241
 
            processBeingStatusChange(msg);
 
244
            processBeingStatusChange2(msg);
242
245
            break;
243
246
 
244
247
        case SMSG_SKILL_CASTING:
798
801
    msg.readInt8("ys");
799
802
    dstBeing->setAction(BeingAction::STAND, 0);
800
803
    dstBeing->setTileCoords(srcX, srcY);
 
804
    if (localPlayer)
 
805
        localPlayer->followMoveTo(dstBeing, srcX, srcY, dstX, dstY);
801
806
    if (!serverFeatures->haveMove3())
802
807
        dstBeing->setDestination(dstX, dstY);
803
808
 
1032
1037
        return;
1033
1038
    }
1034
1039
 
1035
 
    const bool status1 = msg.getId() == SMSG_BEING_STATUS_CHANGE;
1036
 
 
1037
 
    // Status change
1038
 
    const uint16_t status = msg.readInt16("status");
1039
 
    const int id = msg.readInt32("being id");
1040
 
    const bool flag = msg.readUInt8("flag: 0: stop, 1: start");
1041
 
    if (status1)
1042
 
        msg.readInt32("total");
 
1040
    // Status change
 
1041
    const uint16_t status = msg.readInt16("status");
 
1042
    const int id = msg.readInt32("being id");
 
1043
    const bool flag = msg.readUInt8("flag: 0: stop, 1: start");
 
1044
    msg.readInt32("total");
 
1045
    msg.readInt32("left");
 
1046
    msg.readInt32("val1");
 
1047
    msg.readInt32("val2");
 
1048
    msg.readInt32("val3");
 
1049
 
 
1050
    Being *const dstBeing = actorManager->findBeing(id);
 
1051
    if (dstBeing)
 
1052
        dstBeing->setStatusEffect(status, flag);
 
1053
    BLOCK_END("BeingHandler::processBeingStatusChange")
 
1054
}
 
1055
 
 
1056
void BeingHandler::processBeingStatusChange2(Net::MessageIn &msg)
 
1057
{
 
1058
    BLOCK_START("BeingHandler::processBeingStatusChange")
 
1059
    if (!actorManager)
 
1060
    {
 
1061
        BLOCK_END("BeingHandler::processBeingStatusChange")
 
1062
        return;
 
1063
    }
 
1064
 
 
1065
    // Status change
 
1066
    const uint16_t status = msg.readInt16("status");
 
1067
    const int id = msg.readInt32("being id");
 
1068
    const bool flag = msg.readUInt8("flag: 0: stop, 1: start");
1043
1069
    msg.readInt32("left");
1044
1070
    msg.readInt32("val1");
1045
1071
    msg.readInt32("val2");
1086
1112
 
1087
1113
    dstBeing->setAction(BeingAction::STAND, 0);
1088
1114
    dstBeing->setTileCoords(srcX, srcY);
 
1115
    if (localPlayer)
 
1116
        localPlayer->followMoveTo(dstBeing, srcX, srcY, dstX, dstY);
1089
1117
    if (!serverFeatures->haveMove3())
1090
1118
        dstBeing->setDestination(dstX, dstY);
1091
1119
    if (dstBeing->getType() == ActorType::Player)
1238
1266
 
1239
1267
    msg.readInt16("head direction");
1240
1268
 
1241
 
    const uint8_t dir = static_cast<uint8_t>(
1242
 
        msg.readUInt8("player direction") & 0x0FU);
 
1269
    const uint8_t dir = Net::MessageIn::fromServerDirection(
 
1270
        static_cast<uint8_t>(msg.readUInt8("player direction") & 0x0FU));
1243
1271
 
1244
1272
    if (!dstBeing)
1245
1273
    {
1407
1435
 
1408
1436
void BeingHandler::processPlaterStatusChangeNoTick(Net::MessageIn &msg)
1409
1437
{
1410
 
    // +++ probably need show some effect?
1411
 
    msg.readInt16("index");
1412
 
    msg.readInt32("account id");
1413
 
    msg.readUInt8("state");
 
1438
    const uint16_t status = msg.readInt16("index");
 
1439
    const int id = msg.readInt32("account id");
 
1440
    const bool flag = msg.readUInt8("state") ? 1 : 0;
 
1441
 
 
1442
    Being *const dstBeing = actorManager->findBeing(id);
 
1443
    if (!dstBeing)
 
1444
        return;
 
1445
 
 
1446
    dstBeing->setStatusEffect(status, flag);
1414
1447
}
1415
1448
 
1416
1449
void BeingHandler::processBeingResurrect(Net::MessageIn &msg)