Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function getAllLandForSale() external returns(uint256[]){
- uint[] memory propertiesForSaleArray;
- // Get the total number of properties created
- uint256 totalNumberOfProperties = baseContract.getLandArrayLength();
- for(uint i = 0; i < totalNumberOfProperties; ++i) {
- address currentOwner = baseContract.getLandOwner(i);
- if(currentOwner == address(0)){
- propertiesForSaleArray.push(i);
- }
- }
- }
- uint c = 0; // counter
- for(uint i = 0; i < totalNumberOfProperties; ++i) {
- address currentOwner = baseContract.getLandOwner(i);
- if(currentOwner == address(0)){
- propertiesForSaleArray[c] = i;
- c = c + 1;
- }
- }
Add Comment
Please, Sign In to add comment