From faa5b60d67d50ec9b1c28964f6adfdec6723b476 Mon Sep 17 00:00:00 2001 From: Blaizer Date: Tue, 24 Aug 2010 16:50:48 +0930 Subject: [PATCH] Working to a certain degree now. --- Build.PL | 4 +++ lib/Game/Ajar.pm | 65 ++++++++++++--------------------------- lib/Game/Ajar/Commands.pm | 2 +- 3 files changed, 25 insertions(+), 46 deletions(-) diff --git a/Build.PL b/Build.PL index a522130..dea6454 100644 --- a/Build.PL +++ b/Build.PL @@ -11,6 +11,10 @@ my $build = Module::Build->new( 'perl' => 5.010, 'Test::More' => 0, 'File::ShareDir' => 0, + $^O eq "MSWin32" ? ( + 'Win32::Console::ANSI', + 'Win32::Sound', + ) : (), }, recommends => { 'Test::Pod' => 1.22, diff --git a/lib/Game/Ajar.pm b/lib/Game/Ajar.pm index 926246c..264207e 100644 --- a/lib/Game/Ajar.pm +++ b/lib/Game/Ajar.pm @@ -1,13 +1,12 @@ #!/usr/bin/env perl use 5.010; -use strict; -use Text::Wrap qw($columns $unexpand $tabstop); -($columns, $unexpand, $tabstop) = (80, 0, 4); unless($^O eq "MSWin32" and $ARGV[0] ne "-winexe") { #don't if running from windows without exe $SIG{INT} = "sigint"; #disable Ctrl+C sub sigint{} } +use File::Share::Dir; + our (%M, %H) = ( state => { player => 0, @@ -16,9 +15,21 @@ our (%M, %H) = ( }, msgnum => {}, ); -chdir "source" or die "Ajar/source: $!"; -require while ; # .ph first -require while ; # then .pl +use Game::Ajar::Hashes; +use Game::Ajar::OtherHashes; +use Game::Ajar::Subs; +use Game::Ajar::Actions; +use Game::Ajar::Commands; +use Game::Ajar::Combine; +use Game::Ajar::Combine::IfTree; +use Game::Ajar::Look::IfTree; +use Game::Ajar::Reach; +use Game::Ajar::Reach::IfTree; +use Game::Ajar::Separate; +use Game::Ajar::Separate::IfTree; +use Game::Ajar::Use; +use Game::Ajar::Use::Actions; +use Game::Ajar::Use::IfTree; clear_0(); @@ -28,45 +39,9 @@ if($^O eq "MSWin32") { #Colour and sound for Windows require Win32::Sound; }; if($@) { #Missing module(s) - if(($make) = `perl -V:make` =~ /make='(.*)'/) { - print "The modules for colour and/or sound don't seem to be installed.\n Q: Do you want to install them now with \"$make\"?\n"; - if(yes("no_color")) { - print "\nPlease wait while the modules install . . .\n"; - chdir "bin/Win32/Console-ANSI-1.04" or die "Ajar/source/bin/Win32/Console-ANSI-1.04: $!"; - system "perl Makefile.PL"; - system "$make"; - system "$make install"; - require Win32::Console::ANSI; - chdir "../Sound-0.49" or die "Ajar/source/bin/Win32/Sound-0.49: $!"; - system "perl Makefile.PL"; - system "$make"; - system "$make install"; - require Win32::Sound; - chdir "../../.." or die "Ajar/source: $!"; - print "\nModules installed successfully!\n"; #no death, so successful - system "pause && cls"; - } - else { - print " -Win32::Console::ANSI and Win32::Sound must be installed to play Ajar on -Windows. They are located in Ajar/source/bin/Win32 if you want to install them -manually. Check www.cpan.org for help on doing this. Otherwise, simply restart -Ajar and let it try to do it for you. If you are having problems, remove any -other Perls you may have and cleanly install Strawberry Perl v5 -(www.strawberryperl.com) before contacting me."; - exit; - } - } - else { - print " -Win32::Console::ANSI and Win32::Sound must be installed to play Ajar on -Windows. Seeing as you do not have a make program, Ajar cannot do it for you. -They are located in Ajar/source/bin/Win32 if you want to install them manually. -Check www.cpan.org or your Perl's documentation for help on doing this. -However, I urge you to remove whatever Perl you have installed, install -Strawberry Perl v5 (www.strawberryperl.com), and let Ajar do it for you."; - exit; - } + print "Win32::Console::ANSI and Win32::Sound must be installed to play Ajar on +Windows."; + exit; } } diff --git a/lib/Game/Ajar/Commands.pm b/lib/Game/Ajar/Commands.pm index db15e1e..6e834c0 100644 --- a/lib/Game/Ajar/Commands.pm +++ b/lib/Game/Ajar/Commands.pm @@ -187,7 +187,7 @@ sub load { elsif($hash eq 'state') { %state = (@parts); } - elsif(defined %{"lock_$hash"}) { + elsif(%{"lock_$hash"}) { %{$hash} = %{"start_$hash"}; #back to default for(@parts) { if(${"lock_$hash"}{$_}) {