| 312 | } |
| 313 | |
| 314 | sp<Control> ControlGenerator::createBuildingAssignmentControl(GameState &state, |
| 315 | sp<Building> building) |
| 316 | { |
| 317 | const int controlLength = 200, controlHeight = 24, iconLenght = 36; |
| 318 | |
| 319 | if (!singleton.initialised) |
| 320 | { |
| 321 | singleton.init(state); |
| 322 | } |
| 323 | |
| 324 | auto frame = singleton.citySelect[0]; |
| 325 | auto control = mksp<Graphic>(frame); |
| 326 | control->Size = control->SelectionSize = {controlLength, controlHeight}; |
| 327 | control->Name = "ORG_FRAME"; |
| 328 | control->setData(building); |
| 329 | |
| 330 | auto buildingIcon = |
| 331 | control->createChild<Graphic>(building->owner->icon); // TODO: set vanilla building icon |
| 332 | buildingIcon->AutoSize = true; |
| 333 | buildingIcon->Location = {1, 1}; |
| 334 | buildingIcon->Name = "ORG_ICON"; |
| 335 | |
| 336 | UString name(building->name); |
| 337 | for (auto b : state.player_bases) |
| 338 | { |
| 339 | if (b.second->building == building) |
| 340 | { |
| 341 | name = b.second->name; |
| 342 | break; |
| 343 | } |
| 344 | } |
| 345 | auto nameLabel = control->createChild<Label>(name, singleton.labelFont); |
| 346 | nameLabel->Size = {controlLength - iconLenght, singleton.labelFont->getFontHeight()}; |
| 347 | nameLabel->Location = {iconLenght, (control->Size.y - nameLabel->Size.y) / 2}; |
| 348 | |
| 349 | return control; |
| 350 | } |
| 351 | |
| 352 | sp<Control> ControlGenerator::createAgentAssignmentControl(GameState &state, sp<Agent> agent) |
| 353 | { |
nothing calls this directly
no test coverage detected