MCPcopy Create free account
hub / github.com/Warzone2100/warzone2100 / setUpBuildModule

Function setUpBuildModule

src/droid.cpp:2957–2991  ·  view source on GitHub ↗

Deals with building a module - checking if any droid is currently doing this - if so, helping to build the current one*/

Source from the content-addressed store, hash-verified

2955/*Deals with building a module - checking if any droid is currently doing this
2956 - if so, helping to build the current one*/
2957void 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
2994bool DROID::isDamaged() const

Callers 1

actionUpdateDroidFunction · 0.85

Calls 6

getTileStructureFunction · 0.85
checkDroidsBuildingFunction · 0.85
droidStartBuildFunction · 0.85
nextModuleToBuildFunction · 0.85
cancelBuildFunction · 0.85
map_coordFunction · 0.70

Tested by

no test coverage detected