<commit_before><?php

if ($player->getNewbieTurns() > 0)
	create_error('You can\'t take/drop forces under newbie protection!');

if ($player->isLandedOnPlanet())
	create_error('You must first launch to drop forces');

// take either from container or request, prefer container
$drop_mines			= isset($var['drop_mines'])			? $var['drop_mines']			: trim($_REQUEST['drop_mines']);
$drop_combat_drones = isset($var['drop_combat_drones'])	? $var['drop_combat_drones']	: trim($_REQUEST['drop_combat_drones']);
$drop_scout_drones	= isset($var['drop_scout_drones'])	? $var['drop_scout_drones']		: trim($_REQUEST['drop_scout_drones']);
$take_mines			= isset($var['take_mines'])			? $var['take_mines']			: trim($_REQUEST['take_mines']);
$take_combat_drones	= isset($var['take_combat_drones'])	? $var['take_combat_drones']	: trim($_REQUEST['take_combat_drones']);
$take_scout_drones	= isset($var['take_scout_drones'])	? $var['take_scout_drones']		: trim($_REQUEST['take_scout_drones']);

// do we have numbers?
if (isset($drop_mines) && !is_numeric($drop_mines)) create_error('Only numbers as input allowed');
if (isset($drop_combat_drones) && !is_numeric($drop_combat_drones)) create_error('Only numbers as input allowed');
if (isset($drop_scout_drones) && !is_numeric($drop_scout_drones)) create_error('Only numbers as input allowed');
if (isset($take_mines) && !is_numeric($take_mines)) create_error('Only numbers as input allowed');
if (isset($take_combat_drones) && !is_numeric($take_combat_drones)) create_error('Only numbers as input allowed');
if (isset($take_scout_drones) && !is_numeric($take_scout_drones)) create_error('Only numbers as input allowed');

// round if necessary
$drop_mines = round($drop_mines);
$drop_combat_drones = round($drop_combat_drones);
$drop_scout_drones = round($drop_scout_drones);
$take_mines = round($take_mines);
$take_combat_drones = round($take_combat_drones);
$take_scout_drones = round($take_scout_drones);

// so how many forces do we take/add per type?
$change_mines = $drop_mines - $take_mines;
$change_combat_drones = $drop_combat_drones - $take_combat_drones;
$change_scout_drones = $drop_scout_drones - $take_scout_drones;

// do we have any action at all?
if ($change_mines == 0 && $change_combat_drones == 0 && $change_scout_drones == 0)
	create_error('You want to add/remove 0 forces?');

if ($sector->hasLocation())
	create_error('You can\'t drop forces in a sector with a location!');
	
require_once(get_file_loc('SmrForce.class.inc'));
$forces =& SmrForce::getForce($player->getGameID(), $player->getSectorID(), $var['owner_id']);

include(get_file_loc('mine_change.php'));
// check max on that stack<commit_msg>Change isset check to !empty to fix a bug introduced by the fact values are now trimmed.<commit_after><?php

if ($player->getNewbieTurns() > 0)
	create_error('You can\'t take/drop forces under newbie protection!');

if ($player->isLandedOnPlanet())
	create_error('You must first launch to drop forces');

// take either from container or request, prefer container
$drop_mines			= isset($var['drop_mines'])			? $var['drop_mines']			: trim($_REQUEST['drop_mines']);
$drop_combat_drones = isset($var['drop_combat_drones'])	? $var['drop_combat_drones']	: trim($_REQUEST['drop_combat_drones']);
$drop_scout_drones	= isset($var['drop_scout_drones'])	? $var['drop_scout_drones']		: trim($_REQUEST['drop_scout_drones']);
$take_mines			= isset($var['take_mines'])			? $var['take_mines']			: trim($_REQUEST['take_mines']);
$take_combat_drones	= isset($var['take_combat_drones'])	? $var['take_combat_drones']	: trim($_REQUEST['take_combat_drones']);
$take_scout_drones	= isset($var['take_scout_drones'])	? $var['take_scout_drones']		: trim($_REQUEST['take_scout_drones']);

// do we have numbers?
if (!empty($drop_mines) && !is_numeric($drop_mines)) create_error('Only numbers as input allowed');
if (!empty($drop_combat_drones) && !is_numeric($drop_combat_drones)) create_error('Only numbers as input allowed');
if (!empty($drop_scout_drones) && !is_numeric($drop_scout_drones)) create_error('Only numbers as input allowed');
if (!empty($take_mines) && !is_numeric($take_mines)) create_error('Only numbers as input allowed');
if (!empty($take_combat_drones) && !is_numeric($take_combat_drones)) create_error('Only numbers as input allowed');
if (!empty($take_scout_drones) && !is_numeric($take_scout_drones)) create_error('Only numbers as input allowed');

// round if necessary
$drop_mines = round($drop_mines);
$drop_combat_drones = round($drop_combat_drones);
$drop_scout_drones = round($drop_scout_drones);
$take_mines = round($take_mines);
$take_combat_drones = round($take_combat_drones);
$take_scout_drones = round($take_scout_drones);

// so how many forces do we take/add per type?
$change_mines = $drop_mines - $take_mines;
$change_combat_drones = $drop_combat_drones - $take_combat_drones;
$change_scout_drones = $drop_scout_drones - $take_scout_drones;

// do we have any action at all?
if ($change_mines == 0 && $change_combat_drones == 0 && $change_scout_drones == 0)
	create_error('You want to add/remove 0 forces?');

if ($sector->hasLocation())
	create_error('You can\'t drop forces in a sector with a location!');
	
require_once(get_file_loc('SmrForce.class.inc'));
$forces =& SmrForce::getForce($player->getGameID(), $player->getSectorID(), $var['owner_id']);

include(get_file_loc('mine_change.php'));
// check max on that stack
{'fraction_non_alphanumeric': 0.15866543095458757, 'fraction_numerical': 0.0018535681186283596, 'mean_word_length': 8.17687074829932, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6332790', 'n_tokens_mistral': 2031, 'n_tokens_neox': 1934, 'n_words': 375}