Преглед изворни кода

* removed useless but slowing def handling code

Michał W. Urbańczyk пре 17 година
родитељ
комит
bd7d5d2687
5 измењених фајлова са 13 додато и 258 уклоњено
  1. 11 253
      hch/CAmbarCendamo.cpp
  2. 1 0
      hch/CDefObjInfoHandler.h
  3. 1 1
      hch/CLodHandler.cpp
  4. 0 1
      hch/CObjectHandler.h
  5. 0 3
      mapHandler.cpp

+ 11 - 253
hch/CAmbarCendamo.cpp

@@ -576,17 +576,6 @@ void CAmbarCendamo::deh3m()
 		//	vinya->bytes[v] = bufor[i++];
 		//}
 		std::transform(vinya->name.begin(),vinya->name.end(),vinya->name.begin(),(int(*)(int))toupper);
-		std::vector<DefObjInfo>::iterator pit = std::find(CGameInfo::mainObj->dobjinfo->objs.begin(), CGameInfo::mainObj->dobjinfo->objs.end(), 
-			vinya->name);
-		if(pit == CGameInfo::mainObj->dobjinfo->objs.end())
-		{
-			vinya->isOnDefList = false;
-		}
-		else
-		{
-			//vinya->printPriority = pit->priority;
-			vinya->isOnDefList = true;
-		}
 		unsigned char bytes[12];
 		for (int v=0; v<12; v++) // read info
 		{
@@ -2374,17 +2363,17 @@ borderguardend:
 
 	//assigning defobjinfos
 
-	for(int ww=0; ww<CGI->objh->objInstances.size(); ++ww)
-	{
-		for(int h=0; h<CGI->dobjinfo->objs.size(); ++h)
-		{
-			if(CGI->dobjinfo->objs[h].defName==CGI->objh->objInstances[ww]->defInfo->name)
-			{
-				CGI->objh->objInstances[ww]->defObjInfoNumber = h;
-				break;
-			}
-		}
-	}
+	//for(int ww=0; ww<CGI->objh->objInstances.size(); ++ww)
+	//{
+	//	for(int h=0; h<CGI->dobjinfo->objs.size(); ++h)
+	//	{
+	//		if(CGI->dobjinfo->objs[h].defName==CGI->objh->objInstances[ww]->defInfo->name)
+	//		{
+	//			CGI->objh->objInstances[ww]->defObjInfoNumber = h;
+	//			break;
+	//		}
+	//	}
+	//}
 
 	THC std::cout<<"\tHandling defs: "<<th.getDif()<<std::endl;
 	//for(int ww=0; ww<CGI->objh->objInstances.size(); ++ww)
@@ -2845,17 +2834,6 @@ void CAmbarCendamo::processMap(std::vector<std::string> & defsToUnpack)
 						continue;
 					}
 					nxt->name = resDefNames[nxt->subid+1];
-					std::vector<DefObjInfo>::iterator pit = std::find(CGameInfo::mainObj->dobjinfo->objs.begin(), CGameInfo::mainObj->dobjinfo->objs.end(), 
-						nxt->name);
-					if(pit == CGameInfo::mainObj->dobjinfo->objs.end())
-					{
-						nxt->isOnDefList = false;
-					}
-					else
-					{
-						nxt->printPriority = pit->priority;
-						nxt->isOnDefList = true;
-					}
 					map.defy.push_back(nxt); // add this def to the vector
 					defsToUnpack.push_back(nxt->name);
 					CGI->objh->objInstances[j]->defInfo = nxt;
@@ -2879,17 +2857,6 @@ void CAmbarCendamo::processMap(std::vector<std::string> & defsToUnpack)
 						continue;
 					}
 					nxt->name = creDefNames[nxt->subid];
-					std::vector<DefObjInfo>::iterator pit = std::find(CGameInfo::mainObj->dobjinfo->objs.begin(), CGameInfo::mainObj->dobjinfo->objs.end(), 
-						nxt->name);
-					if(pit == CGameInfo::mainObj->dobjinfo->objs.end())
-					{
-						nxt->isOnDefList = false;
-					}
-					else
-					{
-						nxt->printPriority = pit->priority;
-						nxt->isOnDefList = true;
-					}
 					map.defy.push_back(nxt); // add this def to the vector
 					defsToUnpack.push_back(nxt->name);
 					CGI->objh->objInstances[j]->defInfo = nxt;
@@ -2909,17 +2876,6 @@ void CAmbarCendamo::processMap(std::vector<std::string> & defsToUnpack)
 						continue;
 					}
 					nxt->name = creDefNames[nxt->subid];
-					std::vector<DefObjInfo>::iterator pit = std::find(CGameInfo::mainObj->dobjinfo->objs.begin(), CGameInfo::mainObj->dobjinfo->objs.end(), 
-						nxt->name);
-					if(pit == CGameInfo::mainObj->dobjinfo->objs.end())
-					{
-						nxt->isOnDefList = false;
-					}
-					else
-					{
-						nxt->printPriority = pit->priority;
-						nxt->isOnDefList = true;
-					}
 					map.defy.push_back(nxt); // add this def to the vector
 					defsToUnpack.push_back(nxt->name);
 					CGI->objh->objInstances[j]->defInfo = nxt;
@@ -2939,17 +2895,6 @@ void CAmbarCendamo::processMap(std::vector<std::string> & defsToUnpack)
 						continue;
 					}
 					nxt->name = creDefNames[nxt->subid];
-					std::vector<DefObjInfo>::iterator pit = std::find(CGameInfo::mainObj->dobjinfo->objs.begin(), CGameInfo::mainObj->dobjinfo->objs.end(), 
-						nxt->name);
-					if(pit == CGameInfo::mainObj->dobjinfo->objs.end())
-					{
-						nxt->isOnDefList = false;
-					}
-					else
-					{
-						nxt->printPriority = pit->priority;
-						nxt->isOnDefList = true;
-					}
 					map.defy.push_back(nxt); // add this def to the vector
 					defsToUnpack.push_back(nxt->name);
 					CGI->objh->objInstances[j]->defInfo = nxt;
@@ -2969,17 +2914,6 @@ void CAmbarCendamo::processMap(std::vector<std::string> & defsToUnpack)
 						continue;
 					}
 					nxt->name = creDefNames[nxt->subid];
-					std::vector<DefObjInfo>::iterator pit = std::find(CGameInfo::mainObj->dobjinfo->objs.begin(), CGameInfo::mainObj->dobjinfo->objs.end(), 
-						nxt->name);
-					if(pit == CGameInfo::mainObj->dobjinfo->objs.end())
-					{
-						nxt->isOnDefList = false;
-					}
-					else
-					{
-						nxt->printPriority = pit->priority;
-						nxt->isOnDefList = true;
-					}
 					map.defy.push_back(nxt); // add this def to the vector
 					defsToUnpack.push_back(nxt->name);
 					CGI->objh->objInstances[j]->defInfo = nxt;
@@ -2999,17 +2933,6 @@ void CAmbarCendamo::processMap(std::vector<std::string> & defsToUnpack)
 						continue;
 					}
 					nxt->name = creDefNames[nxt->subid];
-					std::vector<DefObjInfo>::iterator pit = std::find(CGameInfo::mainObj->dobjinfo->objs.begin(), CGameInfo::mainObj->dobjinfo->objs.end(), 
-						nxt->name);
-					if(pit == CGameInfo::mainObj->dobjinfo->objs.end())
-					{
-						nxt->isOnDefList = false;
-					}
-					else
-					{
-						nxt->printPriority = pit->priority;
-						nxt->isOnDefList = true;
-					}
 					map.defy.push_back(nxt); // add this def to the vector
 					defsToUnpack.push_back(nxt->name);
 					CGI->objh->objInstances[j]->defInfo = nxt;
@@ -3029,17 +2952,6 @@ void CAmbarCendamo::processMap(std::vector<std::string> & defsToUnpack)
 						continue;
 					}
 					nxt->name = creDefNames[nxt->subid];
-					std::vector<DefObjInfo>::iterator pit = std::find(CGameInfo::mainObj->dobjinfo->objs.begin(), CGameInfo::mainObj->dobjinfo->objs.end(), 
-						nxt->name);
-					if(pit == CGameInfo::mainObj->dobjinfo->objs.end())
-					{
-						nxt->isOnDefList = false;
-					}
-					else
-					{
-						nxt->printPriority = pit->priority;
-						nxt->isOnDefList = true;
-					}
 					map.defy.push_back(nxt); // add this def to the vector
 					defsToUnpack.push_back(nxt->name);
 					CGI->objh->objInstances[j]->defInfo = nxt;
@@ -3059,17 +2971,6 @@ void CAmbarCendamo::processMap(std::vector<std::string> & defsToUnpack)
 						continue;
 					}
 					nxt->name = creDefNames[nxt->subid];
-					std::vector<DefObjInfo>::iterator pit = std::find(CGameInfo::mainObj->dobjinfo->objs.begin(), CGameInfo::mainObj->dobjinfo->objs.end(), 
-						nxt->name);
-					if(pit == CGameInfo::mainObj->dobjinfo->objs.end())
-					{
-						nxt->isOnDefList = false;
-					}
-					else
-					{
-						nxt->printPriority = pit->priority;
-						nxt->isOnDefList = true;
-					}
 					map.defy.push_back(nxt); // add this def to the vector
 					defsToUnpack.push_back(nxt->name);
 					CGI->objh->objInstances[j]->defInfo = nxt;
@@ -3089,17 +2990,6 @@ void CAmbarCendamo::processMap(std::vector<std::string> & defsToUnpack)
 						continue;
 					}
 					nxt->name = creDefNames[nxt->subid];
-					std::vector<DefObjInfo>::iterator pit = std::find(CGameInfo::mainObj->dobjinfo->objs.begin(), CGameInfo::mainObj->dobjinfo->objs.end(), 
-						nxt->name);
-					if(pit == CGameInfo::mainObj->dobjinfo->objs.end())
-					{
-						nxt->isOnDefList = false;
-					}
-					else
-					{
-						nxt->printPriority = pit->priority;
-						nxt->isOnDefList = true;
-					}
 					map.defy.push_back(nxt); // add this def to the vector
 					defsToUnpack.push_back(nxt->name);
 					CGI->objh->objInstances[j]->defInfo = nxt;
@@ -3123,17 +3013,6 @@ void CAmbarCendamo::processMap(std::vector<std::string> & defsToUnpack)
 						continue;
 					}
 					nxt->name = artDefNames[nxt->subid];
-					std::vector<DefObjInfo>::iterator pit = std::find(CGameInfo::mainObj->dobjinfo->objs.begin(), CGameInfo::mainObj->dobjinfo->objs.end(), 
-						nxt->name);
-					if(pit == CGameInfo::mainObj->dobjinfo->objs.end())
-					{
-						nxt->isOnDefList = false;
-					}
-					else
-					{
-						nxt->printPriority = pit->priority;
-						nxt->isOnDefList = true;
-					}
 					map.defy.push_back(nxt); // add this def to the vector
 					defsToUnpack.push_back(nxt->name);
 					CGI->objh->objInstances[j]->defInfo = nxt;
@@ -3153,17 +3032,6 @@ void CAmbarCendamo::processMap(std::vector<std::string> & defsToUnpack)
 						continue;
 					}
 					nxt->name = art1DefNames[nxt->subid];
-					std::vector<DefObjInfo>::iterator pit = std::find(CGameInfo::mainObj->dobjinfo->objs.begin(), CGameInfo::mainObj->dobjinfo->objs.end(), 
-						nxt->name);
-					if(pit == CGameInfo::mainObj->dobjinfo->objs.end())
-					{
-						nxt->isOnDefList = false;
-					}
-					else
-					{
-						nxt->printPriority = pit->priority;
-						nxt->isOnDefList = true;
-					}
 					map.defy.push_back(nxt); // add this def to the vector
 					defsToUnpack.push_back(nxt->name);
 					CGI->objh->objInstances[j]->defInfo = nxt;
@@ -3183,17 +3051,6 @@ void CAmbarCendamo::processMap(std::vector<std::string> & defsToUnpack)
 						continue;
 					}
 					nxt->name = art2DefNames[nxt->subid];
-					std::vector<DefObjInfo>::iterator pit = std::find(CGameInfo::mainObj->dobjinfo->objs.begin(), CGameInfo::mainObj->dobjinfo->objs.end(), 
-						nxt->name);
-					if(pit == CGameInfo::mainObj->dobjinfo->objs.end())
-					{
-						nxt->isOnDefList = false;
-					}
-					else
-					{
-						nxt->printPriority = pit->priority;
-						nxt->isOnDefList = true;
-					}
 					map.defy.push_back(nxt); // add this def to the vector
 					defsToUnpack.push_back(nxt->name);
 					CGI->objh->objInstances[j]->defInfo = nxt;
@@ -3213,17 +3070,6 @@ void CAmbarCendamo::processMap(std::vector<std::string> & defsToUnpack)
 						continue;
 					}
 					nxt->name = art3DefNames[nxt->subid];
-					std::vector<DefObjInfo>::iterator pit = std::find(CGameInfo::mainObj->dobjinfo->objs.begin(), CGameInfo::mainObj->dobjinfo->objs.end(), 
-						nxt->name);
-					if(pit == CGameInfo::mainObj->dobjinfo->objs.end())
-					{
-						nxt->isOnDefList = false;
-					}
-					else
-					{
-						nxt->printPriority = pit->priority;
-						nxt->isOnDefList = true;
-					}
 					map.defy.push_back(nxt); // add this def to the vector
 					defsToUnpack.push_back(nxt->name);
 					CGI->objh->objInstances[j]->defInfo = nxt;
@@ -3243,17 +3089,6 @@ void CAmbarCendamo::processMap(std::vector<std::string> & defsToUnpack)
 						continue;
 					}
 					nxt->name = art4DefNames[nxt->subid];
-					std::vector<DefObjInfo>::iterator pit = std::find(CGameInfo::mainObj->dobjinfo->objs.begin(), CGameInfo::mainObj->dobjinfo->objs.end(), 
-						nxt->name);
-					if(pit == CGameInfo::mainObj->dobjinfo->objs.end())
-					{
-						nxt->isOnDefList = false;
-					}
-					else
-					{
-						nxt->printPriority = pit->priority;
-						nxt->isOnDefList = true;
-					}
 					map.defy.push_back(nxt); // add this def to the vector
 					defsToUnpack.push_back(nxt->name);
 					CGI->objh->objInstances[j]->defInfo = nxt;
@@ -3291,17 +3126,6 @@ void CAmbarCendamo::processMap(std::vector<std::string> & defsToUnpack)
 						continue;
 					}
 					nxt->name = town1DefNames[nxt->subid];
-					std::vector<DefObjInfo>::iterator pit = std::find(CGameInfo::mainObj->dobjinfo->objs.begin(), CGameInfo::mainObj->dobjinfo->objs.end(), 
-						nxt->name);
-					if(pit == CGameInfo::mainObj->dobjinfo->objs.end())
-					{
-						nxt->isOnDefList = false;
-					}
-					else
-					{
-						nxt->printPriority = pit->priority;
-						nxt->isOnDefList = true;
-					}
 					map.defy.push_back(nxt); // add this def to the vector
 					defsToUnpack.push_back(nxt->name);
 					CGI->objh->objInstances[j]->defInfo = nxt;
@@ -3323,18 +3147,7 @@ void CAmbarCendamo::processMap(std::vector<std::string> & defsToUnpack)
 			}
 		case EDefType::HERO_DEF:
 			{
-				std::vector<DefObjInfo>::iterator pit = std::find(CGameInfo::mainObj->dobjinfo->objs.begin(), CGameInfo::mainObj->dobjinfo->objs.end(), 
-						CGI->objh->objInstances[j]->defInfo->name);
-
 				CGI->objh->objInstances[j]->defInfo->printPriority = 0;
-				if(pit == CGameInfo::mainObj->dobjinfo->objs.end())
-				{
-					CGI->objh->objInstances[j]->defInfo->isOnDefList = false;
-				}
-				else
-				{
-					CGI->objh->objInstances[j]->defInfo->isOnDefList = true;
-				}
 				break;
 			}
 		} //end of main switch
@@ -3380,17 +3193,6 @@ void CAmbarCendamo::processMap(std::vector<std::string> & defsToUnpack)
 						CGI->objh->objInstances[j]->defInfo = creGenNumbers[nxt->subid][lvl];
 						continue;
 					}
-					std::vector<DefObjInfo>::iterator pit = std::find(CGameInfo::mainObj->dobjinfo->objs.begin(), CGameInfo::mainObj->dobjinfo->objs.end(), 
-						nxt->name);
-					if(pit == CGameInfo::mainObj->dobjinfo->objs.end())
-					{
-						nxt->isOnDefList = false;
-					}
-					else
-					{
-						nxt->printPriority = pit->priority;
-						nxt->isOnDefList = true;
-					}
 					map.defy.push_back(nxt); // add this def to the vector
 					defsToUnpack.push_back(nxt->name);
 					CGI->objh->objInstances[j]->defInfo = nxt;
@@ -3421,17 +3223,6 @@ void CAmbarCendamo::processMap(std::vector<std::string> & defsToUnpack)
 						CGI->objh->objInstances[j]->defInfo = creGenNumbers[nxt->subid][lvl];
 						continue;
 					}
-					std::vector<DefObjInfo>::iterator pit = std::find(CGameInfo::mainObj->dobjinfo->objs.begin(), CGameInfo::mainObj->dobjinfo->objs.end(), 
-						nxt->name);
-					if(pit == CGameInfo::mainObj->dobjinfo->objs.end())
-					{
-						nxt->isOnDefList = false;
-					}
-					else
-					{
-						nxt->printPriority = pit->priority;
-						nxt->isOnDefList = true;
-					}
 					map.defy.push_back(nxt); // add this def to the vector
 					defsToUnpack.push_back(nxt->name);
 					CGI->objh->objInstances[j]->defInfo = nxt;
@@ -3481,17 +3272,6 @@ void CAmbarCendamo::processMap(std::vector<std::string> & defsToUnpack)
 						CGI->objh->objInstances[j]->defInfo = creGenNumbers[nxt->subid][lvl];
 						continue;
 					}
-					std::vector<DefObjInfo>::iterator pit = std::find(CGameInfo::mainObj->dobjinfo->objs.begin(), CGameInfo::mainObj->dobjinfo->objs.end(), 
-						nxt->name);
-					if(pit == CGameInfo::mainObj->dobjinfo->objs.end())
-					{
-						nxt->isOnDefList = false;
-					}
-					else
-					{
-						nxt->printPriority = pit->priority;
-						nxt->isOnDefList = true;
-					}
 					map.defy.push_back(nxt); // add this def to the vector
 					defsToUnpack.push_back(nxt->name);
 					CGI->objh->objInstances[j]->defInfo = nxt;
@@ -3522,17 +3302,6 @@ void CAmbarCendamo::processMap(std::vector<std::string> & defsToUnpack)
 						CGI->objh->objInstances[j]->defInfo = creGenNumbers[nxt->subid][lvl];
 						continue;
 					}
-					std::vector<DefObjInfo>::iterator pit = std::find(CGameInfo::mainObj->dobjinfo->objs.begin(), CGameInfo::mainObj->dobjinfo->objs.end(), 
-						nxt->name);
-					if(pit == CGameInfo::mainObj->dobjinfo->objs.end())
-					{
-						nxt->isOnDefList = false;
-					}
-					else
-					{
-						nxt->printPriority = pit->priority;
-						nxt->isOnDefList = true;
-					}
 					map.defy.push_back(nxt); // add this def to the vector
 					defsToUnpack.push_back(nxt->name);
 					CGI->objh->objInstances[j]->defInfo = nxt;
@@ -3563,17 +3332,6 @@ void CAmbarCendamo::processMap(std::vector<std::string> & defsToUnpack)
 					CGI->objh->objInstances[j]->defInfo = creGenNumbers[nxt->subid][lvl];
 					continue;
 				}
-				std::vector<DefObjInfo>::iterator pit = std::find(CGameInfo::mainObj->dobjinfo->objs.begin(), CGameInfo::mainObj->dobjinfo->objs.end(), 
-					nxt->name);
-				if(pit == CGameInfo::mainObj->dobjinfo->objs.end())
-				{
-					nxt->isOnDefList = false;
-				}
-				else
-				{
-					nxt->printPriority = pit->priority;
-					nxt->isOnDefList = true;
-				}
 				map.defy.push_back(nxt); // add this def to the vector
 				defsToUnpack.push_back(nxt->name);
 				CGI->objh->objInstances[j]->defInfo = nxt;

+ 1 - 0
hch/CDefObjInfoHandler.h

@@ -18,6 +18,7 @@ struct DefObjInfo
 class CDefObjInfoHandler
 {
 public:
+	//std::vector<std::vector<CGDefInfo> > gobjs;
 	std::vector<DefObjInfo> objs;
 	void load();
 };

+ 1 - 1
hch/CLodHandler.cpp

@@ -421,7 +421,7 @@ std::vector<CDefHandler *> CLodHandler::extractManyFiles(std::vector<std::string
 	std::vector<CDefHandler *> ret(defNamesIn.size()); 
 	for(int hh=0; hh<defNamesIn.size(); ++hh)
 	{
-		std::transform(defNamesIn[hh].begin(), defNamesIn[hh].end(), defNamesIn[hh].begin(), (int(*)(int))toupper);
+		//std::transform(defNamesIn[hh].begin(), defNamesIn[hh].end(), defNamesIn[hh].begin(), (int(*)(int))toupper);
 		Entry * e = entries.znajdz(defNamesIn[hh]);
 		if(!e)
 			continue;

+ 0 - 1
hch/CObjectHandler.h

@@ -330,7 +330,6 @@ public:
 	int type; //(0- ground, 1- towns, 2-creatures, 3- heroes, 4-artifacts, 5- resources)   
 	CDefHandler * handler;
 	int printPriority;
-	bool isOnDefList;
 	bool isVisitable();
 };
 

+ 0 - 3
mapHandler.cpp

@@ -86,7 +86,6 @@ void CMapHandler::randomizeObjects()
 				if(f!=-1 && f!=CGI->dobjinfo->objs.size())
 				{
 					CGI->objh->objInstances[no]->defObjInfoNumber = f;
-					CGI->objh->objInstances[no]->defInfo->isOnDefList = true;
 					CGI->objh->objInstances[no]->ID = CGI->dobjinfo->objs[f].type;
 					CGI->objh->objInstances[no]->subID = CGI->dobjinfo->objs[f].subtype;
 					CGI->objh->objInstances[no]->defInfo->id = CGI->dobjinfo->objs[f].type;
@@ -96,7 +95,6 @@ void CMapHandler::randomizeObjects()
 				else
 				{
 					CGI->objh->objInstances[no]->defObjInfoNumber = -1;
-					CGI->objh->objInstances[no]->defInfo->isOnDefList = false;
 					CGI->objh->objInstances[no]->defInfo->printPriority = 0;
 				}
 			}
@@ -1520,7 +1518,6 @@ CGObjectInstance * CMapHandler::createObject(int id, int subid, int3 pos)
 		}
 	}
 	nobj->defInfo->name = CGI->dobjinfo->objs[nobj->defObjInfoNumber].defName;
-	nobj->defInfo->isOnDefList = (nobj->defObjInfoNumber==-1 ? false : true);
 	for(int g=0; g<6; ++g)
 		nobj->defInfo->blockMap[g] = CGI->dobjinfo->objs[nobj->defObjInfoNumber].blockMap[g];
 	for(int g=0; g<6; ++g)