Skip to content

replaced erroneous 1-tuples with proper arrays where relevant #29

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 6, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions dist/screeps.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -926,7 +926,7 @@ interface FindPathOpts {
ignoreCreeps?: boolean;
ignoreDestructibleStructures?: boolean;
ignoreRoads?: boolean;
ignore?: [any | RoomPosition];
ignore?: any[] | RoomPosition[];
avoid?: any[] | RoomPosition[];
maxOps?: number;
heuristicWeight?: number;
Expand Down Expand Up @@ -992,10 +992,10 @@ declare class GameMap {
* @param toRoom Finish room name or room object.
* @returns the route array or ERR_NO_PATH code
*/
findRoute(fromRoom: string | Room, toRoom: string | Room): [{
findRoute(fromRoom: string | Room, toRoom: string | Room): {
exit: string;
room: string;
}] | number;
}[] | number;
/**
* Get the linear distance (in rooms) between two rooms. You can use this function to estimate the energy cost of
* sending resources through terminals, or using observers and nukes.
Expand Down Expand Up @@ -1277,7 +1277,7 @@ declare class RoomPosition {
* @param objects An array of room's objects or RoomPosition objects that the search should be executed against.
* @param opts An object containing pathfinding options (see Room.findPath), or one of the following: filter, algorithm
*/
findClosestByPath<T>(objects: [T | RoomPosition], opts?: {
findClosestByPath<T>(objects: T[] | RoomPosition[], opts?: {
filter?: any | string;
algorithm?: string;
}): T;
Expand All @@ -1294,7 +1294,7 @@ declare class RoomPosition {
* @param objects An array of room's objects or RoomPosition objects that the search should be executed against.
* @param opts An object containing one of the following options: filter
*/
findClosestByRange<T>(objects: [T | RoomPosition], opts?: {
findClosestByRange<T>(objects: T[] | RoomPosition[], opts?: {
filter: any | string;
}): T;
/**
Expand All @@ -1313,7 +1313,7 @@ declare class RoomPosition {
* @param range The range distance.
* @param opts See Room.find.
*/
findInRange<T>(objects: [T | RoomPosition], range: number, opts?: {
findInRange<T>(objects: T[] | RoomPosition[], range: number, opts?: {
filter?: any | string;
algorithm?: string;
}): T[];
Expand Down
2 changes: 1 addition & 1 deletion src/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ interface FindPathOpts {
ignoreCreeps?: boolean;
ignoreDestructibleStructures?: boolean;
ignoreRoads?: boolean;
ignore?: [any|RoomPosition];
ignore?: any[]|RoomPosition[];
avoid?: any[]|RoomPosition[];
maxOps?: number;
heuristicWeight?: number;
Expand Down
2 changes: 1 addition & 1 deletion src/map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ declare class GameMap {
* @param toRoom Finish room name or room object.
* @returns the route array or ERR_NO_PATH code
*/
findRoute(fromRoom: string|Room, toRoom: string|Room): [{exit: string, room: string}]|number;
findRoute(fromRoom: string|Room, toRoom: string|Room): {exit: string, room: string}[]|number;
/**
* Get the linear distance (in rooms) between two rooms. You can use this function to estimate the energy cost of
* sending resources through terminals, or using observers and nukes.
Expand Down
6 changes: 3 additions & 3 deletions src/room-position.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ declare class RoomPosition {
* @param objects An array of room's objects or RoomPosition objects that the search should be executed against.
* @param opts An object containing pathfinding options (see Room.findPath), or one of the following: filter, algorithm
*/
findClosestByPath<T>(objects: [T|RoomPosition], opts?: {filter?: any|string, algorithm?: string}): T;
findClosestByPath<T>(objects: T[]|RoomPosition[], opts?: {filter?: any|string, algorithm?: string}): T;
/**
* Find an object with the shortest linear distance from the given position.
* @param type See Room.find.
Expand All @@ -58,7 +58,7 @@ declare class RoomPosition {
* @param objects An array of room's objects or RoomPosition objects that the search should be executed against.
* @param opts An object containing one of the following options: filter
*/
findClosestByRange<T>(objects: [T|RoomPosition], opts?: {filter: any|string }): T;
findClosestByRange<T>(objects: T[]|RoomPosition[], opts?: {filter: any|string }): T;
/**
* Find all objects in the specified linear range.
* @param type See Room.find.
Expand All @@ -72,7 +72,7 @@ declare class RoomPosition {
* @param range The range distance.
* @param opts See Room.find.
*/
findInRange<T>(objects: [T|RoomPosition], range: number, opts?: {filter?: any|string, algorithm?: string}): T[];
findInRange<T>(objects: T[]|RoomPosition[], range: number, opts?: {filter?: any|string, algorithm?: string}): T[];
/**
* Find an optimal path to the specified position using A* search algorithm. This method is a shorthand for Room.findPath. If the target is in another room, then the corresponding exit will be used as a target.
* @param x X position in the room.
Expand Down