From: DaveG <da...@us...> - 2005-12-19 05:27:06
|
Update of /cvsroot/planeshift/planeshift/src/server In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19611/src/server Modified Files: adminmanager.cpp Log Message: Made NPC names not have to be unique when using /changename Index: adminmanager.cpp =================================================================== RCS file: /cvsroot/planeshift/planeshift/src/server/adminmanager.cpp,v retrieving revision 1.257 retrieving revision 1.258 diff -C2 -d -r1.257 -r1.258 *** adminmanager.cpp 18 Dec 2005 07:50:58 -0000 1.257 --- adminmanager.cpp 19 Dec 2005 05:26:57 -0000 1.258 *************** *** 2612,2615 **** --- 2612,2616 ---- bool online; unsigned int id; + unsigned int type; Client* target = clients->Find(msg.player); *************** *** 2634,2638 **** id = row.GetUInt32("id"); ! unsigned int type = row.GetUInt32("character_type"); if (type == PSCHARACTER_TYPE_NPC && client->GetSecurityLevel() < GM_LEVEL_9) { --- 2635,2639 ---- id = row.GetUInt32("id"); ! type = row.GetUInt32("character_type"); if (type == PSCHARACTER_TYPE_NPC && client->GetSecurityLevel() < GM_LEVEL_9) { *************** *** 2647,2650 **** --- 2648,2653 ---- prevLastName = target->GetCharacterData()->GetCharLastName(); id = target->GetCharacterData()->GetCharacterID(); + + type = target->GetCharacterData()->GetCharType(); } *************** *** 2669,2673 **** return; ! if(checkFirst) { if (!psServerCharManager::FilterName(msg.newName)) --- 2672,2676 ---- return; ! if(checkFirst) { if (!psServerCharManager::FilterName(msg.newName)) *************** *** 2676,2691 **** return; } ! } if(checkLast) { if (!psServerCharManager::FilterName(msg.newLastName)) ! { psserver->SendSystemError(me->clientnum,"The last name %s is invalid!",msg.newLastName.GetData()); return; } ! } ! //Querying the DB is slow, but I don't see another way to do it ! if (checkFirst) { Result result1(db->Select("SELECT * FROM characters WHERE name='%s'",msg.newName.GetData())); --- 2679,2694 ---- return; } ! } if(checkLast) { if (!psServerCharManager::FilterName(msg.newLastName)) ! { psserver->SendSystemError(me->clientnum,"The last name %s is invalid!",msg.newLastName.GetData()); return; } ! } ! // Querying the DB is slow, but I don't see another way to do it ! if (checkFirst && type == PSCHARACTER_TYPE_PLAYER) { Result result1(db->Select("SELECT * FROM characters WHERE name='%s'",msg.newName.GetData())); *************** *** 2698,2702 **** // If the last name should be unique, check it ! if (msg.uniqueName && checkLast && msg.newLastName.Length() ) { Result result1(db->Select("SELECT * FROM characters WHERE lastname='%s'",msg.newLastName.GetData())); --- 2701,2705 ---- // If the last name should be unique, check it ! if (msg.uniqueName && checkLast && msg.newLastName.Length()) { Result result1(db->Select("SELECT * FROM characters WHERE lastname='%s'",msg.newLastName.GetData())); |