Ship Removal Subroutine

Ship Removal Subroutine; support/discussion/questions

Moderator: thunderchero

Post Reply
User avatar
Gowron
Code Master
Code Master
Posts: 304
Joined: Sat Apr 26, 2008 2:00 am
Location: 50° N, 11° E

Ship Removal Subroutine

Post by Gowron »

At position 4491D0 there's a subroutine which removes a ship from the game. It's used for various instances of destruction or consumption of ships.

It is NOT used for ships which are destroyed as a result of battle, scrapped, destroyed by an intel attack or annihilated because of entering a one-way wormhole.


Subroutine 4491D0 is called from eight locations, depending on the cause of the ship removal:
  • 45E019: unknown.
  • 46828F: removal of 1 troop transport from a task force after a succesful invasion. Also used for removal of all troop transports from a task force after a failed invasion attempt. The ship role "troop transport" (0x09) is stored at position 46827F and can be changed to affect a different ship role instead. If no ship with the respective role is present, then no ship is removed.
  • 4686BF: destruction by orbital battery fire. Removing this call makes OBs unable to destroy any ships.
  • 468774: unknown.
  • 468D0F: removal of 1 troop transport from a task force after the completion of an outpost or a starbase. At position 468C55 the role "troop transport" is stored to determine which kind of ship can add production points to outpost/starbase construction.
  • 469CD2: removal of 1 colony ship from a task force when colonising a system.
  • 46BD1D: destruction by a neutron star.
  • 46BF3A: destruction by a black hole.
There's also a switch table which seems to determine the likelihood of a ship with a certain role being destroyed by a black hole. The switch table starts at position 46BDE0, and the values read as follows:

Code: Select all

value(dec)   ship_role
    95          0x00   // scout
    80          0x01   // destroyer
    15          0x02   // cruiser
    10          0x03   // artillery
     5          0x04   // battleship
    50          0x05   // colony ship
    70          0x09   // troop transport
Remember that only ships with a speed of 1 can be destroyed by black holes.
A discovery consists in seeing something everybody has seen and at the same time thinking something nobody has thought yet.
stardust
Rear-Admiral
Rear-Admiral
Posts: 1381
Joined: Sat Apr 26, 2008 2:00 am
Location: good ole Blighty

Post by stardust »

45E019 , 468774

Could either of these values be responsible for the destruction or theft of a ship via sabotage?

Just an idea.
Computers! [Expletive deleted]

My 4shared folder
User avatar
DCER
Code Master
Code Master
Posts: 683
Joined: Sat Apr 26, 2008 2:00 am

Post by DCER »

And the other one could be destruction by a one way wormhole.

Nice find, Gowron!
stardust
Rear-Admiral
Rear-Admiral
Posts: 1381
Joined: Sat Apr 26, 2008 2:00 am
Location: good ole Blighty

Post by stardust »

Ah, Gowron's pointed out at the top of his post that he's ruled out both the Intel and the one way wormhole already :oops:
Computers! [Expletive deleted]

My 4shared folder
Post Reply

Return to “Ship Removal Subroutine”