Page 1 of 3

converted NearestSpawn

Posted: Fri Mar 10, 2006 7:42 pm
by echoism
in MQ2Data.cpp
replace TLO(dataNearestSpawn)

Code: Select all

TLO(dataNearestSpawn)
{
	if (ISINDEX())
	{
		unsigned long nth;
		SEARCHSPAWN ssSpawn;
		ClearSearchSpawn(&ssSpawn);
		ssSpawn.FRadius=999999.0f;
#ifndef ISXEQ
		PCHAR pSearch;
		if (pSearch=strchr(szIndex,','))
		{
			*pSearch=0;
			++pSearch;
			ParseSearchSpawn(pSearch,&ssSpawn);
			nth=GETNUMBER();
		}
		else
		{
			if (IsNumberToComma(szIndex))
			{
				nth=GETNUMBER();
			}
			else
			{
				nth=1;
				ParseSearchSpawn(szIndex,&ssSpawn);
			}
		}
#else
		if (!ISNUMBER()) {
			nth=1;
			ParseSearchSpawn(0,argc,argv,ssSpawn);
		} else {
			nth=GETNUMBER();
			ParseSearchSpawn(1,argc,argv,ssSpawn);
		}
#endif
		for (unsigned long N = 0 ; N < gSpawnCount ; N++)
		{
			if (EQP_DistArray[N].Value.Float>ssSpawn.FRadius)
				return false;
			if (SpawnMatchesSearch(&ssSpawn,(PSPAWNINFO)pCharSpawn,(PSPAWNINFO)EQP_DistArray[N].VarPtr.Ptr))
			{
				if (--nth==0)
				{
					Ret.Ptr=EQP_DistArray[N].VarPtr.Ptr;
					Ret.Type=pSpawnType;
					return true;
				}
			}
		}
	}
	// No spawn
	return false;
}

Re: converted NearestSpawn

Posted: Tue Jul 08, 2025 5:05 pm
by xyilla

Re: converted NearestSpawn

Posted: Tue Jul 08, 2025 5:06 pm
by xyilla

Re: converted NearestSpawn

Posted: Tue Jul 08, 2025 5:07 pm
by xyilla

Re: converted NearestSpawn

Posted: Tue Jul 08, 2025 5:08 pm
by xyilla

Re: converted NearestSpawn

Posted: Tue Jul 08, 2025 5:09 pm
by xyilla

Re: converted NearestSpawn

Posted: Tue Jul 08, 2025 5:10 pm
by xyilla

Re: converted NearestSpawn

Posted: Tue Jul 08, 2025 5:11 pm
by xyilla

Re: converted NearestSpawn

Posted: Tue Jul 08, 2025 6:25 pm
by xyilla

Re: converted NearestSpawn

Posted: Tue Jul 08, 2025 6:26 pm
by xyilla

Re: converted NearestSpawn

Posted: Tue Jul 08, 2025 6:27 pm
by xyilla

Re: converted NearestSpawn

Posted: Tue Jul 08, 2025 6:28 pm
by xyilla

Re: converted NearestSpawn

Posted: Tue Jul 08, 2025 6:29 pm
by xyilla

Re: converted NearestSpawn

Posted: Tue Jul 08, 2025 6:30 pm
by xyilla

Re: converted NearestSpawn

Posted: Tue Jul 08, 2025 6:31 pm
by xyilla