• 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

0.0
/pol-core/pol/useskill.cpp
1
/** @file
2
 *
3
 * @par History
4
 * - 2009/09/03 MuadDib:   Relocation of account related cpp/h
5
 */
6

7

8
#include <stdlib.h>
9
#include <string>
10

11
#include "bscript/eprog.h"
12
#include "clib/refptr.h"
13
#include "plib/systemstate.h"
14

15
#include "globals/network.h"
16
#include "mobile/attribute.h"
17
#include "mobile/charactr.h"
18
#include "network/client.h"
19
#include "network/pktin.h"
20
#include "polclock.h"
21
#include "scrdef.h"
22
#include "scrstore.h"
23
#include "skills.h"
24
#include "ufunc.h"
25
#include "uoskills.h"
26

27

28
namespace Pol::Core
29
{
30
void handle_use_skill( Network::Client* client, PKTIN_12* msg )
×
31
{
32
  char* params;
33
  unsigned int skillnum = (int)strtoul( (char*)msg->data, &params, 10 );
×
34

35
  if ( skillnum > networkManager.uoclient_general.maxskills )
×
36
    return;
×
37

38
  const UOSkill& uoskill = GetUOSkill( skillnum );
×
39
  if ( !uoskill.inited )
×
40
    return;
×
41
  const Mobile::Attribute* attrib = uoskill.pAttr;
×
42

43
  if ( !attrib->disable_core_checks && !CanUseSkill( client ) )
×
44
    return;
×
NEW
45
  if ( !attrib->script_.empty() )
×
46
  {
47
    if ( StartSkillScript( client, attrib ) )
×
48
      return;
×
49
  }
50

51
  /*Log("Client#%lu: (%s, acct:%s) No handler for skill %d\n",
52
          client->instance_, client->chr->name().c_str(), client->acct->name(), int(skillnum));
53
          cerr << "Character " << client->chr->name() << " (acct: " << client->chr->acct->name() <<
54
     "): No handler for skill " << int(skillnum) << endl;*/
55
  send_sysmessage( client, "That skill cannot be used directly." );
×
56
}
57

58

59
bool StartSkillScript( Network::Client* client, const Mobile::Attribute* attrib )
×
60
{
61
  Mobile::Character* chr = client->chr;
×
62
  ref_ptr<Bscript::EScriptProgram> prog = find_script2(
63
      attrib->script_, true,
×
64
      /* complain if not found */ Plib::systemstate.config.cache_interactive_scripts );
×
65

66
  if ( prog.get() != nullptr )
×
67
  {
68
    if ( chr->start_skill_script( prog.get() ) )
×
69
    {
70
      // Should the script handle the unhiding instead?
71
      if ( chr->hidden() && attrib->unhides )
×
72
        chr->unhide();
×
73
      if ( attrib->delay_seconds )
×
74
      {
75
        chr->disable_skills_until( poltime() + attrib->delay_seconds );
×
76
      }
77
      return true;
×
78
    }
79
  }
80
  std::string msg = "Unable to start skill script:";  //+attrib->script_.c_str();
×
81
  msg += attrib->script_.c_str();
×
82
  send_sysmessage( client, msg.c_str() );
×
83

84
  return false;
×
85
}
×
86

87
bool CanUseSkill( Network::Client* client )
×
88
{
89
  Mobile::Character* chr = client->chr;
×
90

91
  if ( chr->dead() )
×
92
  {
93
    private_say_above( chr, chr, "I am dead and cannot do that." );
×
94
    return false;
×
95
  }
NEW
96
  if ( chr->skill_ex_active() || chr->casting_spell() )
×
97
  {
98
    private_say_above( chr, chr, "I am already performing another action." );
×
99
    return false;
×
100
  }
NEW
101
  if ( poltime() < chr->disable_skills_until() )
×
102
  {
103
    send_sysmessage( client, "You must wait to perform another action." );
×
104
    return false;
×
105
  }
NEW
106
  if ( chr->frozen() )
×
107
  {
108
    private_say_above( chr, chr, "I am frozen and cannot do that." );
×
109
    return false;
×
110
  }
NEW
111
  if ( chr->paralyzed() )
×
112
  {
113
    private_say_above( chr, chr, "I am paralyzed and cannot do that." );
×
114
    return false;
×
115
  }
116

117
  return true;
×
118
}
119
}  // namespace Pol::Core
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