added measurements

This commit is contained in:
Jay Robson 2024-01-17 12:56:04 +11:00
parent 052a65c31c
commit 2e67813f48
5 changed files with 18 additions and 13 deletions

View File

@ -2,22 +2,27 @@
#include "display.hpp" #include "display.hpp"
#include <curses.h> #include <curses.h>
#include <string.h>
#include <stdlib.h>
void display::draw_text(int x, int y, const char* str) void display::draw_text(int x, int y, const char* at)
{ {
for(int i = 0;; i++) for(int i = 0;; i++)
{ {
const char* start = str; const char* start = at;
char c = (str++)[0]; char c = (at++)[0];
while(c != '\n' && c != '\0') while(c != '\n' && c != '\0')
{ {
c = (str++)[0]; c = (at++)[0];
} }
mvaddnstr(x + i, y, start, (size_t)(str - start)); mvaddnstr(x + i, y, start, (size_t)(at - start));
if(c == '\0') return; if(c == '\0')
{
return;
}
} }
} }

View File

@ -14,7 +14,7 @@ control_rod::control_rod(double limit, double max)
void control_rod::display(std::ostream& o) const void control_rod::display(std::ostream& o) const
{ {
o << "Inserted: " << (inserted * 100) << "%\n"; o << "Inserted: " << (inserted * 100) << "%\n";
o << "Absorbed: " << absorbed << " / " << limit << "\n"; o << "Use: " << absorbed << " / " << limit << " mol\n";
}; };
double control_rod::get_k(val_t type) const double control_rod::get_k(val_t type) const

View File

@ -22,6 +22,6 @@ double heater::get_k(sim::reactor::rod::val_t type) const
void heater::display(std::ostream& o) const void heater::display(std::ostream& o) const
{ {
o << "Rate: " << rate << "\n"; o << "Rate: " << rate << " C/s\n";
} }

View File

@ -10,9 +10,9 @@ fuel_rod::fuel_rod(double fuel, double mass) : s(fuel, mass)
void fuel_rod::display(std::ostream& o) const void fuel_rod::display(std::ostream& o) const
{ {
o << "Fuel: " << s.get_fuel() << " / " << s.get_mass() << "\n"; o << "Fuel: " << s.get_fuel() << " / " << s.get_mass() << " mol\n";
o << "Efficiency: " << s.get_efficiency() << "\n"; o << "Efficiency: " << s.get_efficiency() << "\n";
o << "Energy: +" << s.get_energy() << "\n"; o << "Energy: +" << s.get_energy() << " C\n";
} }
double fuel_rod::get_k(val_t type) const double fuel_rod::get_k(val_t type) const

View File

@ -38,9 +38,9 @@ public:
o << r.get_name() << "\n"; o << r.get_name() << "\n";
r.display(o); r.display(o);
o << "Heat: " << r.get(val_t::HEAT) << "\n"; o << "Heat: " << r.get(val_t::HEAT) << " C\n";
o << "Fast: " << r.get(val_t::N_FAST) << "\n"; o << "Fast: " << r.get(val_t::N_FAST) << " mol\n";
o << "Slow: " << r.get(val_t::N_SLOW) << "\n"; o << "Slow: " << r.get(val_t::N_SLOW) << " mol\n";
return o; return o;
} }