// September 2015 // Levee Patroller / Dijk Patrouille // This source file is (c) by Deltares. This source file is open source but only available to select users. Do not redistribute without written permission of Stichting Deltares, Delft, The Netherlands. // This header has been automatically generated. //============================================================================= // WarningMessage // ============== // There are two warning messages: remembermessage and correction message. // // 1. Remember message (RM) // The player receives a call from the AC in 5 minutes if he/she made a report // and the AC approved it. When approved, the AC tells the player keep an eye // on the situation. If the player did not call the AC within 5 minutes the // message pops up. // // 2. Correction message (CM) // The player receives a call from the AC in 2 minutes if he/she made a report // and the AC didn't approve it. The player is told to check his/her observations // immediately and call the AC to tell them whether the assesment is wrong or the // observations are wrong. If the player did not call the AC within 2 minutes the // message pops up. // // Storage // ======= // A player can have more than one message (RM and/or CM). All WarningMessages are // stored in the 'Messages' array in the GeoPlayerController class. When a new // msg is added by GeoPlayerController.addTimer(), it's stored at the back of Messages[]. // // Counting // ======== // All counters are updated in GeoPlayerController.Timer(). This method is called // every second. NOTE: When 'slomo' is used this may become inaccurate. // // GeoSimulator.GeoPlayerController changes the currentTime of every WarningMessage // GeoSimulator.GeoHUD.DrawHUD() draws the message on top of the screen. // GeoSimulator.MenuConversation.FinishedConversation() starts the timer. // ============== // Created by Bas Wenneker (18-09-2006) // © 2006, Geodelft // //============================================================================= // // Date Id Modification // 2007-06-04 wsl Wrote toString function // //============================================================================= class WarningMessage extends Object; var int currentTime;//time remaining before player is called by the AC var RedMarker warningMarker;//marker associated with the message var bool warningType;//true -> rememeberMessage, false -> correctionMessage var bool bCounting;//whether timer is counting /* Initialises the timer. Doesn't start counting yet. type - if true, WarningMessage is a remembermessage else correctionmessage */ function setTimer(bool type, RedMarker marker, optional int timeInSeconds) { warningType = type; warningMarker = marker; if(timeInSeconds == 0) { resetTimer(false); } else { resetTimer(false, timeInSeconds); } } /* Sets currentTime to the defaults based on the type of the WarningMessage. Defaults are five minutes for a remember message and two minutes for a correcting message. When bool start is true, the timer starts counting when back in the game. If timeInSeconds is given, this replaces the default waiting times. */ function resetTimer(bool start, optional int timeInSeconds) { //log("resetTimer():"@start); if(warningMarker != None) { if(timeInSeconds != 0) { // a time was specified as parameter currentTime = timeInSeconds; } else { if(warningType) { // default for remember warning: 300 sec (5 min) currentTime = 300; } else { //correction warning: 120 sec (2 min) currentTime = 120; } } if(start) { bCounting = true; } } } //sets whether it's a remembermessage or a correctionmessage function setType(bool type) { warningType = type; } function bool isSameMarker(RedMarker marker) { return warningMarker.Location == marker.Location; } function string toString() { local String returner; local String typ; local string cou; if(warningType) typ = "checking"; else typ = "correcting"; if(bCounting) cou = ", and counting."; else cou = ", paused."; returner = "WarningMessage of type"@typ$", "; returner = returner$warningMarker.GlobalLocation.LocationSign.NL_LocationName; returner = returner$"; time left "$currentTime; returner = returner$cou$"."; return returner; } defaultproperties{ bCounting=false }