MCPcopy Create free account
hub / github.com/DFHack/dfhack / filltraffic

Function filltraffic

plugins/filltraffic.cpp:70–226  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

68}
69
70command_result filltraffic(color_ostream &out, std::vector<std::string> & params)
71{
72 //Maximum map size.
73 uint32_t x_max,y_max,z_max;
74 //Source and target traffic types.
75 df::tile_traffic source = tile_traffic::Normal;
76 df::tile_traffic target = tile_traffic::Normal;
77 //Option flags
78 bool updown = false;
79 bool checkpit = true;
80 bool checkbuilding = true;
81
82 //Loop through parameters
83 for(size_t i = 0; i < params.size();i++)
84 {
85 if (params[i] == "help" || params[i] == "?" || params[i].size() != 1)
86 return CR_WRONG_USAGE;
87
88 switch (toupper(params[i][0]))
89 {
90 case 'H':
91 target = tile_traffic::High; break;
92 case 'N':
93 target = tile_traffic::Normal; break;
94 case 'L':
95 target = tile_traffic::Low; break;
96 case 'R':
97 target = tile_traffic::Restricted; break;
98 case 'X':
99 updown = true; break;
100 case 'B':
101 checkbuilding = false; break;
102 case 'P':
103 checkpit = false; break;
104 default:
105 return CR_WRONG_USAGE;
106 }
107 }
108
109 if (!Maps::IsValid())
110 {
111 out.printerr("Map is not available!\n");
112 return CR_FAILURE;
113 }
114
115 int32_t cx, cy, cz;
116 Maps::getSize(x_max,y_max,z_max);
117 uint32_t tx_max = x_max * 16;
118 uint32_t ty_max = y_max * 16;
119 Gui::getCursorCoords(cx,cy,cz);
120 while(cx == -30000)
121 {
122 out.printerr("Cursor is not active.\n");
123 return CR_FAILURE;
124 }
125
126 DFCoord xy ((uint32_t)cx,(uint32_t)cy,cz);
127 MapExtras::MapCache MCache;

Callers

nothing calls this directly

Calls 12

toupperFunction · 0.85
isWallTerrainFunction · 0.85
isOpenTerrainFunction · 0.85
LowPassableFunction · 0.85
HighPassableFunction · 0.85
tiletypeAtMethod · 0.80
topMethod · 0.80
setDesignationAtMethod · 0.80
WriteAllMethod · 0.80
sizeMethod · 0.45
printMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected