forked from 0ad/0ad
Fixing #212. Now player can control only the units he owns.
This was SVN commit r6635.
This commit is contained in:
parent
347d6f0ab2
commit
f5bdcda80d
@ -25,6 +25,18 @@ function worldClickHandler(event)
|
|||||||
// Right button single- or double-clicks
|
// Right button single- or double-clicks
|
||||||
if (event.button == SDL_BUTTON_RIGHT && event.clicks <= 2)
|
if (event.button == SDL_BUTTON_RIGHT && event.clicks <= 2)
|
||||||
{
|
{
|
||||||
|
var controlling = true;
|
||||||
|
for (var i = 0; i < selection.length; i++) {
|
||||||
|
if (! (selection[i].player.name == localPlayer.name)) {
|
||||||
|
controlling = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!controlling) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (event.clicks == 1) {
|
if (event.clicks == 1) {
|
||||||
cmd = event.order;
|
cmd = event.order;
|
||||||
}
|
}
|
||||||
@ -237,7 +249,9 @@ function killSelectedEntities()
|
|||||||
for (i=0; i<selection.length; i++)
|
for (i=0; i<selection.length; i++)
|
||||||
{
|
{
|
||||||
//TODO: send network msg, so the unit is killed everywhere
|
//TODO: send network msg, so the unit is killed everywhere
|
||||||
|
console.write('killing....');
|
||||||
selection[i].kill();
|
selection[i].kill();
|
||||||
|
issueCommand(selection[i], NMT_REMOVE_OBJECT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user