diff --git a/common/database.cpp b/common/database.cpp index c03ad97cf..8960a58e0 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -428,7 +428,7 @@ bool Database::ReserveName(uint32 account_id, char* name) char errbuf[MYSQL_ERRMSG_SIZE]; char *query = 0; - if (!RunQuery(query, MakeAnyLenString(&query, "INSERT into character_ SET account_id=%i, name='%s', profile=nullptr", account_id, name), errbuf)) { + if (!RunQuery(query, MakeAnyLenString(&query, "INSERT into character_ SET account_id=%i, name='%s', profile=NULL", account_id, name), errbuf)) { cerr << "Error in ReserveName query '" << query << "' " << errbuf << endl; safe_delete_array(query); return false; @@ -1196,9 +1196,9 @@ bool Database::GetSafePoints(const char* short_name, uint32 version, float* safe { cerr << "Error in GetSafePoint query '" << query << "' " << errbuf << endl; cerr << "If it errors, run the following querys:\n"; - cerr << "ALTER TABLE `zone` CHANGE `minium_level` `min_level` TINYINT(3) UNSIGNED DEFAULT \"0\" NOT nullptr;\n"; - cerr << "ALTER TABLE `zone` CHANGE `minium_status` `min_status` TINYINT(3) UNSIGNED DEFAULT \"0\" NOT nullptr;\n"; - cerr << "ALTER TABLE `zone` ADD flag_needed VARCHAR(128) NOT nullptr DEFAULT '';\n"; + cerr << "ALTER TABLE `zone` CHANGE `minium_level` `min_level` TINYINT(3) UNSIGNED DEFAULT \"0\" NOT NULL;\n"; + cerr << "ALTER TABLE `zone` CHANGE `minium_status` `min_status` TINYINT(3) UNSIGNED DEFAULT \"0\" NOT NULL;\n"; + cerr << "ALTER TABLE `zone` ADD flag_needed VARCHAR(128) NOT NULL DEFAULT '';\n"; safe_delete_array(query); } diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index d389cfcac..9724dec22 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -6129,7 +6129,7 @@ void Client::Handle_OP_RecipesFavorite(const EQApplicationPacket *app) " LEFT JOIN tradeskill_recipe_entries AS tre ON tr.id=tre.recipe_id " " LEFT JOIN (SELECT recipe_id, madecount FROM char_recipe_list WHERE char_id = %u) AS crl ON tr.id=crl.recipe_id " " WHERE tr.id IN (%s) " - " AND tr.must_learn & 0x20 <> 0x20 AND ((tr.must_learn & 0x3 <> 0 AND crl.madecount IS NOT nullptr) OR (tr.must_learn & 0x3 = 0)) " + " AND tr.must_learn & 0x20 <> 0x20 AND ((tr.must_learn & 0x3 <> 0 AND crl.madecount IS NOT NULL) OR (tr.must_learn & 0x3 = 0)) " " GROUP BY tr.id " " HAVING sum(if(tre.item_id %s AND tre.iscontainer > 0,1,0)) > 0 " " LIMIT 100 ", CharacterID(), buf, containers); @@ -6184,7 +6184,7 @@ void Client::Handle_OP_RecipesSearch(const EQApplicationPacket *app) " LEFT JOIN tradeskill_recipe_entries AS tre ON tr.id=tre.recipe_id " " LEFT JOIN (SELECT recipe_id, madecount FROM char_recipe_list WHERE char_id = %u) AS crl ON tr.id=crl.recipe_id " " WHERE %s tr.trivial >= %u AND tr.trivial <= %u " - " AND tr.must_learn & 0x20 <> 0x20 AND((tr.must_learn & 0x3 <> 0 AND crl.madecount IS NOT nullptr) OR (tr.must_learn & 0x3 = 0)) " + " AND tr.must_learn & 0x20 <> 0x20 AND((tr.must_learn & 0x3 <> 0 AND crl.madecount IS NOT NULL) OR (tr.must_learn & 0x3 = 0)) " " GROUP BY tr.id " " HAVING sum(if(tre.item_id %s AND tre.iscontainer > 0,1,0)) > 0 " " LIMIT 200 " diff --git a/zone/mob.cpp b/zone/mob.cpp index 6529a505a..6782a8826 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -3784,12 +3784,12 @@ void Mob::InsertQuestGlobal(int charid, int npcid, int zoneid, const char *varna char *query = 0; char errbuf[MYSQL_ERRMSG_SIZE]; - // Make duration string either "unix_timestamp(now()) + xxx" or "nullptr" + // Make duration string either "unix_timestamp(now()) + xxx" or "NULL" stringstream duration_ss; if (duration == INT_MAX) { - duration_ss << "nullptr"; + duration_ss << "NULL"; } else { diff --git a/zone/npc.cpp b/zone/npc.cpp index cc1aa8603..afba99199 100644 --- a/zone/npc.cpp +++ b/zone/npc.cpp @@ -2432,23 +2432,23 @@ int NPC::GetScore() if(lv < 46) { - minx = ceil( ((lv - (lv / 10)) - 1) ); + minx = static_cast (ceil( ((lv - (lv / 10.0)) - 1.0) )); basehp = (lv * 10) + (lv * lv); } else { - minx = ceil( ((lv - (lv / 10)) - 1) - (( abs(45 - lv) ) / 2) ); + minx = static_cast (ceil( ((lv - (lv / 10.0)) - 1.0) - (( lv - 45.0 ) / 2.0) )); basehp = (lv * 10) + ((lv * lv) * 4); } if(hp > basehp) { - hpcontrib = (int)( (float)((float)hp / (float)basehp) * 1.5); + hpcontrib = static_cast (((hp / static_cast (basehp)) * 1.5)); if(hpcontrib > 5) { hpcontrib = 5; } if(maxdmg > basedmg) { - dmgcontrib = ceil( ((maxdmg / basedmg) * 1.5) ); + dmgcontrib = static_cast (ceil( ((maxdmg / basedmg) * 1.5) )); } if(HasNPCSpecialAtk("E")) { spccontrib++; } //Enrage @@ -2463,9 +2463,11 @@ int NPC::GetScore() } if(npc_spells_id > 12) - { - if(lv < 16) { spccontrib++; } - else { spccontrib += (int)floor(lv/15); } + { + if(lv < 16) + spccontrib++; + else + spccontrib += static_cast (floor(lv/15.0)); } final = minx + hpcontrib + dmgcontrib + spccontrib; diff --git a/zone/perl_npc.cpp b/zone/perl_npc.cpp index b0eb0ce1a..3888c05ea 100644 --- a/zone/perl_npc.cpp +++ b/zone/perl_npc.cpp @@ -2236,7 +2236,7 @@ XS(boot_NPC) newXSproto(strcpy(buf, "GetAttackSpeed"), XS_NPC_GetSlowMitigation, file, "$"); newXSproto(strcpy(buf, "GetAccuracyRating"), XS_NPC_GetAccuracyRating, file, "$"); newXSproto(strcpy(buf, "GetSpawnKillCount"), XS_NPC_GetSpawnKillCount, file, "$"); - newXSproto(strcpy(buf, "GetScore"), XS_NPC_GetSpawnKillCount, file, "$"); + newXSproto(strcpy(buf, "GetScore"), XS_NPC_GetScore, file, "$"); XSRETURN_YES; } diff --git a/zone/questmgr.cpp b/zone/questmgr.cpp index bc7ac3f75..d29e99e87 100644 --- a/zone/questmgr.cpp +++ b/zone/questmgr.cpp @@ -1241,11 +1241,11 @@ int QuestManager::InsertQuestGlobal( char *query = 0; char errbuf[MYSQL_ERRMSG_SIZE]; - // Make duration string either "unix_timestamp(now()) + xxx" or "nullptr" + // Make duration string either "unix_timestamp(now()) + xxx" or "NULL" stringstream duration_ss; if (duration == INT_MAX) { - duration_ss << "nullptr"; + duration_ss << "NULL"; } else { diff --git a/zone/tasks.cpp b/zone/tasks.cpp index dcd3aad57..34b64c1db 100644 --- a/zone/tasks.cpp +++ b/zone/tasks.cpp @@ -1158,7 +1158,7 @@ void TaskManager::SendTaskSelector(Client *c, Mob *mob, int TaskCount, int *Task if(Tasks[TaskList[i]] != nullptr) break; } - // FIXME: The 10 and 5 values in this calculation are to account for the string "nullptr" we are putting in 3 times. + // FIXME: The 10 and 5 values in this calculation are to account for the string "ABCD" we are putting in 3 times. // // Calculate how big the packet needs to be pased on the number of tasks and the // size of the variable length strings. @@ -1236,9 +1236,9 @@ void TaskManager::SendTaskSelector(Client *c, Mob *mob, int TaskCount, int *Task // FIXME: In live packets, these two strings appear to be the same as the Text1 and Text2 // strings from the first activity in the task, however the task chooser/selector // does not appear to make use of them. - sprintf(Ptr, "nullptr"); + sprintf(Ptr, "ABCD"); Ptr = Ptr + strlen(Ptr) + 1; - sprintf(Ptr, "nullptr"); + sprintf(Ptr, "ABCD"); Ptr = Ptr + strlen(Ptr) + 1; AvailableTaskTrailer = (AvailableTaskTrailer_Struct*)Ptr; @@ -1253,7 +1253,7 @@ void TaskManager::SendTaskSelector(Client *c, Mob *mob, int TaskCount, int *Task // In some packets, this next string looks like a short task summary, however it doesn't // appear anywhere in the client window. - sprintf(Ptr, "nullptr"); + sprintf(Ptr, "ABCD"); Ptr = Ptr + strlen(Ptr) + 1; } diff --git a/zone/zone.cpp b/zone/zone.cpp index 17271058f..146da03c6 100644 --- a/zone/zone.cpp +++ b/zone/zone.cpp @@ -2676,22 +2676,22 @@ void Zone::LoadTickItems() char* query = 0; MYSQL_RES *result; MYSQL_ROW row; - tick_items.clear(); - //tick_globals.clear(); if(database.RunQuery(query, MakeAnyLenString(&query, "SELECT it_itemid, it_chance, it_level, it_qglobal, it_bagslot FROM item_tick"), errbuf, &result)) { while((row = mysql_fetch_row(result))) { - if(atoi(row[0]) < 1) - { - //tick_globals[std::string(row[0])] = { 0, atoi(row[1]), atoi(row[2]), (int16)atoi(row[4]), std::string(row[3]) }; - } - else - { - tick_items[atoi(row[0])] = { atoi(row[0]), atoi(row[1]), atoi(row[2]), (int16)atoi(row[4]), std::string(row[3]) }; - } + if(atoi(row[0]) >= 1) + { + item_tick_struct ti_tmp; + ti_tmp.itemid = atoi(row[0]); + ti_tmp.chance = atoi(row[1]); + ti_tmp.level = atoi(row[2]); + ti_tmp.bagslot = (int16)atoi(row[4]); + ti_tmp.qglobal = std::string(row[3]); + tick_items[atoi(row[0])] = ti_tmp; + } } mysql_free_result(result); safe_delete_array(query); @@ -2715,6 +2715,7 @@ uint32 Zone::GetSpawnKillCount(uint32 in_spawnid) { } iterator.Advance(); } + return 0; } void Zone::UpdateHotzone()