try to clean a little the code...
This commit is contained in:
@@ -100,6 +100,10 @@ unsigned char applyShift(unsigned char c){
|
|||||||
'~', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
|
'~', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
|
||||||
'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '{', '|', '}', '~',
|
'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '{', '|', '}', '~',
|
||||||
};
|
};
|
||||||
|
if (c<' ')
|
||||||
|
return ' ';
|
||||||
|
if (c>=0x7f)
|
||||||
|
return c;
|
||||||
return afterShift[c - ' '];
|
return afterShift[c - ' '];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -112,5 +116,9 @@ unsigned char removeShift(unsigned char c){
|
|||||||
'`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
|
'`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
|
||||||
'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '[', '\\',']', '`',
|
'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '[', '\\',']', '`',
|
||||||
};
|
};
|
||||||
|
if (c<' ')
|
||||||
|
return ' ';
|
||||||
|
if (c>=0x7f)
|
||||||
|
return c;
|
||||||
return afterUnShift[c - ' '];
|
return afterUnShift[c - ' '];
|
||||||
}
|
}
|
||||||
|
@@ -86,4 +86,6 @@ bool operator== (cKey a, cKey b);
|
|||||||
/// @return true if the needle is in the haystack
|
/// @return true if the needle is in the haystack
|
||||||
bool mod_contains(eKeyMod haystack, eKeyMod needle);
|
bool mod_contains(eKeyMod haystack, eKeyMod needle);
|
||||||
|
|
||||||
|
unsigned char applyShift(unsigned char c);
|
||||||
|
unsigned char removeShift(unsigned char c);
|
||||||
#endif
|
#endif
|
||||||
|
@@ -238,39 +238,6 @@ bool cControl::handleClick(location){
|
|||||||
return clicked;
|
return clicked;
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned char applyShift(unsigned char c){
|
|
||||||
static const char afterShift[] = {
|
|
||||||
' ', '!', '"', '#', '$', '%', '&', '"', '(', ')', '*', '+', '<', '_', '>', '?',
|
|
||||||
')', '!', '@', '#', '$', '%', '^', '&', '*', '(', ':', ':', '<', '+', '>', '?',
|
|
||||||
'@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
|
|
||||||
'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '{', '|', '}', '^', '_',
|
|
||||||
'~', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
|
|
||||||
'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '{', '|', '}', '~',
|
|
||||||
};
|
|
||||||
if (c<' ')
|
|
||||||
return ' ';
|
|
||||||
if (c>=0x7f)
|
|
||||||
return c;
|
|
||||||
return afterShift[c - ' '];
|
|
||||||
}
|
|
||||||
|
|
||||||
static unsigned char removeShift(unsigned char c){
|
|
||||||
static const char afterUnShift[] = {
|
|
||||||
' ', '1', '\'','3', '4', '5', '7', '\'','9', '0', '8', '=', ',', '-', '.', '/',
|
|
||||||
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ';', ';', ',', '=', '.', '/',
|
|
||||||
'2', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
|
|
||||||
'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '[', '\\',']', '6', '-',
|
|
||||||
'`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
|
|
||||||
'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '[', '\\',']', '`',
|
|
||||||
};
|
|
||||||
// ASAN: c can be called with 0 by cControl::getAttachedKeyDescription()
|
|
||||||
if (c<' ')
|
|
||||||
return ' ';
|
|
||||||
if (c>=0x7f)
|
|
||||||
return c;
|
|
||||||
return afterUnShift[c - ' '];
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string cControl::getAttachedKeyDescription() {
|
std::string cControl::getAttachedKeyDescription() {
|
||||||
std::string s;
|
std::string s;
|
||||||
if(key.spec) {
|
if(key.spec) {
|
||||||
|
@@ -1,5 +1,7 @@
|
|||||||
|
|
||||||
#include <SFML/Graphics/RenderWindow.hpp>
|
#include <SFML/Graphics/RenderWindow.hpp>
|
||||||
|
|
||||||
|
#include "global.hpp"
|
||||||
#include "fields.hpp"
|
#include "fields.hpp"
|
||||||
#include "location.hpp"
|
#include "location.hpp"
|
||||||
|
|
||||||
|
@@ -1167,15 +1167,12 @@ void cUniverse::exportGraphics() {
|
|||||||
used_graphics.insert(party[i].which_graphic - 10000 + j);
|
used_graphics.insert(party[i].which_graphic - 10000 + j);
|
||||||
} else if(party[i].which_graphic >= 1000)
|
} else if(party[i].which_graphic >= 1000)
|
||||||
update_pcs[party[i].which_graphic - 1000].insert(&party[i]);
|
update_pcs[party[i].which_graphic - 1000].insert(&party[i]);
|
||||||
for(size_t j = 0; j < party[i].items.size(); j++) {
|
for (auto &item : party[i].items)
|
||||||
check_item(party[i].items[j]);
|
check_item(item);
|
||||||
}
|
|
||||||
}
|
|
||||||
for(size_t i = 0; i < party.stored_items.size(); i++) {
|
|
||||||
for(size_t j = 0; j < party.stored_items[i].size(); j++) {
|
|
||||||
check_item(party.stored_items[i][j]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
for (auto &items : party.stored_items)
|
||||||
|
for (auto &item : items)
|
||||||
|
check_item(item);
|
||||||
for(mon_num_t monst : party.imprisoned_monst) {
|
for(mon_num_t monst : party.imprisoned_monst) {
|
||||||
if(monst > 0 && monst < scenario.scen_monsters.size())
|
if(monst > 0 && monst < scenario.scen_monsters.size())
|
||||||
check_monst(scenario.scen_monsters[monst]);
|
check_monst(scenario.scen_monsters[monst]);
|
||||||
|
Reference in New Issue
Block a user