Răsfoiți Sursa

* refactoring

mateuszb 12 ani în urmă
părinte
comite
bda766b697

+ 1 - 1
AI/VCAI/VCAI.cpp

@@ -886,7 +886,7 @@ void VCAI::yourTurn()
 	makingTurn = new boost::thread(&VCAI::makeTurn, this);
 }
 
-void VCAI::heroGotLevel(const CGHeroInstance *hero, PrimarySkill::PrimarySkill pskill, std::vector<SecondarySkill::SecondarySkill> &skills, int queryID)
+void VCAI::heroGotLevel(const CGHeroInstance *hero, PrimarySkill::PrimarySkill pskill, std::vector<SecondarySkill> &skills, int queryID)
 {
 	NET_EVENT_HANDLER;
 	LOG_ENTRY;

+ 2 - 2
AI/VCAI/VCAI.h

@@ -270,7 +270,7 @@ public:
 	VCAI(void);
 	~VCAI(void);
 
-	CGObjectInstance * visitedObject; //remember currently viisted object
+	CGObjectInstance * visitedObject; //remember currently visted object
 
 	boost::thread *makingTurn;
 
@@ -285,7 +285,7 @@ public:
 	virtual void init(CCallback * CB) OVERRIDE;
 	virtual void yourTurn() OVERRIDE;
 
-	virtual void heroGotLevel(const CGHeroInstance *hero, PrimarySkill::PrimarySkill pskill, std::vector<SecondarySkill::SecondarySkill> &skills, int queryID) OVERRIDE; //pskill is gained primary skill, interface has to choose one of given skills and call callback with selection id
+	virtual void heroGotLevel(const CGHeroInstance *hero, PrimarySkill::PrimarySkill pskill, std::vector<SecondarySkill> &skills, int queryID) OVERRIDE; //pskill is gained primary skill, interface has to choose one of given skills and call callback with selection id
 	virtual void commanderGotLevel (const CCommanderInstance * commander, std::vector<ui32> skills, int queryID) OVERRIDE; //TODO
 	virtual void showBlockingDialog(const std::string &text, const std::vector<Component> &components, ui32 askID, const int soundID, bool selection, bool cancel) OVERRIDE; //Show a dialog, player must take decision. If selection then he has to choose between one of given components, if cancel he is allowed to not choose. After making choice, CCallback::selectionMade should be called with number of selected component (1 - n) or 0 for cancel (if allowed) and askID.
 	virtual void showGarrisonDialog(const CArmedInstance *up, const CGHeroInstance *down, bool removableUnits, int queryID) OVERRIDE; //all stacks operations between these objects become allowed, interface has to call onEnd when done

+ 1 - 1
CCallback.cpp

@@ -154,7 +154,7 @@ bool CCallback::swapArtifacts(const ArtifactLocation &l1, const ArtifactLocation
  * @param assembleTo If assemble is true, this represents the artifact ID of the combination
  * artifact to assemble to. Otherwise it's not used.
  */
-bool CCallback::assembleArtifacts (const CGHeroInstance * hero, ArtifactPosition::ArtifactPosition artifactSlot, bool assemble, ui32 assembleTo)
+bool CCallback::assembleArtifacts (const CGHeroInstance * hero, ArtifactPosition artifactSlot, bool assemble, ui32 assembleTo)
 {
 	if (player != hero->tempOwner)
 		return false;

+ 2 - 2
CCallback.h

@@ -63,7 +63,7 @@ public:
 	virtual int splitStack(const CArmedInstance *s1, const CArmedInstance *s2, int p1, int p2, int val)=0;//split creatures from the first stack
 	//virtual bool swapArtifacts(const CGHeroInstance * hero1, ui16 pos1, const CGHeroInstance * hero2, ui16 pos2)=0; //swaps artifacts between two given heroes
 	virtual bool swapArtifacts(const ArtifactLocation &l1, const ArtifactLocation &l2)=0;
-	virtual bool assembleArtifacts(const CGHeroInstance * hero, ArtifactPosition::ArtifactPosition artifactSlot, bool assemble, ui32 assembleTo)=0;
+	virtual bool assembleArtifacts(const CGHeroInstance * hero, ArtifactPosition artifactSlot, bool assemble, ui32 assembleTo)=0;
 	virtual bool dismissCreature(const CArmedInstance *obj, int stackPos)=0;
 	virtual void endTurn()=0;
 	virtual void buyArtifact(const CGHeroInstance *hero, ArtifactID aid)=0; //used to buy artifacts in towns (including spell book in the guild and war machines in blacksmith)
@@ -127,7 +127,7 @@ public:
 	bool swapArtifacts(const ArtifactLocation &l1, const ArtifactLocation &l2);
 	//bool moveArtifact(const CGHeroInstance * hero, ui16 src, const CStackInstance * stack, ui16 dest); // TODO: unify classes
 	//bool moveArtifact(const CStackInstance * stack, ui16 src , const CGHeroInstance * hero, ui16 dest); // TODO: unify classes
-	bool assembleArtifacts(const CGHeroInstance * hero, ArtifactPosition::ArtifactPosition artifactSlot, bool assemble, ui32 assembleTo);
+	bool assembleArtifacts(const CGHeroInstance * hero, ArtifactPosition artifactSlot, bool assemble, ui32 assembleTo);
 	bool buildBuilding(const CGTownInstance *town, BuildingID buildingID) OVERRIDE;
 	void recruitCreatures(const CGObjectInstance *obj, CreatureID ID, ui32 amount, si32 level=-1);
 	bool dismissCreature(const CArmedInstance *obj, int stackPos);

+ 3 - 3
client/CCreatureWindow.cpp

@@ -639,7 +639,7 @@ void CCreatureWindow::scrollArt(int dir)
 {
 	//TODO: get next artifact
 	int size = stack->artifactsWorn.size();
-	displayedArtifact  =  size ? static_cast<ArtifactPosition::ArtifactPosition>((displayedArtifact + dir) % size) : ArtifactPosition::CREATURE_SLOT;
+	displayedArtifact  =  size ? static_cast<ArtifactPosition>((displayedArtifact + dir) % size) : ArtifactPosition::CREATURE_SLOT;
 	setArt (stack->getArt(displayedArtifact));
 }
 
@@ -661,12 +661,12 @@ void CCreatureWindow::artifactRemoved (const ArtifactLocation &artLoc)
 	//align artifacts to remove holes
 	BOOST_FOREACH (auto al, stack->artifactsWorn)
 	{
-		ArtifactPosition::ArtifactPosition freeSlot = al.second.artifact->firstAvailableSlot(stack); 
+		ArtifactPosition freeSlot = al.second.artifact->firstAvailableSlot(stack); 
 		if (freeSlot < al.first)
 			LOCPLINT->cb->swapArtifacts (ArtifactLocation(stack, al.first), ArtifactLocation(stack, freeSlot));
 	}
 	int size = stack->artifactsWorn.size();
-	displayedArtifact  =  size ? static_cast<ArtifactPosition::ArtifactPosition>(displayedArtifact % size) : ArtifactPosition::CREATURE_SLOT; //0
+	displayedArtifact  =  size ? static_cast<ArtifactPosition>(displayedArtifact % size) : ArtifactPosition::CREATURE_SLOT; //0
 	setArt (stack->getArt(displayedArtifact));
 }
 void CCreatureWindow::artifactMoved (const ArtifactLocation &artLoc, const ArtifactLocation &destLoc)

+ 1 - 1
client/CCreatureWindow.h

@@ -45,7 +45,7 @@ public:
 	//bool active; //TODO: comment me
 	CreWinType type;
 	int bonusRows; //height of skill window
-	ArtifactPosition::ArtifactPosition displayedArtifact;
+	ArtifactPosition displayedArtifact;
 
 	std::string count; //creature count in text format
 	const CCreature *c; //related creature

+ 2 - 2
client/CHeroWindow.cpp

@@ -222,7 +222,7 @@ void CHeroWindow::update(const CGHeroInstance * hero, bool redrawNeeded /*= fals
 	for(size_t g=0; g< secSkillAreas.size(); ++g)
 	{
 		int skill = curHero->secSkills[g].first,
-			level = curHero->getSecSkillLevel(static_cast<SecondarySkill::SecondarySkill>(curHero->secSkills[g].first));
+			level = curHero->getSecSkillLevel(SecondarySkill(curHero->secSkills[g].first));
 		secSkillAreas[g]->type = skill;
 		secSkillAreas[g]->bonusValue = level;
 		secSkillAreas[g]->text = CGI->generaltexth->skillInfoTexts[skill][level-1];
@@ -298,7 +298,7 @@ void CHeroWindow::commanderWindow()
 	{
 		const CGHeroInstance *srcHero = commonInfo->src.AOH->getHero();
 		//artSelected = true;
-		ArtifactPosition::ArtifactPosition freeSlot = art->firstAvailableSlot (curHero->commander);
+		ArtifactPosition freeSlot = art->firstAvailableSlot (curHero->commander);
 		if (freeSlot < ArtifactPosition::COMMANDER_AFTER_LAST) //we don't want to put it in commander's backpack!
 		{
 			ArtifactLocation src (srcHero, commonInfo->src.slotID);

+ 1 - 1
client/CMT.cpp

@@ -578,7 +578,7 @@ void processCommand(const std::string &message)
 		{
 			BOOST_FOREACH(const CGHeroInstance *h, LOCPLINT->cb->getHeroesInfo())
 				if(h->type->ID == id1)
-					if(const CArtifactInstance *a = h->getArt(static_cast<ArtifactPosition::ArtifactPosition>(id2)))
+					if(const CArtifactInstance *a = h->getArt(ArtifactPosition(id2)))
 						tlog4 << a->nodeName();
 		}
 	}

+ 1 - 1
client/CPlayerInterface.cpp

@@ -469,7 +469,7 @@ void CPlayerInterface::receivedResource(int type, int val)
 	GH.totalRedraw();
 }
 
-void CPlayerInterface::heroGotLevel(const CGHeroInstance *hero, PrimarySkill::PrimarySkill pskill, std::vector<SecondarySkill::SecondarySkill>& skills, int queryID)
+void CPlayerInterface::heroGotLevel(const CGHeroInstance *hero, PrimarySkill::PrimarySkill pskill, std::vector<SecondarySkill>& skills, int queryID)
 {
 	EVENT_HANDLER_CALLED_BY_CLIENT;
 	waitWhileDialog();

+ 1 - 1
client/CPlayerInterface.h

@@ -143,7 +143,7 @@ public:
 	void artifactDisassembled(const ArtifactLocation &al);
 
 	void heroCreated(const CGHeroInstance* hero) OVERRIDE;
-	void heroGotLevel(const CGHeroInstance *hero, PrimarySkill::PrimarySkill pskill, std::vector<SecondarySkill::SecondarySkill> &skills, int queryID) OVERRIDE;
+	void heroGotLevel(const CGHeroInstance *hero, PrimarySkill::PrimarySkill pskill, std::vector<SecondarySkill> &skills, int queryID) OVERRIDE;
 	void commanderGotLevel (const CCommanderInstance * commander, std::vector<ui32> skills, int queryID) OVERRIDE;
 	void heroInGarrisonChange(const CGTownInstance *town) OVERRIDE;
 	void heroMoved(const TryMoveHero & details) OVERRIDE;

+ 4 - 4
client/Client.h

@@ -168,11 +168,11 @@ public:
 	void setOwner(const CGObjectInstance * obj, TPlayerColor owner) OVERRIDE {};
 	void setHoverName(const CGObjectInstance * obj, MetaString * name) OVERRIDE {};
 	void changePrimSkill(const CGHeroInstance * hero, PrimarySkill::PrimarySkill which, si64 val, bool abs=false) OVERRIDE {};
-	void changeSecSkill(const CGHeroInstance * hero, SecondarySkill::SecondarySkill which, int val, bool abs=false) OVERRIDE {}; 
+	void changeSecSkill(const CGHeroInstance * hero, SecondarySkill which, int val, bool abs=false) OVERRIDE {}; 
 	void showBlockingDialog(BlockingDialog *iw, const CFunctionList<void(ui32)> &callback) OVERRIDE {};
 	ui32 showBlockingDialog(BlockingDialog *iw) OVERRIDE {return 0;}; //synchronous version of above
 	void showGarrisonDialog(int upobj, int hid, bool removableUnits, const boost::function<void()> &cb) OVERRIDE {};
-	void showThievesGuildWindow(int player, int requestingObjId) OVERRIDE {};
+	void showThievesGuildWindow(TPlayerColor player, int requestingObjId) OVERRIDE {};
 	void giveResource(TPlayerColor player, Res::ERes which, int val) OVERRIDE {};
 
 	void giveCreatures(const CArmedInstance * objid, const CGHeroInstance * h, const CCreatureSet &creatures, bool remove) OVERRIDE {};
@@ -186,8 +186,8 @@ public:
 	void tryJoiningArmy(const CArmedInstance *src, const CArmedInstance *dst, bool removeObjWhenFinished, bool allowMerging) OVERRIDE {}
 	bool moveStack(const StackLocation &src, const StackLocation &dst, TQuantity count = -1) OVERRIDE {return false;}
 
-	void giveHeroNewArtifact(const CGHeroInstance *h, const CArtifact *artType, ArtifactPosition::ArtifactPosition pos) OVERRIDE {};
-	void giveHeroArtifact(const CGHeroInstance *h, const CArtifactInstance *a, ArtifactPosition::ArtifactPosition pos) OVERRIDE {};
+	void giveHeroNewArtifact(const CGHeroInstance *h, const CArtifact *artType, ArtifactPosition pos) OVERRIDE {};
+	void giveHeroArtifact(const CGHeroInstance *h, const CArtifactInstance *a, ArtifactPosition pos) OVERRIDE {};
 	void putArtifact(const ArtifactLocation &al, const CArtifactInstance *a) OVERRIDE {}; 
 	void removeArtifact(const ArtifactLocation &al) OVERRIDE {};
 	bool moveArtifact(const ArtifactLocation &al1, const ArtifactLocation &al2) OVERRIDE {return false;};

+ 19 - 19
client/GUIClasses.cpp

@@ -1695,7 +1695,7 @@ void CSplitWindow::sliderMoved(int to)
 	setAmount(rightMin + to, false);
 }
 
-CLevelWindow::CLevelWindow(const CGHeroInstance *hero, PrimarySkill::PrimarySkill pskill, std::vector<SecondarySkill::SecondarySkill> &skills, boost::function<void(ui32)> callback):
+CLevelWindow::CLevelWindow(const CGHeroInstance *hero, PrimarySkill::PrimarySkill pskill, std::vector<SecondarySkill> &skills, boost::function<void(ui32)> callback):
     CWindowObject(PLAYER_COLORED, "LVLUPBKG"),
     cb(callback)
 {
@@ -1728,7 +1728,7 @@ CLevelWindow::CLevelWindow(const CGHeroInstance *hero, PrimarySkill::PrimarySkil
 			comps.push_back(new CSelectableComponent(
 								CComponent::secskill,
 								skills[i],
-								hero->getSecSkillLevel( static_cast<SecondarySkill::SecondarySkill>(skills[i]) )+1,
+								hero->getSecSkillLevel( SecondarySkill(skills[i]) )+1,
 								CComponent::medium));
 		}
 		box = new CComponentBox(comps, Rect(75, 300, pos.w - 150, 100));
@@ -3385,9 +3385,9 @@ bool CAltarWindow::putOnAltar(CTradeableItem* altarSlot, const CArtifactInstance
 	return true;
 }
 
-void CAltarWindow::moveFromSlotToAltar(ArtifactPosition::ArtifactPosition slotID, CTradeableItem* altarSlot, const CArtifactInstance *art)
+void CAltarWindow::moveFromSlotToAltar(ArtifactPosition slotID, CTradeableItem* altarSlot, const CArtifactInstance *art)
 {
-	auto freeBackpackSlot = static_cast<ArtifactPosition::ArtifactPosition>(hero->artifactsInBackpack.size() + GameConstants::BACKPACK_START);
+	auto freeBackpackSlot = ArtifactPosition(hero->artifactsInBackpack.size() + GameConstants::BACKPACK_START);
 	if(arts->commonInfo->src.art)
 	{
 		arts->commonInfo->dst.slotID = freeBackpackSlot;
@@ -3771,7 +3771,7 @@ CTavernWindow::HeroPortrait::HeroPortrait(int &sel, int id, int x, int y, const
 
 		int artifs = h->artifactsWorn.size() + h->artifactsInBackpack.size();
 		for(int i=13; i<=17; i++) //war machines and spellbook don't count
-			if(vstd::contains(h->artifactsWorn,static_cast<ArtifactPosition::ArtifactPosition>(i)))
+			if(vstd::contains(h->artifactsWorn, ArtifactPosition(i)))
 				artifs--;
 		sprintf_s(descr, sizeof(descr),CGI->generaltexth->allTexts[215].c_str(),
 				  h->name.c_str(), h->level, h->type->heroClass->name.c_str(), artifs);
@@ -4186,12 +4186,12 @@ void CArtPlace::clickLeft(tribool down, bool previousState)
 						//should not happen, catapult cannot be selected
 						assert(cur->id != ArtifactID::CATAPULT);
 						break;
-					case 4: case 5: case 6: //war machines cannot go to backpack
+					case ArtifactID::BALLISTA: case ArtifactID::AMMO_CART: case ArtifactID::FIRST_AID_TENT: //war machines cannot go to backpack
 						LOCPLINT->showInfoDialog(boost::str(boost::format(CGI->generaltexth->allTexts[153]) % cur->Name()));
 						break;
 					default:
 						setMeAsDest();
-						vstd::amin(ourOwner->commonInfo->dst.slotID, static_cast<ArtifactPosition::ArtifactPosition>(
+						vstd::amin(ourOwner->commonInfo->dst.slotID, ArtifactPosition(
 							ourOwner->curHero->artifactsInBackpack.size() + GameConstants::BACKPACK_START));
 						if(srcInBackpack && srcInSameHero)
 						{
@@ -4589,7 +4589,7 @@ void CArtifactsOfHero::setHero(const CGHeroInstance * hero)
 
 	// Fill the slots for worn artifacts and backpack.
 	for (int g = 0; g < artWorn.size() ; g++)
-		setSlotData(artWorn[g], static_cast<ArtifactPosition::ArtifactPosition>(g));
+		setSlotData(artWorn[g], ArtifactPosition(g));
 	scrollBackpack(0);
 }
 
@@ -4623,7 +4623,7 @@ void CArtifactsOfHero::scrollBackpack(int dir)
 
 		if (s < artsInBackpack)
 		{
-			auto slotID = static_cast<ArtifactPosition::ArtifactPosition>(GameConstants::BACKPACK_START + (s + backpackPos)%artsInBackpack);
+			auto slotID = ArtifactPosition(GameConstants::BACKPACK_START + (s + backpackPos)%artsInBackpack);
 			const CArtifactInstance *art = curHero->getArt(slotID);
 			assert(art);
 			if(!vstd::contains(toOmit, art))
@@ -4640,7 +4640,7 @@ void CArtifactsOfHero::scrollBackpack(int dir)
 		}
 	}
 	for( ; s - omitedSoFar < backpack.size(); s++)
-		eraseSlotData(backpack[s-omitedSoFar], static_cast<ArtifactPosition::ArtifactPosition>(GameConstants::BACKPACK_START + s));
+		eraseSlotData(backpack[s-omitedSoFar], ArtifactPosition(GameConstants::BACKPACK_START + s));
 
 	//in artifact merchant selling artifacts we may have highlight on one of backpack artifacts -> market needs update, cause artifact under highlight changed
 	if(highlightModeCallback)
@@ -4707,7 +4707,7 @@ void CArtifactsOfHero::unmarkLocalSlots(bool withRedraw /*= true*/)
 /**
  * Assigns an artifacts to an artifact place depending on it's new slot ID.
  */
-void CArtifactsOfHero::setSlotData(CArtPlace* artPlace, ArtifactPosition::ArtifactPosition slotID)
+void CArtifactsOfHero::setSlotData(CArtPlace* artPlace, ArtifactPosition slotID)
 {
 	if(!artPlace && slotID >= GameConstants::BACKPACK_START) //spurious call from artifactMoved in attempt to update hidden backpack slot
 	{
@@ -4729,7 +4729,7 @@ void CArtifactsOfHero::setSlotData(CArtPlace* artPlace, ArtifactPosition::Artifa
 /**
  * Makes given artifact slot appear as empty with a certain slot ID.
  */
-void CArtifactsOfHero::eraseSlotData (CArtPlace* artPlace, ArtifactPosition::ArtifactPosition slotID)
+void CArtifactsOfHero::eraseSlotData (CArtPlace* artPlace, ArtifactPosition slotID)
 {
 	artPlace->pickSlot(false);
 	artPlace->slotID = slotID;
@@ -4755,14 +4755,14 @@ CArtifactsOfHero::CArtifactsOfHero(std::vector<CArtPlace *> ArtWorn, std::vector
 	for (size_t g = 0; g < artWorn.size() ; g++)
 	{
 		artWorn[g]->ourOwner = this;
-		eraseSlotData(artWorn[g], static_cast<ArtifactPosition::ArtifactPosition>(g));
+		eraseSlotData(artWorn[g], ArtifactPosition(g));
 	}
 
 	// Init slots for the backpack.
 	for(size_t s=0; s<backpack.size(); ++s)
 	{
 		backpack[s]->ourOwner = this;
-		eraseSlotData(backpack[s], static_cast<ArtifactPosition::ArtifactPosition>(GameConstants::BACKPACK_START + s));
+		eraseSlotData(backpack[s], ArtifactPosition(GameConstants::BACKPACK_START + s));
 	}
 
 	leftArtRoll->callback  += boost::bind(&CArtifactsOfHero::scrollBackpack,this,-1);
@@ -4796,7 +4796,7 @@ CArtifactsOfHero::CArtifactsOfHero(const Point& position, bool createCommonPart
 	{
 		artWorn[g] = new CArtPlace(slotPos[g]);
 		artWorn[g]->ourOwner = this;
-		eraseSlotData(artWorn[g], static_cast<ArtifactPosition::ArtifactPosition>(g));
+		eraseSlotData(artWorn[g], ArtifactPosition(g));
 	}
 
 	// Create slots for the backpack.
@@ -4805,7 +4805,7 @@ CArtifactsOfHero::CArtifactsOfHero(const Point& position, bool createCommonPart
 		CArtPlace * add = new CArtPlace(Point(403 + 46 * s, 365));
 
 		add->ourOwner = this;
-		eraseSlotData(add, static_cast<ArtifactPosition::ArtifactPosition>(GameConstants::BACKPACK_START + s));
+		eraseSlotData(add, ArtifactPosition(GameConstants::BACKPACK_START + s));
 
 		backpack.push_back(add);
 	}
@@ -4999,7 +4999,7 @@ void CArtifactsOfHero::artifactDisassembled(const ArtifactLocation &al)
 void CArtifactsOfHero::updateWornSlots(bool redrawParent /*= true*/)
 {
 	for(int i = 0; i < artWorn.size(); i++)
-		updateSlot(static_cast<ArtifactPosition::ArtifactPosition>(i));
+		updateSlot(ArtifactPosition(i));
 
 
 	if(redrawParent)
@@ -5011,7 +5011,7 @@ const CGHeroInstance * CArtifactsOfHero::getHero() const
 	return curHero;
 }
 
-void CArtifactsOfHero::updateSlot(ArtifactPosition::ArtifactPosition slotID)
+void CArtifactsOfHero::updateSlot(ArtifactPosition slotID)
 {
 	setSlotData(getArtPlace(slotID), slotID);
 }
@@ -5408,7 +5408,7 @@ void CUniversityWindow::CItem::hover(bool on)
 
 int CUniversityWindow::CItem::state()
 {
-	if (parent->hero->getSecSkillLevel(static_cast<SecondarySkill::SecondarySkill>(ID)))//hero know this skill
+	if (parent->hero->getSecSkillLevel(SecondarySkill(ID)))//hero know this skill
 		return 1;
 	if (!parent->hero->canLearnSkill())//can't learn more skills
 		return 0;

+ 7 - 7
client/GUIClasses.h

@@ -498,7 +498,7 @@ class CLevelWindow : public CWindowObject
 	void selectionChanged(unsigned to);
 public:
 
-	CLevelWindow(const CGHeroInstance *hero, PrimarySkill::PrimarySkill pskill, std::vector<SecondarySkill::SecondarySkill> &skills, boost::function<void(ui32)> callback); //c-tor
+	CLevelWindow(const CGHeroInstance *hero, PrimarySkill::PrimarySkill pskill, std::vector<SecondarySkill> &skills, boost::function<void(ui32)> callback); //c-tor
 	~CLevelWindow(); //d-tor
 
 };
@@ -726,7 +726,7 @@ public:
 
 	void artifactPicked();
 	int firstFreeSlot();
-	void moveFromSlotToAltar(ArtifactPosition::ArtifactPosition slotID, CTradeableItem* altarSlot, const CArtifactInstance *art);
+	void moveFromSlotToAltar(ArtifactPosition slotID, CTradeableItem* altarSlot, const CArtifactInstance *art);
 };
 
 class CSystemOptionsWindow : public CWindowObject
@@ -898,7 +898,7 @@ public:
 	bool picked;
 	bool marked;
 
-	ArtifactPosition::ArtifactPosition slotID; //Arts::EPOS enum + backpack starting from Arts::BACKPACK_START
+	ArtifactPosition slotID; //Arts::EPOS enum + backpack starting from Arts::BACKPACK_START
 
 	void lockSlot(bool on);
 	void pickSlot(bool on);
@@ -933,7 +933,7 @@ public:
 	{
 		struct Artpos
 		{
-			ArtifactPosition::ArtifactPosition slotID;
+			ArtifactPosition slotID;
 			const CArtifactsOfHero *AOH;
 			const CArtifactInstance *art;
 
@@ -972,11 +972,11 @@ public:
 	void markPossibleSlots(const CArtifactInstance* art);
 	void unmarkSlots(bool withRedraw = true); //unmarks slots in all visible AOHs
 	void unmarkLocalSlots(bool withRedraw = true); //unmarks slots in that particular AOH
-	void setSlotData (CArtPlace* artPlace, ArtifactPosition::ArtifactPosition slotID);
+	void setSlotData (CArtPlace* artPlace, ArtifactPosition slotID);
 	void updateWornSlots (bool redrawParent = true);
 
-	void updateSlot(ArtifactPosition::ArtifactPosition i);
-	void eraseSlotData (CArtPlace* artPlace, ArtifactPosition::ArtifactPosition slotID);
+	void updateSlot(ArtifactPosition i);
+	void eraseSlotData (CArtPlace* artPlace, ArtifactPosition slotID);
 
 	CArtifactsOfHero(const Point& position, bool createCommonPart = false);
 	//Alternative constructor, used if custom artifacts positioning required (Kingdom interface)

+ 1 - 1
lib/BattleState.cpp

@@ -512,7 +512,7 @@ BattleInfo * BattleInfo::setupBattle( int3 tile, ETerrainType::ETerrainType terr
 	if(!creatureBank)
 	{
 		//Checks if hero has artifact and create appropriate stack
-		auto handleWarMachine= [&](int side, ArtifactPosition::ArtifactPosition artslot, CreatureID cretype, BattleHex hex)
+		auto handleWarMachine= [&](int side, ArtifactPosition artslot, CreatureID cretype, BattleHex hex)
 		{
 			if(heroes[side] && heroes[side]->getArt(artslot))
 				stacks.push_back(curB->generateNewStack(CStackBasicDescriptor(cretype, 1), !side, 255, hex));

+ 25 - 25
lib/CArtHandler.cpp

@@ -38,7 +38,7 @@ const std::map<std::string, CArtifact::EartClass> artifactClassMap = boost::assi
 
 #define ART_POS(x) ( #x, ArtifactPosition::x )
 
-const std::map<std::string, ArtifactPosition::ArtifactPosition> artifactPositionMap = boost::assign::map_list_of
+const std::map<std::string, ArtifactPosition> artifactPositionMap = boost::assign::map_list_of
 	ART_POS(HEAD)
 	ART_POS(SHOULDERS)
 	ART_POS(NECK)
@@ -325,7 +325,7 @@ void CArtHandler::loadArtifacts(bool onlyTxt)
 		for(int j=0;j<slots.size();j++)
 		{
 			if(parser.readString() == "x")
-				nart.possibleSlots[ArtBearer::HERO].push_back(static_cast<ArtifactPosition::ArtifactPosition>(slots[j]));
+				nart.possibleSlots[ArtBearer::HERO].push_back(ArtifactPosition(slots[j]));
 		}
 		nart.aClass = classes[parser.readString()[0]];
 
@@ -695,7 +695,7 @@ void CArtHandler::makeItCommanderArt (CArtifact * a, bool onlyCommander /*= true
 		a->possibleSlots[ArtBearer::CREATURE].clear();
 	}
 	for (int i = ArtifactPosition::COMMANDER1; i <= ArtifactPosition::COMMANDER6; ++i)
-		a->possibleSlots[ArtBearer::COMMANDER].push_back(static_cast<ArtifactPosition::ArtifactPosition>(i));
+		a->possibleSlots[ArtBearer::COMMANDER].push_back(ArtifactPosition(i));
 }
 
 void CArtHandler::makeItCommanderArt( TArtifactInstanceID aid, bool onlyCommander /*= true*/ )
@@ -869,7 +869,7 @@ void CArtifactInstance::init()
 	setNodeType(ARTIFACT_INSTANCE);
 }
 
-ArtifactPosition::ArtifactPosition CArtifactInstance::firstAvailableSlot(const CArtifactSet *h) const
+ArtifactPosition CArtifactInstance::firstAvailableSlot(const CArtifactSet *h) const
 {
 	BOOST_FOREACH(auto slot, artType->possibleSlots[h->bearerType()])
 	{
@@ -884,10 +884,10 @@ ArtifactPosition::ArtifactPosition CArtifactInstance::firstAvailableSlot(const C
 	return firstBackpackSlot(h);
 }
 
-ArtifactPosition::ArtifactPosition CArtifactInstance::firstBackpackSlot(const CArtifactSet *h) const
+ArtifactPosition CArtifactInstance::firstBackpackSlot(const CArtifactSet *h) const
 {
 	if(!artType->isBig()) //discard big artifact
-		return static_cast<ArtifactPosition::ArtifactPosition>(
+		return ArtifactPosition(
 			GameConstants::BACKPACK_START + h->artifactsInBackpack.size());
 
 	return ArtifactPosition::PRE_FIRST;
@@ -898,7 +898,7 @@ bool CArtifactInstance::canBePutAt(const ArtifactLocation al, bool assumeDestRem
 	return canBePutAt(al.getHolderArtSet(), al.slot, assumeDestRemoved);
 }
 
-bool CArtifactInstance::canBePutAt(const CArtifactSet *artSet, ArtifactPosition::ArtifactPosition slot, bool assumeDestRemoved /*= false*/) const
+bool CArtifactInstance::canBePutAt(const CArtifactSet *artSet, ArtifactPosition slot, bool assumeDestRemoved /*= false*/) const
 {
 	if(slot >= GameConstants::BACKPACK_START)
 	{
@@ -1030,7 +1030,7 @@ bool CArtifactInstance::isPart(const CArtifactInstance *supposedPart) const
 	return supposedPart == this;
 }
 
-bool CCombinedArtifactInstance::canBePutAt(const CArtifactSet *artSet, ArtifactPosition::ArtifactPosition slot, bool assumeDestRemoved /*= false*/) const
+bool CCombinedArtifactInstance::canBePutAt(const CArtifactSet *artSet, ArtifactPosition slot, bool assumeDestRemoved /*= false*/) const
 {
 	bool canMainArtifactBePlaced = CArtifactInstance::canBePutAt(artSet, slot, assumeDestRemoved);
 	if(!canMainArtifactBePlaced)
@@ -1055,7 +1055,7 @@ bool CCombinedArtifactInstance::canBePutAt(const CArtifactSet *artSet, ArtifactP
 	{
 		for(auto art = constituentsToBePlaced.begin(); art != constituentsToBePlaced.end(); art++)
 		{
-			if(art->art->canBePutAt(artSet, static_cast<ArtifactPosition::ArtifactPosition>(i), i == slot)) // i == al.slot because we can remove already worn artifact only from that slot  that is our main destination
+			if(art->art->canBePutAt(artSet, ArtifactPosition(i), i == slot)) // i == al.slot because we can remove already worn artifact only from that slot  that is our main destination
 			{
 				constituentsToBePlaced.erase(art);
 				break;
@@ -1091,7 +1091,7 @@ void CCombinedArtifactInstance::createConstituents()
 	}
 }
 
-void CCombinedArtifactInstance::addAsConstituent(CArtifactInstance *art, ArtifactPosition::ArtifactPosition slot)
+void CCombinedArtifactInstance::addAsConstituent(CArtifactInstance *art, ArtifactPosition slot)
 {
 	assert(vstd::contains(*artType->constituents, art->artType->id));
 	assert(art->getParentNodes().size() == 1  &&  art->getParentNodes().front() == art->artType);
@@ -1120,7 +1120,7 @@ void CCombinedArtifactInstance::putAt(ArtifactLocation al)
 				const bool inActiveSlot = vstd::isbetween(ci.slot, 0, GameConstants::BACKPACK_START);
 				const bool suggestedPosValid = ci.art->canBePutAt(suggestedPos);
 
-				ArtifactPosition::ArtifactPosition pos = ArtifactPosition::PRE_FIRST;
+				ArtifactPosition pos = ArtifactPosition::PRE_FIRST;
 				if(inActiveSlot  &&  suggestedPosValid) //there is a valid suggestion where to place lock
 					pos = ci.slot;
 				else
@@ -1202,7 +1202,7 @@ bool CCombinedArtifactInstance::isPart(const CArtifactInstance *supposedPart) co
 	return false;
 }
 
-CCombinedArtifactInstance::ConstituentInfo::ConstituentInfo(CArtifactInstance *Art /*= NULL*/, ArtifactPosition::ArtifactPosition Slot /*= -1*/)
+CCombinedArtifactInstance::ConstituentInfo::ConstituentInfo(CArtifactInstance *Art /*= NULL*/, ArtifactPosition Slot /*= -1*/)
 {
 	art = Art;
 	slot = Slot;
@@ -1213,7 +1213,7 @@ bool CCombinedArtifactInstance::ConstituentInfo::operator==(const ConstituentInf
 	return art == rhs.art && slot == rhs.slot;
 }
 
-const CArtifactInstance* CArtifactSet::getArt(ArtifactPosition::ArtifactPosition pos, bool excludeLocked /*= true*/) const
+const CArtifactInstance* CArtifactSet::getArt(ArtifactPosition pos, bool excludeLocked /*= true*/) const
 {
 	if(const ArtSlotInfo *si = getSlot(pos))
 	{
@@ -1224,12 +1224,12 @@ const CArtifactInstance* CArtifactSet::getArt(ArtifactPosition::ArtifactPosition
 	return NULL;
 }
 
-CArtifactInstance* CArtifactSet::getArt(ArtifactPosition::ArtifactPosition pos, bool excludeLocked /*= true*/)
+CArtifactInstance* CArtifactSet::getArt(ArtifactPosition pos, bool excludeLocked /*= true*/)
 {
 	return const_cast<CArtifactInstance*>((const_cast<const CArtifactSet*>(this))->getArt(pos, excludeLocked));
 }
 
-ArtifactPosition::ArtifactPosition CArtifactSet::getArtPos(int aid, bool onlyWorn /*= true*/) const
+ArtifactPosition CArtifactSet::getArtPos(int aid, bool onlyWorn /*= true*/) const
 {
 	for(auto i = artifactsWorn.cbegin(); i != artifactsWorn.cend(); i++)
 		if(i->second.artifact->artType->id == aid)
@@ -1240,12 +1240,12 @@ ArtifactPosition::ArtifactPosition CArtifactSet::getArtPos(int aid, bool onlyWor
 
 	for(int i = 0; i < artifactsInBackpack.size(); i++)
 		if(artifactsInBackpack[i].artifact->artType->id == aid)
-			return static_cast<ArtifactPosition::ArtifactPosition>(GameConstants::BACKPACK_START + i);
+			return ArtifactPosition(GameConstants::BACKPACK_START + i);
 
 	return ArtifactPosition::PRE_FIRST;
 }
 
-ArtifactPosition::ArtifactPosition CArtifactSet::getArtPos(const CArtifactInstance *art) const
+ArtifactPosition CArtifactSet::getArtPos(const CArtifactInstance *art) const
 {
 	BOOST_FOREACH(auto i, artifactsWorn)
 		if(i.second.artifact == art)
@@ -1253,7 +1253,7 @@ ArtifactPosition::ArtifactPosition CArtifactSet::getArtPos(const CArtifactInstan
 
 	for(int i = 0; i < artifactsInBackpack.size(); i++)
 		if(artifactsInBackpack[i].artifact == art)
-			return static_cast<ArtifactPosition::ArtifactPosition>(GameConstants::BACKPACK_START + i);
+			return ArtifactPosition(GameConstants::BACKPACK_START + i);
 
 	return ArtifactPosition::PRE_FIRST;
 }
@@ -1276,7 +1276,7 @@ bool CArtifactSet::hasArt(ui32 aid, bool onlyWorn /*= false*/) const
 	return getArtPos(aid, onlyWorn) != ArtifactPosition::PRE_FIRST;
 }
 
-const ArtSlotInfo * CArtifactSet::getSlot(ArtifactPosition::ArtifactPosition pos) const
+const ArtSlotInfo * CArtifactSet::getSlot(ArtifactPosition pos) const
 {
 	if(vstd::contains(artifactsWorn, pos))
 		return &artifactsWorn[pos];
@@ -1292,7 +1292,7 @@ const ArtSlotInfo * CArtifactSet::getSlot(ArtifactPosition::ArtifactPosition pos
 	return NULL;
 }
 
-bool CArtifactSet::isPositionFree(ArtifactPosition::ArtifactPosition pos, bool onlyLockCheck /*= false*/) const
+bool CArtifactSet::isPositionFree(ArtifactPosition pos, bool onlyLockCheck /*= false*/) const
 {
 	if(const ArtSlotInfo *s = getSlot(pos))
 		return (onlyLockCheck || !s->artifact) && !s->locked;
@@ -1300,7 +1300,7 @@ bool CArtifactSet::isPositionFree(ArtifactPosition::ArtifactPosition pos, bool o
 	return true; //no slot means not used
 }
 
-si32 CArtifactSet::getArtTypeId(ArtifactPosition::ArtifactPosition pos) const
+si32 CArtifactSet::getArtTypeId(ArtifactPosition pos) const
 {
 	const CArtifactInstance * const a = getArt(pos);
 	if(!a)
@@ -1316,7 +1316,7 @@ CArtifactSet::~CArtifactSet()
 
 }
 
-ArtSlotInfo & CArtifactSet::retreiveNewArtSlot(ArtifactPosition::ArtifactPosition slot)
+ArtSlotInfo & CArtifactSet::retreiveNewArtSlot(ArtifactPosition slot)
 {
 	assert(!vstd::contains(artifactsWorn, slot));
 	ArtSlotInfo &ret = slot < GameConstants::BACKPACK_START
@@ -1326,14 +1326,14 @@ ArtSlotInfo & CArtifactSet::retreiveNewArtSlot(ArtifactPosition::ArtifactPositio
 	return ret;
 }
 
-void CArtifactSet::setNewArtSlot(ArtifactPosition::ArtifactPosition slot, CArtifactInstance *art, bool locked)
+void CArtifactSet::setNewArtSlot(ArtifactPosition slot, CArtifactInstance *art, bool locked)
 {
 	ArtSlotInfo &asi = retreiveNewArtSlot(slot);
 	asi.artifact = art;
 	asi.locked = locked;
 }
 
-void CArtifactSet::eraseArtSlot(ArtifactPosition::ArtifactPosition slot)
+void CArtifactSet::eraseArtSlot(ArtifactPosition slot)
 {
 	if(slot < GameConstants::BACKPACK_START)
 	{
@@ -1341,7 +1341,7 @@ void CArtifactSet::eraseArtSlot(ArtifactPosition::ArtifactPosition slot)
 	}
 	else
 	{
-		slot = static_cast<ArtifactPosition::ArtifactPosition>(slot - GameConstants::BACKPACK_START);
+		slot = ArtifactPosition(slot - GameConstants::BACKPACK_START);
 		artifactsInBackpack.erase(artifactsInBackpack.begin() + slot);
 	}
 }

+ 19 - 19
lib/CArtHandler.h

@@ -66,7 +66,7 @@ public:
 	virtual void levelUpArtifact (CArtifactInstance * art){};
 
 	ui32 price;
-	bmap<ArtBearer::ArtBearer, std::vector<ArtifactPosition::ArtifactPosition> > possibleSlots; //Bearer Type => ids of slots where artifact can be placed
+	bmap<ArtBearer::ArtBearer, std::vector<ArtifactPosition> > possibleSlots; //Bearer Type => ids of slots where artifact can be placed
 	std::vector<ArtifactID> * constituents; // Artifacts IDs a combined artifact consists of, or NULL.
 	std::vector<ArtifactID> * constituentOf; // Reverse map of constituents.
 	EartClass aClass;
@@ -118,11 +118,11 @@ public:
 	void deserializationFix();
 	void setType(CArtifact *Art);
 
-	ArtifactPosition::ArtifactPosition firstAvailableSlot(const CArtifactSet *h) const;
-	ArtifactPosition::ArtifactPosition firstBackpackSlot(const CArtifactSet *h) const;
+	ArtifactPosition firstAvailableSlot(const CArtifactSet *h) const;
+	ArtifactPosition firstBackpackSlot(const CArtifactSet *h) const;
 	int getGivenSpellID() const; //to be used with scrolls (and similar arts), -1 if none
 
-	virtual bool canBePutAt(const CArtifactSet *artSet, ArtifactPosition::ArtifactPosition slot, bool assumeDestRemoved = false) const;
+	virtual bool canBePutAt(const CArtifactSet *artSet, ArtifactPosition slot, bool assumeDestRemoved = false) const;
 	bool canBePutAt(const ArtifactLocation al, bool assumeDestRemoved = false) const;  //forwards to the above one
 	virtual bool canBeDisassembled() const;
 	virtual void putAt(ArtifactLocation al);
@@ -151,26 +151,26 @@ public:
 	struct ConstituentInfo
 	{
 		ConstTransitivePtr<CArtifactInstance> art;
-		ArtifactPosition::ArtifactPosition slot;
+		ArtifactPosition slot;
 		template <typename Handler> void serialize(Handler &h, const int version)
 		{
 			h & art & slot;
 		}
 
 		bool operator==(const ConstituentInfo &rhs) const;
-		ConstituentInfo(CArtifactInstance *art = NULL, ArtifactPosition::ArtifactPosition slot = ArtifactPosition::PRE_FIRST);
+		ConstituentInfo(CArtifactInstance *art = NULL, ArtifactPosition slot = ArtifactPosition::PRE_FIRST);
 	};
 
 	std::vector<ConstituentInfo> constituentsInfo;
 
-	bool canBePutAt(const CArtifactSet *artSet, ArtifactPosition::ArtifactPosition slot, bool assumeDestRemoved = false) const OVERRIDE;
+	bool canBePutAt(const CArtifactSet *artSet, ArtifactPosition slot, bool assumeDestRemoved = false) const OVERRIDE;
 	bool canBeDisassembled() const OVERRIDE;
 	void putAt(ArtifactLocation al) OVERRIDE;
 	void removeFrom(ArtifactLocation al) OVERRIDE;
 	bool isPart(const CArtifactInstance *supposedPart) const OVERRIDE;
 
 	void createConstituents();
-	void addAsConstituent(CArtifactInstance *art, ArtifactPosition::ArtifactPosition slot);
+	void addAsConstituent(CArtifactInstance *art, ArtifactPosition slot);
 	CArtifactInstance *figureMainConstituent(const ArtifactLocation al); //main constituent is replcaed with us (combined art), not lock
 
 	CCombinedArtifactInstance();
@@ -262,21 +262,21 @@ class DLL_LINKAGE CArtifactSet
 {
 public:
 	std::vector<ArtSlotInfo> artifactsInBackpack; //hero's artifacts from bag
-	bmap<ArtifactPosition::ArtifactPosition, ArtSlotInfo> artifactsWorn; //map<position,artifact_id>; positions: 0 - head; 1 - shoulders; 2 - neck; 3 - right hand; 4 - left hand; 5 - torso; 6 - right ring; 7 - left ring; 8 - feet; 9 - misc1; 10 - misc2; 11 - misc3; 12 - misc4; 13 - mach1; 14 - mach2; 15 - mach3; 16 - mach4; 17 - spellbook; 18 - misc5
+	bmap<ArtifactPosition, ArtSlotInfo> artifactsWorn; //map<position,artifact_id>; positions: 0 - head; 1 - shoulders; 2 - neck; 3 - right hand; 4 - left hand; 5 - torso; 6 - right ring; 7 - left ring; 8 - feet; 9 - misc1; 10 - misc2; 11 - misc3; 12 - misc4; 13 - mach1; 14 - mach2; 15 - mach3; 16 - mach4; 17 - spellbook; 18 - misc5
 
-	ArtSlotInfo &retreiveNewArtSlot(ArtifactPosition::ArtifactPosition slot);
-	void setNewArtSlot(ArtifactPosition::ArtifactPosition slot, CArtifactInstance *art, bool locked);
-	void eraseArtSlot(ArtifactPosition::ArtifactPosition slot);
+	ArtSlotInfo &retreiveNewArtSlot(ArtifactPosition slot);
+	void setNewArtSlot(ArtifactPosition slot, CArtifactInstance *art, bool locked);
+	void eraseArtSlot(ArtifactPosition slot);
 
-	const ArtSlotInfo *getSlot(ArtifactPosition::ArtifactPosition pos) const;
-	const CArtifactInstance* getArt(ArtifactPosition::ArtifactPosition pos, bool excludeLocked = true) const; //NULL - no artifact
-	CArtifactInstance* getArt(ArtifactPosition::ArtifactPosition pos, bool excludeLocked = true); //NULL - no artifact
-	ArtifactPosition::ArtifactPosition getArtPos(int aid, bool onlyWorn = true) const; //looks for equipped artifact with given ID and returns its slot ID or -1 if none(if more than one such artifact lower ID is returned)
-	ArtifactPosition::ArtifactPosition getArtPos(const CArtifactInstance *art) const;
+	const ArtSlotInfo *getSlot(ArtifactPosition pos) const;
+	const CArtifactInstance* getArt(ArtifactPosition pos, bool excludeLocked = true) const; //NULL - no artifact
+	CArtifactInstance* getArt(ArtifactPosition pos, bool excludeLocked = true); //NULL - no artifact
+	ArtifactPosition getArtPos(int aid, bool onlyWorn = true) const; //looks for equipped artifact with given ID and returns its slot ID or -1 if none(if more than one such artifact lower ID is returned)
+	ArtifactPosition getArtPos(const CArtifactInstance *art) const;
 	const CArtifactInstance *getArtByInstanceId(TArtifactInstanceID artInstId) const;
 	bool hasArt(ui32 aid, bool onlyWorn = false) const; //checks if hero possess artifact of given id (either in backack or worn)
-	bool isPositionFree(ArtifactPosition::ArtifactPosition pos, bool onlyLockCheck = false) const;
-	si32 getArtTypeId(ArtifactPosition::ArtifactPosition pos) const;
+	bool isPositionFree(ArtifactPosition pos, bool onlyLockCheck = false) const;
+	si32 getArtTypeId(ArtifactPosition pos) const;
 
 	virtual ArtBearer::ArtBearer bearerType() const = 0;
 	virtual ~CArtifactSet();

+ 1 - 1
lib/CGameInterface.h

@@ -76,7 +76,7 @@ public:
 	virtual void yourTurn(){}; //called AFTER playerStartsTurn(player)
 
 	//pskill is gained primary skill, interface has to choose one of given skills and call callback with selection id
-	virtual void heroGotLevel(const CGHeroInstance *hero, PrimarySkill::PrimarySkill pskill, std::vector<SecondarySkill::SecondarySkill> &skills, int queryID)=0;
+	virtual void heroGotLevel(const CGHeroInstance *hero, PrimarySkill::PrimarySkill pskill, std::vector<SecondarySkill> &skills, int queryID)=0;
 	virtual	void commanderGotLevel (const CCommanderInstance * commander, std::vector<ui32> skills, int queryID)=0;
 
 	// Show a dialog, player must take decision. If selection then he has to choose between one of given components,

+ 12 - 11
lib/CGameState.cpp

@@ -630,12 +630,13 @@ std::pair<Obj,int> CGameState::pickObject (CGObjectInstance *obj)
 			delete dwl->info;
 			dwl->info = nullptr;
 
-			std::pair<Obj,int> result(Obj::NO_OBJ, -1);
-			int cid = VLC->townh->towns[faction].creatures[level][0];
+			std::pair<Obj, int> result(Obj::NO_OBJ, -1);
+			CreatureID cid = VLC->townh->towns[faction].creatures[level][0];
 
 			//golem factory is not in list of cregens but can be placed as random object
-			static const int factoryCreatures[] = {32, 33, 116, 117};
-			std::vector<int> factory(factoryCreatures, factoryCreatures + ARRAY_COUNT(factoryCreatures));
+			static const CreatureID factoryCreatures[] = {CreatureID::STONE_GOLEM, CreatureID::IRON_GOLEM,
+				CreatureID::GOLD_GOLEM, CreatureID::DIAMOND_GOLEM};
+			std::vector<CreatureID> factory(factoryCreatures, factoryCreatures + ARRAY_COUNT(factoryCreatures));
 			if (vstd::contains(factory, cid))
 				result = std::make_pair(Obj::CREATURE_GENERATOR4, 1);
 
@@ -837,7 +838,7 @@ void CGameState::init(StartInfo * si)
 				}
 				break;
 			case CScenarioTravel::STravelBonus::SECONDARY_SKILL:
-				hero->setSecSkillLevel(static_cast<SecondarySkill::SecondarySkill>(curBonus->info2), curBonus->info3, true);
+				hero->setSecSkillLevel(SecondarySkill(curBonus->info2), curBonus->info3, true);
 				break;
 			}
 		}
@@ -1687,12 +1688,12 @@ void CGameState::initDuel()
 
 			BOOST_FOREACH(auto &parka, ss.artifacts)
 			{
-				h->putArtifact(static_cast<ArtifactPosition::ArtifactPosition>(parka.first), parka.second);
+				h->putArtifact(ArtifactPosition(parka.first), parka.second);
 			}
 
 			typedef const std::pair<si32, si8> &TSecSKill;
 			BOOST_FOREACH(TSecSKill secSkill, ss.heroSecSkills)
-				h->setSecSkillLevel(static_cast<SecondarySkill::SecondarySkill>(secSkill.first), secSkill.second, 1);
+				h->setSecSkillLevel(SecondarySkill(secSkill.first), secSkill.second, 1);
 
 			h->initHero(h->subID);
 			obj->initObj();
@@ -2449,7 +2450,7 @@ void CGameState::obtainPlayersStats(SThievesGuildInfo & tgi, int level)
 
 	for(auto g = players.begin(); g != players.end(); ++g)
 	{
-		if(g->second.color != 255)
+		if(g->second.color != GameConstants::NEUTRAL_PLAYER)
 			tgi.playerColors.push_back(g->second.color);
 	}
 
@@ -2462,7 +2463,7 @@ void CGameState::obtainPlayersStats(SThievesGuildInfo & tgi, int level)
 		//best hero's portrait
 		for(auto g = players.cbegin(); g != players.cend(); ++g)
 		{
-			if(g->second.color == 255)
+			if(g->second.color == GameConstants::NEUTRAL_PLAYER)
 				continue;
 			const CGHeroInstance * best = statsHLP::findBestHero(this, g->second.color);
 			InfoAboutHero iah;
@@ -2507,7 +2508,7 @@ void CGameState::obtainPlayersStats(SThievesGuildInfo & tgi, int level)
 	{
 		for(auto g = players.cbegin(); g != players.cend(); ++g)
 		{
-			if(g->second.color == 255) //do nothing for neutral player
+			if(g->second.color == GameConstants::NEUTRAL_PLAYER) //do nothing for neutral player
 				continue;
 			if(g->second.human)
 			{
@@ -2525,7 +2526,7 @@ void CGameState::obtainPlayersStats(SThievesGuildInfo & tgi, int level)
 		//best creatures belonging to player (highest AI value)
 		for(auto g = players.cbegin(); g != players.cend(); ++g)
 		{
-			if(g->second.color == 255) //do nothing for neutral player
+			if(g->second.color == GameConstants::NEUTRAL_PLAYER) //do nothing for neutral player
 				continue;
 			int bestCre = -1; //best creature's ID
 			for(int b=0; b<g->second.heroes.size(); ++b)

+ 6 - 6
lib/CHeroHandler.cpp

@@ -21,7 +21,7 @@
  *
  */
 
-SecondarySkill::SecondarySkill CHeroClass::chooseSecSkill(const std::set<SecondarySkill::SecondarySkill> & possibles) const //picks secondary skill out from given possibilities
+SecondarySkill CHeroClass::chooseSecSkill(const std::set<SecondarySkill> & possibles) const //picks secondary skill out from given possibilities
 {
 	if(possibles.size()==1)
 		return *possibles.begin();
@@ -166,7 +166,7 @@ CHeroClass *CHeroClassHandler::loadClass(const JsonNode & node)
 		heroClass->primarySkillHighLevel.push_back(node["highLevelChance"][pSkill].Float());
 	}
 
-	BOOST_FOREACH(const std::string & secSkill, SecondarySkill::names)
+	BOOST_FOREACH(const std::string & secSkill, NSecondarySkill::names)
 	{
 		heroClass->secSkillProbability.push_back(node["secondarySkills"][secSkill].Float());
 	}
@@ -271,9 +271,9 @@ void CHeroHandler::loadHeroJson(CHero * hero, const JsonNode & node)
 
 	BOOST_FOREACH(const JsonNode &set, node["skills"].Vector())
 	{
-		SecondarySkill::SecondarySkill skillID = static_cast<SecondarySkill::SecondarySkill>(
-			boost::range::find(SecondarySkill::names,  set["skill"].String()) - boost::begin(SecondarySkill::names));
-		int skillLevel = boost::range::find(SecondarySkill::levels, set["level"].String()) - boost::begin(SecondarySkill::levels);
+		SecondarySkill skillID = SecondarySkill(
+			boost::range::find(NSecondarySkill::names,  set["skill"].String()) - boost::begin(NSecondarySkill::names));
+		int skillLevel = boost::range::find(NSecondarySkill::levels, set["level"].String()) - boost::begin(NSecondarySkill::levels);
 
 		hero->secSkillsInit.push_back(std::make_pair(skillID, skillLevel));
 	}
@@ -319,7 +319,7 @@ void CHeroHandler::load()
 {
 	for (int i = 0; i < GameConstants::SKILL_QUANTITY; ++i)
 	{
-		VLC->modh->identifiers.registerObject("skill." + SecondarySkill::names[i], i);
+		VLC->modh->identifiers.registerObject("skill." + NSecondarySkill::names[i], i);
 	}
 	classes.load();
 	loadHeroes();

+ 2 - 2
lib/CHeroHandler.h

@@ -64,7 +64,7 @@ public:
 	std::vector<InitialArmyStack> initialArmy;
 
 	CHeroClass * heroClass;
-	std::vector<std::pair<SecondarySkill::SecondarySkill, ui8> > secSkillsInit; //initial secondary skills; first - ID of skill, second - level of skill (1 - basic, 2 - adv., 3 - expert)
+	std::vector<std::pair<SecondarySkill, ui8> > secSkillsInit; //initial secondary skills; first - ID of skill, second - level of skill (1 - basic, 2 - adv., 3 - expert)
 	std::vector<SSpecialtyInfo> spec;
 	std::vector<SSpecialtyBonus> specialty;
 	std::set<SpellID> spells;
@@ -114,7 +114,7 @@ public:
 	std::string imageMapMale;
 	std::string imageMapFemale;
 
-	SecondarySkill::SecondarySkill chooseSecSkill(const std::set<SecondarySkill::SecondarySkill> & possibles) const; //picks secondary skill out from given possibilities
+	SecondarySkill chooseSecSkill(const std::set<SecondarySkill> & possibles) const; //picks secondary skill out from given possibilities
 
 	template <typename Handler> void serialize(Handler &h, const int version)
 	{

+ 17 - 17
lib/CObjectHandler.cpp

@@ -630,7 +630,7 @@ bool CGHeroInstance::canWalkOnSea() const
 	return hasBonusOfType(Bonus::FLYING_MOVEMENT) || hasBonusOfType(Bonus::WATER_WALKING);
 }
 
-ui8 CGHeroInstance::getSecSkillLevel(SecondarySkill::SecondarySkill skill) const
+ui8 CGHeroInstance::getSecSkillLevel(SecondarySkill skill) const
 {
 	for(size_t i=0; i < secSkills.size(); ++i)
 		if(secSkills[i].first == skill)
@@ -638,11 +638,11 @@ ui8 CGHeroInstance::getSecSkillLevel(SecondarySkill::SecondarySkill skill) const
 	return 0;
 }
 
-void CGHeroInstance::setSecSkillLevel(SecondarySkill::SecondarySkill which, int val, bool abs)
+void CGHeroInstance::setSecSkillLevel(SecondarySkill which, int val, bool abs)
 {
 	if(getSecSkillLevel(which) == 0)
 	{
-		secSkills.push_back(std::pair<SecondarySkill::SecondarySkill,ui8>(which, val));
+		secSkills.push_back(std::pair<SecondarySkill,ui8>(which, val));
 		updateSkill(which, val);
 	}
 	else
@@ -755,7 +755,7 @@ void CGHeroInstance::initHero()
 			pushPrimSkill(static_cast<PrimarySkill::PrimarySkill>(g), type->heroClass->primarySkillInitial[g]);
 		}
 	}
-	if(secSkills.size() == 1 && secSkills[0] == std::pair<SecondarySkill::SecondarySkill,ui8>(SecondarySkill::DEFAULT, -1)) //set secondary skills to default
+	if(secSkills.size() == 1 && secSkills[0] == std::pair<SecondarySkill,ui8>(SecondarySkill::DEFAULT, -1)) //set secondary skills to default
 		secSkills = type->secSkillsInit;
 	if (!name.length())
 		name = type->name;
@@ -843,7 +843,7 @@ void CGHeroInstance::initArmy(IArmyDescriptor *dst /*= NULL*/)
 				slot = 9 + aid;
 				break;
 			}
-			auto convSlot = static_cast<ArtifactPosition::ArtifactPosition>(slot);
+			auto convSlot = ArtifactPosition(slot);
 			if(!getArt(convSlot))
 				putArtifact(convSlot, CArtifactInstance::createNewArtifactInstance(aid));
 			else
@@ -1093,7 +1093,7 @@ void CGHeroInstance::initObj() //TODO: use bonus system
 				hs->addNewBonus(bonus);
 				break;
 			case 11://starting skill with mastery (Adrienne)
-				cb->changeSecSkill(this, static_cast<SecondarySkill::SecondarySkill>(spec.val), spec.additionalinfo); //simply give it and forget
+				cb->changeSecSkill(this, SecondarySkill(spec.val), spec.additionalinfo); //simply give it and forget
 				break;
 			case 12://army speed
 				bonus->type = Bonus::STACKS_SPEED;
@@ -1137,7 +1137,7 @@ void CGHeroInstance::initObj() //TODO: use bonus system
 
 	//initialize bonuses
 	BOOST_FOREACH(auto skill_info, secSkills)
-		updateSkill(static_cast<SecondarySkill::SecondarySkill>(skill_info.first), skill_info.second);
+		updateSkill(SecondarySkill(skill_info.first), skill_info.second);
 	Updatespecialty();
 
 	mana = manaLimit(); //after all bonuses are taken into account, make sure this line is the last one
@@ -1198,7 +1198,7 @@ void CGHeroInstance::Updatespecialty() //TODO: calculate special value of bonuse
 		}
 	}
 }
-void CGHeroInstance::updateSkill(SecondarySkill::SecondarySkill which, int val)
+void CGHeroInstance::updateSkill(SecondarySkill which, int val)
 {
 	if(which == SecondarySkill::LEADERSHIP || which == SecondarySkill::LUCK)
 	{ //luck-> VLC->generaltexth->arraytxt[73+luckSkill]; VLC->generaltexth->arraytxt[104+moraleSkill]
@@ -1310,7 +1310,7 @@ ui8 CGHeroInstance::getSpellSchoolLevel(const CSpell * spell, int *outSelectedSc
 	if(spell-> schoolName)									\
 	{															\
 		int thisSchool = std::max<int>(getSecSkillLevel( \
-			static_cast<SecondarySkill::SecondarySkill>(14 + (schoolMechanicsId))), \
+			SecondarySkill(14 + (schoolMechanicsId))), \
 			valOfBonuses(Bonus::MAGIC_SCHOOL_SKILL, 1 << (schoolMechanicsId))); \
 		if(thisSchool > skill)									\
 		{														\
@@ -1373,7 +1373,7 @@ CStackBasicDescriptor CGHeroInstance::calculateNecromancy (const BattleResult &b
 		ui32 raisedUnits = 0;
 
 		// Figure out what to raise and how many.
-		const ui32 creatureTypes[] = {56, 58, 60, 64}; // IDs for Skeletons, Walking Dead, Wights and Liches respectively.
+		const CreatureID creatureTypes[] = {CreatureID::SKELETON, CreatureID::WALKING_DEAD, CreatureID::WIGHTS, CreatureID::LICHES};
 		const bool improvedNecromancy = hasBonusOfType(Bonus::IMPROVED_NECROMANCY);
 		const CCreature *raisedUnitType = VLC->creh->creatures[creatureTypes[improvedNecromancy ? necromancyLevel : 0]];
 		const ui32 raisedUnitHP = raisedUnitType->valOfBonuses(Bonus::STACK_HEALTH);
@@ -1512,7 +1512,7 @@ std::string CGHeroInstance::nodeName() const
 	return "Hero " + name;
 }
 
-void CGHeroInstance::putArtifact(ArtifactPosition::ArtifactPosition pos, CArtifactInstance *art)
+void CGHeroInstance::putArtifact(ArtifactPosition pos, CArtifactInstance *art)
 {
 	assert(!getArt(pos));
 	art->putAt(ArtifactLocation(this, pos));
@@ -4729,7 +4729,7 @@ void CGSeerHut::completeQuest (const CGHeroInstance * h) const //reward
 			cb->changePrimSkill(h, static_cast<PrimarySkill::PrimarySkill>(rID), rVal, false);
 			break;
 		case SECONDARY_SKILL:
-			cb->changeSecSkill(h, static_cast<SecondarySkill::SecondarySkill>(rID), rVal, false);
+			cb->changeSecSkill(h, SecondarySkill(rID), rVal, false);
 			break;
 		case ARTIFACT:
 			cb->giveHeroNewArtifact(h, VLC->arth->artifacts[rID],ArtifactPosition::FIRST_AVAILABLE);
@@ -4805,7 +4805,7 @@ void CGWitchHut::onHeroVisit( const CGHeroInstance * h ) const
 	if(!wasVisited(h->tempOwner))
 		cb->setObjProperty(id,10,h->tempOwner);
 	ui32 txt_id;
-	if(h->getSecSkillLevel(static_cast<SecondarySkill::SecondarySkill>(ability))) //you alredy know this skill
+	if(h->getSecSkillLevel(SecondarySkill(ability))) //you alredy know this skill
 	{
 		txt_id =172;
 	}
@@ -4817,7 +4817,7 @@ void CGWitchHut::onHeroVisit( const CGHeroInstance * h ) const
 	{
 		iw.components.push_back(Component(Component::SEC_SKILL, ability, 1, 0));
 		txt_id = 171;
-		cb->changeSecSkill(h, static_cast<SecondarySkill::SecondarySkill>(ability), 1, true);
+		cb->changeSecSkill(h, SecondarySkill(ability), 1, true);
 	}
 
 	iw.text.addTxt(MetaString::ADVOB_TXT,txt_id);
@@ -4833,7 +4833,7 @@ const std::string & CGWitchHut::getHoverText() const
 		hoverName += "\n" + VLC->generaltexth->allTexts[356]; // + (learn %s)
 		boost::algorithm::replace_first(hoverName,"%s",VLC->generaltexth->skillName[ability]);
 		const CGHeroInstance *h = cb->getSelectedHero(cb->getCurrentPlayer());
-		if(h && h->getSecSkillLevel(static_cast<SecondarySkill::SecondarySkill>(ability))) //hero knows that ability
+		if(h && h->getSecSkillLevel(SecondarySkill(ability))) //hero knows that ability
 			hoverName += "\n\n" + VLC->generaltexth->allTexts[357]; // (Already learned)
 	}
 	return hoverName;
@@ -5553,7 +5553,7 @@ void CGScholar::onHeroVisit( const CGHeroInstance * h ) const
 	EBonusType type = bonusType;
 	int bid = bonusID;
 	//check if the bonus if applicable, if not - give primary skill (always possible)
-	int ssl = h->getSecSkillLevel(static_cast<SecondarySkill::SecondarySkill>(bid)); //current sec skill level, used if bonusType == 1
+	int ssl = h->getSecSkillLevel(SecondarySkill(bid)); //current sec skill level, used if bonusType == 1
 	if((type == SECONDARY_SKILL
 			&& ((ssl == 3)  ||  (!ssl  &&  !h->canLearnSkill()))) ////hero already has expert level in the skill or (don't know skill and doesn't have free slot)
 		|| (type == SPELL  &&  (!h->getArt(ArtifactPosition::SPELLBOOK) || vstd::contains(h->spells, (ui32) bid)
@@ -5577,7 +5577,7 @@ void CGScholar::onHeroVisit( const CGHeroInstance * h ) const
 		iw.components.push_back(Component(Component::PRIM_SKILL,bid,+1,0));
 		break;
 	case SECONDARY_SKILL:
-		cb->changeSecSkill(h,static_cast<SecondarySkill::SecondarySkill>(bid),+1);
+		cb->changeSecSkill(h,SecondarySkill(bid),+1);
 		iw.components.push_back(Component(Component::SEC_SKILL,bid,ssl+1,0));
 		break;
 	case SPELL:

+ 6 - 6
lib/CObjectHandler.h

@@ -297,7 +297,7 @@ public:
 	std::string biography; //if custom
 	si32 portrait; //may be custom
 	si32 mana; // remaining spell points
-	std::vector<std::pair<SecondarySkill::SecondarySkill,ui8> > secSkills; //first - ID of skill, second - level of skill (1 - basic, 2 - adv., 3 - expert); if hero has ability (-1, -1) it meansthat it should have default secondary abilities
+	std::vector<std::pair<SecondarySkill,ui8> > secSkills; //first - ID of skill, second - level of skill (1 - basic, 2 - adv., 3 - expert); if hero has ability (-1, -1) it meansthat it should have default secondary abilities
 	ui32 movement; //remaining movement points
 	ui8 sex;
 	bool inTownGarrison; // if hero is in town garrison
@@ -377,8 +377,8 @@ public:
 	int getCurrentLuck(int stack=-1, bool town=false) const;
 	int getSpellCost(const CSpell *sp) const; //do not use during battles -> bonuses from army would be ignored
 
-	ui8 getSecSkillLevel(SecondarySkill::SecondarySkill skill) const; //0 - no skill
-	void setSecSkillLevel(SecondarySkill::SecondarySkill which, int val, bool abs);// abs == 0 - changes by value; 1 - sets to value
+	ui8 getSecSkillLevel(SecondarySkill skill) const; //0 - no skill
+	void setSecSkillLevel(SecondarySkill which, int val, bool abs);// abs == 0 - changes by value; 1 - sets to value
 	bool canLearnSkill() const; ///true if hero has free secondary skill slot
 
 	int maxMovePoints(bool onLand) const;
@@ -405,7 +405,7 @@ public:
 	void initHero();
 	void initHero(int SUBID);
 
-	void putArtifact(ArtifactPosition::ArtifactPosition pos, CArtifactInstance *art);
+	void putArtifact(ArtifactPosition pos, CArtifactInstance *art);
 	void putInBackpack(CArtifactInstance *art);
 	void initExp();
 	void initArmy(IArmyDescriptor *dst = NULL);
@@ -413,7 +413,7 @@ public:
 	void initHeroDefInfo();
 	void pushPrimSkill(PrimarySkill::PrimarySkill which, int val);
 	void Updatespecialty();
-	void updateSkill(SecondarySkill::SecondarySkill which, int val);
+	void updateSkill(SecondarySkill which, int val);
 
 	CGHeroInstance();
 	virtual ~CGHeroInstance();
@@ -682,7 +682,7 @@ public:
 	si32 luckDiff; //luck modifier
 	TResources resources;//gained / lost resources
 	std::vector<si32> primskills;//gained / lost prim skills
-	std::vector<SecondarySkill::SecondarySkill> abilities; //gained abilities
+	std::vector<SecondarySkill> abilities; //gained abilities
 	std::vector<si32> abilityLevels; //levels of gained abilities
 	std::vector<ArtifactID> artifacts; //gained artifacts
 	std::vector<SpellID> spells; //gained spells

+ 4 - 0
lib/GameConstants.cpp

@@ -48,10 +48,14 @@ bool operator>=(const A & a, const B & b)			\
 	ID_LIKE_OPERATORS_INTERNAL(ENUM_NAME, CLASS_NAME, a, b.num)
 
 
+ID_LIKE_OPERATORS(SecondarySkill, SecondarySkill::ESecondarySkill)
+
 ID_LIKE_OPERATORS(Obj, Obj::EObj)
 
 ID_LIKE_OPERATORS(ArtifactID, ArtifactID::EArtifactID)
 
+ID_LIKE_OPERATORS(ArtifactPosition, ArtifactPosition::EArtifactPosition)
+
 ID_LIKE_OPERATORS(CreatureID, CreatureID::ECreatureID)
 
 ID_LIKE_OPERATORS(SpellID, SpellID::ESpellID)

+ 31 - 6
lib/GameConstants.h

@@ -152,17 +152,28 @@ namespace PrimarySkill
 				EXPERIENCE = 4}; //for some reason changePrimSkill uses it
 }
 
-namespace SecondarySkill
+class SecondarySkill
 {
-	enum SecondarySkill
+public:
+	enum ESecondarySkill
 	{
+		WRONG = -2,
 		DEFAULT = -1,
 		PATHFINDING = 0, ARCHERY, LOGISTICS, SCOUTING, DIPLOMACY, NAVIGATION, LEADERSHIP, WISDOM, MYSTICISM,
 		LUCK, BALLISTICS, EAGLE_EYE, NECROMANCY, ESTATES, FIRE_MAGIC, AIR_MAGIC, WATER_MAGIC, EARTH_MAGIC,
 		SCHOLAR, TACTICS, ARTILLERY, LEARNING, OFFENCE, ARMORER, INTELLIGENCE, SORCERY, RESISTANCE,
 		FIRST_AID
 	};
-}
+
+	SecondarySkill(ESecondarySkill _num = WRONG) : num(_num)
+	{}
+
+	ID_LIKE_CLASS_COMMON(SecondarySkill, ESecondarySkill)
+
+	ESecondarySkill num;
+};
+
+ID_LIKE_OPERATORS_DECLS(SecondarySkill, SecondarySkill::ESecondarySkill)
 
 namespace EVictoryConditionType
 {
@@ -573,9 +584,10 @@ namespace PlayerRelations
 	enum PlayerRelations {ENEMIES, ALLIES, SAME_PLAYER};
 }
 
-namespace ArtifactPosition
+class ArtifactPosition
 {
-	enum ArtifactPosition
+public:
+	enum EArtifactPosition
 	{
 		FIRST_AVAILABLE = -2,
 		PRE_FIRST = -1, //sometimes used as error, sometimes as first free in backpack
@@ -586,7 +598,16 @@ namespace ArtifactPosition
 		CREATURE_SLOT = 0,
 		COMMANDER1 = 0, COMMANDER2, COMMANDER3, COMMANDER4, COMMANDER5, COMMANDER6, COMMANDER_AFTER_LAST
 	};
-}
+
+	ArtifactPosition(EArtifactPosition _num = PRE_FIRST) : num(_num)
+	{}
+
+	ID_LIKE_CLASS_COMMON(ArtifactPosition, EArtifactPosition)
+
+	EArtifactPosition num;
+};
+
+ID_LIKE_OPERATORS_DECLS(ArtifactPosition, ArtifactPosition::EArtifactPosition)
 
 class ArtifactID
 {
@@ -641,6 +662,10 @@ public:
 		STONE_GOLEM = 32,
 		IRON_GOLEM = 33,
 		IMP = 42,
+		SKELETON = 56,
+		WALKING_DEAD = 58,
+		WIGHTS = 60,
+		LICHES = 64,
 		TROGLODYTES = 70,
 		AIR_ELEMENTAL = 112,
 		EARTH_ELEMENTAL = 113,

+ 4 - 4
lib/IGameCallback.h

@@ -209,11 +209,11 @@ public:
 	virtual void setOwner(const CGObjectInstance * objid, TPlayerColor owner)=0;
 	virtual void setHoverName(const CGObjectInstance * obj, MetaString * name)=0;
 	virtual void changePrimSkill(const CGHeroInstance * hero, PrimarySkill::PrimarySkill which, si64 val, bool abs=false)=0;
-	virtual void changeSecSkill(const CGHeroInstance * hero, SecondarySkill::SecondarySkill which, int val, bool abs=false)=0; 
+	virtual void changeSecSkill(const CGHeroInstance * hero, SecondarySkill which, int val, bool abs=false)=0; 
 	virtual void showBlockingDialog(BlockingDialog *iw, const CFunctionList<void(ui32)> &callback)=0;
 	virtual ui32 showBlockingDialog(BlockingDialog *iw) =0; //synchronous version of above //TODO:
 	virtual void showGarrisonDialog(int upobj, int hid, bool removableUnits, const boost::function<void()> &cb) =0; //cb will be called when player closes garrison window
-	virtual void showThievesGuildWindow(int player, int requestingObjId) =0;
+	virtual void showThievesGuildWindow(TPlayerColor player, int requestingObjId) =0;
 	virtual void giveResource(TPlayerColor player, Res::ERes which, int val)=0;
 
 	virtual void giveCreatures(const CArmedInstance *objid, const CGHeroInstance * h, const CCreatureSet &creatures, bool remove) =0;
@@ -227,8 +227,8 @@ public:
 	virtual void tryJoiningArmy(const CArmedInstance *src, const CArmedInstance *dst, bool removeObjWhenFinished, bool allowMerging) =0; //merges army from src do dst or opens a garrison window
 	virtual bool moveStack(const StackLocation &src, const StackLocation &dst, TQuantity count) = 0;
 
-	virtual void giveHeroNewArtifact(const CGHeroInstance *h, const CArtifact *artType, ArtifactPosition::ArtifactPosition pos) = 0;
-	virtual void giveHeroArtifact(const CGHeroInstance *h, const CArtifactInstance *a, ArtifactPosition::ArtifactPosition pos) = 0; //pos==-1 - first free slot in backpack=0; pos==-2 - default if available or backpack
+	virtual void giveHeroNewArtifact(const CGHeroInstance *h, const CArtifact *artType, ArtifactPosition pos) = 0;
+	virtual void giveHeroArtifact(const CGHeroInstance *h, const CArtifactInstance *a, ArtifactPosition pos) = 0; //pos==-1 - first free slot in backpack=0; pos==-2 - default if available or backpack
 	virtual void putArtifact(const ArtifactLocation &al, const CArtifactInstance *a) = 0;
 	virtual void removeArtifact(const ArtifactLocation &al) = 0;
 	virtual bool moveArtifact(const ArtifactLocation &al1, const ArtifactLocation &al2) = 0;

+ 2 - 2
lib/Mapping/CCampaignHandler.cpp

@@ -372,7 +372,7 @@ void CCampaignScenario::prepareCrossoverHeroes( std::vector<CGHeroInstance *> he
 			size_t totalArts = GameConstants::BACKPACK_START + hero->artifactsInBackpack.size();
 			for (size_t i=0; i<totalArts; i++ )
 			{
-				const ArtSlotInfo *info = hero->getSlot(static_cast<ArtifactPosition::ArtifactPosition>(i));
+				const ArtSlotInfo *info = hero->getSlot(ArtifactPosition(i));
 				if (!info)
 					continue;
 
@@ -385,7 +385,7 @@ void CCampaignScenario::prepareCrossoverHeroes( std::vector<CGHeroInstance *> he
 				bool takeable = travelOptions.artifsKeptByHero[id / 8] & ( 1 << (id%8) );
 
 				if (!takeable)
-					hero->eraseArtSlot(static_cast<ArtifactPosition::ArtifactPosition>(i));
+					hero->eraseArtSlot(ArtifactPosition(i));
 			}
 		}
 	}

+ 5 - 5
lib/Mapping/MapFormatH3M.cpp

@@ -542,7 +542,7 @@ void CMapLoaderH3M::readPredefinedHeroes()
 					hero->secSkills.resize(howMany);
 					for(int yy = 0; yy < howMany; ++yy)
 					{
-						hero->secSkills[yy].first = static_cast<SecondarySkill::SecondarySkill>(reader.readUInt8());
+						hero->secSkills[yy].first = SecondarySkill(reader.readUInt8());
 						hero->secSkills[yy].second = reader.readUInt8();
 					}
 				}
@@ -655,7 +655,7 @@ bool CMapLoaderH3M::loadArtifactToSlot(CGHeroInstance * hero, int slot)
 			slot = ArtifactPosition::SPELLBOOK;
 		}
 
-		hero->putArtifact(static_cast<ArtifactPosition::ArtifactPosition>(slot), createArtifact(aid));
+		hero->putArtifact(ArtifactPosition(slot), createArtifact(aid));
 	}
 
 	return isArt;
@@ -845,7 +845,7 @@ void CMapLoaderH3M::readObjects()
 				int gabn = reader.readUInt8(); // Number of gained abilities
 				for(int oo = 0; oo < gabn; ++oo)
 				{
-					evnt->abilities.push_back(static_cast<SecondarySkill::SecondarySkill>(reader.readUInt8()));
+					evnt->abilities.push_back(SecondarySkill(reader.readUInt8()));
 					evnt->abilityLevels.push_back(reader.readUInt8());
 				}
 
@@ -1192,7 +1192,7 @@ void CMapLoaderH3M::readObjects()
 				int gabn = reader.readUInt8();//number of gained abilities
 				for(int oo = 0; oo < gabn; ++oo)
 				{
-					box->abilities.push_back(static_cast<SecondarySkill::SecondarySkill>(reader.readUInt8()));
+					box->abilities.push_back(SecondarySkill(reader.readUInt8()));
 					box->abilityLevels.push_back(reader.readUInt8());
 				}
 				int gart = reader.readUInt8(); //number of gained artifacts
@@ -1590,7 +1590,7 @@ CGObjectInstance * CMapLoaderH3M::readHero(int idToBeGiven)
 		nhi->secSkills.resize(howMany);
 		for(int yy = 0; yy < howMany; ++yy)
 		{
-			nhi->secSkills[yy].first = static_cast<SecondarySkill::SecondarySkill>(reader.readUInt8());
+			nhi->secSkills[yy].first = SecondarySkill(reader.readUInt8());
 			nhi->secSkills[yy].second = reader.readUInt8();
 		}
 	}

+ 9 - 9
lib/NetPacks.h

@@ -317,7 +317,7 @@ struct SetSecSkill : public CPackForClient //106
 
 	ui8 abs; //0 - changes by value; 1 - sets to value
 	si32 id;
-	SecondarySkill::SecondarySkill which;
+	SecondarySkill which;
 	ui16 val;
 
 	template <typename Handler> void serialize(Handler &h, const int version)
@@ -923,7 +923,7 @@ struct ArtifactLocation
 
 
 	TArtHolder artHolder;
-	ArtifactPosition::ArtifactPosition slot;
+	ArtifactPosition slot;
 
 	ArtifactLocation()
 	{
@@ -931,12 +931,12 @@ struct ArtifactLocation
 		slot = ArtifactPosition::PRE_FIRST;
 	}
 	template <typename T>
-	ArtifactLocation(const T *ArtHolder, ArtifactPosition::ArtifactPosition Slot)
+	ArtifactLocation(const T *ArtHolder, ArtifactPosition Slot)
 	{
 		artHolder = const_cast<T*>(ArtHolder); //we are allowed here to const cast -> change will go through one of our packages... do not abuse!
 		slot = Slot;
 	}
-	ArtifactLocation(TArtHolder ArtHolder, ArtifactPosition::ArtifactPosition Slot)
+	ArtifactLocation(TArtHolder ArtHolder, ArtifactPosition Slot)
 	{
 		artHolder = ArtHolder;
 		slot = Slot;
@@ -1175,7 +1175,7 @@ struct HeroLevelUp : public Query//2000
 	si32 heroid;
 	PrimarySkill::PrimarySkill primskill;
 	ui8 level;
-	std::vector<SecondarySkill::SecondarySkill> skills;
+	std::vector<SecondarySkill> skills;
 
 	HeroLevelUp(){type = 2000;};
 
@@ -1377,8 +1377,8 @@ struct StacksHealedOrResurrected : public CPackForClient //3013
 	};
 
 	std::vector<HealInfo> healedStacks;
-	ui8 lifeDrain; //if true, this heal is an effect of life drain
-	ui8 tentHealing; //if true, than it's healing via First Aid Tent
+	bool lifeDrain; //if true, this heal is an effect of life drain
+	bool tentHealing; //if true, than it's healing via First Aid Tent
 	si32 drainedFrom; //if life drain - then stack life was drain from, if tentHealing - stack that is a healer
 
 	template <typename Handler> void serialize(Handler &h, const int version)
@@ -1914,10 +1914,10 @@ struct ExchangeArtifacts : public CPackForServer
 struct AssembleArtifacts : public CPackForServer
 {
 	AssembleArtifacts(){};
-	AssembleArtifacts(si32 _heroID, ArtifactPosition::ArtifactPosition _artifactSlot, bool _assemble, ui32 _assembleTo)
+	AssembleArtifacts(si32 _heroID, ArtifactPosition _artifactSlot, bool _assemble, ui32 _assembleTo)
 		: heroID(_heroID), artifactSlot(_artifactSlot), assemble(_assemble), assembleTo(_assembleTo){};
 	si32 heroID;
-	ArtifactPosition::ArtifactPosition artifactSlot;
+	ArtifactPosition artifactSlot;
 	bool assemble; // True to assemble artifact, false to disassemble.
 	ui32 assembleTo; // Artifact to assemble into.
 

+ 1 - 1
lib/NetPacksLib.cpp

@@ -811,7 +811,7 @@ DLL_LINKAGE void AssembledArtifact::applyGs( CGameState *gs )
 	//retrieve all constituents
 	BOOST_FOREACH(si32 constituentID, *builtArt->constituents)
 	{
-		ArtifactPosition::ArtifactPosition pos = artSet->getArtPos(constituentID);
+		ArtifactPosition pos = artSet->getArtPos(constituentID);
 		assert(pos >= 0);
 		CArtifactInstance *constituentInstance = artSet->getArt(pos);
 

+ 1 - 1
lib/StringConstants.h

@@ -46,7 +46,7 @@ namespace PrimarySkill
 	const std::string names [GameConstants::PRIMARY_SKILLS] = { "attack", "defence", "spellpower", "knowledge" };
 }
 
-namespace SecondarySkill
+namespace NSecondarySkill
 {
 	const std::string names [GameConstants::SKILL_QUANTITY] =
 	{

+ 28 - 27
server/CGameHandler.cpp

@@ -195,7 +195,7 @@ void callWith(std::vector<T> args, boost::function<void(T)> fun, ui32 which)
 	fun(args[which]);
 }
 
-void CGameHandler::levelUpHero(const CGHeroInstance * hero, SecondarySkill::SecondarySkill skill)
+void CGameHandler::levelUpHero(const CGHeroInstance * hero, SecondarySkill skill)
 {
 	changeSecSkill(hero, skill, 1, 0);
 	levelUpHero(hero);
@@ -236,10 +236,10 @@ void CGameHandler::levelUpHero(const CGHeroInstance * hero)
 	hlu.level = hero->level+1;
 
 	//picking sec. skills for choice
-	std::set<SecondarySkill::SecondarySkill> basicAndAdv, expert, none;
+	std::set<SecondarySkill> basicAndAdv, expert, none;
 	for(int i=0;i<GameConstants::SKILL_QUANTITY;i++)
 		if (isAllowed(2,i))
-			none.insert(static_cast<SecondarySkill::SecondarySkill>(i));
+			none.insert(SecondarySkill(i));
 
 	for(unsigned i=0;i<hero->secSkills.size();i++)
 	{
@@ -253,7 +253,7 @@ void CGameHandler::levelUpHero(const CGHeroInstance * hero)
 	//first offered skill
 	if(basicAndAdv.size())
 	{
-		SecondarySkill::SecondarySkill s = hero->type->heroClass->chooseSecSkill(basicAndAdv);//upgrade existing
+		SecondarySkill s = hero->type->heroClass->chooseSecSkill(basicAndAdv);//upgrade existing
 		hlu.skills.push_back(s);
 		basicAndAdv.erase(s);
 	}
@@ -290,8 +290,8 @@ void CGameHandler::levelUpHero(const CGHeroInstance * hero)
 		if(hlu.skills.size() > 1) //apply and ask for secondary skill
 		{
 			boost::function<void(ui32)> callback = boost::function<void(ui32)>(boost::bind
-					(callWith<SecondarySkill::SecondarySkill>, hlu.skills,
-					boost::function<void(SecondarySkill::SecondarySkill)>(boost::bind
+					(callWith<SecondarySkill>, hlu.skills,
+					boost::function<void(SecondarySkill)>(boost::bind
 						(&CGameHandler::levelUpHero, this, hero, _1) ), _1));
 			applyAndAsk(&hlu,hero->tempOwner,callback); //call levelUpHero when client responds
 		}
@@ -484,7 +484,7 @@ void CGameHandler::changePrimSkill(const CGHeroInstance * hero, PrimarySkill::Pr
 	}
 }
 
-void CGameHandler::changeSecSkill( const CGHeroInstance * hero, SecondarySkill::SecondarySkill which, int val, bool abs/*=false*/ )
+void CGameHandler::changeSecSkill( const CGHeroInstance * hero, SecondarySkill which, int val, bool abs/*=false*/ )
 {
 	SetSecSkill sss;
 	sss.id = hero->id;
@@ -587,7 +587,7 @@ void CGameHandler::endBattle(int3 tile, const CGHeroInstance *hero1, const CGHer
 				//we assume that no big artifacts can be found
 				MoveArtifact ma;
 				ma.src = ArtifactLocation (loserHero,
-					static_cast<ArtifactPosition::ArtifactPosition>(GameConstants::BACKPACK_START)); //backpack automatically shifts arts to beginning
+					ArtifactPosition(GameConstants::BACKPACK_START)); //backpack automatically shifts arts to beginning
 				const CArtifactInstance * art =  ma.src.getArt();
 				arts.push_back (art->artType->id);
 				ma.dst = ArtifactLocation (winnerHero, art->firstAvailableSlot(winnerHero));
@@ -2697,7 +2697,7 @@ bool CGameHandler::recruitCreatures( si32 objid, CreatureID crid, ui32 cram, si3
 	return true;
 }
 
-bool CGameHandler::upgradeCreature( ui32 objid, ui8 pos, ui32 upgID )
+bool CGameHandler::upgradeCreature( ui32 objid, ui8 pos, CreatureID upgID )
 {
 	CArmedInstance *obj = static_cast<CArmedInstance*>(gs->map->objects[objid].get());
 	assert(obj->hasStackAtSlot(pos));
@@ -2861,7 +2861,7 @@ bool CGameHandler::moveArtifact(const ArtifactLocation &al1, const ArtifactLocat
 		COMPLAIN_RET("Cannot move catapult!");
 
 	if(dst.slot >= GameConstants::BACKPACK_START)
-		vstd::amin(dst.slot, static_cast<ArtifactPosition::ArtifactPosition>(GameConstants::BACKPACK_START + dst.getHolderArtSet()->artifactsInBackpack.size()));
+		vstd::amin(dst.slot, ArtifactPosition(GameConstants::BACKPACK_START + dst.getHolderArtSet()->artifactsInBackpack.size()));
 
 	if (src.slot == dst.slot  &&  src.artHolder == dst.artHolder)
 		COMPLAIN_RET("Won't move artifact: Dest same as source!");
@@ -2869,7 +2869,7 @@ bool CGameHandler::moveArtifact(const ArtifactLocation &al1, const ArtifactLocat
 	if(dst.slot < GameConstants::BACKPACK_START  &&  destArtifact) //moving art to another slot
 	{
 		//old artifact must be removed first
-		moveArtifact(dst, ArtifactLocation(dst.artHolder, static_cast<ArtifactPosition::ArtifactPosition>(
+		moveArtifact(dst, ArtifactLocation(dst.artHolder, ArtifactPosition(
 			dst.getHolderArtSet()->artifactsInBackpack.size() + GameConstants::BACKPACK_START)));
 	}
 
@@ -2888,7 +2888,7 @@ bool CGameHandler::moveArtifact(const ArtifactLocation &al1, const ArtifactLocat
  * @param assembleTo If assemble is true, this represents the artifact ID of the combination
  * artifact to assemble to. Otherwise it's not used.
  */
-bool CGameHandler::assembleArtifacts (si32 heroID, ArtifactPosition::ArtifactPosition artifactSlot, bool assemble, ui32 assembleTo)
+bool CGameHandler::assembleArtifacts (si32 heroID, ArtifactPosition artifactSlot, bool assemble, ui32 assembleTo)
 {
 
 	CGHeroInstance *hero = gs->getHero(heroID);
@@ -2945,7 +2945,7 @@ bool CGameHandler::buyArtifact( ui32 hid, ArtifactID aid )
 	{
 		int price = VLC->arth->artifacts[aid]->price;
 
-		if(( hero->getArt(static_cast<ArtifactPosition::ArtifactPosition>(9+aid)) && complain("Hero already has this machine!"))
+		if(( hero->getArt(ArtifactPosition(9+aid)) && complain("Hero already has this machine!"))
 		 || (gs->getPlayer(hero->getOwner())->resources[Res::GOLD] < price && complain("Not enough gold!")))
 		{
 			return false;
@@ -2954,7 +2954,7 @@ bool CGameHandler::buyArtifact( ui32 hid, ArtifactID aid )
 		 || ((town->hasBuilt(BuildingID::BALLISTA_YARD, ETownType::STRONGHOLD)) && aid == ArtifactID::BALLISTA))
 		{
 			giveResource(hero->getOwner(),Res::GOLD,-price);
-			giveHeroNewArtifact(hero, VLC->arth->artifacts[aid], static_cast<ArtifactPosition::ArtifactPosition>(9+aid));
+			giveHeroNewArtifact(hero, VLC->arth->artifacts[aid], ArtifactPosition(9+aid));
 			return true;
 		}
 		else
@@ -3039,12 +3039,12 @@ bool CGameHandler::sellArtifact( const IMarket *m, const CGHeroInstance *h, TArt
 //	}
 //}
 
-bool CGameHandler::buySecSkill( const IMarket *m, const CGHeroInstance *h, SecondarySkill::SecondarySkill skill)
+bool CGameHandler::buySecSkill( const IMarket *m, const CGHeroInstance *h, SecondarySkill skill)
 {
 	if (!h)
 		COMPLAIN_RET("You need hero to buy a skill!");
 
-	if (h->getSecSkillLevel(static_cast<SecondarySkill::SecondarySkill>(skill)))
+	if (h->getSecSkillLevel(SecondarySkill(skill)))
 		COMPLAIN_RET("Hero already know this skill");
 
 	if (!h->canLearnSkill())
@@ -3607,18 +3607,19 @@ bool CGameHandler::makeBattleAction( BattleAction &ba )
 					}
 
 					//removing creatures in turrets / keep if one is destroyed
-					if(attack.second > 0 && (attackedPart == 0 || attackedPart == 1 || attackedPart == 6))
+					if(attack.second > 0 && (attackedPart == EWallParts::KEEP ||
+						attackedPart == EWallParts::BOTTOM_TOWER || attackedPart == EWallParts::UPPER_TOWER))
 					{
 						int posRemove = -1;
 						switch(attackedPart)
 						{
-						case 0: //keep
+						case EWallParts::KEEP:
 							posRemove = -2;
 							break;
-						case 1: //bottom tower
+						case EWallParts::BOTTOM_TOWER:
 							posRemove = -3;
 							break;
-						case 6: //upper tower
+						case EWallParts::UPPER_TOWER:
 							posRemove = -4;
 							break;
 						}
@@ -3668,8 +3669,8 @@ bool CGameHandler::makeBattleAction( BattleAction &ba )
 			else
 			{
 				StacksHealedOrResurrected shr;
-				shr.lifeDrain = (ui8)false;
-				shr.tentHealing = (ui8)true;
+				shr.lifeDrain = false;
+				shr.tentHealing = true;
 				shr.drainedFrom = ba.stackNumber;
 
 				StacksHealedOrResurrected::HealInfo hi;
@@ -4862,7 +4863,7 @@ void CGameHandler::showGarrisonDialog( int upobj, int hid, bool removableUnits,
 	}
 }
 
-void CGameHandler::showThievesGuildWindow(int player, int requestingObjId)
+void CGameHandler::showThievesGuildWindow(TPlayerColor player, int requestingObjId)
 {
 	OpenWindow ow;
 	ow.window = OpenWindow::THIEVES_GUILD;
@@ -5641,7 +5642,7 @@ bool CGameHandler::sacrificeCreatures(const IMarket *market, const CGHeroInstanc
 	return true;
 }
 
-bool CGameHandler::sacrificeArtifact(const IMarket * m, const CGHeroInstance * hero, ArtifactPosition::ArtifactPosition slot)
+bool CGameHandler::sacrificeArtifact(const IMarket * m, const CGHeroInstance * hero, ArtifactPosition slot)
 {
 	ArtifactLocation al(hero, slot);
 	const CArtifactInstance *a = al.getArt();
@@ -6068,13 +6069,13 @@ bool CGameHandler::makeAutomaticAction(const CStack *stack, BattleAction &ba)
 	return ret;
 }
 
-void CGameHandler::giveHeroArtifact(const CGHeroInstance *h, const CArtifactInstance *a, ArtifactPosition::ArtifactPosition pos)
+void CGameHandler::giveHeroArtifact(const CGHeroInstance *h, const CArtifactInstance *a, ArtifactPosition pos)
 {
 	assert(a->artType);
 	ArtifactLocation al;
 	al.artHolder = const_cast<CGHeroInstance*>(h);
 
-	ArtifactPosition::ArtifactPosition slot = ArtifactPosition::PRE_FIRST;
+	ArtifactPosition slot = ArtifactPosition::PRE_FIRST;
 	if(pos < 0)
 	{
 		if(pos == ArtifactPosition::FIRST_AVAILABLE)
@@ -6105,7 +6106,7 @@ void CGameHandler::putArtifact(const ArtifactLocation &al, const CArtifactInstan
 	sendAndApply(&pa);
 }
 
-void CGameHandler::giveHeroNewArtifact(const CGHeroInstance *h, const CArtifact *artType, ArtifactPosition::ArtifactPosition pos)
+void CGameHandler::giveHeroNewArtifact(const CGHeroInstance *h, const CArtifact *artType, ArtifactPosition pos)
 {
 	CArtifactInstance *a = NULL;
 	if(!artType->constituents)

+ 9 - 9
server/CGameHandler.h

@@ -135,12 +135,12 @@ public:
 	void setOwner(const CGObjectInstance * obj, TPlayerColor owner) OVERRIDE;
 	void setHoverName(const CGObjectInstance * objid, MetaString * name) OVERRIDE;
 	void changePrimSkill(const CGHeroInstance * hero, PrimarySkill::PrimarySkill which, si64 val, bool abs=false) OVERRIDE;
-	void changeSecSkill(const CGHeroInstance * hero, SecondarySkill::SecondarySkill which, int val, bool abs=false) OVERRIDE; 
+	void changeSecSkill(const CGHeroInstance * hero, SecondarySkill which, int val, bool abs=false) OVERRIDE; 
 	//void showInfoDialog(InfoWindow *iw) OVERRIDE;
 	void showBlockingDialog(BlockingDialog *iw, const CFunctionList<void(ui32)> &callback) OVERRIDE;
 	ui32 showBlockingDialog(BlockingDialog *iw) OVERRIDE; //synchronous version of above
 	void showGarrisonDialog(int upobj, int hid, bool removableUnits, const boost::function<void()> &cb) OVERRIDE;
-	void showThievesGuildWindow(int player, int requestingObjId) OVERRIDE;
+	void showThievesGuildWindow(TPlayerColor player, int requestingObjId) OVERRIDE;
 	void giveResource(TPlayerColor player, Res::ERes which, int val) OVERRIDE;
 
 	void giveCreatures(const CArmedInstance *objid, const CGHeroInstance * h, const CCreatureSet &creatures, bool remove) OVERRIDE;
@@ -154,8 +154,8 @@ public:
 	void tryJoiningArmy(const CArmedInstance *src, const CArmedInstance *dst, bool removeObjWhenFinished, bool allowMerging) OVERRIDE;
 	bool moveStack(const StackLocation &src, const StackLocation &dst, TQuantity count = -1) OVERRIDE;
 
-	void giveHeroNewArtifact(const CGHeroInstance *h, const CArtifact *artType, ArtifactPosition::ArtifactPosition pos) OVERRIDE;
-	void giveHeroArtifact(const CGHeroInstance *h, const CArtifactInstance *a, ArtifactPosition::ArtifactPosition pos) OVERRIDE;
+	void giveHeroNewArtifact(const CGHeroInstance *h, const CArtifact *artType, ArtifactPosition pos) OVERRIDE;
+	void giveHeroArtifact(const CGHeroInstance *h, const CArtifactInstance *a, ArtifactPosition pos) OVERRIDE;
 	void putArtifact(const ArtifactLocation &al, const CArtifactInstance *a) OVERRIDE; 
 	void removeArtifact(const ArtifactLocation &al) OVERRIDE;
 	bool moveArtifact(const ArtifactLocation &al1, const ArtifactLocation &al2) OVERRIDE;
@@ -182,7 +182,7 @@ public:
 	void visitObjectOnTile(const TerrainTile &t, const CGHeroInstance * h);
 	bool teleportHero(si32 hid, si32 dstid, ui8 source, TPlayerColor asker = GameConstants::NEUTRAL_PLAYER);
 	void vistiCastleObjects (const CGTownInstance *t, const CGHeroInstance *h);
-	void levelUpHero(const CGHeroInstance * hero, SecondarySkill::SecondarySkill skill);//handle client respond and send one more request if needed
+	void levelUpHero(const CGHeroInstance * hero, SecondarySkill skill);//handle client respond and send one more request if needed
 	void levelUpHero(const CGHeroInstance * hero);//initial call - check if hero have remaining levelups & handle them
 	void levelUpCommander (const CCommanderInstance * c, int skill); //secondary skill 1 to 6, special skill : skill - 100
 	void levelUpCommander (const CCommanderInstance * c);
@@ -213,14 +213,14 @@ public:
 	bool sendResources(ui32 val, TPlayerColor player, Res::ERes r1, TPlayerColor r2);
 	bool sellCreatures(ui32 count, const IMarket *market, const CGHeroInstance * hero, ui32 slot, Res::ERes resourceID);
 	bool transformInUndead(const IMarket *market, const CGHeroInstance * hero, ui32 slot);
-	bool assembleArtifacts (si32 heroID, ArtifactPosition::ArtifactPosition artifactSlot, bool assemble, ui32 assembleTo);
+	bool assembleArtifacts (si32 heroID, ArtifactPosition artifactSlot, bool assemble, ui32 assembleTo);
 	bool buyArtifact( ui32 hid, ArtifactID aid ); //for blacksmith and mage guild only -> buying for gold in common buildings
 	bool buyArtifact( const IMarket *m, const CGHeroInstance *h, Res::ERes rid, ArtifactID aid); //for artifact merchant and black market -> buying for any resource in special building / advobject
 	bool sellArtifact( const IMarket *m, const CGHeroInstance *h, TArtifactInstanceID aid, Res::ERes rid); //for artifact merchant selling
 	//void lootArtifacts (TArtHolder source, TArtHolder dest, std::vector<ui32> &arts); //after battle - move al arts to winer
-	bool buySecSkill( const IMarket *m, const CGHeroInstance *h, SecondarySkill::SecondarySkill skill);
+	bool buySecSkill( const IMarket *m, const CGHeroInstance *h, SecondarySkill skill);
 	bool garrisonSwap(si32 tid);
-	bool upgradeCreature( ui32 objid, ui8 pos, ui32 upgID );
+	bool upgradeCreature( ui32 objid, ui8 pos, CreatureID upgID );
 	bool recruitCreatures(si32 objid, CreatureID crid, ui32 cram, si32 level);
 	bool buildStructure(si32 tid, BuildingID bid, bool force=false);//force - for events: no cost, no checkings
 	bool razeStructure(si32 tid, BuildingID bid);
@@ -261,7 +261,7 @@ public:
 	void handleAttackBeforeCasting (const BattleAttack & bat);
 	void handleAfterAttackCasting (const BattleAttack & bat);
 	void attackCasting(const BattleAttack & bat, Bonus::BonusType attackMode, const CStack * attacker);
-	bool sacrificeArtifact(const IMarket * m, const CGHeroInstance * hero, ArtifactPosition::ArtifactPosition slot);
+	bool sacrificeArtifact(const IMarket * m, const CGHeroInstance * hero, ArtifactPosition slot);
 	void spawnWanderingMonsters(CreatureID creatureID);
 	friend class CVCMIServer;
 	friend class CScriptCallback;

+ 2 - 2
server/NetPacksServer.cpp

@@ -192,11 +192,11 @@ bool TradeOnMarketplace::applyGh( CGameHandler *gh )
 	case EMarketMode::CREATURE_UNDEAD:
 		return gh->transformInUndead(m, hero, r1);
 	case EMarketMode::RESOURCE_SKILL:
-		return gh->buySecSkill(m, hero, static_cast<SecondarySkill::SecondarySkill>(r2));
+		return gh->buySecSkill(m, hero, SecondarySkill(r2));
 	case EMarketMode::CREATURE_EXP:
 		return gh->sacrificeCreatures(m, hero, r1, val);
 	case EMarketMode::ARTIFACT_EXP:
-		return gh->sacrificeArtifact(m, hero, static_cast<ArtifactPosition::ArtifactPosition>(r1));
+		return gh->sacrificeArtifact(m, hero, ArtifactPosition(r1));
 	default:
 		COMPLAIN_AND_RETURN("Unknown exchange mode!");
 	}