reaver
06-26-2002, 09:41 AM
Was bored at work, so started looking thru the new code that was added to dump Bank/Equip information to a file.
My goal: to clean up the output of the file by removing the Lore information if its the same as the item name.
Problem: Last time I programmed was in Fortran77 :P So, C++ and QT are totally unfamiliar.
Here's the current snipet of code from interface.cpp as of the latest CVS:
QFile bankfile(Qstring("/tmp/bankfile.") + Qstring::number(getpid()));
if (bankfile.open(IO_Append | IO_WriteOnly))
{
QTextStream out(&bankfile);
out << "Item: " << itemp->item.name;
if (itemp->item.stackable == 1)
out << "x" << itemp->item.number;
out << ",(" << itemp->item.lore << "), Slot: " // This is what I want to change
<< slotName << endl;
}
What I want to change is to only output Lore info if item.name does not equal item.lore AND item.name does not equal "*" + item.lore. So here is my miserable attempt at coding in a language I don't understand yet (flame on!)
if ((item.name != itemp->item.lore) &&
(item.name != "*" + itemp->item.lore))
out << ",(" << itemp->item.lore << ")";
out << ", Slot: " << slotName << endl;
Any tips, /rudes, cackles or rtfm comments welcome ;)
-Reaver
My goal: to clean up the output of the file by removing the Lore information if its the same as the item name.
Problem: Last time I programmed was in Fortran77 :P So, C++ and QT are totally unfamiliar.
Here's the current snipet of code from interface.cpp as of the latest CVS:
QFile bankfile(Qstring("/tmp/bankfile.") + Qstring::number(getpid()));
if (bankfile.open(IO_Append | IO_WriteOnly))
{
QTextStream out(&bankfile);
out << "Item: " << itemp->item.name;
if (itemp->item.stackable == 1)
out << "x" << itemp->item.number;
out << ",(" << itemp->item.lore << "), Slot: " // This is what I want to change
<< slotName << endl;
}
What I want to change is to only output Lore info if item.name does not equal item.lore AND item.name does not equal "*" + item.lore. So here is my miserable attempt at coding in a language I don't understand yet (flame on!)
if ((item.name != itemp->item.lore) &&
(item.name != "*" + itemp->item.lore))
out << ",(" << itemp->item.lore << ")";
out << ", Slot: " << slotName << endl;
Any tips, /rudes, cackles or rtfm comments welcome ;)
-Reaver