Bazaar developer reference

CvPlayer::isCityNameValid(CvString &, bool) const

Defined in
CvPlayer.cpp, line 3347
Class
CvPlayer
Hook name
CivHooks::CvPlayer_isCityNameValid

Hooks

static bool BeforeCvPlayer_isCityNameValid(const CvPlayer* self, CvString& szName, bool bTestDestroyed, bool& result);static void AfterCvPlayer_isCityNameValid(const CvPlayer* self, CvString& szName, bool bTestDestroyed, bool& result);static bool ReplaceCvPlayer_isCityNameValid(bool (*original)(const CvPlayer*, CvString&, bool), const CvPlayer* self, CvString& szName, bool bTestDestroyed);CivRegisterBefore<CivHooks::CvPlayer_isCityNameValid>(host, &BeforeCvPlayer_isCityNameValid);CivRegisterAfter<CivHooks::CvPlayer_isCityNameValid>(host, &AfterCvPlayer_isCityNameValid);CivRegisterReplace<CivHooks::CvPlayer_isCityNameValid>(host, &ReplaceCvPlayer_isCityNameValid);

Code

3347bool CvPlayer::isCityNameValid(CvString& szName, bool bTestDestroyed) const3348{3349	const CvCity* pLoopCity;3350	int iLoop;33513352	if(bTestDestroyed)3353	{3354		if(GC.getGame().isDestroyedCityName(szName))3355		{3356			return false;3357		}33583359		for(int iPlayer = 0; iPlayer < MAX_PLAYERS; ++iPlayer)3360		{3361			CvPlayer& kLoopPlayer = GET_PLAYER((PlayerTypes)iPlayer);3362			for(pLoopCity = kLoopPlayer.firstCity(&iLoop); pLoopCity != NULL; pLoopCity = kLoopPlayer.nextCity(&iLoop))3363			{3364				if(pLoopCity->getName() == szName)3365				{3366					return false;3367				}3368			}3369		}3370	}3371	else3372	{3373		for(pLoopCity = firstCity(&iLoop); pLoopCity != NULL; pLoopCity = nextCity(&iLoop))3374		{3375			if(pLoopCity->getName() == szName)3376			{3377				return false;3378			}3379		}3380	}33813382	return true;3383}

Calls

Called by