Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Synchronet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Main
Synchronet
Commits
45a99c71
Commit
45a99c71
authored
14 years ago
by
mcmlxxix
Browse files
Options
Downloads
Patches
Plain Diff
added revision info, some fixes
parent
079ac1e7
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
xtrn/tankbattle/tanks.js
+15
-20
15 additions, 20 deletions
xtrn/tankbattle/tanks.js
with
15 additions
and
20 deletions
xtrn/tankbattle/tanks.js
+
15
−
20
View file @
45a99c71
...
...
@@ -9,6 +9,8 @@
for Synchronet BBS systems.
-----------------------------------------------------------
*/
//$Id$
const
VERSION
=
"
$Revision$
"
.
split
(
'
'
)[
1
];
var
root
=
js
.
exec_dir
;
...
...
@@ -247,16 +249,14 @@ function lobby()
notify
(
"
No such battle!
"
);
return
false
;
}
if
(
!
battles
[
gameNumber
].
players
[
user
.
alias
])
{
joinBattle
(
battles
[
gameNumber
],
user
.
alias
);
notice
(
"
You joined battle #
"
+
gameNumber
);
return
true
;
}
joinBattle
(
battles
[
gameNumber
]);
return
true
;
}
function
createBattle
()
{
var
id
=
players
.
getPlayerID
(
user
.
alias
);
for
each
(
var
b
in
battles
)
{
if
(
b
.
players
[
players
.
getPlayerID
(
user
.
alias
)
])
{
if
(
b
.
players
[
id
])
{
menuPrompt
(
"
\
1r
\
1hYou are already in a game
\
1n
\
1r[
\
1hpress a key
\
1n
\
1r]
"
);
return
false
;
}
...
...
@@ -283,7 +283,6 @@ function lobby()
var
mapFile
=
list
[
mapNumber
-
1
];
var
battle
=
new
Battle
(
false
,
mapFile
);
var
id
=
players
.
getPlayerID
(
user
.
alias
);
var
position
=
0
;
var
player
=
new
Player
(
id
,
position
,
100
);
player
.
start
=
battle
.
start
[
position
];
...
...
@@ -294,17 +293,17 @@ function lobby()
notice
(
"
\
1g
\
1hGame #
"
+
parseInt
(
battle
.
gameNumber
,
10
)
+
"
created
"
);
storeGame
(
battle
);
}
function
joinBattle
(
battle
,
name
)
function
joinBattle
(
battle
)
{
if
(
battle
.
players
[
players
.
getPlayerID
(
user
.
alias
)])
{
var
id
=
players
.
getPlayerID
(
user
.
alias
);
if
(
battle
.
players
[
id
])
{
menuPrompt
(
"
\
1r
\
1hYou are already in that game
\
1n
\
1r[
\
1hpress a key
\
1n
\
1r]
"
);
return
false
;
}
if
(
countMembers
(
battle
.
players
)
==
battle
.
start
.
length
)
{
menuPrompt
(
"
\
1r
\
1h
You are already in a game
\
1n
\
1r[
\
1hpress a key
\
1n
\
1r]
"
);
menuPrompt
(
"
\
1r
\
1h
That game is full
\
1n
\
1r[
\
1hpress a key
\
1n
\
1r]
"
);
return
false
;
}
var
id
=
players
.
getPlayerID
(
name
);
var
position
=
countMembers
(
battle
.
players
);
var
player
=
new
Player
(
id
,
position
,
100
);
player
.
start
=
battle
.
start
[
position
];
...
...
@@ -312,6 +311,7 @@ function lobby()
player
.
coords
=
new
Coords
(
player
.
start
.
x
,
player
.
start
.
y
);
battle
.
players
[
id
]
=
player
;
storePlayerData
(
battle
,
id
,
position
);
notice
(
"
You joined battle #
"
+
battle
.
gameNumber
);
}
function
updateBattles
()
{
...
...
@@ -385,7 +385,7 @@ function lobby()
console
.
pushxy
();
for
each
(
var
m
in
waiting
)
{
console
.
putmsg
(
"
\
1n
\
1cBattle #
\
1h
"
+
m
.
gameNumber
);
if
(
countMembers
(
m
.
players
)
>
1
)
if
(
m
.
timer
.
countdown
>
0
)
console
.
putmsg
(
"
\
1n
\
1c:
\
1r
\
1h
"
+
parseInt
(
m
.
timer
.
countdown
,
10
));
console
.
popxy
();
console
.
down
();
...
...
@@ -590,6 +590,9 @@ function playGame(battle)
if
(
file_exists
(
battle
.
dataFile
))
{
file_remove
(
battle
.
dataFile
);
}
if
(
file_exists
(
battle
.
dataFile
+
"
.bck
"
))
{
file_remove
(
battle
.
dataFile
+
"
.bck
"
);
}
}
function
send
(
func
)
{
...
...
@@ -1207,14 +1210,6 @@ function playGame(battle)
init
();
main
();
}
function
getNewGameNumber
()
{
var
gNum
=
1
;
while
(
file_exists
(
root
+
"
battle
"
+
gNum
+
"
.ini
"
))
{
gNum
++
;
}
return
gNum
;
}
function
menuPrompt
(
text
)
{
chat
.
input_line
.
clear
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment