mateuszb 18 лет назад
Родитель
Сommit
52a12bd09e
2 измененных файлов с 44 добавлено и 2 удалено
  1. 26 0
      CAmbarCendamo.cpp
  2. 18 2
      CCastleHandler.h

+ 26 - 0
CAmbarCendamo.cpp

@@ -1130,6 +1130,32 @@ void CAmbarCendamo::deh3m()
 				nobj.info = spec;
 				break;
 			}
+		case EDefType::TOWN_DEF:
+			{
+				CCastleObjInfo * spec = new CCastleObjInfo;
+				spec->bytes[0] = bufor[i]; ++i;
+				spec->bytes[1] = bufor[i]; ++i;
+				spec->bytes[2] = bufor[i]; ++i;
+				spec->bytes[3] = bufor[i]; ++i;
+				spec->player = bufor[i]; ++i;
+
+				bool hasName = bufor[i]; ++i;
+				if(hasName)
+				{
+					int len = readNormalNr(i); i+=4;
+					for(iny gg=0; gg<len; ++gg)
+					{
+						spec->name += bufor[i]; ++i;
+					}
+				}
+				bool stGarr = bufor[i]; ++i; //true if garrison isn't empty
+				if(stGarr)
+				{
+					spec->garrison = readCreatureSet(i); i+=28;
+				}
+				spec->garrison.formation = bufor[i]; ++i;
+				break;
+			}
 		} //end of main switch
 		CGameInfo::mainObj->objh->objInstances.push_back(nobj);
 		//TODO - dokoñczyæ, du¿o do zrobienia - trzeba patrzeæ, co def niesie

+ 18 - 2
CCastleHandler.h

@@ -4,8 +4,14 @@
 #include "CBuildingHandler.h"
 #include "CHeroHandler.h"
 #include "CObjectHandler.h"
+#include "CCreatureHandler.h"
 
-class CCastle : public CSpecObjInfo //castle class
+class CCastleEvent
+{
+public:
+};
+
+class CCastleObjInfo : public CSpecObjInfo //castle class
 {
 public:
 	int x, y, z; //posiotion
@@ -14,7 +20,17 @@ public:
 	std::vector<bool> isLocked; //isLocked[i] is true, when building buildings[i] canot be built
 	CHero * visitingHero;
 	CHero * garnisonHero;
-	//TODO: dokoñczyæ
+
+	unsigned char bytes[4]; //identifying bytes
+	unsigned char player; //255 - nobody, players 0 - 7
+	std::string name; //town name
+	CCreatureSet garrison;
+
+	std::vector<CSpell *> possibleSpells;
+	std::vector<CSpell *> obligatorySpells;
+	std::vector<CSpell *> availableSpells;
+	
+	std::vector<CCastleEvent> events;
 };
 
 #endif //CCASTLEHANDLER_H