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

polserver / polserver / 21541532363

31 Jan 2026 08:14AM UTC coverage: 60.532% (+0.03%) from 60.507%
21541532363

push

github

web-flow
Tidy modernize for loops (#862)

* trigger loop convert

* Automated clang-tidy change: modernize-loop-convert

* fixed refactor

* Automated clang-tidy change: modernize-loop-convert

* compile

* first look through

* fixes and start to use a few ranges

* revert autogenerated file

* compilation fix

* second pass

* renamed loop variable

---------

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

164 of 447 new or added lines in 61 files covered. (36.69%)

6 existing lines in 5 files now uncovered.

44377 of 73312 relevant lines covered (60.53%)

499857.83 hits per line

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

10.94
/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

NEW
264
  for ( unsigned int serial : mob->to_be_reportable_ )
×
265
  {
266
    send_sysmessage( client, "ToBeReportable: " + Clib::hexint( serial ) );
×
267
  }
268

NEW
269
  for ( auto rt : mob->reportable_ )
×
270
  {
271
    send_sysmessage( client, "Reportable: " + Clib::hexint( rt.serial ) + " at " +
×
272
                                 Clib::tostring( rt.polclock ) );
×
273
  }
274

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

281
void show_repdata( Mobile::Character* looker, Mobile::Character* mob )
×
282
{
283
  RepSystem::show_repdata( looker->client, mob );
×
284
}
×
285

286

287
void textcmd_repdata( Network::Client* client )
×
288
{
289
  send_sysmessage( client, "Please target a mobile to display repdata for." );
×
290
  gamestate.target_cursors.repdata_cursor.send_object_cursor( client );
×
291
}
×
292

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

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

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

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

375
void textcmd_orphans( Network::Client* client )
×
376
{
377
  OSTRINGSTREAM os;
×
378
  os << "Unreaped orphans: " << stateManager.uobjcount.unreaped_orphans;
×
379

380
  send_sysmessage( client, OSTRINGSTREAM_STR( os ) );
×
381

382
  OSTRINGSTREAM os2;
×
383
  os2 << "EChrRef count: " << stateManager.uobjcount.uobj_count_echrref;
×
384
  send_sysmessage( client, OSTRINGSTREAM_STR( os2 ) );
×
385
}
×
386

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

401
  send_sysmessage(
×
402
      client,
403
      "Running: " + Clib::tostring( (unsigned int)( scriptScheduler.getRunlist().size() ) ) );
×
404
  send_sysmessage(
×
405
      client,
406
      "Blocked: " + Clib::tostring( (unsigned int)( scriptScheduler.getHoldlist().size() ) ) );
×
407
}
×
408

409
void textcmd_log_profile( Network::Client* client )
×
410
{
411
  log_all_script_cycle_counts( false );
×
412
  send_sysmessage( client, "Script profile written to logfile" );
×
413
}
×
414

415
void textcmd_log_profile_clear( Network::Client* client )
×
416
{
417
  log_all_script_cycle_counts( true );
×
418
  send_sysmessage( client, "Script profile written to logfile and cleared" );
×
419
}
×
420

421
void textcmd_heapcheck( Network::Client* /*client*/ )
×
422
{
423
  PrintAllocationData();
×
424
  Clib::PrintHeapData();
×
425
}
×
426

427
void textcmd_threads( Network::Client* client )
×
428
{
429
  std::string s = "Child threads: " + Clib::tostring( threadhelp::child_threads );
×
430
  send_sysmessage( client, s );
×
431
}
×
432

433
void textcmd_constat( Network::Client* client )
×
434
{
435
  int i = 0;
×
436
  send_sysmessage( client, "Connection statuses:" );
×
NEW
437
  for ( auto itr : networkManager.clients )
×
438
  {
439
    OSTRINGSTREAM os;
×
NEW
440
    os << i << ": " << itr->status() << " ";
×
441
    send_sysmessage( client, OSTRINGSTREAM_STR( os ) );
×
442
    ++i;
×
443
  }
×
444
}
×
445

446

447
void textcmd_singlezone_integ_item( Network::Client* client )
×
448
{
449
  Pos2d gridp = zone_convert( client->chr->pos() );
×
450
  bool ok = check_single_zone_item_integrity( gridp, client->chr->realm() );
×
451
  if ( ok )
×
452
    send_sysmessage( client, "Item integrity checks out OK!" );
×
453
  else
454
    send_sysmessage( client, "Item integrity problems detected. " );
×
455
}
×
456

457
bool check_item_integrity();
458
void textcmd_integ_item( Network::Client* client )
×
459
{
460
  bool ok = check_item_integrity();
×
461
  if ( ok )
×
462
    send_sysmessage( client, "Item integrity checks out OK!" );
×
463
  else
464
    send_sysmessage( client, "Item integrity problems detected.  Check logfile" );
×
465
}
×
466
void check_character_integrity();
467
void textcmd_integ_chr( Network::Client* /*client*/ )
×
468
{
469
  check_character_integrity();
×
470
}
×
471

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

490
  for ( int i = chr->cmdlevel(); i >= 0; --i )
×
491
  {
492
    CmdLevel& cmdlevel = gamestate.cmdlevels[i];
×
NEW
493
    for ( auto& diridx : cmdlevel.searchlist )
×
494
    {
495
      std::string filename;
×
496

NEW
497
      Plib::Package* pkg = diridx.pkg;
×
NEW
498
      filename = diridx.dir + cmd + std::string( ".txt" );
×
499
      if ( pkg )
×
500
        filename = pkg->dir() + filename;
×
501

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

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

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

541
  std::string upp( scriptname );
×
542
  Clib::mkupperASCII( upp );
×
543
  if ( upp == "AUX" || upp == "CON" || upp == "PRN" || upp == "NUL" )
×
544
    return false;
×
545

546
  for ( int i = client->chr->cmdlevel(); i >= 0; --i )
×
547
  {
548
    CmdLevel& cmdlevel = gamestate.cmdlevels[i];
×
NEW
549
    for ( auto& diridx : cmdlevel.searchlist )
×
550
    {
551
      ScriptDef sd;
×
NEW
552
      Plib::Package* pkg = diridx.pkg;
×
553
      if ( pkg )
×
NEW
554
        sd.quickconfig( pkg, diridx.dir + scriptname + ".ecl" );
×
555
      else
NEW
556
        sd.quickconfig( diridx.dir + scriptname + ".ecl" );
×
557
      if ( !sd.exists() )
×
558
        continue;
×
559

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

575
        Module::UOExecutorModule* uoemod = new Module::UOExecutorModule( *ex );
×
576
        ex->addModule( uoemod );
×
577
        ex->priority( 100 );
×
578

579
        if ( ex->setProgram( prog.get() ) )
×
580
        {
581
          uoemod->controller_.set( client->chr );  // DAVE added 12/04, let character issuing
×
582
                                                   // textcmd be the script controller
583
          schedule_executor( ex.release() );
×
584
          return true;
×
585
        }
586

587
        ERROR_PRINTLN( "script {}: setProgram failed", scriptname );
×
588
        // TODO: it seems to keep looking until it finds one it can use..guess this is okay?
589
      }
×
590
    }
×
591
  }
592
  return false;
×
593
}
×
594

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

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

625
  if ( start_textcmd_script( client, cmd, lang ) )
×
626
    return true;
×
627

628
  if ( client->chr->cmdlevel() >= gamestate.cmdlevels.size() - 2 )
×
629
  {
630
    TextCmds::iterator itr2 = gamestate.textcmds.find( cmd );
×
631
    if ( itr2 != gamestate.textcmds.end() )
×
632
    {
633
      TextCmdFunc f = ( *itr2 ).second;
×
634
      ( *f )( client );
×
635
      return true;
×
636
    }
637

638
    ParamTextCmds::iterator itr1 = gamestate.paramtextcmds.find( cmd );
×
639
    if ( itr1 != gamestate.paramtextcmds.end() )
×
640
    {
641
      ParamTextCmdFunc f = ( *itr1 ).second;
×
642

643
      ( *f )( client, cmd.substr( ( *itr1 ).first.size() + 1 ) );
×
644
      return true;
×
645
    }
646
  }
647

648
  return false;
×
649
}
×
650
}  // 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