• 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

10.75
/pol-core/pol/textcmd.cpp
1
/** @file
2
 *
3
 * @par History
4
 * - 2006/06/15 Austin:    Removed .set .priv and .priv
5
 * - 2006/05/30 Shinigami: fixed a smaller mistype in textcmd_startlog()
6
 *                         set correct time stamp in textcmd_startlog() and textcmd_stoplog()
7
 * - 2009/09/03 MuadDib:   Relocation of account related cpp/h
8
 * - 2009/09/10 MuadDib:   Cleanup of depreciated internal text commands.
9
 * - 2009/10/17 Turley:    check for priv "plogany" enabled instead of existence - Tomi
10
 */
11

12

13
#include "textcmd.h"
14

15
#include <cstddef>
16
#include <ctype.h>
17
#include <iosfwd>
18
#include <stdio.h>
19
#include <stdlib.h>
20
#include <string.h>
21
#include <string>
22
#include <time.h>
23

24
#include "../bscript/berror.h"
25
#include "../bscript/impstr.h"
26
#include "../clib/cfgelem.h"
27
#include "../clib/cfgfile.h"
28
#include "../clib/clib.h"
29
#include "../clib/clib_endian.h"
30
#include "../clib/esignal.h"
31
#include "../clib/fileutil.h"
32
#include "../clib/logfacility.h"
33
#include "../clib/opnew.h"
34
#include "../clib/rawtypes.h"
35
#include "../clib/refptr.h"
36
#include "../clib/spinlock.h"
37
#include "../clib/stlutil.h"
38
#include "../clib/strutil.h"
39
#include "../clib/threadhelp.h"
40
#include "../plib/clidata.h"
41
#include "../plib/pkg.h"
42
#include "../plib/systemstate.h"
43
#include "../plib/uconst.h"
44
#include "accounts/account.h"
45
#include "allocd.h"
46
#include "globals/network.h"
47
#include "globals/state.h"
48
#include "globals/uvars.h"
49
#include "item/item.h"
50
#include "item/itemdesc.h"
51
#include "mobile/charactr.h"
52
#include "module/uomod.h"
53
#include "network/client.h"
54
#include "network/pktboth.h"
55
#include "polclock.h"
56
#include "repsys.h"
57
#include "scrdef.h"
58
#include "scrsched.h"
59
#include "scrstore.h"
60
#include "ufunc.h"
61
#include "ufuncstd.h"
62
#include "uoexec.h"
63
#include "uoscrobj.h"
64
#include "utype.h"
65
#include "uworld.h"
66

67

68
namespace Pol::Core
69
{
70
bool wordicmp::operator()( const std::string& lhs, const std::string& rhs ) const
×
71
{
72
  size_t len = std::min( lhs.size(), rhs.size() );
×
73

74
  return ( strnicmp( lhs.c_str(), rhs.c_str(), len ) < 0 );
×
75
}
76

77

78
void register_command( const std::string& cmd, TextCmdFunc f )
×
79
{
80
  gamestate.textcmds.insert( TextCmds::value_type( cmd, f ) );
×
81
}
×
82
void register_command( const std::string& cmd, ParamTextCmdFunc f )
×
83
{
84
  gamestate.paramtextcmds.insert( ParamTextCmds::value_type( cmd, f ) );
×
85
}
×
86

87
bool FindEquipTemplate( const std::string& template_name, Clib::ConfigElem& elem )
1✔
88
{
89
  try
90
  {
91
    Clib::ConfigFile cf( "config/equip.cfg" );
1✔
92
    while ( cf.read( elem ) )
1✔
93
    {
94
      if ( !elem.type_is( "Equipment" ) )
1✔
95
        continue;
×
96
      const char* rest = elem.rest();
1✔
97
      if ( rest == nullptr || *rest == '\0' )
1✔
98
        continue;
×
99
      if ( stricmp( rest, template_name.c_str() ) == 0 )
1✔
100
        return true;
1✔
101
    }
102
    return false;
×
103
  }
1✔
104
  catch ( ... )
×
105
  {
106
    return false;
×
107
  }
×
108
}
109

110
Bscript::BObjectImp* equip_from_template( Mobile::Character* chr, const std::string& template_name )
1✔
111
{
112
  Clib::ConfigElem elem;
1✔
113
  if ( !FindEquipTemplate( template_name, elem ) )
1✔
114
  {
115
    return new Bscript::BError( "Equipment template not found" );
×
116
  }
117

118
  std::string tmp;
1✔
119
  while ( elem.remove_prop( "Equip", &tmp ) || elem.remove_prop( "Weapon", &tmp ) ||
6✔
120
          elem.remove_prop( "Armor", &tmp ) )
1✔
121
  {
122
    ISTRINGSTREAM is( tmp );
4✔
123
    std::string objtype_str;
4✔
124
    if ( is >> objtype_str )
4✔
125
    {
126
      unsigned int objtype;
127
      const char* ot_str = objtype_str.c_str();
4✔
128
      if ( isdigit( *ot_str ) )
4✔
129
      {
130
        objtype = static_cast<u32>( strtoul( ot_str, nullptr, 0 ) );
4✔
131
      }
132
      else
133
      {
134
        objtype = Items::get_objtype_byname( ot_str );
×
135
        if ( !objtype )
×
136
        {
137
          ERROR_PRINTLN( "Blech! Can't find '{}' named in equip.cfg", ot_str );
×
138
          continue;
×
139
        }
140
      }
141
      std::string color_str;
4✔
142
      unsigned short color = 0;
4✔
143
      if ( is >> color_str )
4✔
144
      {
145
        color = static_cast<unsigned short>( strtoul( color_str.c_str(), nullptr, 0 ) );
×
146
      }
147
      Items::Item* it = Items::Item::create( objtype );
4✔
148
      if ( it != nullptr )
4✔
149
      {
150
        color &= Plib::VALID_ITEM_COLOR_MASK;
4✔
151
        it->color = color;
4✔
152
        it->layer = Plib::tilelayer( it->graphic );
4✔
153
        // FIXME equip scripts, equiptest scripts
154
        if ( chr->equippable( it ) )
4✔
155
        {
156
          chr->equip( it );
4✔
157
          update_item_to_inrange( it );
4✔
158
        }
159
        else
160
        {
161
          it->destroy();
×
162
        }
163
      }
164
    }
4✔
165
  }
4✔
166
  return new Bscript::BLong( 1 );
1✔
167
}
1✔
168

169
// FIXME should do a command handler table like for messages received.
170
void send_client_char_data( Mobile::Character* chr, Network::Client* client );
171

172
void send_move_if_inrange2( Mobile::Character* chr, Network::Client* client )
×
173
{
174
  if ( client->ready && client->chr && client->chr != chr && client->chr->in_visual_range( chr ) )
×
175
  {
176
    send_move( client, chr );
×
177
  }
178
}
×
179

180
void textcmd_resendchars( Network::Client* client )
×
181
{
182
  Core::WorldIterator<Core::MobileFilter>::InRange( client->chr, client->chr->los_size(),
×
183
                                                    [&]( Mobile::Character* zonechr )
×
184
                                                    { send_client_char_data( zonechr, client ); } );
×
185
}
×
186

187
void textcmd_shutdown( Network::Client* /*client*/ )
×
188
{
189
  Clib::signal_exit();
×
190
}
×
191

192
void handle_ident_cursor( Mobile::Character* chr, PKTBI_6C* msgin )
×
193
{
194
  if ( chr->client != nullptr )
×
195
  {
196
    char s[80];
197
    snprintf( s, Clib::arsize( s ), "Serial: 0x%8.08lX, %ld, ObjType 0x%4.04X",
×
198
              static_cast<unsigned long>( cfBEu32( msgin->selected_serial ) ),
×
199
              static_cast<signed long>( cfBEu32( msgin->selected_serial ) ),
×
200
              cfBEu16( msgin->graphic ) );
×
201
    send_sysmessage( chr->client, s );
×
202
  }
203
}
×
204

205
void textcmd_ident( Network::Client* client )
×
206
{
207
  send_sysmessage( client, "Select something to identify." );
×
208
  gamestate.target_cursors.ident_cursor.send_object_cursor( client );
×
209
}
×
210

211
void textcmd_listarmor( Network::Client* client )
×
212
{
213
  client->chr->showarmor();
×
214
}
×
215

216

217
std::string timeoutstr( polclock_t at )
×
218
{
219
  polclock_t ticks = at - polclock();
×
220
  auto seconds = ticks / POLCLOCKS_PER_SEC;
×
221
  return Clib::tostring( seconds ) + " seconds";
×
222
}
223

224
///
225
/// Internal Command: .i_repdata
226
/// Show Reputation System Data for a Targetted Mobile
227
/// Displays:
228
///  Murderer status
229
///  Criminal status and timeout
230
///  LawfullyDamaged status and timeouts
231
///  AggressorTo status and timeouts
232
///  ToBeReportable list
233
///  Reportable list
234
///  RepSystem Task status
235
///
236
void RepSystem::show_repdata( Network::Client* client, Mobile::Character* mob )
×
237
{
238
  if ( mob->is_murderer() )
×
239
  {
240
    send_sysmessage( client, "Mobile is a murderer." );
×
241
  }
242
  else if ( mob->is_criminal() )
×
243
  {
244
    send_sysmessage( client, "Mobile is criminal for " + timeoutstr( mob->criminal_until_ ) + " [" +
×
245
                                 Clib::tostring( mob->criminal_until_ ) + "]" );
×
246
  }
247

248
  for ( Mobile::Character::MobileCont::const_iterator itr = mob->aggressor_to_.begin();
×
249
        itr != mob->aggressor_to_.end(); ++itr )
×
250
  {
251
    send_sysmessage( client, "Aggressor to " + ( *itr ).first->name() + " for " +
×
252
                                 timeoutstr( ( *itr ).second ) + " [" +
×
253
                                 Clib::tostring( ( *itr ).second ) + "]" );
×
254
  }
255

256
  for ( Mobile::Character::MobileCont::const_iterator itr = mob->lawfully_damaged_.begin();
×
257
        itr != mob->lawfully_damaged_.end(); ++itr )
×
258
  {
259
    send_sysmessage( client, "Lawfully Damaged " + ( *itr ).first->name() + " for " +
×
260
                                 timeoutstr( ( *itr ).second ) + " [" +
×
261
                                 Clib::tostring( ( *itr ).second ) + "]" );
×
262
  }
263

264
  for ( Mobile::Character::ToBeReportableList::const_iterator itr = mob->to_be_reportable_.begin();
×
265
        itr != mob->to_be_reportable_.end(); ++itr )
×
266
  {
267
    USERIAL serial = ( *itr );
×
268
    send_sysmessage( client, "ToBeReportable: " + Clib::hexint( serial ) );
×
269
  }
270

271
  for ( Mobile::Character::ReportableList::const_iterator itr = mob->reportable_.begin();
×
272
        itr != mob->reportable_.end(); ++itr )
×
273
  {
274
    const Mobile::reportable_t& rt = ( *itr );
×
275
    send_sysmessage( client, "Reportable: " + Clib::hexint( rt.serial ) + " at " +
×
276
                                 Clib::tostring( rt.polclock ) );
×
277
  }
278

279
  if ( mob->repsys_task_ != nullptr )
×
280
    send_sysmessage( client, "Repsys task is active, runs in " +
×
281
                                 timeoutstr( mob->repsys_task_->next_run_clock() ) + " [" +
×
282
                                 Clib::tostring( mob->repsys_task_->next_run_clock() ) + "]" );
×
283
}
×
284

285
void show_repdata( Mobile::Character* looker, Mobile::Character* mob )
×
286
{
287
  RepSystem::show_repdata( looker->client, mob );
×
288
}
×
289

290

291
void textcmd_repdata( Network::Client* client )
×
292
{
293
  send_sysmessage( client, "Please target a mobile to display repdata for." );
×
294
  gamestate.target_cursors.repdata_cursor.send_object_cursor( client );
×
295
}
×
296

297
void start_packetlog( Mobile::Character* looker, Mobile::Character* mob )
×
298
{
299
  if ( mob->connected() )  // gotta be connected to get packets right?
×
300
  {
301
    auto res = mob->client->start_log();
×
302
    if ( res == Network::PacketLog::Success )
×
303
    {
304
      send_sysmessage( looker->client, "I/O log file opened for " + mob->name() );
×
305
    }
306
    else if ( res == Network::PacketLog::Unchanged )
×
307
    {
308
      send_sysmessage( looker->client, "I/O log was already open for " + mob->name() );
×
309
    }
310
    else
311
    {
312
      send_sysmessage( looker->client, "Unable to open I/O log file for " + mob->name() );
×
313
    }
314
  }
315
}
×
316

317
void textcmd_startlog( Network::Client* client )
×
318
{
319
  if ( client->chr->can_plogany() )
×
320
  {
321
    send_sysmessage( client, "Please target a player to start packet logging for." );
×
322
    gamestate.target_cursors.startlog_cursor.send_object_cursor( client );
×
323
  }
324
  else
325
  {
326
    auto res = client->start_log();
×
327
    if ( res == Network::PacketLog::Success )
×
328
    {
329
      send_sysmessage( client, "I/O log file opened." );
×
330
    }
331
    else if ( res == Network::PacketLog::Unchanged )
×
332
    {
333
      send_sysmessage( client, "I/O log was already open." );
×
334
    }
335
    else
336
    {
337
      send_sysmessage( client, "Unable to open I/O log file." );
×
338
    }
339
  }
340
}
×
341

342
void stop_packetlog( Mobile::Character* looker, Mobile::Character* mob )
×
343
{
344
  if ( mob->connected() )  // gotta be connected to already have packets right?
×
345
  {
346
    auto res = mob->client->stop_log();
×
347
    if ( res == Network::PacketLog::Success )
×
348
    {
349
      send_sysmessage( looker->client, "I/O log file closed for " + mob->name() );
×
350
    }
351
    else
352
    {
353
      send_sysmessage( looker->client, "Packet Logging not enabled for " + mob->name() );
×
354
    }
355
  }
356
}
×
357

358
void textcmd_stoplog( Network::Client* client )
×
359
{
360
  if ( client->chr->can_plogany() )
×
361
  {
362
    send_sysmessage( client, "Please target a player to stop packet logging for." );
×
363
    gamestate.target_cursors.stoplog_cursor.send_object_cursor( client );
×
364
  }
365
  else
366
  {
367
    auto res = client->stop_log();
×
368
    if ( res == Network::PacketLog::Success )
×
369
    {
370
      send_sysmessage( client, "I/O log file closed." );
×
371
    }
372
    else
373
    {
374
      send_sysmessage( client, "Packet Logging not enabled." );
×
375
    }
376
  }
377
}
×
378

379
void textcmd_orphans( Network::Client* client )
×
380
{
381
  OSTRINGSTREAM os;
×
382
  os << "Unreaped orphans: " << stateManager.uobjcount.unreaped_orphans;
×
383

384
  send_sysmessage( client, OSTRINGSTREAM_STR( os ) );
×
385

386
  OSTRINGSTREAM os2;
×
387
  os2 << "EChrRef count: " << stateManager.uobjcount.uobj_count_echrref;
×
388
  send_sysmessage( client, OSTRINGSTREAM_STR( os2 ) );
×
389
}
×
390

391
void list_scripts();
392
void textcmd_list_scripts( Network::Client* )
×
393
{
394
  list_scripts();
×
395
}
×
396
void list_crit_scripts();
397
void textcmd_list_crit_scripts( Network::Client* )
×
398
{
399
  list_crit_scripts();
×
400
}
×
401
void textcmd_procs( Network::Client* client )
×
402
{
403
  send_sysmessage( client, "Process Information:" );
×
404

405
  send_sysmessage(
×
406
      client,
407
      "Running: " + Clib::tostring( (unsigned int)( scriptScheduler.getRunlist().size() ) ) );
×
408
  send_sysmessage(
×
409
      client,
410
      "Blocked: " + Clib::tostring( (unsigned int)( scriptScheduler.getHoldlist().size() ) ) );
×
411
}
×
412

413
void textcmd_log_profile( Network::Client* client )
×
414
{
415
  log_all_script_cycle_counts( false );
×
416
  send_sysmessage( client, "Script profile written to logfile" );
×
417
}
×
418

419
void textcmd_log_profile_clear( Network::Client* client )
×
420
{
421
  log_all_script_cycle_counts( true );
×
422
  send_sysmessage( client, "Script profile written to logfile and cleared" );
×
423
}
×
424

425
void textcmd_heapcheck( Network::Client* /*client*/ )
×
426
{
427
  PrintAllocationData();
×
428
  Clib::PrintHeapData();
×
429
}
×
430

431
void textcmd_threads( Network::Client* client )
×
432
{
433
  std::string s = "Child threads: " + Clib::tostring( threadhelp::child_threads );
×
434
  send_sysmessage( client, s );
×
435
}
×
436

437
void textcmd_constat( Network::Client* client )
×
438
{
439
  int i = 0;
×
440
  send_sysmessage( client, "Connection statuses:" );
×
441
  for ( Clients::const_iterator itr = networkManager.clients.begin(),
×
442
                                end = networkManager.clients.end();
×
443
        itr != end; ++itr )
×
444
  {
445
    OSTRINGSTREAM os;
×
446
    os << i << ": " << ( *itr )->status() << " ";
×
447
    send_sysmessage( client, OSTRINGSTREAM_STR( os ) );
×
448
    ++i;
×
449
  }
×
450
}
×
451

452

453
void textcmd_singlezone_integ_item( Network::Client* client )
×
454
{
455
  Pos2d gridp = zone_convert( client->chr->pos() );
×
456
  bool ok = check_single_zone_item_integrity( gridp, client->chr->realm() );
×
457
  if ( ok )
×
458
    send_sysmessage( client, "Item integrity checks out OK!" );
×
459
  else
460
    send_sysmessage( client, "Item integrity problems detected. " );
×
461
}
×
462

463
bool check_item_integrity();
464
void textcmd_integ_item( Network::Client* client )
×
465
{
466
  bool ok = check_item_integrity();
×
467
  if ( ok )
×
468
    send_sysmessage( client, "Item integrity checks out OK!" );
×
469
  else
470
    send_sysmessage( client, "Item integrity problems detected.  Check logfile" );
×
471
}
×
472
void check_character_integrity();
473
void textcmd_integ_chr( Network::Client* /*client*/ )
×
474
{
475
  check_character_integrity();
×
476
}
×
477

478
std::string get_textcmd_help( Mobile::Character* chr, const std::string& cmd )
×
479
{
480
  /* const char* t = cmd;
481
   while ( *t )
482
   {
483
     if ( !isalpha( *t ) && ( *t != '_' ) )
484
     {
485
       // cout << "illegal command char: as int = " << int(*t) << ", as char = " << *t << endl;
486
       return "";
487
     }
488
     ++t;
489
   }
490
 */
491
  std::string upp( cmd );
×
492
  Clib::mkupperASCII( upp );
×
493
  if ( upp == "AUX" || upp == "CON" || upp == "PRN" || upp == "NUL" )
×
494
    return "";
×
495

496
  for ( int i = chr->cmdlevel(); i >= 0; --i )
×
497
  {
498
    CmdLevel& cmdlevel = gamestate.cmdlevels[i];
×
499
    for ( unsigned diridx = 0; diridx < cmdlevel.searchlist.size(); ++diridx )
×
500
    {
501
      std::string filename;
×
502

503
      Plib::Package* pkg = cmdlevel.searchlist[diridx].pkg;
×
504
      filename = cmdlevel.searchlist[diridx].dir + cmd + std::string( ".txt" );
×
505
      if ( pkg )
×
506
        filename = pkg->dir() + filename;
×
507

508
      if ( Clib::FileExists( filename.c_str() ) )
×
509
      {
510
        std::string result;
×
511
        std::ifstream ifs( filename.c_str(), std::ios::binary );
×
512
        char temp[64];
513
        do
514
        {
515
          ifs.read( temp, sizeof temp );
×
516
          if ( ifs.gcount() )
×
517
            result.append( temp, static_cast<size_t>( ifs.gcount() ) );
×
518
        } while ( !ifs.eof() );
×
519
        return result;
×
520
      }
×
521
    }
×
522
  }
523
  return "";
×
524
}
×
525

526
bool start_textcmd_script( Network::Client* client, const std::string& text,
×
527
                           const std::string& lang )
528
{
529
  std::string scriptname;
×
530
  std::string params;
×
531
  size_t pos = text.find_first_of( ' ' );
×
532
  if ( pos != std::string::npos )
×
533
  {
534
    scriptname = std::string( text, 0, pos );
×
535
    params = text.substr( pos + 1 );
×
536
  }
537
  else
538
  {
539
    scriptname = text;
×
540
    params = "";
×
541
  }
542

543
  // early out test for invalid scriptnames
544
  if ( scriptname.find_first_of( "*\"':;!?#&-+()/\\=" ) != std::string::npos )
×
545
    return false;
×
546

547
  std::string upp( scriptname );
×
548
  Clib::mkupperASCII( upp );
×
549
  if ( upp == "AUX" || upp == "CON" || upp == "PRN" || upp == "NUL" )
×
550
    return false;
×
551

552
  for ( int i = client->chr->cmdlevel(); i >= 0; --i )
×
553
  {
554
    CmdLevel& cmdlevel = gamestate.cmdlevels[i];
×
555
    for ( unsigned diridx = 0; diridx < cmdlevel.searchlist.size(); ++diridx )
×
556
    {
557
      ScriptDef sd;
×
558
      Plib::Package* pkg = cmdlevel.searchlist[diridx].pkg;
×
559
      if ( pkg )
×
560
        sd.quickconfig( pkg, cmdlevel.searchlist[diridx].dir + scriptname + ".ecl" );
×
561
      else
562
        sd.quickconfig( cmdlevel.searchlist[diridx].dir + scriptname + ".ecl" );
×
563
      if ( !sd.exists() )
×
564
        continue;
×
565

566
      ref_ptr<Bscript::EScriptProgram> prog =
567
          find_script2( sd,
568
                        false,  // don't complain if not found
569
                        Plib::systemstate.config.cache_interactive_scripts );
×
570
      if ( prog.get() != nullptr )
×
571
      {
572
        std::unique_ptr<UOExecutor> ex( create_script_executor() );
×
573
        if ( prog->haveProgram )
×
574
        {
575
          if ( !lang.empty() )
×
576
            ex->pushArg( new Bscript::String( lang ) );
×
577
          ex->pushArg( new Bscript::String( params ) );
×
578
          ex->pushArg( new Module::ECharacterRefObjImp( client->chr ) );
×
579
        }
580

581
        Module::UOExecutorModule* uoemod = new Module::UOExecutorModule( *ex );
×
582
        ex->addModule( uoemod );
×
583
        ex->priority( 100 );
×
584

585
        if ( ex->setProgram( prog.get() ) )
×
586
        {
587
          uoemod->controller_.set( client->chr );  // DAVE added 12/04, let character issuing
×
588
                                                   // textcmd be the script controller
589
          schedule_executor( ex.release() );
×
590
          return true;
×
591
        }
592

NEW
593
        ERROR_PRINTLN( "script {}: setProgram failed", scriptname );
×
594
        // TODO: it seems to keep looking until it finds one it can use..guess this is okay?
595
      }
×
596
    }
×
597
  }
598
  return false;
×
599
}
×
600

601
bool process_command( Network::Client* client, const std::string& text,
×
602
                      const std::string& lang /*""*/ )
603
{
604
  static int init;
605
  if ( !init )
×
606
  {
607
    init = 1;
×
608
    register_command( "armor", textcmd_listarmor );
×
609
    register_command( "constat", textcmd_constat );
×
610
    register_command( "heapcheck", &textcmd_heapcheck );
×
611
    register_command( "i_repdata", textcmd_repdata );
×
612
    register_command( "t_ident", textcmd_ident );
×
613
    register_command( "integ_item", textcmd_integ_item );
×
614
    register_command( "integ_chr", textcmd_integ_chr );
×
615
    register_command( "i_s_item_integ", textcmd_singlezone_integ_item );  // davedebug
×
616
    register_command( "list_crit", &textcmd_list_crit_scripts );
×
617
    register_command( "list_scripts", &textcmd_list_scripts );
×
618
    register_command( "log_profile", &textcmd_log_profile );
×
619
    register_command( "log_profile_clear", &textcmd_log_profile_clear );
×
620
    register_command( "orphans", &textcmd_orphans );
×
621
    register_command( "procs", &textcmd_procs );
×
622
    register_command( "resendchars", &textcmd_resendchars );
×
623
    register_command( "shutdown", &textcmd_shutdown );
×
624
    register_command( "startlog", &textcmd_startlog );
×
625
    register_command( "stoplog", &textcmd_stoplog );
×
626
    register_command( "threads", &textcmd_threads );
×
627
  }
628

629
  std::string cmd = text.substr( 1 );  // skip the "/" or "."
×
630

631
  if ( start_textcmd_script( client, cmd, lang ) )
×
632
    return true;
×
633

634
  if ( client->chr->cmdlevel() >= gamestate.cmdlevels.size() - 2 )
×
635
  {
636
    TextCmds::iterator itr2 = gamestate.textcmds.find( cmd );
×
637
    if ( itr2 != gamestate.textcmds.end() )
×
638
    {
639
      TextCmdFunc f = ( *itr2 ).second;
×
640
      ( *f )( client );
×
641
      return true;
×
642
    }
643

644
    ParamTextCmds::iterator itr1 = gamestate.paramtextcmds.find( cmd );
×
645
    if ( itr1 != gamestate.paramtextcmds.end() )
×
646
    {
647
      ParamTextCmdFunc f = ( *itr1 ).second;
×
648

649
      ( *f )( client, cmd.substr( ( *itr1 ).first.size() + 1 ) );
×
650
      return true;
×
651
    }
652
  }
653

654
  return false;
×
655
}
×
656
}  // 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