mirror of
https://github.com/AdAstra-LD/DS-Pokemon-Rom-Editor.git
synced 2026-05-09 21:50:57 -05:00
Minor Script Editor error detection fixes
This commit is contained in:
parent
08d5400694
commit
fe2cd07de6
|
|
@ -94,6 +94,7 @@
|
|||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="AB.cs" />
|
||||
<Compile Include="Extensions.cs" />
|
||||
<Compile Include="GameCamera.cs" />
|
||||
<Compile Include="Properties\PokePics.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
|
|
|
|||
10
DS_Map/Extensions.cs
Normal file
10
DS_Map/Extensions.cs
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
namespace DSPRE {
|
||||
public static class Extensions {
|
||||
public static int IndexOfNumber(this string str) {
|
||||
return str.IndexOfAny("0123456789".ToCharArray());
|
||||
}
|
||||
public static bool ContainsNumber(this string str) {
|
||||
return str.IndexOfNumber() > 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -109,7 +109,7 @@ namespace DSPRE.ROMFiles {
|
|||
id = ushort.Parse(nameParts[0], NumberStyles.HexNumber, CultureInfo.InvariantCulture);
|
||||
} catch {
|
||||
string details;
|
||||
if (wholeLine.Contains('@') && wholeLine.Contains('#')) {
|
||||
if (wholeLine.Contains(':') && wholeLine.ContainsNumber()) {
|
||||
details = "This probably means you forgot to \"End\" the Script or Function above it.";
|
||||
details += Environment.NewLine + "Please, also note that only Functions can be terminated\nwith \"Return\".";
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -461,7 +461,7 @@ namespace DSPRE.ROMFiles {
|
|||
int i = 0;
|
||||
while (i < lineSourceL.Count) {
|
||||
int positionOfScriptNumber;
|
||||
if (lineSourceL[i].IndexOf(':') < 0 || (positionOfScriptNumber = lineSourceL[i].IndexOfAny("0123456789".ToCharArray())) < 0) { //Script #1
|
||||
if (!lineSourceL[i].Contains(':') || (positionOfScriptNumber = lineSourceL[i].IndexOfNumber()) < 0) { //Script #1
|
||||
continue;
|
||||
}
|
||||
uint scriptNumber = uint.Parse(lineSourceL[i++].Substring(positionOfScriptNumber).Split()[0].Replace(":", ""));
|
||||
|
|
@ -497,7 +497,7 @@ namespace DSPRE.ROMFiles {
|
|||
int i = 0;
|
||||
while (i < lineSourceL.Count) {
|
||||
int positionOfActionNumber;
|
||||
if (lineSourceL[i].IndexOf(':') < 0 || (positionOfActionNumber = lineSourceL[i].IndexOfAny("0123456789".ToCharArray())) < 0) { // Move on until script header is found
|
||||
if (!lineSourceL[i].Contains(':') || (positionOfActionNumber = lineSourceL[i].IndexOfNumber()) < 0) { // Move on until script header is found
|
||||
continue;
|
||||
}
|
||||
uint actionNumber = uint.Parse(lineSourceL[i++].Substring(positionOfActionNumber).Split()[0].Replace(":", ""));
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user