• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

polserver / polserver / 21108840797

18 Jan 2026 08:35AM UTC coverage: 60.508% (+0.02%) from 60.492%
21108840797

push

github

web-flow
ClangTidy readability-else-after-return (#857)

* trigger tidy

* Automated clang-tidy change: readability-else-after-return

* compile test

* rerun

* Automated clang-tidy change: readability-else-after-return

* trigger..

* Automated clang-tidy change: readability-else-after-return

* manually removed a few

* Automated clang-tidy change: readability-else-after-return

* removed duplicate code

* fix remaining warnings

* fixed scope

---------

Co-authored-by: Clang Tidy <clang-tidy@users.noreply.github.com>

837 of 1874 new or added lines in 151 files covered. (44.66%)

46 existing lines in 25 files now uncovered.

44448 of 73458 relevant lines covered (60.51%)

525066.38 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

32.5
/pol-core/pol/module/partymod.cpp
1
/** @file
2
 *
3
 * @par History
4
 * - 2009/12/21 Turley:    ._method() call fix
5
 */
6

7

8
#include "pol_global_config.h"
9

10
#include "partymod.h"
11
#include <stddef.h>
12

13
#include "../../bscript/berror.h"
14
#include "../../bscript/executor.h"
15
#include "../../bscript/impstr.h"
16
#include "../../bscript/objmembers.h"
17
#include "../../bscript/objmethods.h"
18
#include "../../clib/rawtypes.h"
19
#include "../../clib/stlutil.h"
20
#include "../clfunc.h"
21
#include "../fnsearch.h"
22
#include "../globals/settings.h"
23
#include "../globals/uvars.h"
24
#include "../mobile/charactr.h"
25
#include "../network/pktdef.h"
26
#include "../party.h"
27
#include "../party_cfg.h"
28
#include "../partyscrobj.h"
29
#include "../polobject.h"
30
#include "../syshook.h"
31
#include "../uoexec.h"
32
#include "../uoscrobj.h"
33
#include <module_defs/party.h>
34

35
namespace Pol
36
{
37
namespace Core
38
{
39
class UOExecutor;
40

41
}
42
namespace Module
43
{
44
using namespace Bscript;
45
using UOExecutor = Core::UOExecutor;
46

47
PartyExecutorModule::PartyExecutorModule( Executor& exec )
371✔
48
    : TmplExecutorModule<PartyExecutorModule, Core::PolModule>( exec )
371✔
49
{
50
}
371✔
51

52

53
BObjectImp* CreatePartyRefObjImp( Core::Party* party )
6✔
54
{
55
  return new EPartyRefObjImp( ref_ptr<Core::Party>( party ) );
6✔
56
}
57

58
// party.em Functions:
59
bool getPartyParam( Executor& exec, unsigned param, Core::Party*& party, BError*& err )
×
60
{
61
  BApplicObjBase* aob = nullptr;
×
62
  if ( exec.hasParams( param + 1 ) )
×
63
    aob = exec.getApplicObjParam( param, &party_type );
×
64

65
  if ( aob == nullptr )
×
66
  {
67
    err = new BError( "Invalid parameter type" );
×
68
    return false;
×
69
  }
70

71
  EPartyRefObjImp* pr = static_cast<EPartyRefObjImp*>( aob );
×
72
  party = pr->value().get();
×
73
  if ( Core::system_find_mobile( party->leader() ) == nullptr )
×
74
  {
75
    err = new BError( "Party has no leader" );
×
76
    return false;
×
77
  }
78
  return true;
×
79
}
80

81
BObjectImp* PartyExecutorModule::mf_CreateParty()
1✔
82
{
83
  Mobile::Character* leader;
84
  Mobile::Character* firstmem;
85
  if ( ( getCharacterParam( 0, leader ) ) && ( getCharacterParam( 1, firstmem ) ) )
1✔
86
  {
87
    if ( leader->has_party() )
1✔
88
      return new BError( "Leader is already in a party" );
×
89
    if ( leader->has_candidate_of() )
1✔
90
      return new BError( "Leader is already candidate of a party" );
×
91
    if ( leader->has_offline_mem_of() )
1✔
92
      return new BError( "Leader is already offline member of a party" );
×
93
    if ( leader == firstmem )
1✔
94
      return new BError( "Leader and Firstmember are the same" );
×
95
    if ( firstmem->has_party() )
1✔
96
      return new BError( "First Member is already in a party" );
×
97
    if ( firstmem->has_candidate_of() )
1✔
98
      return new BError( "First Member is already candidate of a party" );
×
99
    if ( firstmem->has_offline_mem_of() )
1✔
100
      return new BError( "First Member is already offline member of a party" );
×
101

102
    Core::Party* party = new Core::Party( leader->serial );
1✔
103
    Core::gamestate.parties.emplace_back( party );
1✔
104
    leader->party( party );
1✔
105

106
    if ( party->add_member( firstmem->serial ) )
1✔
107
    {
108
      firstmem->party( party );
1✔
109
      if ( Core::settingsManager.party_cfg.Hooks.OnPartyCreate )
1✔
110
        Core::settingsManager.party_cfg.Hooks.OnPartyCreate->call( CreatePartyRefObjImp( party ) );
×
111
      party->send_msg_to_all( Core::CLP_Added );  // You have been added to the party.
1✔
112
      if ( leader->has_active_client() )
1✔
113
        Core::send_sysmessage_cl_affix( leader->client, Core::CLP_Joined, firstmem->name(),
×
114
                                        true );  //  : joined the party.
115
      if ( firstmem->has_active_client() )
1✔
116
        Core::send_sysmessage_cl_affix( firstmem->client, Core::CLP_Joined, leader->name(), true );
×
117
      party->send_member_list( nullptr );
1✔
118
      party->send_stats_on_add( firstmem );
1✔
119
    }
120

121
    return new BLong( 1 );
1✔
122
  }
NEW
123
  return new BError( "Invalid parameter type" );
×
124
}
125

126
BObjectImp* PartyExecutorModule::mf_DisbandParty()
×
127
{
128
  Core::Party* party;
129
  BError* err;
130
  if ( getPartyParam( exec, 0, party, err ) )
×
131
  {
132
    Core::disband_party( party->leader() );
×
133
    return new BLong( 1 );
×
134
  }
NEW
135
  return err;
×
136
}
137

138
BObjectImp* PartyExecutorModule::mf_SendPartyMsg()
×
139
{
140
  Core::Party* party;
141
  BError* err;
142
  if ( getPartyParam( exec, 0, party, err ) )
×
143
  {
144
    const String* text;
145
    Mobile::Character* chr;
146
    if ( ( getCharacterParam( 1, chr ) ) && ( getUnicodeStringParam( 2, text ) ) )
×
147
    {
148
      if ( text->length() > SPEECH_MAX_LEN )
×
149
        return new BError( "Text exceeds maximum size." );
×
150
      if ( Core::settingsManager.party_cfg.Hooks.OnPublicChat )
×
151
        Core::settingsManager.party_cfg.Hooks.OnPublicChat->call( chr->make_ref(),
×
152
                                                                  new String( *text ) );
×
153

154
      party->send_member_msg_public( chr, text->value() );
×
155
      return new BLong( 1 );
×
156
    }
NEW
157
    return new BError( "Invalid parameter type" );
×
158
  }
NEW
159
  return err;
×
160
}
161

162
BObjectImp* PartyExecutorModule::mf_SendPrivatePartyMsg()
×
163
{
164
  Core::Party* party;
165
  BError* err;
166
  if ( getPartyParam( exec, 0, party, err ) )
×
167
  {
168
    const String* text;
169
    Mobile::Character* chr;
170
    Mobile::Character* tochr;
171
    if ( ( getCharacterParam( 1, chr ) ) && ( getCharacterParam( 2, tochr ) ) &&
×
172
         ( getUnicodeStringParam( 3, text ) ) )
×
173
    {
174
      if ( text->length() > SPEECH_MAX_LEN )
×
175
        return new BError( "Text exceeds maximum size." );
×
176
      if ( Core::settingsManager.party_cfg.Hooks.OnPrivateChat )
×
177
        Core::settingsManager.party_cfg.Hooks.OnPrivateChat->call(
×
178
            chr->make_ref(), tochr->make_ref(), new String( *text ) );
×
179

180
      party->send_member_msg_private( chr, tochr, text->value() );
×
181
      return new BLong( 1 );
×
182
    }
NEW
183
    return new BError( "Invalid parameter type" );
×
184
  }
NEW
185
  return err;
×
186
}
187
}  // namespace Module
188
}  // namespace Pol
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc