Something went wrong. Try again.
[Mirror] Libreopolis is a cross-platform city simulation game fully compatible with SimCity 2000. gitlab.com/conasg/libreopolis
Something went wrong. Try again.
1234567891011121314151617181920// RCI demand gauge KAT (ui/rci_gauge.hpp): the bar height = maxH*|demand|/2000, clamped to [0,maxH].#include "sc2k/ui/rci_gauge.hpp"#include <cstdio>#include "test_harness.hpp"int main() { using sc2k::ui::rci_bar_height; CHECK(rci_bar_height(0, 22) == 0); CHECK(rci_bar_height(2000, 22) == 22); // full positive CHECK(rci_bar_height(-2000, 22) == 22); // full negative (magnitude) CHECK(rci_bar_height(1000, 22) == 11); // half CHECK(rci_bar_height(-666, 22) == 22 * 666 / 2000); // proportional CHECK(rci_bar_height(5000, 22) == 22); // clamps above full-scale if (failures == 0) { std::printf("rci_gauge: all checks passed\n"); return 0; } std::printf("rci_gauge: %d failure(s)\n", failures); return 1;}