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

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