Next mapgen commit
[SmugglerRL.git] / src / util.d
blob2a846dd49d4b1b7b5edf07be88eb0b8c99c1a4d0
1 public import std.random: uniform;
2 import game;
3 import constants;
5 public alias rnd = uniform;
7 void exit(ubyte code) {
8 import core.runtime: Runtime;
9 static import core.stdc.stdlib;
10 Runtime.terminate();
11 core.stdc.stdlib.exit(code);
14 pure string format(T...)(string s, T args) {
15 import std.array: appender;
16 import std.format: formattedWrite;
17 auto w = appender!string();
18 formattedWrite(w, s, args);
19 return w.data;
22 pure string fillstr(int length, char ch=' ') {
23 string buf;
24 while (length --> 0) {
25 buf ~= ch;
27 return buf;