Misc code cleanup

Resolved an issue with uninitialized struct members
Removed some redundant conditional checks
Made the boolean part of JS function RegisterSkill( <skillnum>, <bool> ) actually work; can now be used to disable/enable JS-implemented skills
Fixed a bug with cHTMLTemplate::Process() where the same expression was used for both branches of a ternary operator
Various minor cleanups; removed some unused variables, addressed some potential portability issues
This commit is contained in:
Xoduz 2018-09-19 18:43:11 +08:00
parent 46f9293567
commit a5da577d4d
11 changed files with 46 additions and 23 deletions

View file

@ -360,7 +360,7 @@ void cHTMLTemplate::Process( void )
while( sPos != std::string::npos )
{
UString myY = UString::number( tChar->GetY() );
(cwmWorldState->GetKeepRun())?parsedInline.replace( sPos, 8, myY ):parsedInline.replace( sPos, 8, myY );
(cwmWorldState->GetKeepRun())?parsedInline.replace( sPos, 8, myY ):parsedInline.replace( sPos, 8, "" );
sPos = parsedInline.find( "%playery" );
}
@ -467,13 +467,9 @@ void cHTMLTemplate::Process( void )
//NPCCount
UI32 npccount = 0;
if( npccount == 0 )
{
UI32 b = 0;
ObjectFactory::getSingleton().IterateOver( OT_CHAR, b, NULL, &CountNPCFunctor );
npccount = b;
}
UString npcs = UString::number( npccount );
Pos = ParsedContent.find( "%npcs" );
@ -781,7 +777,7 @@ void cHTMLTemplates::TemplateInfoGump( CSocket *mySocket )
UI32 Entries = 0; // Entries per page
UI16 CurrentPage = 0; // Page
for( size_t i = 0; i < Templates.size(); ++i )
for( unsigned int i = 0; i < Templates.size(); ++i )
{
if( Entries == 0 )
{