mirror of
https://github.com/YouHaveTrouble/GuildMaster.git
synced 2026-05-11 22:16:59 +00:00
fix infinite loading screen on new save file
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "adventurers-guild",
|
"name": "adventurers-guild",
|
||||||
"version": "0.15.2",
|
"version": "0.15.3",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
|
|||||||
+5
-3
@@ -148,8 +148,10 @@ export default defineComponent({
|
|||||||
if (deltaTime > 0) return; // not yet time for a new recruit
|
if (deltaTime > 0) return; // not yet time for a new recruit
|
||||||
|
|
||||||
if (Object.keys(this.adventurers).length <= 0) {
|
if (Object.keys(this.adventurers).length <= 0) {
|
||||||
const firstAdventurer = this.adventurersDatabase[0];
|
const firstAdventurer = this.adventurersDatabase["aldek"];
|
||||||
this.adventurersForHire[firstAdventurer.id] = firstAdventurer;
|
this.adventurersForHire[firstAdventurer.id] = firstAdventurer;
|
||||||
|
this.setNextRecruitArrival(currentTimestamp, cooldownModifier)
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const newAdventurerForHire = getNewAdventurerForHire(Object.values(this.adventurersDatabase), Object.values(this.adventurers));
|
const newAdventurerForHire = getNewAdventurerForHire(Object.values(this.adventurersDatabase), Object.values(this.adventurers));
|
||||||
@@ -338,11 +340,11 @@ export default defineComponent({
|
|||||||
this.loadGame();
|
this.loadGame();
|
||||||
this.adventurersDatabase = removeAlreadyHiredAdventurers(this.adventurersDatabase, this.adventurers);
|
this.adventurersDatabase = removeAlreadyHiredAdventurers(this.adventurersDatabase, this.adventurers);
|
||||||
|
|
||||||
if (Object.keys(this.adventurersForHire).length < this.guild.recruitmentCapacity.getRecruitmentCapacity()) {
|
if (Object.keys(this.adventurers).length > 0 && Object.keys(this.adventurersForHire).length < this.guild.recruitmentCapacity.getRecruitmentCapacity()) {
|
||||||
// check if more time passed than next recruit arrival and simulate next recruit arrivals up to now
|
// check if more time passed than next recruit arrival and simulate next recruit arrivals up to now
|
||||||
const now = new Date();
|
const now = new Date();
|
||||||
if (this.nextRecruitArrival.getTime() < now.getTime()) {
|
if (this.nextRecruitArrival.getTime() < now.getTime()) {
|
||||||
const slotsLeft = 2 - Object.keys(this.adventurersForHire).length;
|
const slotsLeft = this.guild.recruitmentCapacity.getRecruitmentCapacity() - Object.keys(this.adventurersForHire).length;
|
||||||
for (let i = 0; i < slotsLeft; i++) {
|
for (let i = 0; i < slotsLeft; i++) {
|
||||||
await this.checkForNewRecruit(this.nextRecruitArrival.getTime());
|
await this.checkForNewRecruit(this.nextRecruitArrival.getTime());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user