mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-12-19 23:30:25 +00:00
index_pointer now produces better sequences of chars
This commit is contained in:
parent
b544461dc7
commit
7c9c599e4c
@ -48,10 +48,13 @@ EX map<void*, int> pointer_indices;
|
||||
|
||||
EX string index_pointer(void *v) {
|
||||
if(v == nullptr) return "0";
|
||||
if(!pointer_indices.count(v)) pointer_indices[v] = isize(pointer_indices);
|
||||
if(!pointer_indices.count(v)) {
|
||||
int s = isize(pointer_indices);
|
||||
pointer_indices[v] = s;
|
||||
}
|
||||
int i = pointer_indices[v];
|
||||
string res;
|
||||
int i = pointer_indices[v] + 1;
|
||||
while(i) { res += ('A' + (i % 26)); i /= 26; }
|
||||
while(true) { res += ('A' + (i % 26)); i /= 26; if(!i) break; i--; }
|
||||
return res;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user