I'm not sure how to describe it. after I've implemented a number of source changes, namely:
http://otland.net/threads/increase-player-damage.177331/#post-1991331 <- fault
http://otland.net/threads/level-and-vocation-instead-of-world-name-on-character-login.158447/
http://otland.net/threads/autostacking-stackable-items-in-tfs-0-3-6pl1.162795/ <-fine
and commenting out the "checking software version" due to "malformed file" like so ;
My server started to crash, alot.
I managed to find the source in-game of the crash by testing. It lead me to firefield, and then to the conclusion that when there's no creature or player online/alive and I(player) take damage from it(like posion or firefield) Server crashes. Illustration below, when scorpion is alive and i take posion damage, it's all good. but when I kill it, and the posion is about to damage me, server crashes that very moment.
I will make a fresh .dev and do the changes step by step and test which one is causing the issue tomorrow. But even if i knew I doubt I'd find the cause in those codes. So if anyone got a hunch or maybe experienced the same problem, do you know where the cause is?
I'm using TFS 0.3.6pl1
from: svn://svn.otland.net/public/forgottenserver/tags/0.3.6pl1
Thanks in advance, will edit this post tomorrow when I've located which feature are wrong
Edit:
After adding them one by one I got to Erikas feature Increase player damage, and this one was the burglar;http://otland.net/threads/increase-player-damage.177331/#post-1991331
I don't know the coding language, but i have a feeling this:
Is bad code. The compiler don't give me any syntax errors or warnings, just 100% successfull compile. I can't verify is this code is bad because if i take some away it will error upon compile.
http://otland.net/threads/increase-player-damage.177331/#post-1991331 <- fault
http://otland.net/threads/level-and-vocation-instead-of-world-name-on-character-login.158447/
http://otland.net/threads/autostacking-stackable-items-in-tfs-0-3-6pl1.162795/ <-fine
and commenting out the "checking software version" due to "malformed file" like so ;
Code:
/*
std::cout << ">> Checking software version... ";
#if defined(WINDOWS) && !defined(__CONSOLE__)
SendMessage(GUI::getInstance()->m_statusBar, WM_SETTEXT, 0, (LPARAM)">> Checking software version");
#endif
if(xmlDocPtr doc = xmlParseFile(VERSION_CHECK))
{
xmlNodePtr p, root = xmlDocGetRootElement(doc);
if(!xmlStrcmp(root->name, (const xmlChar*)"versions"))
{
p = root->children->next;
if(!xmlStrcmp(p->name, (const xmlChar*)"entry"))
{
std::string version;
int32_t patch, build, timestamp;
bool tmp = false;
if(readXMLString(p, "version", version) && version != STATUS_SERVER_VERSION)
tmp = true;
if(readXMLInteger(p, "patch", patch) && patch > VERSION_PATCH)
tmp = true;
if(readXMLInteger(p, "build", build) && build > VERSION_BUILD)
tmp = true;
if(readXMLInteger(p, "timestamp", timestamp) && timestamp > VERSION_TIMESTAMP)
tmp = true;
if(tmp)
{
std::cout << "outdated, please consider updating!" << std::endl;
std::cout << "> Current version information - version: " << STATUS_SERVER_VERSION << ", patch: " << VERSION_PATCH;
std::cout << ", build: " << VERSION_BUILD << ", timestamp: " << VERSION_TIMESTAMP << "." << std::endl;
std::cout << "> Latest version information - version: " << version << ", patch: " << patch;
std::cout << ", build: " << build << ", timestamp: " << timestamp << "." << std::endl;
if(g_config.getBool(ConfigManager::CONFIM_OUTDATED_VERSION) && version.find("_SVN") == std::string::npos)
{
#if defined(WINDOWS) && !defined(__CONSOLE__)
if(MessageBox(GUI::getInstance()->m_mainWindow, "Continue?", "Outdated software", MB_YESNO) == IDNO)
#else
std::cout << "Continue? (y/N)" << std::endl;
char buffer = getchar();
if(buffer == 10 || (buffer != 121 && buffer != 89))
#endif
startupErrorMessage("Aborted.");
}
}
else
std::cout << "up to date!" << std::endl;
}
else
std::cout << "failed checking - malformed entry." << std::endl;
}
else
std::cout << "failed checking - malformed file." << std::endl;
xmlFreeDoc(doc);
}
else
std::cout << "failed - could not parse remote file (are you connected to the internet?)" << std::endl;
/**/
My server started to crash, alot.
I managed to find the source in-game of the crash by testing. It lead me to firefield, and then to the conclusion that when there's no creature or player online/alive and I(player) take damage from it(like posion or firefield) Server crashes. Illustration below, when scorpion is alive and i take posion damage, it's all good. but when I kill it, and the posion is about to damage me, server crashes that very moment.
I will make a fresh .dev and do the changes step by step and test which one is causing the issue tomorrow. But even if i knew I doubt I'd find the cause in those codes. So if anyone got a hunch or maybe experienced the same problem, do you know where the cause is?
I'm using TFS 0.3.6pl1
from: svn://svn.otland.net/public/forgottenserver/tags/0.3.6pl1
Thanks in advance, will edit this post tomorrow when I've located which feature are wrong
Edit:
After adding them one by one I got to Erikas feature Increase player damage, and this one was the burglar;http://otland.net/threads/increase-player-damage.177331/#post-1991331
I don't know the coding language, but i have a feeling this:
Code:
creature.cpp
found this function:
Code:
void Creature::drainHealth(Creature* attacker, CombatType_t combatType, int32_t damage)
and replace it all to this:
Code:
void Creature::drainHealth(Creature* attacker, CombatType_t combatType, int32_t damage)
{
lastDamageSource = combatType;
onAttacked();
if(attacker->getPlayer())
{
if(attacker->getPlayer()->getExtraMagicDamage() > 1)
{
int16_t color = g_config.getNumber(ConfigManager::EXTRA_DAMAGE_COLOR);
if(color < 0)
color = random_range(0, 255);
int realDamage = damage;
damage = damage * attacker->getPlayer()->getExtraMagicDamage();
std::stringstream ss;
ss << "+" << damage - realDamage;
g_game.addAnimatedText(attacker->getPosition(), (uint8_t)color, ss.str());
}
}
changeHealth(-damage);
if(attacker)
attacker->onAttackedCreatureDrainHealth(this, damage);
}
Is bad code. The compiler don't give me any syntax errors or warnings, just 100% successfull compile. I can't verify is this code is bad because if i take some away it will error upon compile.
Last edited: