Converting unsinged ints to regular ints, because tinyxml cannot query for unsigned ones and thus negates the purpose of using unsigned ones. This also causes compiler errors.

This commit is contained in:
Faerbit 2014-12-08 13:33:38 +01:00
parent 1d82412576
commit 3f90032bf0
3 changed files with 11 additions and 11 deletions

View File

@ -58,7 +58,7 @@ Converter::Converter(){
Converter::~Converter(){
}
std::vector<unsigned int> Converter::newComposition(unsigned int type, float posX, float posZ){
std::vector<int> Converter::newComposition(int type, float posX, float posZ){
XMLElement* newComposition = doc->NewElement("composition");
doc->InsertFirstChild(newComposition);
@ -95,7 +95,7 @@ std::vector<unsigned int> Converter::newComposition(unsigned int type, float pos
newComposition->InsertFirstChild(xRot);
newComposition->InsertFirstChild(scale);
std::vector<unsigned int> ret = nextID;
std::vector<int> ret = nextID;
nextID[1] += 1;
if (nextID[1] == 255){
nextID[1] = 0;
@ -104,7 +104,7 @@ std::vector<unsigned int> Converter::newComposition(unsigned int type, float pos
return ret;
}
void Converter::updateComposition(unsigned int idG, unsigned int idB, float posX, float posZ){
void Converter::updateComposition(int idG, int idB, float posX, float posZ){
XMLElement* thisComposition = doc->FirstChildElement("composition");
int idGreen, idBlue;
for(; thisComposition; thisComposition=thisComposition->NextSiblingElement("composition")){
@ -117,7 +117,7 @@ void Converter::updateComposition(unsigned int idG, unsigned int idB, float posX
}
}
void Converter::deleteComposition(unsigned int idG, unsigned int idB){
void Converter::deleteComposition(int idG, int idB){
XMLElement* thisComposition = doc->FirstChildElement("composition");
int idGreen, idBlue;
for(; thisComposition; thisComposition=thisComposition->NextSiblingElement("composition")){
@ -134,7 +134,7 @@ void Converter::save(){
doc->SaveFile(charXmlFile);
}
std::vector<unsigned int> Converter::getNextID(){
std::vector<int> Converter::getNextID(){
return nextID;
}

View File

@ -11,14 +11,14 @@ class Converter {
Converter(std::string level);
Converter();
~Converter();
void updateComposition(unsigned int idG, unsigned int idB, float posX, float posZ); //updates the position of a composition
std::vector<unsigned int> newComposition(unsigned int type, float posX, float posZ);//creates a new composition and returns its ID
void deleteComposition(unsigned int idG, unsigned int idB);
void updateComposition(int idG, int idB, float posX, float posZ); //updates the position of a composition
std::vector<int> newComposition(int type, float posX, float posZ);//creates a new composition and returns its ID
void deleteComposition(int idG, int idB);
void save(); //writes the xml to file
std::vector<unsigned int> getNextID(); //returns the next unused ID
std::vector<int> getNextID(); //returns the next unused ID
private:
std::vector<unsigned int> nextID;
std::vector<int> nextID;
std::string xmlFile;
XMLDocument* doc = new XMLDocument();
XMLDocument* compositions = new XMLDocument();

View File

@ -34,7 +34,7 @@ int main( int argc, char *argv[] ){
//if there is a composition here, adjust the xml and image
if(image[pixel]!=0 && image[pixel]!=255){
if((image[pixel+1]==0 && image[pixel+2]==0) || (image[pixel+1]==255 && image[pixel+2]==255)){
std::vector<unsigned int> temp;
std::vector<int> temp;
temp = conv.newComposition(image[pixel], 0.5+rowNum-0.5*height, 0.5+columnNum-0.5*width);
idFound[temp[0]][temp[1]] = true;
image[pixel+1] = temp[0];