1
This commit is contained in:
parent
a4f826ec22
commit
0f3c154067
@ -99,6 +99,7 @@ class Human : public Creature
|
|||||||
a8::XTimerWp revive_timer;
|
a8::XTimerWp revive_timer;
|
||||||
long long dead_frameno = 0;
|
long long dead_frameno = 0;
|
||||||
long long real_dead_frameno = 0;
|
long long real_dead_frameno = 0;
|
||||||
|
int sort_id = 0;
|
||||||
|
|
||||||
Weapon default_weapon;
|
Weapon default_weapon;
|
||||||
|
|
||||||
|
@ -564,12 +564,15 @@ void Incubator::Rearrangement()
|
|||||||
std::vector<int> teams4;
|
std::vector<int> teams4;
|
||||||
{
|
{
|
||||||
std::map<int, int> team_num_hash;
|
std::map<int, int> team_num_hash;
|
||||||
|
int i = 0;
|
||||||
for (auto hum : hold_humans_) {
|
for (auto hum : hold_humans_) {
|
||||||
if (team_num_hash.find(hum->team_id) != team_num_hash.end()) {
|
if (team_num_hash.find(hum->team_id) != team_num_hash.end()) {
|
||||||
++team_num_hash[hum->team_id];
|
++team_num_hash[hum->team_id];
|
||||||
} else {
|
} else {
|
||||||
team_num_hash[hum->team_id];
|
team_num_hash[hum->team_id];
|
||||||
}
|
}
|
||||||
|
hum->sort_id = i;
|
||||||
|
++i;
|
||||||
}
|
}
|
||||||
for (auto& pair : team_num_hash) {
|
for (auto& pair : team_num_hash) {
|
||||||
if (pair.second > 1) {
|
if (pair.second > 1) {
|
||||||
@ -597,4 +600,25 @@ void Incubator::Rearrangement()
|
|||||||
} else if (!teams2.empty()) {
|
} else if (!teams2.empty()) {
|
||||||
team_id = teams2.at(rand() % teams2.size());
|
team_id = teams2.at(rand() % teams2.size());
|
||||||
}
|
}
|
||||||
|
if (team_id) {
|
||||||
|
for (auto hum : hold_humans_) {
|
||||||
|
if (hum->team_id == team_id) {
|
||||||
|
hum->sort_id = 999999;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
std::sort(hold_humans_.begin(), hold_humans_.end(),
|
||||||
|
[] (Human* a, Human* b) -> bool
|
||||||
|
{
|
||||||
|
return a->sort_id < b->sort_id;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
#ifdef DEBUG
|
||||||
|
{
|
||||||
|
std::string data = "Rearrangement ";
|
||||||
|
for (auto hum : hold_humans_) {
|
||||||
|
data += a8::XValue(hum->team_id) + ",";
|
||||||
|
}
|
||||||
|
a8::XPrintf("%s\n", {data});
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user