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

#38 - Zombie Units on Auto-salvage (ADDED-CLOSED)

 
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: Wed Dec 26, 2012 3:31 am    Post subject: #38 - Zombie Units on Auto-salvage (ADDED-CLOSED) Reply with quote

files: process_turn.php


Units that auto-salvaged (apparently from PDS only) still shot in combat (Battle between Jekyll and GR8SHAG, both confirmed)

Bug happened when units that auto-salvaged were not added to $destroyedunits and thus didn't have their weapons, attacks and being targets removed and kept their effects and weapons

insert this in code where autosalvage is a success (lines ~5064, ~6395)

Code:
// Bug fix for zombie shooting, autosalvaged units are not in $destroyedunits and thus kept shooting and stayed as targets as well as kept their effects and weapons
                        $sqltext ="DELETE FROM tinywarz_live.deployed_order_attack WHERE weapon_id IN (SELECT id FROM deployed_weapons WHERE i_on_unit=".$weapon->target_id." OR  target_id=".$weapon->target_id." AND is_perm = 'N' ) ";
                        $res =& $db->query($sqltext, Array() );
                        if (DB::isError($res)) { ReportDBError($res); }
                  
                        $sqltext = "DELETE FROM deployed_weapons WHERE i_on_unit=".$weapon->target_id;
                        $res =& $db->query($sqltext, Array() );
                        if (DB::isError($res)) { ReportDBError($res); }

                        $sqltext ="DELETE FROM tinywarz_live.deployed_order_target WHERE unit_id=".$weapon->target_id." OR target_id=".$weapon->target_id;
                        $res =& $db->query($sqltext, Array() );
                        if (DB::isError($res)) { ReportDBError($res); }
                  
                        $deff =& $db->getCol("SELECT id FROM deployed_effects WHERE i_actor=".$weapon->target_id." OR i_target=".$weapon->target_id,'id', array());
                        if (DB::isError($deff)) { ReportDBError($deff); }
                        if (count($deff)>0) {
                        $deff = implode(",",$deff);
                        $sqltext ="DELETE FROM tinywarz_live.deployed_order_command WHERE i_effect IN (".$deff.") ";
                        $res =& $db->query($sqltext, Array() );
                        if (DB::isError($res)) { ReportDBError($res); }
                        }
                        $sqltext ="DELETE FROM tinywarz_live.deployed_effects WHERE i_actor=".$weapon->target_id." OR i_target=".$weapon->target_id." AND keep_on_death='N' ";
                        $res =& $db->query($sqltext, Array() );
                        if (DB::isError($res)) { ReportDBError($res); }


They said that only units that autosalvaged from PDS had this issue but i couldn't find a difference in code between the two autosalvages or what followed them

ticket link: http://sourceforge.net/p/dropshock/tickets/38/


Last edited by khaibar on Sun Jan 06, 2013 8:36 am; edited 1 time in total
Back to top
View user's profile Send private message
Dark Leth
Council Member


Joined: 05 Jul 2005
Posts: 1498

PostPosted: Wed Dec 26, 2012 4:35 am    Post subject: Reply with quote

Support the idea.
Back to top
View user's profile Send private message
Slayer_666
Council Member


Joined: 20 Dec 2012
Posts: 226

PostPosted: Wed Dec 26, 2012 6:11 am    Post subject: Reply with quote

Yeah, support and to follow this, when a unit died and auto salvages, the attacks and the target you just killed is still registered when you check the units attacks and targeting, so it's annoying having 20+ targets when they all auto salvage and none are alive


Slayer
Back to top
View user's profile Send private message
SpaceGhost
Mentor


Joined: 07 Sep 2007
Posts: 57

PostPosted: Thu Dec 27, 2012 9:45 am    Post subject: Reply with quote

Support
Thanks SpaceGhost
Back to top
View user's profile Send private message
Walterohdim
Site Admin


Joined: 15 Jun 2006
Posts: 1629
Location: Somewhere with lots of doors

PostPosted: Thu Dec 27, 2012 6:09 pm    Post subject: Reply with quote

Support to get it to 4 even though I don't understand it.


Walterohdim
_________________
Wannabee historian of Tinywarz. Through the building of myth we will build community. M. Scott Peck

Back to top
View user's profile Send private message Visit poster's website
Vanoi
Site Admin


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

PostPosted: Fri Dec 28, 2012 3:59 pm    Post subject: Reply with quote

Support from me, but you should really push this.

Edit: What would happen if you just set $destroyedunits[] = $weapon->target_id; and allow the system to remove the units normally?

then add a check for $canDestroy where ever it removes the units from the inventory?(Can't find it)
_________________
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
khaibar
Advanced


Joined: 14 Dec 2007
Posts: 1141

PostPosted: Sat Dec 29, 2012 12:49 am    Post subject: Reply with quote

$canDestroy is local for every kill not a structure element
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