GCC Code Coverage Report
Directory: src/ Exec Total Coverage
File: src/net/tmwa/questrecv.cpp Lines: 0 20 0.0 %
Date: 2017-11-29 Branches: 0 12 0.0 %

Line Branch Exec Source
1
/*
2
 *  The ManaPlus Client
3
 *  Copyright (C) 2012-2017  The ManaPlus Developers
4
 *
5
 *  This file is part of The ManaPlus Client.
6
 *
7
 *  This program is free software; you can redistribute it and/or modify
8
 *  it under the terms of the GNU General Public License as published by
9
 *  the Free Software Foundation; either version 2 of the License, or
10
 *  any later version.
11
 *
12
 *  This program is distributed in the hope that it will be useful,
13
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
 *  GNU General Public License for more details.
16
 *
17
 *  You should have received a copy of the GNU General Public License
18
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
 */
20
21
#include "net/tmwa/questrecv.h"
22
23
#include "gui/windows/skilldialog.h"
24
#include "gui/windows/questswindow.h"
25
26
#include "net/messagein.h"
27
28
#include "const/resources/skill.h"
29
30
#include "debug.h"
31
32
namespace TmwAthena
33
{
34
35
void QuestRecv::processSetQuestVar(Net::MessageIn &msg)
36
{
37
    const int var = msg.readInt16("variable");
38
    const int val = msg.readInt32("value");
39
    if (questsWindow != nullptr)
40
    {
41
        questsWindow->updateQuest(var, val, 0, 0, 0);
42
        questsWindow->rebuild(true);
43
    }
44
    if (skillDialog != nullptr)
45
    {
46
        skillDialog->updateQuest(var, val, 0, 0, 0);
47
        skillDialog->playUpdateEffect(var + SKILL_VAR_MIN_ID);
48
    }
49
}
50
51
void QuestRecv::processPlayerQuests(Net::MessageIn &msg)
52
{
53
    const int count = (msg.readInt16("len") - 4) / 6;
54
    for (int f = 0; f < count; f ++)
55
    {
56
        const int var = msg.readInt16("variable");
57
        const int val = msg.readInt32("value");
58
        if (questsWindow != nullptr)
59
            questsWindow->updateQuest(var, val, 0, 0, 0);
60
        if (skillDialog != nullptr)
61
            skillDialog->updateQuest(var, val, 0, 0, 0);
62
    }
63
    if (questsWindow != nullptr)
64
        questsWindow->rebuild(false);
65
}
66
67
}  // namespace TmwAthena