FAQFAQ   SearchSearch   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Code: Speed demon and cloak

 
Post new topic   Reply to topic    Drop Shock Forum Index -> Open Source
View previous topic :: View next topic  
Author Message
khaibar
Advanced


Joined: 14 Dec 2007
Posts: 1141

PostPosted: Sun Jul 15, 2012 11:45 am    Post subject: Code: Speed demon and cloak Reply with quote

https://sourceforge.net/p/dropshock/tickets/17/

Something I don't understand

process_deploy.php on 1466 -> 1484
Code:


    $sqltext ="UPDATE deployed_units SET i_speed_cloak='5' WHERE id=? AND i_speed_cloak='4'";
            $res =& $db->query($sqltext, Array($insertedunitid[$i]) );
            if (DB::isError($res)) { ReportDBError($res, "process_deploy"); }

            $sqltext ="UPDATE deployed_units SET i_speed_cloak='4' WHERE id=? AND i_speed_cloak='3'";
            $res =& $db->query($sqltext, Array($insertedunitid[$i]) );
            if (DB::isError($res)) { ReportDBError($res, "process_deploy"); }

            $sqltext ="UPDATE deployed_units SET i_speed_cloak='3' WHERE id=? AND i_speed_cloak='2'";
            $res =& $db->query($sqltext, Array($insertedunitid[$i]) );
            if (DB::isError($res)) { ReportDBError($res, "process_deploy"); }

            $sqltext ="UPDATE deployed_units SET i_speed_cloak='2' WHERE id=? AND i_speed_cloak='1'";
            $res =& $db->query($sqltext, Array($insertedunitid[$i]) );
            if (DB::isError($res)) { ReportDBError($res, "process_deploy"); }

            $sqltext ="UPDATE deployed_units SET i_speed_cloak='1' WHERE id=? AND i_speed_cloak='0'";
            $res =& $db->query($sqltext, Array($insertedunitid[$i]) );
            if (DB::isError($res)) { ReportDBError($res, "process_deploy");


why not just

Code:

$sqltext ="UPDATE deployed_units SET i_speed_cloak=i_speed_cloak+1 WHERE id=? ";
            $res =& $db->query($sqltext, Array($insertedunitid[$i]) );
            if (DB::isError($res)) { ReportDBError($res, "process_deploy");

if there is a 5 cloak speed limit just add a condition and i_speed_cloak<5
Back to top
View user's profile Send private message
Vanoi
Site Admin


Joined: 25 Aug 2005
Posts: 1403
Location: Avoiding You (The Void)

PostPosted: Sun Jul 15, 2012 1:19 pm    Post subject: Reply with quote

Because that would give units without cloak the ability to cloak
_________________
The person who will go to great lengths to fight boredom...
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Frizz
Site Admin


Joined: 10 Jun 2005
Posts: 3814

PostPosted: Sun Jul 15, 2012 6:23 pm    Post subject: Reply with quote

Cloak is an enumerated type in the database, the possible values are:

'N','T','D','0','1','2','3','4','5'

Thus you cannot simply +1 it.

If you check process_deploy, you'll see 'i_speed_cloak' getting set to 'D' for non-cloaking units. See process_turn if you want to know how each cloak type is handled.

_f
_________________

Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Drop Shock Forum Index -> Open Source All times are GMT - 7 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © phpBB Group