From 3f90032bf0467c1418735d20fc6a05b505c36031 Mon Sep 17 00:00:00 2001 From: Faerbit Date: Mon, 8 Dec 2014 13:33:38 +0100 Subject: [PATCH] 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. --- converter/converter.cc | 10 +++++----- converter/converter.hh | 10 +++++----- converter/main.cc | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/converter/converter.cc b/converter/converter.cc index f4bee91..0194018 100644 --- a/converter/converter.cc +++ b/converter/converter.cc @@ -58,7 +58,7 @@ Converter::Converter(){ Converter::~Converter(){ } -std::vector Converter::newComposition(unsigned int type, float posX, float posZ){ +std::vector Converter::newComposition(int type, float posX, float posZ){ XMLElement* newComposition = doc->NewElement("composition"); doc->InsertFirstChild(newComposition); @@ -95,7 +95,7 @@ std::vector Converter::newComposition(unsigned int type, float pos newComposition->InsertFirstChild(xRot); newComposition->InsertFirstChild(scale); - std::vector ret = nextID; + std::vector ret = nextID; nextID[1] += 1; if (nextID[1] == 255){ nextID[1] = 0; @@ -104,7 +104,7 @@ std::vector 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 Converter::getNextID(){ +std::vector Converter::getNextID(){ return nextID; } diff --git a/converter/converter.hh b/converter/converter.hh index d0d2e62..aef1914 100644 --- a/converter/converter.hh +++ b/converter/converter.hh @@ -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 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 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 getNextID(); //returns the next unused ID + std::vector getNextID(); //returns the next unused ID private: - std::vector nextID; + std::vector nextID; std::string xmlFile; XMLDocument* doc = new XMLDocument(); XMLDocument* compositions = new XMLDocument(); diff --git a/converter/main.cc b/converter/main.cc index a18f867..81faafc 100644 --- a/converter/main.cc +++ b/converter/main.cc @@ -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 temp; + std::vector 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];