• 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/tips.cpp
1
/** @file
2
 *
3
 * @par History
4
 * - 2009/07/23 MuadDib:   updates for new Enum::Packet Out ID
5
 */
6

7

8
#include <string>
9

10
#include "../clib/clib_endian.h"
11
#include "../clib/rawtypes.h"
12
#include "globals/uvars.h"
13
#include "network/packethelper.h"
14
#include "network/packets.h"
15
#include "network/pktdef.h"
16
#include "network/pktin.h"
17

18

19
namespace Pol::Core
20
{
21
bool send_tip( Network::Client* client, const char* tipname, unsigned short tipnum )
×
22
{
23
  std::string convertedText = Clib::strUtf8ToCp1252( tipname );
×
24
  size_t textlen = convertedText.length() + 1;
×
25
  if ( textlen > 0 && unsigned( textlen ) <= 9999 )
×
26
  {
27
    Network::PktHelper::PacketOut<Network::PktOut_A6> msg;
×
28
    msg->WriteFlipped<u16>( textlen + 10 );
×
29
    msg->Write<u8>( PKTOUT_A6_TYPE_TIP );
×
30
    msg->offset += 2;  // unk4,5
×
31
    msg->WriteFlipped<u16>( tipnum );
×
32
    msg->WriteFlipped<u16>( textlen );
×
33
    msg->Write( convertedText.c_str(), static_cast<u16>( textlen ) );
×
34
    msg.Send( client );
×
35
    return true;
×
36
  }
×
37

NEW
38
  return false;
×
UNCOV
39
}
×
40

41
void send_tip( Network::Client* client, const std::string& tiptext )
×
42
{
43
  std::string convertedText = Clib::strUtf8ToCp1252( tiptext );
×
44
  size_t textlen = convertedText.size() + 1;
×
45
  if ( textlen >= 10000 )
×
46
    textlen = 9999;
×
47

48
  Network::PktHelper::PacketOut<Network::PktOut_A6> msg;
×
49
  msg->WriteFlipped<u16>( textlen + 10 );
×
50
  msg->Write<u8>( PKTOUT_A6_TYPE_TIP );
×
51
  msg->offset += 2;  // unk4,5
×
52
  msg->offset += 2;  // tipnum
×
53
  msg->WriteFlipped<u16>( textlen );
×
54
  msg->Write( convertedText.c_str(), static_cast<u16>( textlen ) );
×
55
  msg.Send( client );
×
56
}
×
57

58
void handle_get_tip( Network::Client* client, PKTIN_A7* msg )
×
59
{
60
  u16 tipnum = cfBEu16( msg->lasttip );
×
61
  if ( !gamestate.tipfilenames.empty() )
×
62
  {
63
    if ( msg->prevnext )
×
64
    {
65
      ++tipnum;
×
66
      if ( tipnum >= gamestate.tipfilenames.size() )
×
67
        tipnum = 0;
×
68
    }
69
    else
70
    {
71
      --tipnum;
×
72
      if ( tipnum >= gamestate.tipfilenames.size() )
×
73
        tipnum = static_cast<u16>( gamestate.tipfilenames.size() ) - 1;
×
74
    }
75

76
    send_tip( client, gamestate.tipfilenames[tipnum].c_str(), tipnum );
×
77
  }
78
}
×
79
}  // 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