Compare commits

...

3 Commits

Author SHA1 Message Date
e3e7bf5ccd Package script:
tar jar and run.sh
2021-01-11 02:34:41 +03:00
b386665e66 Simple run script for MacOS/Linux 2021-01-11 02:16:07 +03:00
5e1ff6451c Exit Button improved:
Exit button behaviour was just setting flags.
    This caused the program to set the exit flag when
    it is paused and wont exit until the unpause. Some other
    Funky stuff when the sim ends are fixed.
2021-01-05 17:11:43 +03:00
3 changed files with 29 additions and 1 deletions

14
package.sh Executable file
View File

@ -0,0 +1,14 @@
#!/bin/bash
GIT=$(command -v git)
HEAD=$(command -v head)
CUT=$(command -v cut)
JAR_ARTIFACT="out/artifacts/Hajj_simulation_jar/Hajj-simulation.jar"
if [ -z $"GIT" ] || [ -z $"HEAD" ] || [ -z $"CUT" ]; then
echo "Tools missing"
exit 1
else
tar -cvf Hajj-Simulation-$(git log | head -n1 | cut -d' ' -f2).tar.gz $JAR_ARTIFACT run.sh
fi

9
run.sh Executable file
View File

@ -0,0 +1,9 @@
#!/bin/bash
jav=$(command -v java)
if [ -z "$jav" ]; then
>&2 echo "Can't find java installation"
else
java -jar out/artifacts/Hajj_simulation_jar/Hajj-simulation.jar
fi

View File

@ -32,6 +32,7 @@ public class MakkahCity {
private static final Thread t = new Thread(inputListener,"InputThread-Makkah");
private static boolean isAllRoutSet;
private static final DataManeger dataManeger = new DataManeger();
private static volatile boolean done_flag;
//GUI
private static boolean exit_flag;
private static boolean pause_flag;
@ -212,7 +213,10 @@ public class MakkahCity {
btnExit.setFont(new Font("Rockwell", Font.PLAIN, 16));
btnExit.setForeground(Color.white);
btnExit.setBounds(888, 623, 166, 29);
btnExit.addActionListener(actionEvent -> exit_flag = true);
btnExit.addActionListener(actionEvent -> {
if (pause_flag || done_flag) System.exit(0);
else exit_flag = true;
});
btnPause = new JButton("Pause");
btnPause.setBackground(new Color(9,9,9));
@ -530,6 +534,7 @@ public class MakkahCity {
//lblArrivedToHotelsTime.setText(getDistTimeForLbl());
}
//When done show menu to analyze. Exit from menu too.
done_flag = true;
inputListener.pause();
startMenu();
}