![]() code ideaUpdated: 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: | Have comments? Email Me |