mirror of
https://github.com/ineedbots/iw4_bot_warfare.git
synced 2025-04-22 13:55:43 +00:00
changes
This commit is contained in:
parent
33053acf66
commit
26acc1c792
@ -44,14 +44,24 @@ getRemoteWaypoints(mapname)
|
|||||||
if (!res.lines.size)
|
if (!res.lines.size)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
waypointCount = int(res.lines[0]);
|
||||||
|
|
||||||
|
waypoints = [];
|
||||||
println("Loading remote waypoints...");
|
println("Loading remote waypoints...");
|
||||||
|
|
||||||
wps = linesToWaypoints(res);
|
for (i = 1; i <= waypointCount; i++)
|
||||||
|
|
||||||
if (wps.size)
|
|
||||||
{
|
{
|
||||||
level.waypoints = wps;
|
tokens = tokenizeLine(res.lines[i], ",");
|
||||||
println("Loaded " + wps.size + " waypoints from remote.");
|
|
||||||
|
waypoint = parseTokensIntoWaypoint(tokens);
|
||||||
|
|
||||||
|
waypoints[i-1] = waypoint;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (waypoints.size)
|
||||||
|
{
|
||||||
|
level.waypoints = waypoints;
|
||||||
|
println("Loaded " + waypoints.size + " waypoints from remote.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,6 +71,10 @@ getRemoteWaypoints(mapname)
|
|||||||
getRemoteVersion()
|
getRemoteVersion()
|
||||||
{
|
{
|
||||||
request = httpGet( "https://raw.githubusercontent.com/ineedbots/iw4x_waypoints/master/version.txt" );
|
request = httpGet( "https://raw.githubusercontent.com/ineedbots/iw4x_waypoints/master/version.txt" );
|
||||||
|
|
||||||
|
if (!isDefined(request))
|
||||||
|
return result;
|
||||||
|
|
||||||
request waittill( "done", success, data );
|
request waittill( "done", success, data );
|
||||||
|
|
||||||
if (!success)
|
if (!success)
|
||||||
@ -69,29 +83,6 @@ getRemoteVersion()
|
|||||||
return strtok(data, "\n")[0];
|
return strtok(data, "\n")[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
Converts an array of lines coresponding to a csv file into an array of waypoint objs
|
|
||||||
*/
|
|
||||||
linesToWaypoints(res)
|
|
||||||
{
|
|
||||||
waypoints = [];
|
|
||||||
waypointCount = int(res.lines[0]);
|
|
||||||
|
|
||||||
if (waypointCount <= 0)
|
|
||||||
return waypoints;
|
|
||||||
|
|
||||||
for (i = 1; i <= waypointCount; i++)
|
|
||||||
{
|
|
||||||
tokens = tokenizeLine(res.lines[i], ",");
|
|
||||||
|
|
||||||
waypoint = parseTokensIntoWaypoint(tokens);
|
|
||||||
|
|
||||||
waypoints[i-1] = waypoint;
|
|
||||||
}
|
|
||||||
|
|
||||||
return waypoints;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Returns an array of each line from the response of the http url request
|
Returns an array of each line from the response of the http url request
|
||||||
*/
|
*/
|
||||||
@ -101,6 +92,10 @@ getLinesFromUrl(url)
|
|||||||
result.lines = [];
|
result.lines = [];
|
||||||
|
|
||||||
request = httpGet( url );
|
request = httpGet( url );
|
||||||
|
|
||||||
|
if (!isDefined(request))
|
||||||
|
return result;
|
||||||
|
|
||||||
request waittill( "done", success, data );
|
request waittill( "done", success, data );
|
||||||
|
|
||||||
if (!success)
|
if (!success)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user