Outis73
Posts: 16
Joined: 12/16/2010 Status: offline
|
I installed the game and left the .net 1.1 and 4.0 framework boxes checked as well as the directx 9 box. The random scenario generator and campaign scenario shortcuts open notepad windows. (They are lengthy) Also, from the game menu none of the editors will open up except the map scene editor. What is going on?? and how can I fix it?? The RANDOM BATTLE GENERATOR popups the following in a notepad window. The RANDOM CAMPAIGN GENERATOR displays a similiar notepad window. <!-- *** DO NOT DELETE THIS SECTION *** Panzer Command Random Battle Generator (05/03/2008) A Microsoft HTML application (IE 6.0+ required) *** SECTION END *** --> <html> <head> <META HTTP-EQUIV="MSThemeCompatible" CONTENT="Yes"> <HTA:APPLICATION ID = "oPzCRBg" APPLICATIONNAME="PzCRBg" BORDER="thin" BORDERSTYLE="normal" CAPTION="yes" ICON="game icon 16x16.bmp.ico" SHOWINTASKBAR="yes" SINGLEINSTANCE="yes" SCROLL="no" SCROLLFLAT = "yes" SYSMENU="yes" CONTEXTMENU="no" SELECTION="no" VERSION = "2.6.0.0" WINDOWSTATE="normal" /> <script type="text/JScript.Encode"> TITLESTR = "Panzer Command: Random Battle Generator (2.6)"; INFO_TITLE = "Panzer Command: Random Battle Generator"; document.writeln("<title>"+TITLESTR+"</title>"); SWIDTH = screen.width; SHEIGHT = screen.height; if ((SWIDTH < 1024) || (SHEIGHT < 720)) { alert("Can't run application: Minimium Resoultion = 1024x720"); window.close(); } version = parseFloat(navigator.appVersion.split("MSIE")[1]); if (isNaN(version) || (version < 6)) { alert("Can't run application: Requires Microsoft Intenet Explorer 6.0 or above"); window.close(); } var myshell = new ActiveXObject( "WScript.shell" ); var bkey = false; var PCOWSINSTALLED = false; try { bKey = myshell.RegRead ("HKLM\\Software\\Matrix Games\\Panzer Command Ostfront\\installed"); } catch (err) { alert("Can't run application: Panzer Command Ostfront Not Installed!"); window.close(); } if (bKey != "TRUE") { alert("Can't run application: Panzer Command Ostfront Not Installed!"); window.close(); } bkey = false; try { bKey = myshell.RegRead ("HKLM\\Software\\Matrix Games\\Panzer Command Operation Winter Storm\\installed"); } catch (err) { } if (bKey == "TRUE") PCOWSINSTALLED = true; PCOWSINSTALLED = true; function extractArgs(str) { var matches = str.match(/((?!"([^"]+)")\b(\S+)\b|"([^"]+)")/g); var args = new Array; for (var i = 0; i < matches.length; i++) { args = matches; args = args.replace(/^"(.*)"$/, "$1"); } return args; } function ReSize(x,y) { try { window.resizeTo(x,y) } catch(ignore) { setTimeout('ReSize('+x+','+y+')',100) } } function MoveTo(x,y) { try { window.moveTo(x,y) } catch(ignore) { setTimeout('MoveTo('+x+','+y+')',100) } } if (screen.deviceXDPI == 96) ReSize(643,732); else ReSize(670,738); if (extractArgs(oPzCRBg.commandLine).length > 2) MoveTo(-1000,-1000); else if (SHEIGHT <= 768) MoveTo(0,0); </script> <script language="VBScript.Encode" src="Editor/comms.vbs"></script> <style type="text/css"> p, table, th { font-family: verdana, arial, 'sans-serif'; font-size: 9pt; } select.fixed { font-family: Lucida Console; font-size:9pt; } td.hilite { font-family: verdana, arial, 'sans-serif'; font-size: 8pt; font-weight: bold; } div.percent { font-family: verdana, arial, 'sans-serif'; font-size: 10pt; font-weight: bold; } td.Green { color: rgb(0,128,0); } td.Veteran { color: rgb(128,128,128); } td.Elite { color: rgb(128,128,0); } table.armour, table.penetration, td.small, select.small, input.small, div.small { font-family: verdana, arial, 'sans-serif'; font-size: 7pt; } h1 { font-family: verdana, arial, 'sans-serif'; font-size: 26pt; font-weight: bold; } </style> <script type="text/JScript.Encode"> // *** START CONSTANTS if (screen.deviceXDPI == 96) MAPLEFT = 635; else MAPLEFT = 662; MAPTOP = 1 MAPWIDTH = 0; MAPHEIGHT = 0; MAPPOSADJX = 24; MAPPOSADJY = 62; MAPOVERSAMP = 1000; MAXMAPX = 1000; MAXMAPY = 1000; DEGTORAD = 2 * 3.1415926 / 360; /***** NEW CODE ****/ GERM = 0; RUSS = 1; INF = 0; TRA = 1; ART = 2; AIR = 3; ATG = 4; ARM = 5; NUMUNITTYPES = 6; PLATSIZE = new Array(); PLATSIZE[GERM] = new Array(); PLATSIZE[RUSS] = new Array(); PLATSIZE[GERM][INF] = 4; PLATSIZE[RUSS][INF] = 4; PLATSIZE[GERM][TRA] = 4; PLATSIZE[RUSS][TRA] = 4; PLATSIZE[GERM][ART] = 3; PLATSIZE[RUSS][ART] = 6; PLATSIZE[GERM][AIR] = 3; PLATSIZE[RUSS][AIR] = 3; PLATSIZE[GERM][ATG] = 3; PLATSIZE[RUSS][ATG] = 3; PLATSIZE[GERM][ARM] = 5; PLATSIZE[RUSS][ARM] = 10; UNITTYPENAME = new Array(); UNITTYPENAME[INF] = "Infantry"; UNITTYPENAME[TRA] = "Transport"; UNITTYPENAME[ART] = "Artillery"; UNITTYPENAME[AIR] = "Air"; UNITTYPENAME[ATG] = "Gun"; UNITTYPENAME[ARM] = "Armour"; SUBSTYPE = new Array(); SUBSTYPE[INF] = ATG; SUBSTYPE[TRA] = ARM; SUBSTYPE[ART] = AIR; SUBSTYPE[AIR] = ART; SUBSTYPE[ATG] = INF; SUBSTYPE[ARM] = TRA; BATTLE_PREPLANNED = "Russian"; BATTLE_ROD = "true"; BATTLE_POINTS_MULTI = 1.0; BATTLE_PHASES = "40:40"; BATTLE_ID = ""; BATTLE_NAME = ""; BATTLE_DATE = new Array(); BATTLE_DESC = ""; BATTLE_TEMPLATE = ""; CMDLINE_DATE = new Array(); MD = 0; YEAR = 1941; SEASON = 0; MONTH = 0; DAY = 0; DATE = ""; VPBONUSTURN = 0; VPBONUSAMT = 0; MEDIA = ""; NAME = "Random"; MODELS = ""; ID = "Random"; DESC = "Random Battle"; PLAINDESC = ""; FORCENAME = new Array(); FORCENAME[GERM] = "German"; FORCENAME[RUSS] = "Russian"; FORCEMIX = new Array(); FORCELOCK = new Array(); FORCEPRESETDATA = new Array(); FORCEPRESETNAME = new Array(); FORCEPRESETTITLE = new Array(); FORCEPRESETID = new Array(); NUMFORCEMIXES = new Array(); BRIEFING = new Array(); REINFORCE = new Array(); MF = new Array(); ENGAGE = new Array(); EXP = new Array(); DIR = new Array(); STR = new Array(); RND = new Array(); AI = new Array(); POINTS = new Array(); CORENUM_POINTS = new Array(); COREMAX_POINTS = new Array(); EXPNAME = new Array(); EXPNAME[0] = "Green"; EXPNAME[1] = "Veteran"; EXPNAME[2] = "Elite"; REINFORCENAME = new Array(); REINFORCENAME[0] = "no"; REINFORCENAME[1] = "yes"; DIRNAME = new Array(); DIRNAME[0] = "North"; DIRNAME[1] = "North East"; DIRNAME[2] = "East"; DIRNAME[3] = "South East"; DIRNAME[4] = "South"; DIRNAME[5] = "South West"; DIRNAME[6] = "West"; DIRNAME[7] = "North West"; EDGENAME = new Array(); EDGENAME[0] = "Southern"; EDGENAME[1] = "South Western"; EDGENAME[2] = "Western"; EDGENAME[3] = "North Western"; EDGENAME[4] = "Northern"; EDGENAME[5] = "North Eastern"; EDGENAME[6] = "Eastern"; EDGENAME[7] = "South Eastern"; STRNAME = new Array(); STRNAME[0] = "Depleted"; STRNAME[1] = "Under"; STRNAME[2] = "Operational"; STRNAME[3] = "Full"; MFNAME = new Array(); MFNAME[0] = "None"; MFNAME[1] = "Sparse"; MFNAME[2] = "Dense"; ENGAGENAME = new Array(); ENGAGENAME[0] = "Defends"; ENGAGENAME[1] = "Defends with Time Bonus"; ENGAGENAME[2] = "Assaults"; POSTURENAME = new Array(); POSTURENAME[0] = "defend"; POSTURENAME[1] = "defbonus"; POSTURENAME[2] = "attack"; MAXPOINTS = 22; POINTSNAME = new Array(); POINTSNAME[0] = "0"; POINTSNAME[1] = "25"; POINTSNAME[2] = "50"; POINTSNAME[3] = "75"; POINTSNAME[4] = "100"; POINTSNAME[5] = "150"; POINTSNAME[6] = "200"; POINTSNAME[7] = "250"; POINTSNAME[8] = "300"; POINTSNAME[9] = "350"; POINTSNAME[10] = "400"; POINTSNAME[11] = "450"; POINTSNAME[12] = "500"; POINTSNAME[13] = "600"; POINTSNAME[14] = "700"; POINTSNAME[15] = "800"; POINTSNAME[16] = "900"; POINTSNAME[17] = "1000"; POINTSNAME[18] = "1250"; POINTSNAME[19] = "1500"; POINTSNAME[20] = "1750"; POINTSNAME[21] = "2000"; SEASONNAME = new Array(); SEASONNAME[0] = "Summer"; SEASONNAME[1] = "Autumn"; SEASONNAME[2] = "Winter"; SEASONNAME[3] = "Spring"; MONTHNAME = new Array(); MONTHNAME[1] = "January"; MONTHNAME[2] = "February"; MONTHNAME[3] = "March"; MONTHNAME[4] = "April"; MONTHNAME[5] = "May"; MONTHNAME[6] = "June"; MONTHNAME[7] = "July"; MONTHNAME[8] = "August"; MONTHNAME[9] = "September"; MONTHNAME[10] = "October"; MONTHNAME[11] = "November"; MONTHNAME[12] = "December"; SEASONMONTH = new Array(); SEASONMONTH[0] = "6,7,8"; SEASONMONTH[1] = "9,10,11"; SEASONMONTH[2] = "12,1,2"; SEASONMONTH[3] = "3,4,5"; MONTHSEASON = new Array(); MONTHSEASON[1] = 2; MONTHSEASON[2] = 2; MONTHSEASON[3] = 3; MONTHSEASON[4] = 3; MONTHSEASON[5] = 3; MONTHSEASON[6] = 0; MONTHSEASON[7] = 0; MONTHSEASON[8] = 0; MONTHSEASON[9] = 1; MONTHSEASON[10] = 1; MONTHSEASON[11] = 1; MONTHSEASON[12] = 2; MINDATE = "6/22/1941"; MAXDATE = "5/8/1945"; POINTS_SPENT = new Array(); FORCE_TOTAL = new Array(); TOTAL_POINTS = new Array(); TPlatIdx = 0; TUnitX = new Array(); TUnitY = new Array(); TPlatType = new Array(); TPlatUnitIdx = new Array(); SelTPlatIdx = new Array(); SelTUnitX = new Array(); SelTUnitY = new Array(); SelTPlatReinf = new Array(); SelTPlatUnitIdx = new Array(); TObjIdx = 0; TObjX = new Array(); TObjY = new Array(); TObjName = new Array(); TObjSel = new Array(); TMineIdx = 0; TMineX = new Array(); TMineY = new Array(); TMineLX = new Array(); TMineLY = new Array(); TMineType = new Array(); TMineSel = new Array(); MINETYPE = new Array(); MINETYPE[0] = "antitank"; MINETYPE[1] = "antipersonnel"; EquipYear = new Array(); EquipID = new Array(); EquipName = new Array(); EquipPts = new Array(); Equip3D = new Array(); EquipMonth = new Array(); EquipEndYear = new Array(); EquipEndMonth = new Array(); EquipMedYear = new Array(); EquipMedMonth = new Array(); EquipMedPrev = new Array(); EquipStdDev = new Array(); EquipIdx = new Array(); EquipProb = new Array(); EquipPTot = new Array(); EquipTag = new Array(); EquipMax = new Array(); UNITSETUP = new Array(); UNITSETUP[0] = new Array(); UNITSETUP[1] = new Array(); UNITSETUP[2] = new Array(); CFPlatoonIdx = new Array(); CFPlatoonID = new Array(); CFPlatoonName = new Array(); CFPlatoonNum = new Array(); CFPlatoonMax = new Array(); CFPlatoonExp = new Array(); CFPlatoonReinT = new Array(); CFPlatoonReinC = new Array(); CFPlatoonTag = new Array(); CFPlatoonPts = new Array(); CFPlatoonX = new Array(); CFPlatoonY = new Array(); CFPlatoonHd = new Array(); CFPlatoonProb = new Array(); PlatoonIdx = 0; PlatoonNat = new Array(); PlatoonID = new Array(); PlatoonName = new Array(); PlatoonExp = new Array(); PlatoonNum = new Array(); PlatoonMax = new Array(); PlatoonCore = new Array(); PlatoonReinT = new Array(); PlatoonReinC = new Array(); PlatoonSet = new Array(); PlatoonType = new Array(); PlatoonCost = new Array(); PlatoonProb = new Array(); PlatoonAmmo = new Array(); UnitIdx = 0; UnitX = new Array(); UnitY = new Array(); UnitHd = new Array(); UnitPPos = new Array(); UnitPlatoon = new Array(); PreloadObjIdx = 0; ObjIdx = 0; ObjX = new Array(); ObjY = new Array(); ObjPts = new Array(); ObjNat = new Array(); ObjName = new Array(); MineIdx = 0; MineX = new Array(); MineY = new Array(); MineLX = new Array(); MineLY = new Array(); MineNat = new Array(); MineType = new Array(); MineDens = new Array(); // Reinforcement Area (Inverse Area) NRAREA = "50,50,50,950,950,950,950,50"; IntT = new Array(); MAXTPLATS = 2500; MAXLOOPCOUNT = 20; BUILDATTEMPTS = 0; CANCEL_BUILD = 0; CMDLINE = 0; FROMGAME = 0; WARNINGS = 1; H_MULTI = 1; CORE_ERROR = new Array(); CORE_ERROR[0] = ""; CORE_ERROR[1] = ""; var fso = new ActiveXObject("Scripting.FileSystemObject"); var xmlDoc = new ActiveXObject("Microsoft.XMLDOM"); var strComputer = "."; var objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\\\"+strComputer+"\\root\\cimv2"); var xmlObj; HEADER = new Array(); HEADER[0] = new Array(); HEADER[0][0] = new Array(); HEADER[0][1] = new Array(); HEADER[0][2] = new Array(); HEADER[1] = new Array(); HEADER[1][0] = new Array(); HEADER[1][1] = new Array(); HEADER[1][2] = new Array(); HEADER_COUNT = 2; HEADER[0][0][0] = "Germany assaults a Russian defensive position."; HEADER[0][0][1] = "German assault."; HEADER[0][1][0] = "Germany defends against a Russian Assault."; HEADER[0][1][1] = "Germany defends."; HEADER[0][2][0] = "Germany meets a Russian attack."; HEADER[0][2][1] = "Germany engages a Russian force."; HEADER[1][0][0] = "Russia assaults a German defensive position."; HEADER[1][0][1] = "Russian assault."; HEADER[1][1][0] = "Russia defends against a German Assault."; HEADER[1][1][1] = "Russia defends."; HEADER[1][2][0] = "Russia meets a German attack."; HEADER[1][2][1] = "Russia engages a German force."; SITUATION = new Array(); SITUATION_COUNT = 4; SITUATION[0] = "The enemy is just up ahead."; SITUATION[1] = "The enemy forces are close by."; SITUATION[2] = "Forward scouts have detected the enemy in the area."; SITUATION[3] = "Enemy sighted ahead."; ORDER = new Array(); ORDER[0] = new Array(); ORDER[1] = new Array(); ORDER[2] = new Array(); ORDER_COUNT = 3; ORDER[0][0] = "You are ordered to rout the enemy forces from their defensive positions."; ORDER[0][1] = "You are ordered to assault and destroy the defending enemy forces."; ORDER[0][2] = "You are ordered to engage and defeat the enemy."; ORDER[1][0] = "You are ordered to defend against the incoming tide of the enemy."; ORDER[1][1] = "You are ordered to hold off the incoming enemy force."; ORDER[1][2] = "You are ordered to delay the attacking forces, whilst inflicting significant casualties upon them."; ORDER[2][0] = "You are ordered to engage and defeat the enemy forces in this area."; ORDER[2][1] = "You are ordered to smash the enemy forces present in this area."; ORDER[2][2] = "You are ordered to anihilate the enemy force."; OBJ_ORDER = new Array(); OBJ_ORDER[0] = new Array(); OBJ_ORDER[1] = new Array(); OBJ_ORDER[2] = new Array(); OBJ_ORDER_COUNT = 3; OBJ_ORDER[0][0] = "HQ has identified the {obj} as a vital objective of this assault."; OBJ_ORDER[0][1] = "Securing the {obj} is of paramount importance."; OBJ_ORDER[0][2] = "The {obj} is the most important objective."; OBJ_ORDER[1][0] = "Defend the {obj} at all costs."; OBJ_ORDER[1][1] = "Attempt to hold the {obj} from the enemy."; OBJ_ORDER[1][2] = "HQ wants you to defend the {obj} as a primary objective."; OBJ1_ORDER = new Array(); OBJ1_ORDER[0] = new Array(); OBJ1_ORDER[1] = new Array(); OBJ1_ORDER[2] = new Array(); OBJ1_ORDER_COUNT = 3; OBJ1_ORDER[0][0] = "The {obj} should also be secured."; OBJ1_ORDER[0][1] = "The {obj} should also be captured."; OBJ1_ORDER[0][2] = "Also consider capturing the {obj}."; OBJ1_ORDER[1][0] = "It is also important that the {obj} should also be defended if possible."; OBJ1_ORDER[1][1] = "Also protect the {obj} from enemy attack."; OBJ1_ORDER[1][2] = "Deny the {obj} from the enemy as well."; TIME_ORDER = new Array(); TIME_ORDER[0] = new Array(); TIME_ORDER[1] = new Array(); TIME_ORDER_COUNT = 3; TIME_ORDER[0][0] = "You must achive your objectives in a timely manner."; TIME_ORDER[0][1] = "It is important that you control the battlefield quickly."; TIME_ORDER[0][2] = "As is often the case in war speed is essential."; TIME_ORDER[1][0] = "You must hold out for as long as possible."; TIME_ORDER[1][1] = "It is important that you delay the enemy control of the battlefield for as long as possible."; TIME_ORDER[1][2] = "Stall the enemy."; TIME1_ORDER = new Array(); TIME1_ORDER[0] = new Array(); TIME1_ORDER[1] = new Array(); TIME1_ORDER_COUNT = 3; TIME1_ORDER[0][0] = "The enemy will be receiving a defensive bonus on or about turn {turn}."; TIME1_ORDER[0][1] = "Your victory will be less favourable if achieved after about turn {turn}."; TIME1_ORDER[0][2] = "To prevent a greater operational victory by the enemy, finish them by about turn {turn}."; TIME1_ORDER[1][0] = "You will receive a defensive bonus on or about turn {turn}."; TIME1_ORDER[1][1] = "Your victory will be more favourable if you can hold until after about turn {turn}."; TIME1_ORDER[1][2] = "To prevent a greater operational victory by the enemy, hold them until about turn {turn}."; IQ_ORDER = new Array(); IQ_ORDER_COUNT = 6; IQ_ORDER[0] = "Expect {res} enemy resistance."; IQ_ORDER[1] = "Expect a {res} enemy resolve."; IQ_ORDER[2] = "Expect a {res} enemy fight."; IQ_ORDER[3] = "Expect the enemy {force} will provide {res} resistance."; IQ_ORDER[4] = "The enemy {force} will put up a {res} fight."; IQ_ORDER[5] = "The degree of enemy resolve is unknown."; IQ1_ORDER = new Array(); IQ1_ORDER_COUNT = 3; IQ1_ORDER[0] = "Our recon assets have detected enemy {units}."; IQ1_ORDER[1] = "The enemy is known to have {units}."; IQ1_ORDER[2] = "The enemy is likely to have {units}."; REPORT_STR = ""; ALLOWLISTLEN = new Array(); ALLOWLISTUID = new Array(); ALLOWLISTNAME = new Array(); ALLOWLISTMAX = new Array() SELECTEDFORCEMIX = new Array(); TemplateRIdx = 0; TemplateRID = new Array(); PresetRIdx = new Array(); PresetRID = new Array(); UsersetupRIdx = new Array(); UsersetupRID = new Array(); StrengthRIdx = new Array(); StrengthRID = new Array(); ExpRIdx = new Array(); ExpRID = new Array(); MinefieldRIdx = new Array(); MinefieldRID = new Array(); ReinforceRIdx = new Array(); ReinforceRID = new Array(); PostureRIdx = new Array(); PostureRID = new Array(); SETUPIdx = 0; SETUPID = new Array(); SETUPNAME = new Array(); SETUPICON = new Array(); SETUPENEMY = new Array(); SETUPFACE = new Array(); SETUPDESC = new Array(); SETUPATK = new Array(); SETUPATKZONE = new Array(); SETUPDEF = new Array(); SETUPDEFZONE = new Array(); SETUPSIM = new Array(); TID = ""; function PreErrorMsg(ErrCode, ErrText) { var dump = ""; if (CMDLINE) { dump = "\n\nDump:\n\n"; dump += "\nDates:\t(" + BATTLE_DATE[0] + " - " + MONTH+"/"+DAY+"/"+YEAR + " - " + BATTLE_DATE[1] + ")"; dump += "\nBattle:\t" + BATTLE_ID; dump += "\nTemplate:\t" + TID + "\nModels:\t" + MODELS; dump += "\n\nSIDE 0 = " + FORCENAME[0] + "\t\tSIDE 1 = " + FORCENAME[1]; dump += "\nPoints:\n SIDE 0 = " + TOTAL_POINTS[0] + "\t\tSIDE 1 = " + TOTAL_POINTS[1]; try { dump += "\nPreset:\n SIDE 0 = " + FORCEPRESETID[0][0].substring(0,10) + "\t\tSIDE 1 = " + FORCEPRESETID[1][0].substring(0,10); } catch (err) {} try { dump += "\nPosture:\n SIDE 0 = " + ENGAGENAME[fENGAGE(0)].substring(0,10) + "\t\tSIDE 1 = " + ENGAGENAME[fENGAGE(1)].substring(0,10); } catch (err) {} dump += "\nSetup:\n SIDE 0 = " + SETUPNAME[UsersetupRID[0][DIR[0]]] + "\t\tSIDE 1 = " + SETUPNAME[UsersetupRID[1][DIR[1]]]; try { dump += "\nStrength:\n SIDE 0 = " + STRNAME[StrengthRID[0][STR[0]]].substring(0,10) + "\t\tSIDE 1 = " + STRNAME[StrengthRID[1][STR[1]]].substring(0,10); } catch (err) {} dump += "\nExperience:\n SIDE 0 = " + EXPNAME[ExpRID[0][EXP[0]]] + "\t\tSIDE 1 = " + EXPNAME[ExpRID[1][EXP[1]]]; dump += "\nMinefields:\n SIDE 0 = " + MFNAME[MinefieldRID[0][MF[0]]] + "\t\tSIDE 1 = " + MFNAME[MinefieldRID[1][MF[1]]]; dump += "\nReinforcements:\n SIDE 0 = " + REINFORCENAME[ReinforceRID[0][REINFORCE[0]]] + "\t\tSIDE 1 = " + REINFORCENAME[ReinforceRID[1][REINFORCE[1]]]; ErrorMsg(ErrCode,ErrText+dump); Exit_RBG(0); } else { ErrorMsg(ErrCode,ErrText); window.close(); } } function loadXML(xmlFile) { xmlDoc.async="false"; xmlDoc.onreadystatechange=verify; xmlDoc.load(xmlFile); xmlObj=xmlDoc.documentElement; } function verify() { if (xmlDoc.readyState != 4) return false; } function ParseValidXML(fname) { var txt; if (xmlDoc.parseError.errorCode!=0) { txt="Illegal XML Parse\n\n"; txt=txt+"XML Error Code: " + xmlDoc.parseError.errorCode + "\n"; txt=txt+'XML File: "'+fname+'"' + '\n'; txt=txt+"Error Reason: " + xmlDoc.parseError.reason; txt=txt+"Error Line: " + xmlDoc.parseError.line; PreErrorMsg("004",txt); return (false); } return (true); } function AddMenuOption(menu, value, text) { var OptNew = document.createElement('option'); OptNew.text = text; OptNew.value = value; document.getElementById(menu).add(OptNew); } function AddTemplate(fname) { if (fname.toLowerCase().match("\\.xml")) { var f = "Data/Templates/"+fname.substring(0,fname.length-4)+".xml"; loadXML(f); if (!ParseValidXML(f)) return; var id = xmlObj.getAttribute("id"); if (id) id = id.toLowerCase(); else PreErrorMsg("101","Error in 'id' field of '"+f+"'"); var name = xmlObj.getAttribute("name"); if (!name) PreErrorMsg("101","Error in 'name' field of '"+f+"'"); var m = xmlObj.getAttribute("models"); if (m) m = m.toLowerCase(); else PreErrorMsg("101","Error in 'models' field of '"+f+"'"); if (CMDLINE) { var dd = (Date.parse(BATTLE_DATE[1]) - Date.parse(BATTLE_DATE[0])) / 1000 / 60 / 60 / 24; if (dd < 185) { var d = new Date(); d.setTime(Date.parse(BATTLE_DATE[0])); var s0 = MONTHSEASON[d.getMonth()+1]; d.setTime(Date.parse(BATTLE_DATE[1])); var s1 = MONTHSEASON[d.getMonth()+1]; if ((((m == "default") || (m == "winter") || (m == "autumn") || (m == "fall")) && PCOWSINSTALLED) || (m == "winterdemo")) { if ((s0 == 1) || (s0 == 2) || (s1 == 1) || (s1 == 2)) AddMenuOption("oTemplateSelect_menu",id + "@" + f,name); } else if ((m == "summer") || (m == "spring")) { if ((s0 == 0) || (s0 == 3) || (s1 == 0) || (s1 == 3)) AddMenuOption("oTemplateSelect_menu",id + "@" + f,name); } return; } } if ((((m == "default") || (m == "winter") || (m == "autumn") || (m == "fall")) && PCOWSINSTALLED) || (m == "winterdemo")) AddMenuOption("oTemplateSelect_menu",id + "@" + f,name); else if ((m == "summer") || (m == "spring")) AddMenuOption("oTemplateSelect_menu",id + "@" + f,name); } } function AddBattle(fname) { if (fname.toLowerCase().match("\\.xml")) { var f = "Data/Battles/"+fname.substring(0,fname.length-4)+".xml"; loadXML(f); if (!ParseValidXML(f)) return; var id = xmlObj.getAttribute("id"); if (id) id = id.toLowerCase(); else PreErrorMsg("101","Error in 'id' field of '"+f+"'"); var name = xmlObj.getAttribute("name"); if (!name) PreErrorMsg("101","Error in 'name' field of '"+f+"'"); if (!CMDLINE) { var m = xmlObj.getAttribute("showinmenu"); if (m) m = m.toLowerCase(); else m = "false"; if ((m == "true") || (m == "yes")) {} else return; } AddMenuOption("oBattleSelect_menu",id + "@" + f,name); } } function AddPreset(fname) { if (fname.toLowerCase().match("\\.xml")) { var gs = 0, rs = 1, sim; var f = "Data/Presets/"+fname.substring(0,fname.length-4)+".xml"; loadXML(f); if (!ParseValidXML(f)) return; var id = xmlObj.getAttribute("id"); if (id) id = id.toLowerCase(); else PreErrorMsg("101","Error in 'id' field of '"+f+"'"); var name = xmlObj.getAttribute("name"); if (!name) PreErrorMsg("101","Error in 'name' field of '"+f+"'"); var m = xmlObj.getAttribute("showinmenu"); if (m) m = m.toLowerCase(); else m = "false"; if ((m == "true") || (m == "yes")) sim = true; else sim = false; if (FORCENAME[0].toLowerCase() == "german") { gs = 0; rs = 1; } if (FORCENAME[0].toLowerCase() == "russian") { rs = 0; gs = 1; } var side = xmlObj.getAttribute("side"); if (side) side = side.toLowerCase(); if (side == "german") { if ((PresetRID[gs][0].toLowerCase() != "random") || sim) AddMenuOption("oFORCEMIX0_menu",id + "@" + f,name); } else if (side == "russian") { if ((PresetRID[rs][0].toLowerCase() != "random") || sim) AddMenuOption("oFORCEMIX1_menu",id + "@" + f,name); } else PreErrorMsg("101","Error in 'side' field of '"+f+"'"); } } function PopulateBattles() { var i; var fo; var files; document.getElementById("oBattleSelect_menu").options.length = 0; fo = fso.GetFolder("Data/Battles"); files = new Enumerator(fo.Files); for (i=0; !files.atEnd(); files.moveNext()) AddBattle(files.item().name); } function PopulateTemplates() { var i; var fo; var files; document.getElementById("oTemplateSelect_menu").options.length = 0; fo = fso.GetFolder("Data/Templates"); files = new Enumerator(fo.Files); for (i=0; !files.atEnd(); files.moveNext()) AddTemplate(files.item().name); } function PopulatePresets() { var i; var fo; var files; document.getElementById("oFORCEMIX0_menu").options.length = 0; document.getElementById("oFORCEMIX1_menu").options.length = 0; fo = fso.GetFolder("Data/Presets"); files = new Enumerator(fo.Files); for (i=0; !files.atEnd(); files.moveNext()) AddPreset(files.item().name); } function AddEquipment(fname) { var i,j,k,x,y,z,sut,side,generic,tag; if (fname.toLowerCase().match("\\.xml")) { loadXML(fname); if (!ParseValidXML(fname)) return; if (xmlObj.getAttribute('side') == "German") side = 0; else side = 1; if (xmlObj.selectSingleNode("set").childNodes(0).getAttribute("compendium").match("genericvehicle")) generic = 0; else generic = 1; sut = -1; tag = ""; for (i = 0; i < xmlObj.childNodes.length; i++) { x = xmlObj.childNodes(i); if ((x.tagName) && (x.tagName.toLowerCase() == "attributes")) { if ((xmlObj.tagName) && (xmlObj.tagName.toLowerCase() == "armouredunit")) sut = ARM; else sut = INF; for (j = 0; j < x.childNodes.length; j++) { y = x.childNodes(j); if ((y.tagName) && (y.tagName.toLowerCase() == "attribute")) { z = y.getAttribute("name").toLowerCase(); tag = z; if (z == "team") { sut = INF; break; } if (z == "truck") { sut = TRA; break; } if (z == "indirectfire") { sut = ART; break; } if ((z == "fighterbomber") || (z == "divebomber")) { sut = AIR; break; } if ((z == "lightgun") || (z == "mediumgun") || (z == "heavygun") || (z == "assaultgun")) { sut = ATG; } if ((z == "lighttank") || (z == "mediumtank") || (z == "heavytank")) { sut = ARM; break;} if ((z == "halftrack") || (z == "scoutcar") || (z == "recon")) { sut = TRA; } } } } } if (xmlObj.getAttribute("rbg")) if (xmlObj.getAttribute("rbg").toLowerCase() == "false") return; if (sut == -1) return; var endservice = xmlObj.getAttribute("endservice"); var medservice = xmlObj.getAttribute("medservice"); var medprev = xmlObj.getAttribute("medprev"); var stddev = xmlObj.getAttribute("stddev"); EquipYear[side][sut][EquipIdx[side][sut]] = parseInt(xmlObj.getAttribute("year"),"10"); EquipMonth[side][sut][EquipIdx[side][sut]] = parseInt(xmlObj.getAttribute("month"),"10"); if (!endservice) { EquipEndYear[side][sut][EquipIdx[side][sut]] = 45; EquipEndMonth[side][sut][EquipIdx[side][sut]] = 6; } else { EquipEndYear[side][sut][EquipIdx[side][sut]] = parseInt(endservice.substring(endservice.search("/")+1,endservice.length),"10"); EquipEndMonth[side][sut][EquipIdx[side][sut]] = parseInt(endservice.substring(0,endservice.search("/")),"10"); } if (!medservice) { EquipMedYear[side][sut][EquipIdx[side][sut]] = parseInt(EquipYear[side][sut][EquipIdx[side][sut]],"10") + 1; EquipMedMonth[side][sut][EquipIdx[side][sut]] = parseInt(EquipMonth[side][sut][EquipIdx[side][sut]],"10"); if (((EquipMedYear[side][sut][EquipIdx[side][sut]] * 12) + EquipMedMonth[side][sut][EquipIdx[side][sut]]) > ((EquipEndYear[side][sut][EquipIdx[side][sut]] * 12) + EquipEndMonth[side][sut][EquipIdx[side][sut]])) { EquipMedYear[side][sut][EquipIdx[side][sut]] = parseInt(EquipEndYear[side][sut][EquipIdx[side][sut]],"10"); EquipMedMonth[side][sut][EquipIdx[side][sut]] = parseInt(EquipEndMonth[side][sut][EquipIdx[side][sut]],"10"); } } else { EquipMedYear[side][sut][EquipIdx[side][sut]] = parseInt(medservice.substring(medservice.search("/")+1,medservice.length),"10"); EquipMedMonth[side][sut][EquipIdx[side][sut]] = parseInt(medservice.substring(0,medservice.search("/")),"10"); } if (!medprev) EquipMedPrev[side][sut][EquipIdx[side][sut]] = 5; else EquipMedPrev[side][sut][EquipIdx[side][sut]] = parseInt(medprev,"10"); if (!stddev) EquipStdDev[side][sut][EquipIdx[side][sut]] = 12; else EquipStdDev[side][sut][EquipIdx[side][sut]] = parseInt(stddev,"10"); EquipID[side][sut][EquipIdx[side][sut]] = xmlObj.getAttribute("type"); EquipPts[side][sut][EquipIdx[side][sut]] = xmlObj.getAttribute("points"); EquipTag[side][sut][EquipIdx[side][sut]] = tag; EquipProb[side][sut][EquipIdx[side][sut]] = 0; Equip3D[side][sut][EquipIdx[side][sut]] = generic; EquipMax[side][sut][EquipIdx[side][sut]] = PLATSIZE[side][sut]; if (((EquipYear[side][sut][EquipIdx[side][sut]] * 12) + EquipMonth[side][sut][EquipIdx[side][sut]]) > ((EquipMedYear[side][sut][EquipIdx[side][sut]] * 12) + EquipMedMonth[side][sut][EquipIdx[side][sut]])) PreErrorMsg("011","Error in equipment '"+EquipID[side][sut][EquipIdx[side][sut]]+"' Start or Median service dates"); if (((EquipMedYear[side][sut][EquipIdx[side][sut]] * 12) + EquipMedMonth[side][sut][EquipIdx[side][sut]]) > ((EquipEndYear[side][sut][EquipIdx[side][sut]] * 12) + EquipEndMonth[side][sut][EquipIdx[side][sut]])) PreErrorMsg("011","Error in equipment '"+EquipID[side][sut][EquipIdx[side][sut]]+"' Median or End service dates"); EquipIdx[side][sut]++; } } function Load_SetupZones() { var i, j; var fo; var files; var fname; fo = fso.GetFolder("Data/Setups"); files = new Enumerator(fo.Files); SETUPIdx = 0; for (i=0; !files.atEnd(); files.moveNext()) { fname = "Data/Setups/"+files.item().name; if (fname.toLowerCase().match("\\.xml")) { loadXML(fname); if (!ParseValidXML(fname)) return; SETUPID[SETUPIdx] = xmlObj.getAttribute('id'); SETUPNAME[SETUPIdx] = xmlObj.getAttribute('name'); SETUPICON[SETUPIdx] = xmlObj.getAttribute('icon'); SETUPENEMY[SETUPIdx] = xmlObj.getAttribute('enemyid'); SETUPFACE[SETUPIdx] = xmlObj.getAttribute('faceto'); SETUPDESC[SETUPIdx] = xmlObj.getAttribute('desc'); SETUPATK[SETUPIdx] = xmlObj.getAttribute('attack'); SETUPATKZONE[SETUPIdx] = xmlObj.getAttribute('attackzone'); SETUPDEF[SETUPIdx] = xmlObj.getAttribute('defend'); SETUPDEFZONE[SETUPIdx] = xmlObj.getAttribute('defendzone'); SETUPSIM[SETUPIdx] = xmlObj.getAttribute('showinmenu'); if (SETUPSIM[SETUPIdx] == null) SETUPSIM[SETUPIdx] = "false"; SETUPIdx++; } } for (i = 0; i < SETUPIdx; i++) { for (j = 0; j < SETUPIdx; j++) if (SETUPENEMY.toLowerCase() == SETUPID[j].toLowerCase()) break; if (j < SETUPIdx) SETUPENEMY = j; else PreErrorMsg("055","Setup Zone '"+SETUPID+"' doesn't have a valid enemyid"); } } function Load_Equipment() { var i, j; var fo; var files; for (i = 0; i < 2; i++) for (j = 0; j < NUMUNITTYPES; j++) { EquipIdx[j] = 0; EquipPTot[j] = 0; } fo = fso.GetFolder("Data/ArmouredUnits"); files = new Enumerator(fo.Files); for (i=0; !files.atEnd(); files.moveNext()) AddEquipment("Data/ArmouredUnits/"+files.item().name); fo = fso.GetFolder("Data/Infantry"); files = new Enumerator(fo.Files); for (i=0; !files.atEnd(); files.moveNext()) AddEquipment("Data/Infantry/"+files.item().name); } function Init() { var i,j; var o = document.getElementById("oLoading_div").style; o.width = 632; o.height = 702; o.left = 0; o.top = 0; o.zIndex = 5; for (i = 0; i < MAXTPLATS; i++) { TUnitX = new Array(); TUnitY = new Array(); } for (i = 0; i < NUMUNITTYPES; i++) { SelTUnitX = new Array(); SelTUnitY = new Array(); SelTPlatReinf = new Array(); SelTPlatUnitIdx = new Array(); for (j = 0; j < MAXTPLATS; j++) { SelTUnitX[j] = new Array(); SelTUnitY[j] = new Array(); } } for (i = 0; i < 2; i++) { IntT = new Array(); for (j = 0; j < 10; j++) IntT[j] = -1; PresetRID = new Array(); UsersetupRID = new Array(); StrengthRID = new Array(); MinefieldRID = new Array(); PostureRID = new Array(); ReinforceRID = new Array(); ExpRID = new Array(); } for (i = 0; i < 2; i++) { ALLOWLISTLEN = new Array(); ALLOWLISTUID = new Array(); ALLOWLISTNAME = new Array(); ALLOWLISTMAX = new Array(); FORCEPRESETDATA = new Array(); FORCEPRESETNAME = new Array(); FORCEPRESETTITLE = new Array(); FORCEPRESETID = new Array(); BRIEFING = ""; EquipYear = new Array(); EquipID = new Array(); EquipName = new Array(); EquipPts = new Array(); Equip3D = new Array(); EquipMonth = new Array(); EquipEndMonth = new Array(); EquipEndYear = new Array(); EquipMedMonth = new Array(); EquipMedYear = new Array(); EquipMedPrev = new Array(); EquipStdDev = new Array(); EquipProb = new Array(); EquipIdx = new Array(); EquipPTot = new Array(); EquipTag = new Array(); EquipMax = new Array(); CFPlatoonIdx = new Array(); CFPlatoonID = new Array(); CFPlatoonName = new Array(); CFPlatoonNum = new Array(); CFPlatoonMax = new Array(); CFPlatoonExp = new Array(); CFPlatoonReinT = new Array(); CFPlatoonReinC = new Array(); CFPlatoonTag = new Array(); CFPlatoonPts = new Array(); CFPlatoonX = new Array(); CFPlatoonY = new Array(); CFPlatoonHd = new Array(); CFPlatoonProb = new Array(); FORCEMIX = new Array(); FORCELOCK = new Array(); POINTS_SPENT = new Array(); for (j = 0; j < NUMUNITTYPES; j++) { EquipYear[j] = new Array(); EquipMonth[j] = new Array(); EquipEndYear[j] = new Array(); EquipEndMonth[j] = new Array(); EquipMedMonth[j] = new Array(); EquipMedYear[j] = new Array(); EquipMedPrev[j] = new Array(); EquipStdDev[j] = new Array(); EquipID[j] = new Array(); EquipName[j] = new Array(); EquipPts[j] = new Array(); EquipTag[j] = new Array(); Equip3D[j] = new Array(); EquipProb[j] = new Array(); EquipMax[j] = new Array(); CFPlatoonID[j] = new Array(); CFPlatoonName[j] = new Array(); CFPlatoonNum[j] = new Array(); CFPlatoonMax[j] = new Array(); CFPlatoonExp[j] = new Array(); CFPlatoonReinT[j] = new Array(); CFPlatoonReinC[j] = new Array(); CFPlatoonTag[j] = new Array(); CFPlatoonPts[j] = new Array(); CFPlatoonX[j] = new Array(); CFPlatoonY[j] = new Array(); CFPlatoonHd[j] = new Array(); CFPlatoonProb[j] = new Array(); FORCEMIX[j] = 0; FORCELOCK[j] = 0; } REINFORCE = 0; MF = 0; ENGAGE = 0; EXP = 0; STR = 0; DIR = 0; RND = 0; AI = 0; ToggleAI(i); POINTS = 0; } document.getElementById("oBuild").src = "Editor/Build.png"; document.getElementById("oBuild").alt = "Build Battle"; Load_SetupZones(); Load_Equipment(); } function fENGAGE(s) { return (PostureRID[ENGAGE]); } function ToggleEXP(i, dir) { if (dir) EXP += dir; if (EXP >= ExpRIdx) EXP = 0; if (EXP < 0) EXP = ExpRIdx - 1; var idx = ExpRID[EXP]; if (IntT[3]) document.getElementById("oEXP"+i).src = "Editor/EXP"+i+idx+"r.png"; else document.getElementById("oEXP"+i).src = "Editor/EXP"+i+idx+".png"; document.getElementById("oEXP"+i).alt = EXPNAME[idx] + " " + FORCENAME + "s"; } function TogglePoints(i, dir) { POINTS += dir; if (POINTS > (MAXPOINTS-1)) POINTS = 0; if (POINTS < 0) POINTS = (MAXPOINTS-1); document.getElementById("oPoints"+i).src = "Editor/Points"+i+POINTS+".png"; document.getElementById("oPoints"+i).alt = FORCENAME + " Force has " + POINTSNAME[POINTS] + " Points to Spend\n\nLeft-click to increase, Right-click to decrease\nOr scroll through the values with the mousewheel"; } function ToggleSTR(i,dir) { if (dir) STR += dir; if (STR >= StrengthRIdx) STR = 0; if (STR < 0) STR = StrengthRIdx - 1; var idx = StrengthRID[STR]; if (IntT[4]) document.getElementById("oSTR"+i).src = "Editor/STR"+idx+"r.png"; else document.getElementById("oSTR"+i).src = "Editor/STR"+idx+".png"; document.getElementById("oSTR"+i).alt = STRNAME[idx] + " Strength"; } function ToggleMF(i,dir) { if (dir) MF += dir; if (MF >= MinefieldRIdx) MF = 0; if (MF < 0) MF = MinefieldRIdx - 1; var idx = MinefieldRID[MF]; if (IntT[1]) document.getElementById("oMF"+i).src = "Editor/MF"+idx+"r.png"; else document.getElementById("oMF"+i).src = "Editor/MF"+idx+".png"; document.getElementById("oMF"+i).alt = FORCENAME + " Minefields: " + MFNAME[idx]; if ((idx > 0) && (fENGAGE(i) == 2)) ToggleEngage(i,1); } function ToggleEngage(i,dir) { var k; if (dir) ENGAGE += dir; if (ENGAGE >= PostureRIdx) ENGAGE = 0; if (ENGAGE < 0) ENGAGE = PostureRIdx - 1; var idx = PostureRID[ENGAGE]; if (IntT[2]) document.getElementById("oENGAGE"+i).src = "Editor/Engage"+i+idx+"r.png"; else document.getElementById("oENGAGE"+i).src = "Editor/Engage"+i+idx+".png"; document.getElementById("oENGAGE"+i).alt = FORCENAME + " " + ENGAGENAME[idx]; if (idx != 2) { var j = Math.abs(i - 1); if (fENGAGE(j) != 2) { for (k = 0; k < PostureRIdx[j]; k++) if (PostureRID[j][k] == 2) { ENGAGE[j] = k; break; } ToggleEngage(j,0); } } else if (MinefieldRID[MF] > 0) { for (k = 0; k < MinefieldRIdx; k++) if (MinefieldRID[k] == 0) { MF = k; break; } ToggleMF(i,0); } } function ToggleDIR(i,dir) { var k; if (dir) DIR += dir; if (DIR >= UsersetupRIdx) DIR = 0; if (DIR < 0) DIR = UsersetupRIdx - 1; var idx = UsersetupRID[DIR]; if (IntT[5]) document.getElementById("oDIR"+i).src = "Editor/"+SETUPICON[idx]+"r.png"; else document.getElementById("oDIR"+i).src = "Editor/"+SETUPICON[idx]+".png"; document.getElementById("oDIR_txt"+i).innerHTML = SETUPNAME[idx]; document.getElementById("oDIR"+i).alt = FORCENAME + " player is " + SETUPDESC[idx] + "."; var j = Math.abs(i-1); for (k = 0; k < UsersetupRIdx[j]; k++) { if (SETUPENEMY[idx] == UsersetupRID[j][k]) { DIR[j] = k; break; } } idx = UsersetupRID[j][DIR[j]]; if (IntT[j][5]) document.getElementById("oDIR"+j).src = "Editor/"+SETUPICON[idx]+"r.png"; else document.getElementById("oDIR"+j).src = "Editor/"+SETUPICON[idx]+".png"; document.getElementById("oDIR_txt"+j).innerHTML = SETUPNAME[idx]; document.getElementById("oDIR"+j).alt = FORCENAME[j] + " player is " + SETUPDESC[idx] + "."; } function ToggleReinf(i,dir) { if (dir) REINFORCE += dir; if (REINFORCE >= ReinforceRIdx) REINFORCE = 0; if (REINFORCE < 0) REINFORCE = ReinforceRIdx - 1; var idx = ReinforceRID[REINFORCE]; if (IntT[0]) document.getElementById("oReinf"+i).src = "Editor/Reinf"+i+idx+"r.png"; else document.getElementById("oReinf"+i).src = "Editor/Reinf"+i+idx+".png"; if (idx) document.getElementById("oReinf"+i).alt = FORCENAME + " Reinforcements Available"; else document.getElementById("oReinf"+i).alt = FORCENAME + " Reinforcements Not Available"; } function RandomTemplate() { var i, o = document.getElementById("oTemplateSelect_menu"); i = iRnd(TemplateRIdx); o.value = Load_Template(TemplateRID); } function RandomPreset(i) { var j, o = document.getElementById("oFORCEMIX"+i+"_menu"); j = iRnd(PresetRIdx); o.value = Load_Preset(PresetRID[j], i); } function RandomDIR(i) { DIR = iRnd(UsersetupRIdx); ToggleDIR(i,0); } function RandomSTR(i) { STR = iRnd(StrengthRIdx); ToggleSTR(i,0); } function RandomReinf(i) { REINFORCE = iRnd(ReinforceRIdx); ToggleReinf(i,0); } function RandomMF(i) { MF = iRnd(MinefieldRIdx); ToggleMF(i,0); } function RandomEXP(i) { EXP = iRnd(ExpRIdx); ToggleEXP(i,0); } function RandomEngage(i) { ENGAGE = iRnd(PostureRIdx); ToggleEngage(i,0); } function DisplayDate() { var post; post = NumberPostscript(DAY); DATE = GenerateDATE(YEAR); document.getElementById("oDate_txt").innerHTML = "<table width='100%' cellpadding='0' cellspacing='0'><tr><td align='left' valign='bottom'><a title='Battle Date ("+BATTLE_DATE[0]+" - "+BATTLE_DATE[1]+")'>Battle Date:</a></td><td align='right' width='100' valign='bottom'><b><a title='"+MONTHNAME[MONTH]+"' onmousewheel='if (event.wheelDelta <= -5) SetDate(\"\",\"dec\",\"\",0); else if (event.wheelDelta >= 5) SetDate(\"\",\"inc\",\"\",0);' onclick='SetDate(\"\",\"inc\",\"\",0)' ondblclick='SetDate(\"\",\"inc\",\"\",0)'>" + MONTHNAME[MONTH] + "</a></b></td><td align='right' valign='bottom' width='40'><b><a title='"+DAY+post+"' onmousewheel='if (event.wheelDelta <= -5) SetDate(\"dec\",\"\",\"\",0); else if (event.wheelDelta >= 5) SetDate(\"inc\",\"\",\"\",0);' onclick='SetDate(\"inc\",\"\",\"\",0)' ondblclick='SetDate(\"inc\",\"\",\"\",0)'>" + DAY+"<sup>"+post+"</sup>" + "</a></b>,</td><td align='right' valign='bottom' width='40'><b><a title='"+YEAR+"' onmousewheel='if (event.wheelDelta <= -5) SetDate(\"\",\"\",\"dec\",0); else if (event.wheelDelta >= 5) SetDate(\"\",\"\",\"inc\",0);' onclick='SetDate(\"\",\"\",\"inc\",0)' ondblclick='SetDate(\"\",\"\",\"inc\",0)'>" + YEAR + "</a></td></tr></table>"; } function ToggleYear(i) { if (i == 1) SetDate("","","inc",0); if (i == -1) SetDate("","","dec",0); } function DisplayYear() { if ((IntT[0][7]) || (IntT[1][7])) document.getElementById("oYear").src = "Editor/"+YEAR+"r.png"; else document.getElementById("oYear").src = "Editor/"+YEAR+".png"; document.getElementById("oYear").alt = YEAR; } function DisplaySeason() { if ((IntT[0][6]) || (IntT[1][6])) document.getElementById("oSeason").src = "Editor/Season"+SEASON+"r.png"; else document.getElementById("oSeason").src = "Editor/Season"+SEASON+".png"; document.getElementById("oSeason").alt = SEASONNAME[SEASON]; } function ToggleSeason(i) { if (SEASON == 0) SEASON = 3; else if (SEASON == 3) SEASON = 0; else if (SEASON == 1) SEASON = 2; else if (SEASON == 2) SEASON = 1; Check_Season(); if (i == 1) SetDate("rand","rand","",0); } function Check_Season() { if ((MODELS == "default") || (MODELS == "winter") || (MODELS == "autumn") || (MODELS == "fall") || (MODELS == "winterdemo")) { if ((SEASON == 0) || (SEASON == 3)) { SEASON = iRnd(1,2); } } else if ((MODELS == "summer") || (MODELS == "spring")) { if ((SEASON == 1) || (SEASON == 2)) { if (iRnd(2) == 1) SEASON = 0; else SEASON = 3; } } } var oldd, oldm, oldy; function SetDate(d,m,y,n) { var dt; var d1 = new Date(); var d2 = new Date(); if (n == 0) { oldd = DAY; oldm = MONTH; oldy = YEAR; } d1.setTime(Date.parse(BATTLE_DATE[0])); d2.setTime(Date.parse(BATTLE_DATE[1])); if (y == "rand") //YEAR = 1941 + iRnd(5); YEAR = iRnd(d1.getFullYear(),d2.getFullYear()); else if (y == "inc") YEAR++; else if (y == "dec") YEAR--; if (m == "rand") MONTH = StripNth(SEASONMONTH[SEASON],iRnd(3)); else if (m == "inc") MONTH++; else if (m == "dec") MONTH--; if (MONTH > 12) { MONTH = 1; YEAR++ } if (MONTH < 1) { MONTH = 12; YEAR--; } if (d == "rand") DAY = iRnd(1,31); else if (d == "inc") DAY++; else if (d == "dec") DAY--; if ((DAY > 29) && (MONTH == 2) && (YEAR == 1944)) { DAY = 1; MONTH++; } else if ((DAY > 28) && (MONTH == 2) && (YEAR != 1944) && (YEAR != 1940)) { DAY = 1; MONTH++; } else if ((DAY > 30) && ((MONTH == 9) || (MONTH == 4) || (MONTH == 6) || (MONTH == 11))) { DAY = 1; MONTH++; } else if (DAY > 31) { DAY = 1; MONTH++; } if (DAY < 1) { MONTH--; if ((MONTH == 2) && ((YEAR == 1944) || (YEAR == 1940))) DAY = 29; else if ((MONTH == 2) && (YEAR != 1944) && (YEAR != 1940)) DAY = 28; else if ((MONTH == 0) || (MONTH == 1) || (MONTH == 3) || (MONTH == 5) || (MONTH == 7) || (MONTH == 8) || (MONTH == 10)) DAY = 31; else DAY = 30; } if (MONTH > 12) { MONTH = 1; YEAR++ } if (MONTH < 1) { MONTH = 12; YEAR--; } if (YEAR > d2.getFullYear()) YEAR = d1.getFullYear(); if (YEAR < d1.getFullYear()) YEAR = d2.getFullYear(); dt = MONTH+"/"+DAY+"/"+YEAR; if ((Date.parse(dt) < Date.parse(BATTLE_DATE[0])) || (Date.parse(dt) > Date.parse(BATTLE_DATE[1]))) { if (n < 1000) { if ((d == "rand") || (m == "rand") || (y == "rand")) { if ((m == "rand") && ((n % 2) == 1)) ToggleSeason(0); else if (n > 500) m = "rand"; if ((y != "rand") && (n > 500)) y = "rand"; SetDate(d,m,y,(n+1)); return; } else if ((y == "inc") || (y == "dec")) { SetDate(d,m,y,(n+1)); return; } } DAY = oldd; MONTH = oldm; YEAR = oldy; } SEASON = MONTHSEASON[MONTH]; DisplaySeason(); DisplayYear(); DisplayDate(); } function MatchTemplateDate() { var i, r, o = document.getElementById("oTemplateSelect_menu"); for (i = 0; i < 25; i++) { SEASON = MONTHSEASON[MONTH]; r = Load_Template(TemplateRID[iRnd(TemplateRIdx)]); if (r != false) { o.value = r; return; } } for (i = 0; i < TemplateRIdx; i++) { SEASON = MONTHSEASON[MONTH]; r = Load_Template(TemplateRID); if (r != false) { o.value = r; return; } } PreErrorMsg("112","Can't generate a template legal date within the date bounds supplied!"); } function SetRCGDate(n) { var dt; var d1 = new Date(); var d2 = new Date(); d1.setTime(Date.parse(BATTLE_DATE[0])); d2.setTime(Date.parse(BATTLE_DATE[1])); YEAR = iRnd(d1.getFullYear(),d2.getFullYear()); MONTH = iRnd(1,12); DAY = iRnd(1,31); if ((DAY > 29) && (MONTH == 2) && (YEAR == 1944)) DAY = 1; else if ((DAY > 28) && (MONTH == 2) && (YEAR != 1944) && (YEAR != 1940)) DAY = 1; else if ((DAY > 30) && ((MONTH == 9) || (MONTH == 4) || (MONTH == 6) || (MONTH == 11))) DAY = 1; else if (DAY > 31) DAY = 1; dt = MONTH+"/"+DAY+"/"+YEAR; if ((Date.parse(dt) < Date.parse(BATTLE_DATE[0])) || (Date.parse(dt) > Date.parse(BATTLE_DATE[1]))) { if (n < 1000) { SetRCGDate(n+1); return; } else { PreErrorMsg("111","Can't generate a legal date within the date bounds supplied!"); return; } } MatchTemplateDate(); } function SetRND(i,j,s,event) { var dir = 1; if (event) if (event.wheelDelta <= -5) dir = -1; if ((s == 0) || (IntT[j])) { clearInterval(IntT[j]); IntT[j] = 0; if (j == 0) ToggleReinf(i,dir); if (j == 1) ToggleMF(i,dir); if (j == 2) ToggleEngage(i,dir); if (j == 3) ToggleEXP(i,dir); if (j == 4) ToggleSTR(i,dir); if (j == 5) { ToggleDIR(i,dir); if (IntT[Math.abs(i-1)][j]) SetRND(Math.abs(i-1),5,0); } if (j == 6) { clearInterval(IntT[Math.abs(i-1)][j]); IntT[Math.abs(i-1)][j] = 0; ToggleSeason(1); } if (j == 7) { clearInterval(IntT[Math.abs(i-1)][j]); IntT[Math.abs(i-1)][j] = 0; ToggleYear(dir); } if (j == 8) { document.getElementById("oDice_img").style.visibility = "hidden"; clearInterval(IntT[Math.abs(i-1)][j]); IntT[Math.abs(i-1)][j] = 0; } if (j == 9) document.getElementById("oPDice"+i+"_img").style.visibility = "hidden"; return; } if (IntT[j]) return; if (j == 0) IntT[0] = setInterval('RandomReinf('+i+')',250); if (j == 1) IntT[1] = setInterval('RandomMF('+i+')',250); if (j == 2) IntT[2] = setInterval('RandomEngage('+i+')',250); if (j == 3) IntT[3] = setInterval('RandomEXP('+i+')',250); if (j == 4) IntT[4] = setInterval('RandomSTR('+i+')',250); if (j == 5) { IntT[5] = setInterval('RandomDIR('+i+')',350); if (!IntT[Math.abs(i-1)][j]) SetRND(Math.abs(i-1),5,1); } if (j == 6) IntT[6] = setInterval('SEASON = iRnd(4); ToggleSeason(1)',250); if (j == 7) IntT[7] = setInterval('YEAR = 1941 + iRnd(5); ToggleYear(1)',250); if (j == 8) { document.getElementById("oDice_img").style.visibility = "visible"; IntT[8] = setInterval('RandomTemplate()',250); } if (j == 9) { document.getElementById("oPDice"+i+"_img").style.visibility = "visible"; IntT[9] = setInterval('RandomPreset('+i+')',250); } } function ToggleRND(i,o) { var j; if (isNaN(o)) RND = !RND; else RND = o; if (RND) { document.getElementById("oRND"+i).src = "Editor/Random.png"; document.getElementById("oRND"+i).alt = FORCENAME + " Setup is Randomized"; for (j = 0; j < 10; j++) if (!IntT[j]) SetRND(i,j,1); } else { document.getElementById("oRND"+i).src = "Editor/NoRandom.png"; document.getElementById("oRND"+i).alt = FORCENAME + " Setup as Selected"; for (j = 0; j < 10; j++) if (IntT[j]) SetRND(i,j,0); } } function ToggleAI(i) { AI = !AI; if (AI) { document.getElementById("oAI"+i).src = "Editor/AI.png"; document.getElementById("oAI"+i).alt = FORCENAME + " Played by AI"; } else { document.getElementById("oAI"+i).src = "Editor/HI"+i+".png"; document.getElementById("oAI"+i).alt = FORCENAME + " Played by Human"; } if (AI) { var j = Math.abs(i - 1); if (AI[j]) ToggleAI(j); } } function ToggleLock(i,j) { var o = document.getElementById("oLOCK"+i+j).style; if (o.visibility == "hidden") { o.visibility = "visible"; FORCELOCK[j] = 1; } else { o.visibility = "hidden"; FORCELOCK[j] = 0; } } function MouseArrowDown(event, i, j) { DeltaX = event.clientX; MD = 1; } function MouseArrowUp() { MD = 0; } function CalcP(v) { return Math.floor((v - 88) / 1.62); } function CalcV(p) { return Math.floor((p * 1.62) + 89); } function MouseArrowDrag(event, i, j) { if (MD == 1) { if (FORCELOCK[j]) return; var b = document.getElementById("oBAR"+i+j); var t = document.getElementById("oTEXT"+i+j); var oldv, newv, oldp, newp, x, n, sum = 0, sucess = false; oldv = parseInt(b.style.width); newv = Math.min(Math.max(oldv + (event.clientX - DeltaX), 89), 250); oldp = CalcP(oldv); newp = CalcP(newv); for (x = 0; x < 6; x++) if (x == j) sum = sum + newp; else sum = sum + FORCEMIX[x]; if (sum != 100) for (x = 0; x < 6; x++) { if (x == j) continue; n = FORCEMIX[x] + (100 - sum); if ((n >= 0) && (n <= 100) && (!FORCELOCK[x])) { FORCEMIX[x] = n; document.getElementById("oBAR"+i+x).style.width = CalcV(n); document.getElementById("oTEXT"+i+x).style.left = CalcV(n)+5; document.getElementById("oTEXT"+i+x).innerHTML = n + "%"; sucess = true; break; } } if (sucess) { b.style.width = newv; t.style.left = newv+5; t.innerHTML = CalcP(newv) + "%"; FORCEMIX[j] = CalcP(newv); } if (oldp != newp) DeltaX = event.clientX; } } function ConvertToCR(str) { var i; var s = ""; for (i = 0; i < str.length; i++) { if (str.charCodeAt(i) == 13) continue; if (str.charCodeAt(i) == 10) s = s + " [cr] "; else s = s + str.substring(i,i+1); } return s; } function ConvertFromCR(str, nl) { var i; var s = ""; var lss = false; for (i = 0; i < str.length; i++) if (str.substring(i,i+6).toLowerCase() == " [cr] ") { s = s + nl; i = i + 4; lss = true; } else if (lss) { lss = false; if (str.substring(i,i+1) != " ") s = s + str.substring(i,i+1); } else s = s + str.substring(i,i+1); return s; } function StripNth(str,n) { var count = 0; var lp = 0; var j; for (j = 0; j < str.length; j++) if (str.substring(j,j+1) == ",") { if (count == n) return(parseInt(str.substring(lp,j),"10")); lp = j+1; count++; } return(parseInt(str.substring(lp,j+1),"10")); } function AddTPlat(z) { var i, id; id = z.getAttribute("unitid"); for (i = 0; i < NUMUNITTYPES; i++) if (UNITTYPENAME == id) { TPlatType[TPlatIdx] = i; break; } if (i == NUMUNITTYPES) { PreErrorMsg("019","Unknown Unit Type in Template File"); return false; } TPlatUnitIdx[TPlatIdx] = parseInt(z.getAttribute("max"),"10"); for (i = 0; i < TPlatUnitIdx[TPlatIdx]; i++) { TUnitX[TPlatIdx] = StripNth(z.getAttribute("x"),i); TUnitY[TPlatIdx] = StripNth(z.getAttribute("z"),i); //UnitHd[UnitIdx] = StripNth(z.getAttribute("heading"),i); } TPlatIdx++; } function AddTCFPlat(side,z) { var i, j, k, id, x = 0, exp = ""; try { id = z.getAttribute("unitid"); } catch (err) { PreErrorMsg("019","Unknown UnitID in Battle File"); return false; } for (i = 0; i < NUMUNITTYPES; i++) { for (j = 0; j < EquipIdx[side]; j++) if (EquipID[side][j] == id) { x = CFPlatoonIdx[side]; CFPlatoonID[side][x] = id; |