1
0
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:
freenity 2009-01-25 12:33:10 +00:00
parent 347d6f0ab2
commit f5bdcda80d

View File

@ -25,6 +25,18 @@ function worldClickHandler(event)
// Right button single- or double-clicks
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) {
cmd = event.order;
}
@ -237,7 +249,9 @@ function killSelectedEntities()
for (i=0; i<selection.length; i++)
{
//TODO: send network msg, so the unit is killed everywhere
console.write('killing....');
selection[i].kill();
issueCommand(selection[i], NMT_REMOVE_OBJECT);
}
}
}