Fix for spell target det crash. Also added a command line arg to world ignore_db that lets you ignore the db conversion process for servers that dont need it.

This commit is contained in:
KimLS 2015-01-25 14:18:12 -08:00
parent fc5266e115
commit 0c7a861caf
2 changed files with 17 additions and 13 deletions

View File

@ -187,6 +187,7 @@ int main(int argc, char** argv) {
database.LoadLogSettings(Log.log_settings);
Log.StartFileLogs();
bool ignore_db = false;
if (argc >= 2) {
char tmp[2];
if (strcasecmp(argv[1], "help") == 0 || strcasecmp(argv[1], "?") == 0 || strcasecmp(argv[1], "/?") == 0 || strcasecmp(argv[1], "-?") == 0 || strcasecmp(argv[1], "-h") == 0 || strcasecmp(argv[1], "-help") == 0) {
@ -271,6 +272,9 @@ int main(int argc, char** argv) {
std::cout << "Usage: world startzone zoneshortname" << std::endl;
return 0;
}
else if(strcasecmp(argv[1], "ignore_db") == 0) {
ignore_db = true;
}
else {
std::cerr << "Error, unknown command line option" << std::endl;
return 1;
@ -284,8 +288,10 @@ int main(int argc, char** argv) {
Log.Out(Logs::General, Logs::World_Server, "HTTP world service disabled.");
}
Log.Out(Logs::General, Logs::World_Server, "Checking Database Conversions..");
database.CheckDatabaseConversions();
if(!ignore_db) {
Log.Out(Logs::General, Logs::World_Server, "Checking Database Conversions..");
database.CheckDatabaseConversions();
}
Log.Out(Logs::General, Logs::World_Server, "Loading variables..");
database.LoadVariables();
Log.Out(Logs::General, Logs::World_Server, "Loading zones..");

View File

@ -1467,14 +1467,14 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce
// target required for these
case ST_Undead: {
if(!spell_target || (
spell_target->GetBodyType() != BT_SummonedUndead
&& spell_target->GetBodyType() != BT_Undead
&& spell_target->GetBodyType() != BT_Vampire
mob_body != BT_SummonedUndead
&& mob_body != BT_Undead
&& mob_body != BT_Vampire
)
)
{
//invalid target
Log.Out(Logs::Detail, Logs::Spells, "Spell %d canceled: invalid target of body type %d (undead)", spell_id, spell_target->GetBodyType());
Log.Out(Logs::Detail, Logs::Spells, "Spell %d canceled: invalid target of body type %d (undead)", spell_id, mob_body);
Message_StringID(13,SPELL_NEED_TAR);
return false;
}
@ -1483,11 +1483,10 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce
}
case ST_Summoned: {
uint8 body_type = spell_target?spell_target->GetBodyType():0;
if(!spell_target || (body_type != BT_Summoned && body_type != BT_Summoned2 && body_type != BT_Summoned3))
if(!spell_target || (mob_body != BT_Summoned && mob_body != BT_Summoned2 && mob_body != BT_Summoned3))
{
//invalid target
Log.Out(Logs::Detail, Logs::Spells, "Spell %d canceled: invalid target of body type %d (summoned)", spell_id, body_type);
Log.Out(Logs::Detail, Logs::Spells, "Spell %d canceled: invalid target of body type %d (summoned)", spell_id, mob_body);
Message_StringID(13,SPELL_NEED_TAR);
return false;
}
@ -1497,12 +1496,11 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce
case ST_SummonedPet:
{
uint8 body_type = spell_target ? spell_target->GetBodyType() : 0;
if(!spell_target || (spell_target != GetPet()) ||
(body_type != BT_Summoned && body_type != BT_Summoned2 && body_type != BT_Summoned3 && body_type != BT_Animal))
(mob_body != BT_Summoned && mob_body != BT_Summoned2 && mob_body != BT_Summoned3 && mob_body != BT_Animal))
{
Log.Out(Logs::Detail, Logs::Spells, "Spell %d canceled: invalid target of body type %d (summoned pet)",
spell_id, body_type);
spell_id, mob_body);
Message_StringID(13, SPELL_NEED_TAR);
@ -1526,7 +1524,7 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce
if(!spell_target || mob_body != target_bt)
{
//invalid target
Log.Out(Logs::Detail, Logs::Spells, "Spell %d canceled: invalid target of body type %d (want body Type %d)", spell_id, spell_target->GetBodyType(), target_bt);
Log.Out(Logs::Detail, Logs::Spells, "Spell %d canceled: invalid target of body type %d (want body Type %d)", spell_id, mob_body, target_bt);
if(!spell_target)
Message_StringID(13,SPELL_NEED_TAR);
else