// 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. //============================================================================= // Menu that shows up when you are having a conversation with the levee expert // when taking a measure // // --------------------------------------------------------------------------- // Created by Zmr // © 2006, Geodelft // // Date Id Modification // 2006-11-22 Bas Created this header // 2006-11-22 Bas Fixed bug in conversation // 2006-11-22 Bas When the conversation is finished show the okbutton to close window // 2007-06-08 wsl Removed needless code previously in all AC Menus // 2007-06-19 wsl Added copying of all variables from the previous ConvState // 2007-08-27 Wsl removed all occurrences of bStableSet (not used), removed unused code from HangupButtonClicked() //============================================================================= class MenuMeasureActionCenter extends MenuActionCenter DependsOn(Measure); function InitComponent(GUIController MyController, GUIComponent MyOwner) { super.InitComponent(MyController,MyOwner); GUIGFxButton(Controls[5]).Graphic = Material'InGameMenuImagesT.ImageButtons.TCtmp'; Controls[5].WinHeight = 2.2 * Controls[5].WinWidth; // to compensate for the changed aspect ratio of the image } //============================================================================= //This function takes care of getting all the information needed to run the menu properly // // Date Id Modification // 2006-10-07 The Fixed compiler error in GetInformation // 2006-12-05 Bas Fixed multiple 'nullpointers' (Accessed None) // 2007-06-05 Wsl Moved from MenuActionCenter to here and removed unnecessary info //============================================================================= function GetInformation() { // get map name if(ConvState[ConvState.Length-1].Map == "") { ConvState[ConvState.Length-1].Map = GeoPC.level.title; } // get player name ConvState[ConvState.Length-1].PlayerName = GeoPC.PlayerReplicationInfo.GetHumanReadableName(); // get location name (GeoPC.NearByMarker cannot be none, because you're called by the levee expert // directly after you've taken a measure, so you're always near the right marker if(GeoPC.NearByMarker.GlobalLocation.LocationSign != none) { if(GeoPC.Dutch) { ConvState[ConvState.Length-1].Location = GeoPC.NearByMarker.GlobalLocation.LocationSign.NL_LocationName; } else { ConvState[ConvState.Length-1].Location = GeoPC.NearByMarker.GlobalLocation.LocationSign.EN_LocationName; } } else { ConvState[ConvState.Length-1].Location = ""; } // get the diagnosis, assessment & assessmentsame from the previous ConvState ConvState[ConvState.Length-1].DiagnosedMechanism = ConvState[ConvState.Length-2].DiagnosedMechanism; ConvState[ConvState.Length-1].Assessment = ConvState[ConvState.Length-2].Assessment; ConvState[ConvState.Length-1].AssessmentSame = ConvState[ConvState.Length-2].AssessmentSame; ConvState[ConvState.Length-1].AmountOfAssessments = ConvState[ConvState.Length-2].AmountOfAssessments; // get the current failure state (there will always be a nearby marker for this menu because you're called // by the levee expert directly after taking a measure from the marker menu, but there will not always be a failure) if((GeoPC.NearByMarker.LTile) != none) { ConvState[ConvState.Length-1].StateOfFailure = (GeoPC.NearByMarker.LTile).CurrentState; } // get the last state from the previous ConvState and use it as the first state for the current, new ConvState. // (needed in the case that the assessment turned out to be wrong, to add the transition to state checking to it) ConvState[ConvState.Length-1].ConversationStates.Remove(0,ConvState[ConvState.Length-1].ConversationStates.Length); ConvState[ConvState.Length-1].ConversationStates.Insert(0,1); ConvState[ConvState.Length-1].ConversationStates[0] = ConvState[ConvState.Length-2].ConversationStates[ConvState[ConvState.Length-2].ConversationStates.Length-1]; } function UpdateLanguage() { super.UpdateLanguage(); if(GeoPC.Dutch) { GUILabel(Controls[4]).Caption = NL_Title; GUIScrollTextBox(Controls[NOSTB]).SetContent("Je wordt gebeld door de dijk-expert."); CurrentLanguage=Dutch; } else { GUILabel(Controls[4]).Caption = EN_Title; GUIScrollTextBox(Controls[NOSTB]).SetContent("You are called by the levee expert."); CurrentLanguage=English; } } function CalcNewLines() { local int tmp,i; local array TempString; if(ConvState[ConvState.Length-1].ConversationFinished) { // next line button invisible, hang up button appears // Strange BUG, for some reason C8 becomes unclickable when C3 // is made invisible; that's why it's disabled instead Controls[3].MenuState = MSAT_Disabled; Controls[8].setVisibility(true); } else if((GeoPC.NearByMarker.LTile) != none) { //there is a failure near this marker, so the red marker was set right if((GeoPC.NearByMarker.LTile).CurrentState == STA_Critical) { //the failure was very serious (critical) so it was appropriate to take action. if(GeoPC.NearByMarker.MeasureTaken.bMeasureEffective) { //the right measure was taken TempString.Insert(0,4); TempString[0] = CurrentLanguage.getValue("2"); TempString[1] = CurrentLanguage.getValue("5.2-D"); TempString[2] = CurrentLanguage.getValue("6.2-A"); TempString[3] = CurrentLanguage.getValue("5.8-A"); ConvState[ConvState.Length-1].ConversationFinished = true; } else { // it was the wrong measure TempString.Insert(0,3); TempString[0] = CurrentLanguage.getValue("2"); TempString[1] = CurrentLanguage.getValue("5.2-E"); TempString[2] = CurrentLanguage.getValue("6.1-A"); ConvState[ConvState.Length-1].ConversationFinished = true; } } else if((GeoPC.NearByMarker.LTile).CurrentState == STA_Failed) { TempString.Insert(0,1); TempString[0] = CurrentLanguage.getValue("failed"); ConvState[ConvState.Length-1].ConversationFinished = true; } else { //the failure was not very serious (critical) so there should have been no measure taken. if((GeoPC.NearByMarker.LTile).Mechanism == FM_ErosionInner && (GeoPC.NearByMarker.LTile).LeveeType == LT_PrimaryLevee) { // erosion of the inner slope of a primary levee is an exception: TempString.Insert(0,4); TempString[0] = CurrentLanguage.getValue("2"); TempString[1] = CurrentLanguage.getValue("5.2-B1")$"||"$CurrentLanguage.getValue("5.2-H"); TempString[2] = CurrentLanguage.getValue("6.1-A"); TempString[3] = CurrentLanguage.getValue("5.8-A"); ConvState[ConvState.Length-1].ConversationFinished = true; } else { // the failure was not very serious tell the player the reason why it is not very serious TempString.Insert(0,4); TempString[0] = CurrentLanguage.getValue("2"); TempString[1] = CurrentLanguage.getValue("5.2-B1"); TempString[1] = TempString[1]$"||"$WhyFailureNotAsExpected(STA_Critical); TempString[1] = TempString[1]$"||"$CurrentLanguage.getValue("5.2-B2"); TempString[1] = TempString[1]@CurrentLanguage.getValue("5.2-C2"); TempString[2] = CurrentLanguage.getValue("6.1-A"); TempString[3] = CurrentLanguage.getValue("5.1"); ConvState[ConvState.Length-1].ConversationFinished = true; ConvState[ConvState.Length-1].ConversationStates.Insert(ConvState[ConvState.Length-1].ConversationStates.Length,1); ConvState[ConvState.Length-1].ConversationStates[ConvState[ConvState.Length-1].ConversationStates.Length-1] = Con_Checking; } } } else { // there ain't a failure at the place of the marker TempString.Insert(0,5); TempString[0] = CurrentLanguage.getValue("2"); TempString[1] = CurrentLanguage.getValue("5.2-F"); TempString[2] = CurrentLanguage.getValue("4.1"); TempString[3] = CurrentLanguage.getValue("5.2-A2"); TempString[4] = CurrentLanguage.getValue("6.1-A"); ConvState[ConvState.Length-1].ConversationFinished = true; } //Add the tempString array to the Lines array tmp = Lines.Length; Lines.Insert(tmp,TempString.Length); for(i=0;i failureSignals,tempSignals; local Signal failureSignal; local GeoEnums.GeoStates failureState; local SignalStringData.HowSeriousStruct HSeriousStruct; local string returner; returner = ""; log("### Start WhyFailureNotAsExpected ###"); // (there will always be a nearby marker for this menu because you're called by the levee expert // directly after taking a measure from the marker menu, but there will not always be a failure) if(GeoPC.NearByMarker.LTile != none) { failureState = (GeoPC.NearByMarker.LTile).CurrentState; log("(GeoPC.NearByMarker.LTile).CurrentState:"@(GeoPC.NearByMarker.LTile).CurrentState); log("GeoPC.NearByMarker.LTile.bReportable"@GeoPC.NearByMarker.LTile.bReportable); log("GeoPC.NearByMarker.LTile.bRelevant"@GeoPC.NearByMarker.LTile.bRelevant); log("GeoPC.NearByMarker.LTile.bCritical"@GeoPC.NearByMarker.LTile.bCritical); failureSignals = (GeoPC.NearByMarker.LTile).Signals; Log("Failuresignals.length: " @ failuresignals.length); for(i = 0; i < failureSignals.Length; i++) { // for all signals of the failure, traverse all its signal reports to see if any // of them were made during the phase the failure actually is in currently. // As soon as one does, add the signal having such a report to tempSignals. Log("Geostate: " @ failureSignal.SignalReports[j].GeoState @ " - current state: " @ failureState); failureSignal = failureSignals[i]; for(j = 0; j < failureSignal.SignalReports.Length; j++) { if(failureSignal.SignalReports[j].GeoState != failureState) { failureSignal.SignalReports.Remove(j,1); j--; } } if(failureSignal.SignalReports.Length > 0) { tempSignals.Insert(0,1); tempSignals[0] = failureSignal; } } log("tempSignals.length = "$tempSignals.length); if(tempSignals.Length > 0) { // if any signals were found that were reported about in the current phase of the failure, // get the seriousness according to these observations. HSeriousStruct = DataObject.HowSerious(tempSignals, GeoPC); log("HSeriousStruct.states = "$HSeriousStruct.states); if(expectedstate == STA_Reportable) { HSeriousStruct.ReasonNot_VerySerious = HSeriousStruct.ReasonNot_NotSerious; } else if(expectedstate == STA_Relevant) { HSeriousStruct.ReasonNot_VerySerious = HSeriousStruct.ReasonNot_Serious; } else if(expectedstate == STA_Critical) { // why is this still empty? } else if(expectedstate == STA_NONE) { HSeriousStruct.ReasonNot_VerySerious.Remove(1, HSeriousStruct.ReasonNot_VerySerious.Length-1); HSeriousStruct.ReasonNot_VerySerious[0]=""; } log("HSeriousStruct.ReasonNot_VerySerious.Length = "$HSeriousStruct.ReasonNot_VerySerious.Length); for(i=0;i