Grasp of the Fallen
Grasp of the Fallen / Engines / Event Scheduling / Communication Delay /

code idea

Updated: 6/15/2004

// set these on game init
messageDay = 20021202; // year month day
messageSentToday = 0;
// test if today's messages were sent yet and if it's after midnight
if(townData.getCurrentDay() < globalDay){
	newName = "thisTown" + (townDataObjectNum + 1);
	TOWNDATA td;
	td.send();
}

// member function that sends message to another town
TOWNDATA::send(newName, sourceTown, destinationTown)
{
	If(messageDay <= globalDay and messageSentToday == 0 and currentTime >= midnight){

		nextDay(messageDay);

		if(messageDay == globalDay) messageSentToday = 1;

		// send a message
		duplicateTownData(newName, sourceTown, destinationTown);
	}
}

// member function of townData object
TOWNDATA::update()
{
	if (destinationTime <= currentTime){
		// merge with destination
		destinationObject = travelingObject;
		// destroy this townData object
		delete travelingObject;
	}
}



Email a friend, post this to your blog or
share with social bookmarking sites:



©2004-2009 GraspoftheFallen.com - All Rights Reserved. An RPG game under development by Bruce Kirkpatrick | Have comments? Email Me