From 9ca4b629cd91c2749d9efafd752fc5175ebce5fd Mon Sep 17 00:00:00 2001 From: rubidium Date: Tue, 18 Jan 2011 23:09:43 +0000 Subject: (svn r21846) -Codechange: move documentation towards the code to make it more likely to be updated [o-s]. --- src/road.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src/road.cpp') diff --git a/src/road.cpp b/src/road.cpp index 4142f0bfa..dd5641823 100644 --- a/src/road.cpp +++ b/src/road.cpp @@ -36,6 +36,12 @@ static bool IsPossibleCrossing(const TileIndex tile, Axis ax) GetFoundationSlope(tile, NULL) == SLOPE_FLAT); } +/** + * Clean up unneccesary RoadBits of a planed tile. + * @param tile current tile + * @param org_rb planed RoadBits + * @return optimised RoadBits + */ RoadBits CleanUpRoadBits(const TileIndex tile, RoadBits org_rb) { if (!IsValidTile(tile)) return ROAD_NONE; @@ -91,6 +97,12 @@ RoadBits CleanUpRoadBits(const TileIndex tile, RoadBits org_rb) return org_rb; } +/** + * Finds out, whether given company has all given RoadTypes available + * @param company ID of company + * @param rts RoadTypes to test + * @return true if company has all requested RoadTypes available + */ bool HasRoadTypesAvail(const CompanyID company, const RoadTypes rts) { RoadTypes avail_roadtypes; @@ -105,11 +117,21 @@ bool HasRoadTypesAvail(const CompanyID company, const RoadTypes rts) return (rts & ~avail_roadtypes) == 0; } +/** + * Validate functions for rail building. + * @param rt road type to check. + * @return true if the current company may build the road. + */ bool ValParamRoadType(const RoadType rt) { return HasRoadTypesAvail(_current_company, RoadTypeToRoadTypes(rt)); } +/** + * Get the road types the given company can build. + * @param company the company to get the roadtypes for. + * @return the road types. + */ RoadTypes GetCompanyRoadtypes(CompanyID company) { RoadTypes rt = ROADTYPES_NONE; -- cgit v1.2.3-54-g00ecf