I was screwing with how stuff got loaded in EQ and here is how I'm trying to load data for the items:
Code: Select all
void Eternal::ItemSystem::Initialize() {
DbgLog *Dbg = DbgLog::GetInstance();
Dbg->Print("Loading items\n");
std::ifstream file("Data/ItemSet.txt");
// How many items were loaded
unsigned int n = 0;
// Just to load crap into
std::string str;
// Holds the item sprite paths
std::vector<std::string>lines;
while(!file.eof()) {
file >> str;
lines.push_back(str);
std::getline(file,str);
Descriptions.push_back(str);
n++;
}
// Resize the vector to fit our sprite amount
Sprites.resize(n);
// Loop through them all and load them
for ( unsigned int i = 0;i < n;i++ ) {
Sprites[i].Load(lines.at(i));
}
file.close();
Dbg->Print("Loaded items successfully\n");
}
Code: Select all
Data/Graphics/Items/Item1.png -- sprite path
WORK YOU PILE OF SHIT! -- description
When I add a item to the map like so:
Code: Select all
ItemSystem->AddItem(200,200,1);
But if I make the sprite vector public and do this:
Code: Select all
ItemSystem->Sprites[0].Load("Data/Graphics/Items/Item1.png");
ItemSystem->AddItem(200,200,1);
Any suggestions?
Oh and I moved the item down and right a little bit in the second screenshot, don't worry about it xD