63 lines
2.4 KiB
C++
63 lines
2.4 KiB
C++
#include "main.h"
|
|
|
|
int main() {
|
|
|
|
Chunk* testchunk = new Chunk();
|
|
std::vector<BlockInfo*> testblock;
|
|
|
|
std::cout << "-Test 1-------BlockInfo------------------" << std::endl;
|
|
|
|
testblock.push_back(new BlockInfo(BTYPE_AIR, "The air in the sky"));
|
|
testblock.push_back(new BlockInfo(BTYPE_DIRT, "The dirt on the ground"));
|
|
testblock.push_back(new BlockInfo(BTYPE_GRASS, "The grass on the dirt"));
|
|
|
|
testblock[1]->SetDurability(5);
|
|
testblock[2]->SetDurability(6);
|
|
|
|
for (int index = 0; index < testblock.size(); ++index)
|
|
testblock[index]->Show();
|
|
|
|
std::cout << "GetDurability: " << testblock[0]->GetDurability() << " and " << testblock[1]->GetDurability() << " and " << testblock[2]->GetDurability() << std::endl;
|
|
std::cout << "GetType: " << testblock[0]->GetType() << " and " << testblock[1]->GetType() << " and " << testblock[2]->GetType() << std::endl;
|
|
|
|
std::cout << std::endl;
|
|
std::cout << "-Test 2--------Chunk/BlockArray3D---------" << std::endl;
|
|
testchunk->SetBlock(1, 0, 0, BTYPE_DIRT);
|
|
testchunk->SetBlock(2, 0, 0, BTYPE_GRASS);
|
|
testblock.push_back(new BlockInfo(testchunk->GetBlock(0, 0, 0), "A new block in the chunk"));
|
|
testblock.push_back(new BlockInfo(testchunk->GetBlock(1, 0, 0), "A dirty block in the chunk"));
|
|
testblock.push_back(new BlockInfo(testchunk->GetBlock(2, 0, 0), "A grassy block in the chunk"));
|
|
|
|
for (int index = 3; index < testblock.size(); ++index)
|
|
testblock[index]->Show();
|
|
|
|
std::cout << std::endl;
|
|
std::cout << "-Test 3--------Chunk Copy------------------" << std::endl;
|
|
Chunk testchunkcopy(*testchunk);
|
|
|
|
delete testchunk;
|
|
|
|
testblock.push_back(new BlockInfo(testchunkcopy.GetBlock(0, 0, 0), "A block in a copied chunk"));
|
|
testblock.push_back(new BlockInfo(testchunkcopy.GetBlock(1, 0, 0), "A dirty block in a copied chunk"));
|
|
testblock.push_back(new BlockInfo(testchunkcopy.GetBlock(1, 0, 0), "A grassy block in a copied chunk"));
|
|
|
|
for (int index = 6; index < testblock.size(); ++index)
|
|
testblock[index]->Show();
|
|
|
|
std::cout << std::endl;
|
|
std::cout << "-Test 3--------Chunk Reset/Remove Block-----" << std::endl;
|
|
testchunkcopy.Reset(BTYPE_GRASS);
|
|
testchunkcopy.RemoveBlock(3, 0, 0);
|
|
testchunkcopy.SetBlock(4, 0, 0, BTYPE_DIRT);
|
|
|
|
testblock.clear();
|
|
|
|
for (int index = 0; index < 10; ++index)
|
|
testblock.push_back(new BlockInfo(testchunkcopy.GetBlock(index, 0, 0), "A block in a reset chunk containing lots of grass"));
|
|
|
|
for (int index = 0; index < testblock.size(); ++index)
|
|
testblock[index]->Show();
|
|
|
|
return 0;
|
|
}
|