equal
deleted
inserted
replaced
904 const ChunkHandler _engine_chunk_handlers[] = { |
904 const ChunkHandler _engine_chunk_handlers[] = { |
905 { 'ENGN', Save_ENGN, Load_ENGN, CH_ARRAY}, |
905 { 'ENGN', Save_ENGN, Load_ENGN, CH_ARRAY}, |
906 { 'ENGS', LoadSave_ENGS, LoadSave_ENGS, CH_RIFF | CH_LAST}, |
906 { 'ENGS', LoadSave_ENGS, LoadSave_ENGS, CH_RIFF | CH_LAST}, |
907 }; |
907 }; |
908 |
908 |
909 |
909 /* |
910 |
910 * returns true if an engine is valid, and it is of the specified type, and buildable by the current player, false otherwise |
|
911 * |
|
912 * engine = index of the engine to check |
|
913 * type = the type the engine should be of (VEH_xxx) |
|
914 */ |
|
915 bool IsEngineBuildable(int engine, byte type) { |
|
916 Engine *e; |
|
917 |
|
918 // check if it's an engine that is in the engine array |
|
919 if (0 > engine || engine >= TOTAL_NUM_ENGINES ) return false; |
|
920 |
|
921 e = DEREF_ENGINE(engine); |
|
922 |
|
923 // check if it's an engine of specified type |
|
924 if (e->type != type) return false; |
|
925 |
|
926 // check if it's available |
|
927 if (!HASBIT(e->player_avail, _current_player)) return false; |
|
928 |
|
929 return true; |
|
930 } |
|
931 |
|
932 |
|
933 |
|
934 |