Skip to content

Commit

Permalink
A few small changes
Browse files Browse the repository at this point in the history
addStructure() now takes the direction argument as an int instead of a float.
Added lines in functions.md and wzapi.cpp to clarify that the direction argument is optional.
  • Loading branch information
DARwins1 committed Aug 5, 2023
1 parent 989c294 commit 5d2f9cf
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions doc/js-functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -775,6 +775,7 @@ Get the limits of the scrollable area of the map as an area object. (3.2+ only)
Create a structure on the given position. Returns the structure on success, null otherwise.
Position uses world coordinates, if you want use position based on Map Tiles, then
use as addStructure(structureName, players, x*128, y*128)
Direction is optional, and is specified in degrees.

## getStructureLimit(structureName[, player])

Expand Down
3 changes: 2 additions & 1 deletion src/wzapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2981,8 +2981,9 @@ scr_area wzapi::getScrollLimits(WZAPI_NO_PARAMS)
//-- Create a structure on the given position. Returns the structure on success, null otherwise.
//-- Position uses world coordinates, if you want use position based on Map Tiles, then
//-- use as addStructure(structureName, players, x*128, y*128)
//-- Direction is optional, and is specified in degrees.
//--
wzapi::returned_nullable_ptr<const STRUCTURE> wzapi::addStructure(WZAPI_PARAMS(std::string structureName, int player, int x, int y, optional<float> _direction))
wzapi::returned_nullable_ptr<const STRUCTURE> wzapi::addStructure(WZAPI_PARAMS(std::string structureName, int player, int x, int y, optional<int> _direction))
{
int structureIndex = getStructStatFromName(WzString::fromUtf8(structureName.c_str()));
SCRIPT_ASSERT(nullptr, context, structureIndex >= 0 && structureIndex < numStructureStats, "Structure %s not found", structureName.c_str());
Expand Down
2 changes: 1 addition & 1 deletion src/wzapi.h
Original file line number Diff line number Diff line change
Expand Up @@ -1084,7 +1084,7 @@ namespace wzapi
bool removeObject(WZAPI_PARAMS(BASE_OBJECT *psObj, optional<bool> _sfx));
no_return_value setScrollLimits(WZAPI_PARAMS(int x1, int y1, int x2, int y2));
scr_area getScrollLimits(WZAPI_NO_PARAMS);
returned_nullable_ptr<const STRUCTURE> addStructure(WZAPI_PARAMS(std::string structureName, int player, int x, int y, optional<float> _direction));
returned_nullable_ptr<const STRUCTURE> addStructure(WZAPI_PARAMS(std::string structureName, int player, int x, int y, optional<int> _direction));
unsigned int getStructureLimit(WZAPI_PARAMS(std::string structureName, optional<int> _player));
int countStruct(WZAPI_PARAMS(std::string structureName, optional<int> _playerFilter));
int countDroid(WZAPI_PARAMS(optional<int> _droidType, optional<int> _playerFilter));
Expand Down

0 comments on commit 5d2f9cf

Please sign in to comment.