PDA

View Full Version : shareddb.cpp


LostZaphod
10-14-2006, 07:45 AM
I kept receiving the error message
shareddb.cpp
line 251
Run-Time Check Failure #3 - The variable 'augslot' is being used without being defined.

At the top it is defined as
uint32 augslot[5] = { 0, 0, 0, 0, 0 };
and on line 251
uint32 len_query = MakeAnyLenString(&query, "REPLACE INTO inventory (charid,slotid,itemid,charges,instnodrop,color,aug slot1,augslot2,augslot3,augslot4,augslot5) VALUES(%i,%i,%i,%i,%i,%i,%i,%i,%i,%i,%i)",
char_id, slot_id, inst->GetItem()->ID, charges, inst->IsInstNoDrop() ? 1:0,inst->GetColor(),augslot[0],augslot[1],augslot[2],augslot[3],augslot[4],augslot[5] );

you find the augslot[5] (that is the sixth item of the array, and only five are defined). There are also 11 %i, but 12 variables are being passed. We need to remove the ",augslot[5]" from the line.
cvs diff -u -- shareddb.cpp (in directory C:\cvs\EQEmuCVS\Source\common\)
Index: shareddb.cpp
================================================== =================
RCS file: /cvsroot/eqemulator/EQEmuCVS/Source/common/Attic/shareddb.cpp,v
retrieving revision 1.1.2.8
diff -u -r1.1.2.8 shareddb.cpp
--- shareddb.cpp 22 May 2006 04:03:49 -0000 1.1.2.8
+++ shareddb.cpp 14 Oct 2006 19:33:13 -0000
@@ -248,7 +248,9 @@
charges = 255;
// Update/Insert item
uint32 len_query = MakeAnyLenString(&query, "REPLACE INTO inventory (charid,slotid,itemid,charges,instnodrop,color,aug slot1,augslot2,augslot3,augslot4,augslot5) VALUES(%i,%i,%i,%i,%i,%i,%i,%i,%i,%i,%i)",
- char_id, slot_id, inst->GetItem()->ID, charges, inst->IsInstNoDrop() ? 1:0,inst->GetColor(),augslot[0],augslot[1],augslot[2],augslot[3],augslot[4],augslot[5] );
+ char_id, slot_id, inst->GetItem()->ID, charges, inst->IsInstNoDrop() ? 1:0,inst->GetColor(),augslot[0],augslot[1],augslot[2],augslot[3],augslot[4] );
+ //uint32 len_query = MakeAnyLenString(&query, "REPLACE INTO inventory (charid,slotid,itemid,charges,instnodrop,color,aug slot1,augslot2,augslot3,augslot4,augslot5) VALUES(%i,%i,%i,%i,%i,%i,%i,%i,%i,%i,%i)",
+ //char_id, slot_id, inst->GetItem()->ID, charges, inst->IsInstNoDrop() ? 1:0,inst->GetColor(),augslot[0],augslot[1],augslot[2],augslot[3],augslot[4],augslot[5] );

ret = RunQuery(query, len_query, errbuf);
}

***** CVS exited normally with code 1 *****