Skip to content

Commit

Permalink
Merge pull request #60 from stormprograms/stormprograms-patch-1
Browse files Browse the repository at this point in the history
fix sleep on windows
  • Loading branch information
Metr0Gn0me authored Mar 8, 2019
2 parents 4eb3b5a + 9df57d0 commit 62ebacb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/include/stormscript.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
#ifndef STSCLASSES_H_
#define STSCLASSES_H_

#if defined(_WIN32)
#define PLATFORM "Windows"
#if (defined(_WIN32)) || (defined(__MINGW32__))
#define PLATFORM 1
#include <windows.h>
#else
#define PLATFORM "other"
#define PLATFORM 0
#include <unistd.h>
#endif
/*
Expand Down
6 changes: 5 additions & 1 deletion src/interpreter/exec.cc
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,11 @@ void sts::exec(int *x, int function, std::vector<stsclasstype> *pclasstypes, std
else if (prs[y]=="sys")
sys(&y, vars);
else if (prs[y] == "wait") {
sleep(std::stoi(getval(vars, new int(y+1)).val));
#if PLATFORM == 1
Sleep(std::stoi(getval(vars, new int(y+1)).val) * 1000);
#else
sleep(std::stoi(getval(vars, new int(y+1)).val));
#endif
y++;
}
else if ((prs[y]=="}") || (prs[y]=="loop")) {
Expand Down

0 comments on commit 62ebacb

Please sign in to comment.