• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Compiling [C++] A "new" reborn system.

bilmattan

evo-Online - Owner
Joined
Aug 5, 2008
Messages
1,316
Reaction score
11
Location
Sweden
Error :
Code:
player.cpp: In member function âuint32_t Player::getResetLevel() constâ:
player.cpp:3408: error: invalid conversion from âint32_tâ to âconst char*â
player.cpp:3408: error: initializing argument 1 of âstd::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _CharT*, const _Alloc&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]â
cc1plus: warnings being treated as errors

Code :
[cpp]
uint32_t Player::getResetLevel() const
{
if (!(g_config.getBool(ConfigManager::USE_RESET)))
return 0;

char buffer[30];
std::string value;
getStorage(g_config.getNumber(ConfigManager::RESET_STORAGE), value);
return ((atoi(value.c_str()) < 0 ? 0 : atoi(value.c_str()))*g_config.getNumber(ConfigManager::RESET_LEVEL));
}
[/cpp]

Thanks,
Max
 
this line:
Code:
getStorage(g_config.getNumber(ConfigManager::RESET_STORAGE), value);
argument 1 should be std::string not uint32_t
 
this line:
Code:
getStorage(g_config.getNumber(ConfigManager::RESET_STORAGE), value);
argument 1 should be std::string not uint32_t

So you mean it's just to change to this? :
[cpp]
std::string Player::getResetLevel() const
{
if (!(g_config.getBool(ConfigManager::USE_RESET)))
return 0;

char buffer[30];
std::string value;
getStorage(g_config.getNumber(ConfigManager::RESET_STORAGE), value);
return ((atoi(value.c_str()) < 0 ? 0 : atoi(value.c_str()))*g_config.getNumber(ConfigManager::RESET_LEVEL));
}
[/cpp]

edit :
tested, error :
Code:
player.cpp:3401: error: prototype for âstd::String Player::getResetLevel() constâ does not match any in class âPlayerâ
player.h:180: error: candidate is: uint32_t Player::getResetLevel() const
 
no, change to this:
Code:
uint32_t Player::getResetLevel() const
{
    if (!(g_config.getBool(ConfigManager::USE_RESET)))
        return 0;
 
 	std::string value;
	[b][color="red"]std::stringstream ss;
	ss << g_config.getNumber(ConfigManager::RESET_STORAGE);
	getStorage(ss.str()[/color][/b], value);
	return ((atoi(value.c_str()) < 0 ? 0 : atoi(value.c_str()))*g_config.getNumber(ConfigManager::RESET_LEVEL));
}
 
no, change to this:
Code:
uint32_t Player::getResetLevel() const
{
    if (!(g_config.getBool(ConfigManager::USE_RESET)))
        return 0;
 
 	std::string value;
	[b][color="red"]std::stringstream ss;
	ss << g_config.getNumber(ConfigManager::RESET_STORAGE);
	getStorage(ss.str()[/color][/b], value);
	return ((atoi(value.c_str()) < 0 ? 0 : atoi(value.c_str()))*g_config.getNumber(ConfigManager::RESET_LEVEL));
}

Amazing!

It worked.

Got a PayPal address I could donate to?
 
Back
Top