Code cleanup

Embraced the usage of R32, R64, SI16, UI16, SI32, UI32, SI64 and UI64 typedef aliases as replacement for built-in types throughout the sourcecode:
	typedef float				R32;
	typedef double				R64;
	typedef signed char			SI08;
	typedef unsigned char		UI08;
	typedef signed short int	SI16;
	typedef unsigned short int	UI16;
	typedef signed int			SI32;
	typedef unsigned int		UI32;
	typedef signed long long	SI64;
	typedef unsigned long long	UI64;
As part of this process, UI32 was redefined from unsigned long int to unsigned int, and SI32 from signed long int to signed int to ensure the size of variables using these remain the same (32bit) across both Windows, Linux and MacOS for both 32bit and 64bit platforms
Replaced instances of toLong() with toInt(), and toULong() to toUInt()
Replaced instances of "long" and "int" with SI32 where possible
Replaced instances of "unsigned long" and "unsigned int" with UI32 where possible
Replaced instances of "float" with R32 where possible
This commit is contained in:
Xoduz 2020-08-12 23:46:33 +08:00
parent 524c10b24c
commit 3e8006c648
82 changed files with 830 additions and 811 deletions

View file

@ -95,7 +95,7 @@ void cHTMLTemplate::Process( void )
// Replacing Placeholders
// Account-Count
UString AccountCount = UString::number( Accounts->size() );
UString AccountCount = UString::number( (SI32)(Accounts->size()) );
size_t Pos = ParsedContent.find( "%accounts" );
while( Pos != std::string::npos )
{
@ -118,7 +118,7 @@ void cHTMLTemplate::Process( void )
Pos = ParsedContent.find( "%version" );
}
// Character Count
UString CharacterCount = UString::number( ObjectFactory::getSingleton().CountOfObjects( OT_CHAR ) );
UString CharacterCount = UString::number( (SI32)ObjectFactory::getSingleton().CountOfObjects( OT_CHAR ) );
Pos = ParsedContent.find( "%charcount" );
while( Pos != std::string::npos )
{
@ -127,7 +127,7 @@ void cHTMLTemplate::Process( void )
}
// Item Count
UString ItemCount = UString::number( ObjectFactory::getSingleton().CountOfObjects( OT_ITEM ) );
UString ItemCount = UString::number( (SI32)ObjectFactory::getSingleton().CountOfObjects( OT_ITEM ) );
Pos = ParsedContent.find( "%itemcount" );
while( Pos != std::string::npos )
{
@ -216,7 +216,7 @@ void cHTMLTemplate::Process( void )
time_t currTime;
time( &currTime );
currTime = mktime( gmtime( &currTime ) );
UString timestamp = UString::number( static_cast<size_t>(currTime) );
UString timestamp = UString::number( (SI32)currTime );
Pos = ParsedContent.find( "%tstamp" );
while( Pos != std::string::npos )
{
@ -407,7 +407,7 @@ void cHTMLTemplate::Process( void )
}
// GuildCount
UString GuildCount = UString::number( GuildSys->NumGuilds() );
UString GuildCount = UString::number( (SI32)GuildSys->NumGuilds() );
Pos = ParsedContent.find( "%guildcount" );
while( Pos != std::string::npos )
{
@ -644,7 +644,7 @@ void cHTMLTemplate::Load( ScriptSection *found )
UTag = tag.upper();
if( UTag == "UPDATE" )
UpdateTimer = data.toULong();
UpdateTimer = data.toUInt();
else if( UTag == "TYPE" )
{
UData = data.upper();
@ -774,7 +774,7 @@ void cHTMLTemplates::TemplateInfoGump( CSocket *mySocket )
UI32 Entries = 0; // Entries per page
UI16 CurrentPage = 0; // Page
for( unsigned int i = 0; i < Templates.size(); ++i )
for( UI32 i = 0; i < Templates.size(); ++i )
{
if( Entries == 0 )
{