Răsfoiți Sursa

Nodrze + jego obsługa dla CHeroHandlera i CHero.

Michał W. Urbańczyk 18 ani în urmă
părinte
comite
34276093ed
3 a modificat fișierele cu 7 adăugiri și 2 ștergeri
  1. 2 0
      CHeroHandler.cpp
  2. 4 1
      CHeroHandler.h
  3. 1 1
      CMT.cpp

+ 2 - 0
CHeroHandler.cpp

@@ -3,6 +3,7 @@
 
 
 void CHeroHandler::loadHeroes()
 void CHeroHandler::loadHeroes()
 {
 {
+	int ID=0;
 	std::ifstream inp("H3bitmap.lod\\HOTRAITS.TXT", std::ios::in);
 	std::ifstream inp("H3bitmap.lod\\HOTRAITS.TXT", std::ios::in);
 	std::string dump;
 	std::string dump;
 	for(int i=0; i<25; ++i)
 	for(int i=0; i<25; ++i)
@@ -99,6 +100,7 @@ void CHeroHandler::loadHeroes()
 			}
 			}
 		}
 		}
 		nher.refType3stack = base.substr(iit, base.size()-iit);
 		nher.refType3stack = base.substr(iit, base.size()-iit);
+		nher.ID=ID++;
 		heroes.push_back(nher);
 		heroes.push_back(nher);
 		delete[500] tab;
 		delete[500] tab;
 	}
 	}

+ 4 - 1
CHeroHandler.h

@@ -4,16 +4,19 @@
 #include <string>
 #include <string>
 #include <vector>
 #include <vector>
 #include "CCreatureHandler.h"
 #include "CCreatureHandler.h"
+#include "nodrze.h"
 
 
 class CHero
 class CHero
 {
 {
 public:
 public:
 	std::string name;
 	std::string name;
+	int ID;
 	int low1stack, high1stack, low2stack, high2stack, low3stack, high3stack; //amount of units; described below
 	int low1stack, high1stack, low2stack, high2stack, low3stack, high3stack; //amount of units; described below
 	std::string refType1stack, refType2stack, refType3stack; //reference names of units appearing in hero's army if he is recruited in tavern
 	std::string refType1stack, refType2stack, refType3stack; //reference names of units appearing in hero's army if he is recruited in tavern
 	std::string bonusName, shortBonus, longBonus; //for special abilities
 	std::string bonusName, shortBonus, longBonus; //for special abilities
 	std::string biography; //biography, of course
 	std::string biography; //biography, of course
 	bool isAllowed; //true if we can play with this hero (depends on map)
 	bool isAllowed; //true if we can play with this hero (depends on map)
+	bool operator<(CHero& drugi){if (ID < drugi.ID) return true; else return false;}
 };
 };
 
 
 class CHeroInstance
 class CHeroInstance
@@ -28,7 +31,7 @@ public:
 class CHeroHandler
 class CHeroHandler
 {
 {
 public:
 public:
-	std::vector<CHero> heroes;
+	nodrze<CHero> heroes;
 	void loadHeroes();
 	void loadHeroes();
 	void loadSpecialAbilities();
 	void loadSpecialAbilities();
 	void loadBiographies();
 	void loadBiographies();

+ 1 - 1
CMT.cpp

@@ -258,7 +258,7 @@ int _tmain(int argc, _TCHAR* argv[])
 		CObjectHandler * objh = new CObjectHandler;
 		CObjectHandler * objh = new CObjectHandler;
 		objh->loadObjects();
 		objh->loadObjects();
 		cgi->objh = objh;
 		cgi->objh = objh;
-		CAmbarCendamo * ac = new CAmbarCendamo("1base+l4"); //4gryf
+		CAmbarCendamo * ac = new CAmbarCendamo("4gryf"); //4gryf
 		cgi->ac = ac;
 		cgi->ac = ac;
 		THC std::cout<<"Wczytywanie pliku: "<<tmh.getDif()<<std::endl;
 		THC std::cout<<"Wczytywanie pliku: "<<tmh.getDif()<<std::endl;
 		ac->deh3m();
 		ac->deh3m();