summaryrefslogtreecommitdiff
path: root/nlvcross/nodes/(105,16,-75).lua
blob: ebeedf7425212aa743a5f4a6f1bf9891977fc333 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
local d = os.date()
local m = d.min
if event.train then
atc_send("B0WOL")
end
if m % 10 == 0 then
atc_send("B0WOCD1RSM")
local h = d.hour
local mm = (m + 10)%60
if mm<10 and m>10 then h=h+1 end
digiline_send("depmon", "Train to | Kulbacki Land | Next dep.: | "..h..":"..mm)
else
digiline_send("depmon", "Train to | Kulbacki Land | in "..(9-(m%10)).."m"..(59-d.sec).."s")
interrupt(10)
end
;Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "jmutex.h" JMutex::JMutex() { initialized = false; } JMutex::~JMutex() { if (initialized) #ifdef JMUTEX_CRITICALSECTION DeleteCriticalSection(&mutex); #else CloseHandle(mutex); #endif // JMUTEX_CRITICALSECTION } int JMutex::Init() { if (initialized) return ERR_JMUTEX_ALREADYINIT; #ifdef JMUTEX_CRITICALSECTION InitializeCriticalSection(&mutex); #else mutex = CreateMutex(NULL,FALSE,NULL); if (mutex == NULL) return ERR_JMUTEX_CANTCREATEMUTEX; #endif // JMUTEX_CRITICALSECTION initialized = true; return 0; } int JMutex::Lock() { if (!initialized) return ERR_JMUTEX_NOTINIT; #ifdef JMUTEX_CRITICALSECTION EnterCriticalSection(&mutex); #else WaitForSingleObject(mutex,INFINITE); #endif // JMUTEX_CRITICALSECTION return 0; } int JMutex::Unlock() { if (!initialized) return ERR_JMUTEX_NOTINIT; #ifdef JMUTEX_CRITICALSECTION LeaveCriticalSection(&mutex); #else ReleaseMutex(mutex); #endif // JMUTEX_CRITICALSECTION return 0; }