Deals with building a module - checking if any droid is currently doing this - if so, helping to build the current one*/
| 2955 | /*Deals with building a module - checking if any droid is currently doing this |
| 2956 | - if so, helping to build the current one*/ |
| 2957 | void setUpBuildModule(DROID *psDroid) |
| 2958 | { |
| 2959 | Vector2i tile = map_coord(psDroid->order.pos); |
| 2960 | |
| 2961 | //check not another Truck started |
| 2962 | STRUCTURE *psStruct = getTileStructure(tile.x, tile.y); |
| 2963 | if (psStruct) |
| 2964 | { |
| 2965 | // if a droid is currently building, or building is in progress of being built/upgraded the droid's order should be DORDER_HELPBUILD |
| 2966 | if (checkDroidsBuilding(psStruct) || !psStruct->status) |
| 2967 | { |
| 2968 | //set up the help build scenario |
| 2969 | psDroid->order.type = DORDER_HELPBUILD; |
| 2970 | setDroidTarget(psDroid, (BASE_OBJECT *)psStruct); |
| 2971 | if (droidStartBuild(psDroid)) |
| 2972 | { |
| 2973 | psDroid->action = DACTION_BUILD; |
| 2974 | return; |
| 2975 | } |
| 2976 | } |
| 2977 | else |
| 2978 | { |
| 2979 | if (nextModuleToBuild(psStruct, -1) > 0) |
| 2980 | { |
| 2981 | //no other droids building so just start it off |
| 2982 | if (droidStartBuild(psDroid)) |
| 2983 | { |
| 2984 | psDroid->action = DACTION_BUILD; |
| 2985 | return; |
| 2986 | } |
| 2987 | } |
| 2988 | } |
| 2989 | } |
| 2990 | cancelBuild(psDroid); |
| 2991 | } |
| 2992 | |
| 2993 | |
| 2994 | bool DROID::isDamaged() const |
no test coverage detected