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

« back to all changes in this revision

Viewing changes to src/net/ea/beinghandler.cpp

  • Committer: Package Import Robot
  • Author(s): Patrick Matthäi
  • Date: 2014-10-12 12:23:57 UTC
  • mfrom: (1.1.36)
  • Revision ID: package-import@ubuntu.com-20141012122357-7836sgv1j1v02cs2
Tags: 1.4.10.11-1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
 
25
25
#include "actormanager.h"
26
26
#include "configuration.h"
27
 
#include "effectmanager.h"
28
27
#include "game.h"
29
28
#include "party.h"
30
29
 
31
30
#include "being/localplayer.h"
32
31
#include "being/playerrelations.h"
33
32
 
34
 
#include "particle/particle.h"
 
33
#include "gui/viewport.h"
35
34
 
36
35
#include "gui/windows/botcheckerwindow.h"
37
36
#include "gui/windows/socialwindow.h"
38
37
#include "gui/windows/killstats.h"
39
38
 
 
39
#include "resources/mapitemtype.h"
 
40
 
40
41
#include "resources/map/map.h"
41
42
 
42
43
#include "debug.h"
250
251
    BLOCK_END("BeingHandler::processBeingAction")
251
252
}
252
253
 
253
 
void BeingHandler::processBeingSelfEffect(Net::MessageIn &msg) const
254
 
{
255
 
    BLOCK_START("BeingHandler::processBeingSelfEffect")
256
 
    if (!effectManager || !actorManager)
257
 
    {
258
 
        BLOCK_END("BeingHandler::processBeingSelfEffect")
259
 
        return;
260
 
    }
261
 
 
262
 
    const int id = static_cast<uint32_t>(msg.readInt32("being id"));
263
 
    Being *const being = actorManager->findBeing(id);
264
 
    if (!being)
265
 
    {
266
 
        BLOCK_END("BeingHandler::processBeingSelfEffect")
267
 
        return;
268
 
    }
269
 
 
270
 
    const int effectType = msg.readInt32("effect type");
271
 
 
272
 
    if (Particle::enabled)
273
 
        effectManager->trigger(effectType, being);
274
 
 
275
 
    // +++ need dehard code effectType == 3
276
 
    if (effectType == 3 && being->getType() == ActorType::Player
277
 
        && socialWindow)
278
 
    {   // reset received damage
279
 
        socialWindow->resetDamage(being->getName());
280
 
    }
281
 
    BLOCK_END("BeingHandler::processBeingSelfEffect")
282
 
}
283
 
 
284
254
void BeingHandler::processBeingEmotion(Net::MessageIn &msg) const
285
255
{
286
256
    BLOCK_START("BeingHandler::processBeingEmotion")
331
301
        }
332
302
        else
333
303
        {
334
 
            dstBeing->setName(msg.readString(24, "name"));
 
304
            const std::string name = msg.readString(24, "name");
 
305
            if (dstBeing->getType() != ActorType::Portal)
 
306
            {
 
307
                dstBeing->setName(name);
 
308
            }
 
309
            else if (viewport)
 
310
            {
 
311
                Map *const map = viewport->getMap();
 
312
                if (map)
 
313
                {
 
314
                    map->addPortalTile(name, MapItemType::PORTAL,
 
315
                        dstBeing->getTileX(), dstBeing->getTileY());
 
316
                }
 
317
            }
335
318
            dstBeing->updateGuild();
336
319
            dstBeing->addToCache();
337
320
 
404
387
    BLOCK_END("BeingHandler::processPlayerStop")
405
388
}
406
389
 
407
 
void BeingHandler::processPlayerMoveToAttack(Net::MessageIn &msg A_UNUSED)
408
 
                                             const
 
390
void BeingHandler::processPlayerMoveToAttack(Net::MessageIn &msg) const
409
391
{
410
392
    BLOCK_START("BeingHandler::processPlayerStop")
411
 
    /*
412
 
      * This is an *advisory* message, telling the client that
413
 
      * it needs to move the character before attacking
414
 
      * a target (out of range, obstruction in line of fire).
415
 
      * We can safely ignore this...
416
 
      */
 
393
    msg.readInt32("target id");
 
394
    msg.readInt16("target x");
 
395
    msg.readInt16("target y");
 
396
    msg.readInt16("x");
 
397
    msg.readInt16("y");
 
398
    msg.readInt16("attack range");
 
399
 
417
400
    if (localPlayer)
418
401
        localPlayer->fixAttackTarget();
419
402
    BLOCK_END("BeingHandler::processPlayerStop")